mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-10-31 18:57:51 +00:00
Compare commits
4 Commits
v3.0.0-RC1
...
release/v2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f77b23024 | ||
|
|
511c53a9c0 | ||
|
|
db33693157 | ||
|
|
d966f53423 |
@@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
project(owsec VERSION 3.0.0)
|
project(owsec VERSION 2.11.0)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
@@ -185,7 +185,6 @@ if(NOT SMALL_BUILD)
|
|||||||
CppKafka::cppkafka
|
CppKafka::cppkafka
|
||||||
${AWSSDK_LINK_LIBRARIES}
|
${AWSSDK_LINK_LIBRARIES}
|
||||||
fmt::fmt
|
fmt::fmt
|
||||||
resolv
|
|
||||||
)
|
)
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
target_link_libraries(owsec PUBLIC PocoJSON)
|
target_link_libraries(owsec PUBLIC PocoJSON)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ fullnameOverride: ""
|
|||||||
images:
|
images:
|
||||||
owsec:
|
owsec:
|
||||||
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owsec
|
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owsec
|
||||||
tag: v3.0.0-RC1
|
tag: v2.11.0
|
||||||
pullPolicy: Always
|
pullPolicy: Always
|
||||||
# regcred:
|
# regcred:
|
||||||
# registry: tip-tip-wlan-cloud-ucentral.jfrog.io
|
# registry: tip-tip-wlan-cloud-ucentral.jfrog.io
|
||||||
|
|||||||
@@ -171,31 +171,6 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_to_json(Obj, "lastModified", LastModified);
|
field_to_json(Obj, "lastModified", LastModified);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultFirmware::to_json(Poco::JSON::Object &Obj) const {
|
|
||||||
field_to_json(Obj, "deviceType", deviceType);
|
|
||||||
field_to_json(Obj, "description", Description);
|
|
||||||
field_to_json(Obj, "uri", uri);
|
|
||||||
field_to_json(Obj, "revision", revision);
|
|
||||||
field_to_json(Obj, "imageCreationDate", imageCreationDate);
|
|
||||||
field_to_json(Obj, "created", Created);
|
|
||||||
field_to_json(Obj, "lastModified", LastModified);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DefaultFirmware::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
|
||||||
try {
|
|
||||||
field_from_json(Obj, "deviceType", deviceType);
|
|
||||||
field_from_json(Obj, "description", Description);
|
|
||||||
field_from_json(Obj, "uri", uri);
|
|
||||||
field_from_json(Obj, "revision", revision);
|
|
||||||
field_from_json(Obj, "imageCreationDate", imageCreationDate);
|
|
||||||
field_from_json(Obj, "created", Created);
|
|
||||||
field_from_json(Obj, "lastModified", LastModified);
|
|
||||||
return true;
|
|
||||||
} catch (const Poco::Exception &E) {
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CommandDetails::to_json(Poco::JSON::Object &Obj) const {
|
void CommandDetails::to_json(Poco::JSON::Object &Obj) const {
|
||||||
EmbedDocument("details", Obj, Details);
|
EmbedDocument("details", Obj, Details);
|
||||||
EmbedDocument("results", Obj, Results);
|
EmbedDocument("results", Obj, Results);
|
||||||
@@ -271,8 +246,6 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_to_json(Obj, "connectionCompletionTime", connectionCompletionTime);
|
field_to_json(Obj, "connectionCompletionTime", connectionCompletionTime);
|
||||||
field_to_json(Obj, "totalConnectionTime", Utils::Now() - started);
|
field_to_json(Obj, "totalConnectionTime", Utils::Now() - started);
|
||||||
field_to_json(Obj, "certificateExpiryDate", certificateExpiryDate);
|
field_to_json(Obj, "certificateExpiryDate", certificateExpiryDate);
|
||||||
field_to_json(Obj, "connectReason", connectReason);
|
|
||||||
|
|
||||||
#ifdef TIP_GATEWAY_SERVICE
|
#ifdef TIP_GATEWAY_SERVICE
|
||||||
hasRADIUSSessions = RADIUSSessionTracker()->HasSessions(SerialNumber);
|
hasRADIUSSessions = RADIUSSessionTracker()->HasSessions(SerialNumber);
|
||||||
AP_WS_Server()->ExtendedAttributes(SerialNumber, hasGPS, sanity,
|
AP_WS_Server()->ExtendedAttributes(SerialNumber, hasGPS, sanity,
|
||||||
@@ -430,10 +403,6 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_to_json(Obj, "acctConfig", acctConfig);
|
field_to_json(Obj, "acctConfig", acctConfig);
|
||||||
field_to_json(Obj, "coaConfig", coaConfig);
|
field_to_json(Obj, "coaConfig", coaConfig);
|
||||||
field_to_json(Obj, "useByDefault", useByDefault);
|
field_to_json(Obj, "useByDefault", useByDefault);
|
||||||
field_to_json(Obj, "radsecKeepAlive", radsecKeepAlive);
|
|
||||||
field_to_json(Obj, "poolProxyIp", poolProxyIp);
|
|
||||||
field_to_json(Obj, "radsecPoolType", radsecPoolType);
|
|
||||||
field_to_json(Obj, "enabled", enabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RadiusProxyPool::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool RadiusProxyPool::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
@@ -444,10 +413,6 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_from_json(Obj, "acctConfig", acctConfig);
|
field_from_json(Obj, "acctConfig", acctConfig);
|
||||||
field_from_json(Obj, "coaConfig", coaConfig);
|
field_from_json(Obj, "coaConfig", coaConfig);
|
||||||
field_from_json(Obj, "useByDefault", useByDefault);
|
field_from_json(Obj, "useByDefault", useByDefault);
|
||||||
field_from_json(Obj, "radsecKeepAlive", radsecKeepAlive);
|
|
||||||
field_from_json(Obj, "poolProxyIp", poolProxyIp);
|
|
||||||
field_from_json(Obj, "radsecPoolType", radsecPoolType);
|
|
||||||
field_from_json(Obj, "enabled", enabled);
|
|
||||||
return true;
|
return true;
|
||||||
} catch (const Poco::Exception &E) {
|
} catch (const Poco::Exception &E) {
|
||||||
}
|
}
|
||||||
@@ -665,50 +630,18 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_to_json(Obj, "chargeableUserIdentity", chargeableUserIdentity);
|
field_to_json(Obj, "chargeableUserIdentity", chargeableUserIdentity);
|
||||||
field_to_json(Obj, "interface", interface);
|
field_to_json(Obj, "interface", interface);
|
||||||
field_to_json(Obj, "secret", secret);
|
field_to_json(Obj, "secret", secret);
|
||||||
field_to_json(Obj, "nasId", nasId);
|
|
||||||
field_to_json(Obj, "calledStationId", calledStationId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RADIUSSessionList::to_json(Poco::JSON::Object &Obj) const {
|
void RADIUSSessionList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
field_to_json(Obj, "sessions", sessions);
|
field_to_json(Obj, "sessions", sessions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadiusCoADMParameters::to_json(Poco::JSON::Object &Obj) const {
|
|
||||||
field_to_json(Obj, "accountingSessionId", accountingSessionId);
|
|
||||||
field_to_json(Obj, "accountingMultiSessionId", accountingMultiSessionId);
|
|
||||||
field_to_json(Obj, "callingStationId", callingStationId);
|
|
||||||
field_to_json(Obj, "chargeableUserIdentity", chargeableUserIdentity);
|
|
||||||
field_to_json(Obj, "userName", userName);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RadiusCoADMParameters::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool RadiusCoADMParameters::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
field_from_json(Obj, "accountingSessionId", accountingSessionId);
|
field_from_json(Obj, "accountingSessionId", accountingSessionId);
|
||||||
field_from_json(Obj, "accountingMultiSessionId", accountingMultiSessionId);
|
field_from_json(Obj, "accountingMultiSessionId", accountingMultiSessionId);
|
||||||
field_from_json(Obj, "callingStationId", callingStationId);
|
field_from_json(Obj, "callingStationId", callingStationId);
|
||||||
field_from_json(Obj, "chargeableUserIdentity", chargeableUserIdentity);
|
field_from_json(Obj, "chargeableUserIdentity", chargeableUserIdentity);
|
||||||
field_from_json(Obj, "userName", userName);
|
|
||||||
return true;
|
|
||||||
} catch (const Poco::Exception &E) {
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DeviceTransferRequest::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
|
||||||
try {
|
|
||||||
field_from_json(Obj, "serialNumber", serialNumber);
|
|
||||||
field_from_json(Obj, "server", server);
|
|
||||||
field_from_json(Obj, "port", port);
|
|
||||||
return true;
|
|
||||||
} catch (const Poco::Exception &E) {
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DeviceCertificateUpdateRequest::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
|
||||||
try {
|
|
||||||
field_from_json(Obj, "serialNumber", serialNumber);
|
|
||||||
field_from_json(Obj, "encodedCertificate", encodedCertificate);
|
|
||||||
return true;
|
return true;
|
||||||
} catch (const Poco::Exception &E) {
|
} catch (const Poco::Exception &E) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,13 +42,12 @@ namespace OpenWifi::GWObjects {
|
|||||||
uint64_t sessionId = 0;
|
uint64_t sessionId = 0;
|
||||||
double connectionCompletionTime = 0.0;
|
double connectionCompletionTime = 0.0;
|
||||||
std::uint64_t certificateExpiryDate = 0;
|
std::uint64_t certificateExpiryDate = 0;
|
||||||
std::uint64_t hasRADIUSSessions = 0;
|
bool hasRADIUSSessions = false;
|
||||||
bool hasGPS = false;
|
bool hasGPS = false;
|
||||||
std::uint64_t sanity=0;
|
std::uint64_t sanity=0;
|
||||||
std::double_t memoryUsed=0.0;
|
std::double_t memoryUsed=0.0;
|
||||||
std::double_t load=0.0;
|
std::double_t load=0.0;
|
||||||
std::double_t temperature=0.0;
|
std::double_t temperature=0.0;
|
||||||
std::string connectReason;
|
|
||||||
|
|
||||||
void to_json(const std::string &SerialNumber, Poco::JSON::Object &Obj) ;
|
void to_json(const std::string &SerialNumber, Poco::JSON::Object &Obj) ;
|
||||||
};
|
};
|
||||||
@@ -182,26 +181,6 @@ namespace OpenWifi::GWObjects {
|
|||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DefaultFirmware {
|
|
||||||
std::string deviceType;
|
|
||||||
std::string Description;
|
|
||||||
std::string uri;
|
|
||||||
std::string revision;
|
|
||||||
uint64_t imageCreationDate;
|
|
||||||
uint64_t Created;
|
|
||||||
uint64_t LastModified;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DefaultFirmwareList {
|
|
||||||
std::vector<DefaultFirmware> firmwares;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct CommandDetails {
|
struct CommandDetails {
|
||||||
std::string UUID;
|
std::string UUID;
|
||||||
std::string SerialNumber;
|
std::string SerialNumber;
|
||||||
@@ -360,10 +339,6 @@ namespace OpenWifi::GWObjects {
|
|||||||
RadiusProxyServerConfig acctConfig;
|
RadiusProxyServerConfig acctConfig;
|
||||||
RadiusProxyServerConfig coaConfig;
|
RadiusProxyServerConfig coaConfig;
|
||||||
bool useByDefault = false;
|
bool useByDefault = false;
|
||||||
std::string radsecPoolType;
|
|
||||||
std::string poolProxyIp;
|
|
||||||
std::uint64_t radsecKeepAlive=25;
|
|
||||||
bool enabled=true;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
@@ -418,8 +393,7 @@ namespace OpenWifi::GWObjects {
|
|||||||
callingStationId,
|
callingStationId,
|
||||||
chargeableUserIdentity,
|
chargeableUserIdentity,
|
||||||
secret,
|
secret,
|
||||||
interface,
|
interface;
|
||||||
nasId;
|
|
||||||
std::uint64_t inputPackets = 0,
|
std::uint64_t inputPackets = 0,
|
||||||
outputPackets = 0,
|
outputPackets = 0,
|
||||||
inputOctets = 0,
|
inputOctets = 0,
|
||||||
@@ -427,7 +401,6 @@ namespace OpenWifi::GWObjects {
|
|||||||
inputGigaWords = 0,
|
inputGigaWords = 0,
|
||||||
outputGigaWords = 0;
|
outputGigaWords = 0;
|
||||||
std::uint32_t sessionTime = 0;
|
std::uint32_t sessionTime = 0;
|
||||||
std::string calledStationId;
|
|
||||||
|
|
||||||
#ifdef TIP_GATEWAY_SERVICE
|
#ifdef TIP_GATEWAY_SERVICE
|
||||||
RADIUS::RadiusPacket accountingPacket;
|
RADIUS::RadiusPacket accountingPacket;
|
||||||
@@ -445,68 +418,7 @@ namespace OpenWifi::GWObjects {
|
|||||||
std::string accountingSessionId,
|
std::string accountingSessionId,
|
||||||
accountingMultiSessionId,
|
accountingMultiSessionId,
|
||||||
callingStationId,
|
callingStationId,
|
||||||
chargeableUserIdentity,
|
chargeableUserIdentity;
|
||||||
userName;
|
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class RadiusPoolStrategy {
|
|
||||||
round_robin, random, weighted, unknown
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class RadiusEndpointType {
|
|
||||||
generic, radsec, globalreach, orion, unknown
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline RadiusEndpointType RadiusEndpointType(const std::string &T) {
|
|
||||||
if(T=="generic") return RadiusEndpointType::generic;
|
|
||||||
if(T=="radsec") return RadiusEndpointType::radsec;
|
|
||||||
if(T=="globalreach") return RadiusEndpointType::globalreach;
|
|
||||||
if(T=="orion") return RadiusEndpointType::orion;
|
|
||||||
return RadiusEndpointType::unknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline RadiusPoolStrategy RadiusPoolStrategy(const std::string &T) {
|
|
||||||
if(T=="round_robin") return RadiusPoolStrategy::round_robin;
|
|
||||||
if(T=="random") return RadiusPoolStrategy::random;
|
|
||||||
if(T=="weighted") return RadiusPoolStrategy::weighted;
|
|
||||||
return RadiusPoolStrategy::unknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline std::string to_string(enum RadiusEndpointType T) {
|
|
||||||
switch(T) {
|
|
||||||
case RadiusEndpointType::generic: return "generic";
|
|
||||||
case RadiusEndpointType::radsec: return "radsec";
|
|
||||||
case RadiusEndpointType::globalreach: return "globalreach";
|
|
||||||
case RadiusEndpointType::orion: return "orion";
|
|
||||||
default:
|
|
||||||
return "unknown";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline std::string to_string(enum RadiusPoolStrategy T) {
|
|
||||||
switch(T) {
|
|
||||||
case RadiusPoolStrategy::round_robin: return "round_robin";
|
|
||||||
case RadiusPoolStrategy::random: return "random";
|
|
||||||
case RadiusPoolStrategy::weighted: return "weighted";
|
|
||||||
default:
|
|
||||||
return "unknown";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct DeviceTransferRequest {
|
|
||||||
std::string serialNumber;
|
|
||||||
std::string server;
|
|
||||||
std::uint64_t port;
|
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DeviceCertificateUpdateRequest {
|
|
||||||
std::string serialNumber;
|
|
||||||
std::string encodedCertificate;
|
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -92,7 +92,6 @@ namespace OpenWifi::OWLSObjects {
|
|||||||
field_to_json(Obj, "endTime", endTime);
|
field_to_json(Obj, "endTime", endTime);
|
||||||
field_to_json(Obj, "errorDevices", errorDevices);
|
field_to_json(Obj, "errorDevices", errorDevices);
|
||||||
field_to_json(Obj, "owner", owner);
|
field_to_json(Obj, "owner", owner);
|
||||||
field_to_json(Obj, "expectedDevices", expectedDevices);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dashboard::to_json([[maybe_unused]] Poco::JSON::Object &Obj) const {}
|
void Dashboard::to_json([[maybe_unused]] Poco::JSON::Object &Obj) const {}
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ namespace OpenWifi::OWLSObjects {
|
|||||||
uint64_t endTime;
|
uint64_t endTime;
|
||||||
uint64_t errorDevices;
|
uint64_t errorDevices;
|
||||||
std::string owner;
|
std::string owner;
|
||||||
uint64_t expectedDevices;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1194,243 +1194,4 @@ namespace OpenWifi::ProvObjects {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLBLRAccountInfo::to_json(Poco::JSON::Object &Obj) const {
|
|
||||||
info.to_json(Obj);
|
|
||||||
field_to_json(Obj, "privateKey", privateKey);
|
|
||||||
field_to_json(Obj, "country", country);
|
|
||||||
field_to_json(Obj, "province", province);
|
|
||||||
field_to_json(Obj, "city", city);
|
|
||||||
field_to_json(Obj, "organization", organization);
|
|
||||||
field_to_json(Obj, "commonName", commonName);
|
|
||||||
field_to_json(Obj, "CSR", CSR);
|
|
||||||
field_to_json(Obj, "CSRPrivateKey", CSRPrivateKey);
|
|
||||||
field_to_json(Obj, "CSRPublicKey", CSRPublicKey);
|
|
||||||
field_to_json(Obj, "GlobalReachAcctId", GlobalReachAcctId);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GLBLRAccountInfo::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
|
||||||
try {
|
|
||||||
info.from_json(Obj);
|
|
||||||
field_from_json(Obj, "privateKey", privateKey);
|
|
||||||
field_from_json(Obj, "country", country);
|
|
||||||
field_from_json(Obj, "province", province);
|
|
||||||
field_from_json(Obj, "city", city);
|
|
||||||
field_from_json(Obj, "organization", organization);
|
|
||||||
field_from_json(Obj, "commonName", commonName);
|
|
||||||
field_from_json(Obj, "CSR", CSR);
|
|
||||||
field_from_json(Obj, "CSRPrivateKey", CSRPrivateKey);
|
|
||||||
field_from_json(Obj, "CSRPublicKey", CSRPublicKey);
|
|
||||||
field_from_json(Obj, "GlobalReachAcctId", GlobalReachAcctId);
|
|
||||||
return true;
|
|
||||||
} catch (const Poco::Exception &E) {
|
|
||||||
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GLBLRCertificateInfo::to_json(Poco::JSON::Object &Obj) const {
|
|
||||||
field_to_json(Obj, "id", id);
|
|
||||||
field_to_json(Obj, "name", name);
|
|
||||||
field_to_json(Obj, "accountId", accountId);
|
|
||||||
field_to_json(Obj, "csr", csr);
|
|
||||||
field_to_json(Obj, "certificate", certificate);
|
|
||||||
field_to_json(Obj, "certificateChain", certificateChain);
|
|
||||||
field_to_json(Obj, "certificateId", certificateId);
|
|
||||||
field_to_json(Obj, "expiresAt", expiresAt);
|
|
||||||
field_to_json(Obj, "created", created);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GLBLRCertificateInfo::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
|
||||||
try {
|
|
||||||
field_from_json(Obj, "id", id);
|
|
||||||
field_from_json(Obj, "name", name);
|
|
||||||
field_from_json(Obj, "accountId", accountId);
|
|
||||||
field_from_json(Obj, "csr", csr);
|
|
||||||
field_from_json(Obj, "certificate", certificate);
|
|
||||||
field_from_json(Obj, "certificateChain", certificateChain);
|
|
||||||
field_from_json(Obj, "certificateId", certificateId);
|
|
||||||
field_from_json(Obj, "expiresAt", expiresAt);
|
|
||||||
field_from_json(Obj, "created", created);
|
|
||||||
return true;
|
|
||||||
} catch (const Poco::Exception &E) {
|
|
||||||
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GooglOrionAccountInfo::to_json(Poco::JSON::Object &Obj) const {
|
|
||||||
info.to_json(Obj);
|
|
||||||
field_to_json(Obj, "privateKey", privateKey);
|
|
||||||
field_to_json(Obj, "certificate", certificate);
|
|
||||||
field_to_json(Obj, "cacerts", cacerts);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GooglOrionAccountInfo::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
|
||||||
try {
|
|
||||||
info.from_json(Obj);
|
|
||||||
field_from_json(Obj, "privateKey", privateKey);
|
|
||||||
field_from_json(Obj, "certificate", certificate);
|
|
||||||
field_from_json(Obj, "cacerts", cacerts);
|
|
||||||
return true;
|
|
||||||
} catch (const Poco::Exception &E) {
|
|
||||||
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RADIUSServer::to_json(Poco::JSON::Object &Obj) const {
|
|
||||||
field_to_json(Obj, "Hostname", Hostname);
|
|
||||||
field_to_json(Obj, "IP", IP);
|
|
||||||
field_to_json(Obj, "Port", Port);
|
|
||||||
field_to_json(Obj, "Secret", Secret);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RADIUSServer::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
|
||||||
try {
|
|
||||||
field_from_json(Obj, "Hostname", Hostname);
|
|
||||||
field_from_json(Obj, "IP", IP);
|
|
||||||
field_from_json(Obj, "Port", Port);
|
|
||||||
field_from_json(Obj, "Secret", Secret);
|
|
||||||
return true;
|
|
||||||
} catch (const Poco::Exception &E) {
|
|
||||||
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RADIUSEndPointRadiusType::to_json(Poco::JSON::Object &Obj) const {
|
|
||||||
field_to_json(Obj, "Authentication", Authentication);
|
|
||||||
field_to_json(Obj, "Accounting", Accounting);
|
|
||||||
field_to_json(Obj, "CoA", CoA);
|
|
||||||
field_to_json(Obj, "AccountingInterval", AccountingInterval);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RADIUSEndPointRadiusType::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
|
||||||
try {
|
|
||||||
field_from_json(Obj, "Authentication", Authentication);
|
|
||||||
field_from_json(Obj, "Accounting", Accounting);
|
|
||||||
field_from_json(Obj, "CoA", CoA);
|
|
||||||
field_from_json(Obj, "AccountingInterval", AccountingInterval);
|
|
||||||
return true;
|
|
||||||
} catch (const Poco::Exception &E) {
|
|
||||||
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RADIUSEndPointRadsecType::to_json(Poco::JSON::Object &Obj) const {
|
|
||||||
field_to_json(Obj, "Hostname", Hostname);
|
|
||||||
field_to_json(Obj, "IP", IP);
|
|
||||||
field_to_json(Obj, "Port", Port);
|
|
||||||
field_to_json(Obj, "Secret", Secret);
|
|
||||||
field_to_json(Obj, "OpenRoamingType", OpenRoamingType);
|
|
||||||
field_to_json(Obj, "UseOpenRoamingAccount", UseOpenRoamingAccount);
|
|
||||||
field_to_json(Obj, "Weight", Weight);
|
|
||||||
field_to_json(Obj, "Certificate", Certificate);
|
|
||||||
field_to_json(Obj, "PrivateKey", PrivateKey);
|
|
||||||
field_to_json(Obj, "CaCerts", CaCerts);
|
|
||||||
field_to_json(Obj, "AllowSelfSigned", AllowSelfSigned);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RADIUSEndPointRadsecType::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
|
||||||
try {
|
|
||||||
field_from_json(Obj, "Hostname", Hostname);
|
|
||||||
field_from_json(Obj, "IP", IP);
|
|
||||||
field_from_json(Obj, "Port", Port);
|
|
||||||
field_from_json(Obj, "Secret", Secret);
|
|
||||||
field_from_json(Obj, "OpenRoamingType", OpenRoamingType);
|
|
||||||
field_from_json(Obj, "UseOpenRoamingAccount", UseOpenRoamingAccount);
|
|
||||||
field_from_json(Obj, "Weight", Weight);
|
|
||||||
field_from_json(Obj, "Certificate", Certificate);
|
|
||||||
field_from_json(Obj, "PrivateKey", PrivateKey);
|
|
||||||
field_from_json(Obj, "CaCerts", CaCerts);
|
|
||||||
field_from_json(Obj, "AllowSelfSigned", AllowSelfSigned);
|
|
||||||
return true;
|
|
||||||
} catch (const Poco::Exception &E) {
|
|
||||||
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RADIUSEndPoint::to_json(Poco::JSON::Object &Obj) const {
|
|
||||||
info.to_json(Obj);
|
|
||||||
field_to_json(Obj, "Type", Type);
|
|
||||||
field_to_json(Obj, "RadsecServers", RadsecServers);
|
|
||||||
field_to_json(Obj, "RadiusServers", RadiusServers);
|
|
||||||
field_to_json(Obj, "PoolStrategy", PoolStrategy);
|
|
||||||
field_to_json(Obj, "Index", Index);
|
|
||||||
field_to_json(Obj, "UsedBy", UsedBy);
|
|
||||||
field_to_json(Obj, "UseGWProxy", UseGWProxy);
|
|
||||||
field_to_json(Obj, "NasIdentifier", NasIdentifier);
|
|
||||||
field_to_json(Obj, "AccountingInterval", AccountingInterval);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RADIUSEndPoint::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
|
||||||
try {
|
|
||||||
info.from_json(Obj);
|
|
||||||
field_from_json(Obj, "Type", Type);
|
|
||||||
field_from_json(Obj, "RadsecServers", RadsecServers);
|
|
||||||
field_from_json(Obj, "RadiusServers", RadiusServers);
|
|
||||||
field_from_json(Obj, "PoolStrategy", PoolStrategy);
|
|
||||||
field_from_json(Obj, "Index", Index);
|
|
||||||
field_from_json(Obj, "UsedBy", UsedBy);
|
|
||||||
field_from_json(Obj, "UseGWProxy", UseGWProxy);
|
|
||||||
field_from_json(Obj, "NasIdentifier", NasIdentifier);
|
|
||||||
field_from_json(Obj, "AccountingInterval", AccountingInterval);
|
|
||||||
return true;
|
|
||||||
} catch (const Poco::Exception &E) {
|
|
||||||
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RADIUSEndpointUpdateStatus::to_json(Poco::JSON::Object &Obj) const {
|
|
||||||
field_to_json(Obj, "lastUpdate", lastUpdate);
|
|
||||||
field_to_json(Obj, "lastConfigurationChange", lastConfigurationChange);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RADIUSEndpointUpdateStatus::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
|
||||||
try {
|
|
||||||
field_from_json(Obj, "lastUpdate", lastUpdate);
|
|
||||||
field_from_json(Obj, "lastConfigurationChange", lastConfigurationChange);
|
|
||||||
return true;
|
|
||||||
} catch (const Poco::Exception &E) {
|
|
||||||
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RADIUSEndpointUpdateStatus::Read() {
|
|
||||||
Poco::File F(OpenWifi::MicroServiceDataDirectory()+"/RADIUSEndpointUpdateStatus.json");
|
|
||||||
try {
|
|
||||||
if (F.exists()) {
|
|
||||||
Poco::JSON::Parser P;
|
|
||||||
std::ifstream ifs(F.path(), std::ios_base::in | std::ios_base::binary);
|
|
||||||
auto Obj = P.parse(ifs);
|
|
||||||
return from_json(Obj.extract<Poco::JSON::Object::Ptr>());
|
|
||||||
}
|
|
||||||
} catch (...) {
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RADIUSEndpointUpdateStatus::Save() {
|
|
||||||
Poco::File F(OpenWifi::MicroServiceDataDirectory()+"/RADIUSEndpointUpdateStatus.json");
|
|
||||||
try {
|
|
||||||
Poco::JSON::Object Obj;
|
|
||||||
to_json(Obj);
|
|
||||||
std::ofstream O(F.path(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary);
|
|
||||||
Poco::JSON::Stringifier::stringify(Obj, O);
|
|
||||||
return true;
|
|
||||||
} catch (...) {
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RADIUSEndpointUpdateStatus::ChangeConfiguration() {
|
|
||||||
Read();
|
|
||||||
lastConfigurationChange = Utils::Now();
|
|
||||||
return Save();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace OpenWifi::ProvObjects
|
} // namespace OpenWifi::ProvObjects
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
Types::TagList tags;
|
Types::TagList tags;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -37,7 +36,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
Types::UUIDvec_t serialNumbers;
|
Types::UUIDvec_t serialNumbers;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -48,7 +46,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::string policy;
|
std::string policy;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -60,18 +57,14 @@ namespace OpenWifi::ProvObjects {
|
|||||||
Types::UUID_t venue;
|
Types::UUID_t venue;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<ManagementPolicy> ManagementPolicyVec;
|
typedef std::vector<ManagementPolicy> ManagementPolicyVec;
|
||||||
|
|
||||||
struct RRMAlgorithmDetails {
|
struct RRMAlgorithmDetails {
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string parameters;
|
std::string parameters;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -79,9 +72,7 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::string vendor;
|
std::string vendor;
|
||||||
std::string schedule;
|
std::string schedule;
|
||||||
std::vector<RRMAlgorithmDetails> algorithms;
|
std::vector<RRMAlgorithmDetails> algorithms;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -91,7 +82,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::string firmwareUpgrade{"inherit"};
|
std::string firmwareUpgrade{"inherit"};
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -114,10 +104,8 @@ namespace OpenWifi::ProvObjects {
|
|||||||
Types::UUIDvec_t configurations;
|
Types::UUIDvec_t configurations;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<Entity> EntityVec;
|
typedef std::vector<Entity> EntityVec;
|
||||||
|
|
||||||
struct DiGraphEntry {
|
struct DiGraphEntry {
|
||||||
@@ -125,7 +113,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
Types::UUID_t child;
|
Types::UUID_t child;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -153,10 +140,8 @@ namespace OpenWifi::ProvObjects {
|
|||||||
Types::UUIDvec_t boards;
|
Types::UUIDvec_t boards;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<Venue> VenueVec;
|
typedef std::vector<Venue> VenueVec;
|
||||||
|
|
||||||
struct UserInfoDigest {
|
struct UserInfoDigest {
|
||||||
@@ -165,7 +150,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::string userType;
|
std::string userType;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -178,10 +162,8 @@ namespace OpenWifi::ProvObjects {
|
|||||||
Types::UUID_t venue;
|
Types::UUID_t venue;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<ManagementRole> ManagementRoleVec;
|
typedef std::vector<ManagementRole> ManagementRoleVec;
|
||||||
|
|
||||||
enum LocationType {
|
enum LocationType {
|
||||||
@@ -250,10 +232,8 @@ namespace OpenWifi::ProvObjects {
|
|||||||
Types::UUID_t managementPolicy;
|
Types::UUID_t managementPolicy;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<Location> LocationVec;
|
typedef std::vector<Location> LocationVec;
|
||||||
|
|
||||||
struct OperatorLocation {
|
struct OperatorLocation {
|
||||||
@@ -273,10 +253,8 @@ namespace OpenWifi::ProvObjects {
|
|||||||
Types::UUID_t managementPolicy;
|
Types::UUID_t managementPolicy;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<Location> LocationVec;
|
typedef std::vector<Location> LocationVec;
|
||||||
|
|
||||||
struct SubLocation {
|
struct SubLocation {
|
||||||
@@ -292,7 +270,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::string geoCode;
|
std::string geoCode;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -300,7 +277,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::vector<OperatorLocation> locations;
|
std::vector<OperatorLocation> locations;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -380,10 +356,8 @@ namespace OpenWifi::ProvObjects {
|
|||||||
Types::UUID_t managementPolicy;
|
Types::UUID_t managementPolicy;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<Contact> ContactVec;
|
typedef std::vector<Contact> ContactVec;
|
||||||
|
|
||||||
struct OperatorContact {
|
struct OperatorContact {
|
||||||
@@ -405,7 +379,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
Types::UUID_t managementPolicy;
|
Types::UUID_t managementPolicy;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -424,7 +397,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::string accessPIN;
|
std::string accessPIN;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -432,7 +404,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::vector<OperatorContact> contacts;
|
std::vector<OperatorContact> contacts;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -445,10 +416,8 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::string configuration;
|
std::string configuration;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<DeviceConfigurationElement> DeviceConfigurationElementVec;
|
typedef std::vector<DeviceConfigurationElement> DeviceConfigurationElementVec;
|
||||||
|
|
||||||
struct DeviceConfiguration {
|
struct DeviceConfiguration {
|
||||||
@@ -465,10 +434,8 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::string subscriber;
|
std::string subscriber;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<DeviceConfiguration> DeviceConfigurationVec;
|
typedef std::vector<DeviceConfiguration> DeviceConfigurationVec;
|
||||||
|
|
||||||
struct InventoryTag {
|
struct InventoryTag {
|
||||||
@@ -492,7 +459,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
bool doNotAllowOverrides = false;
|
bool doNotAllowOverrides = false;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -502,7 +468,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
InventoryTagVec taglist;
|
InventoryTagVec taglist;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -513,7 +478,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
uint64_t errorCode;
|
uint64_t errorCode;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -522,7 +486,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
Types::CountedMap tenants;
|
Types::CountedMap tenants;
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -532,7 +495,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::string description;
|
std::string description;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -541,7 +503,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::vector<ExpandedUseEntry> entries;
|
std::vector<ExpandedUseEntry> entries;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -549,7 +510,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::vector<ExpandedUseEntryList> entries;
|
std::vector<ExpandedUseEntryList> entries;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -557,13 +517,10 @@ namespace OpenWifi::ProvObjects {
|
|||||||
Types::UUIDvec_t list;
|
Types::UUIDvec_t list;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ACLACCESS {
|
enum ACLACCESS { NONE = 0, READ = 1, MODIFY = 2, CREATE = 3, DELETE = 4 };
|
||||||
NONE = 0, READ = 1, MODIFY = 2, CREATE = 3, DELETE = 4
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ObjectACL {
|
struct ObjectACL {
|
||||||
UuidList users;
|
UuidList users;
|
||||||
@@ -571,7 +528,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
uint64_t access = (uint64_t)NONE;
|
uint64_t access = (uint64_t)NONE;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -579,7 +535,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::vector<ObjectACL> list;
|
std::vector<ObjectACL> list;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -594,7 +549,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::string venue;
|
std::string venue;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -602,7 +556,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::vector<Map> list;
|
std::vector<Map> list;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -632,7 +585,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::string operatorId;
|
std::string operatorId;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -643,7 +595,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::string value;
|
std::string value;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -651,7 +602,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::vector<Variable> variables;
|
std::vector<Variable> variables;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -666,7 +616,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
Types::UUID_t managementPolicy;
|
Types::UUID_t managementPolicy;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -674,7 +623,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::vector<VariableBlock> variableBlocks;
|
std::vector<VariableBlock> variableBlocks;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -689,7 +637,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::string registrationId;
|
std::string registrationId;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -697,7 +644,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::vector<Operator> operators;
|
std::vector<Operator> operators;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -708,7 +654,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
Types::UUIDvec_t devices;
|
Types::UUIDvec_t devices;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -724,7 +669,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
bool defaultService = false;
|
bool defaultService = false;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -732,7 +676,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::vector<ServiceClass> serviceClasses;
|
std::vector<ServiceClass> serviceClasses;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -743,7 +686,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::string firmwareRCOnly{"inherit"};
|
std::string firmwareRCOnly{"inherit"};
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -768,7 +710,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::string realMacAddress;
|
std::string realMacAddress;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -776,7 +717,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::vector<SubscriberDevice> subscriberDevices;
|
std::vector<SubscriberDevice> subscriberDevices;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -789,7 +729,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::uint64_t modified;
|
std::uint64_t modified;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -799,119 +738,12 @@ namespace OpenWifi::ProvObjects {
|
|||||||
std::vector<ConfigurationOverride> overrides;
|
std::vector<ConfigurationOverride> overrides;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool UpdateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U,
|
bool UpdateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U,
|
||||||
ObjectInfo &I);
|
ObjectInfo &I);
|
||||||
|
|
||||||
bool CreateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U,
|
bool CreateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U,
|
||||||
ObjectInfo &I);
|
ObjectInfo &I);
|
||||||
|
|
||||||
bool CreateObjectInfo(const SecurityObjects::UserInfo &U, ObjectInfo &I);
|
bool CreateObjectInfo(const SecurityObjects::UserInfo &U, ObjectInfo &I);
|
||||||
|
|
||||||
struct GLBLRAccountInfo {
|
|
||||||
ObjectInfo info;
|
|
||||||
std::string privateKey;
|
|
||||||
std::string country, province, city, organization, commonName;
|
|
||||||
std::string CSR, CSRPrivateKey, CSRPublicKey;
|
|
||||||
std::string GlobalReachAcctId;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct GLBLRCertificateInfo {
|
|
||||||
std::string id;
|
|
||||||
std::string name;
|
|
||||||
std::string accountId;
|
|
||||||
std::string csr;
|
|
||||||
std::string certificate;
|
|
||||||
std::string certificateChain;
|
|
||||||
std::string certificateId;
|
|
||||||
std::uint64_t expiresAt = 0;
|
|
||||||
std::uint64_t created = 0;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
|
||||||
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct GooglOrionAccountInfo {
|
|
||||||
ObjectInfo info;
|
|
||||||
std::string privateKey;
|
|
||||||
std::string certificate;
|
|
||||||
std::vector<std::string> cacerts;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct RADIUSServer {
|
|
||||||
std::string Hostname;
|
|
||||||
std::string IP;
|
|
||||||
std::uint64_t Port=0;
|
|
||||||
std::string Secret;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct RADIUSEndPointRadiusType {
|
|
||||||
std::vector<RADIUSServer> Authentication;
|
|
||||||
std::vector<RADIUSServer> Accounting;
|
|
||||||
std::vector<RADIUSServer> CoA;
|
|
||||||
std::uint64_t AccountingInterval = 60;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct RADIUSEndPointRadsecType {
|
|
||||||
std::string Hostname;
|
|
||||||
std::string IP;
|
|
||||||
std::uint64_t Port=2083;
|
|
||||||
std::string Secret{"radsec"};
|
|
||||||
std::string OpenRoamingType;
|
|
||||||
std::string UseOpenRoamingAccount;
|
|
||||||
std::uint64_t Weight=0;
|
|
||||||
std::string Certificate;
|
|
||||||
std::string PrivateKey;
|
|
||||||
std::vector<std::string> CaCerts;
|
|
||||||
bool AllowSelfSigned=false;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct RADIUSEndPoint {
|
|
||||||
ObjectInfo info;
|
|
||||||
std::string Type{"radius"};
|
|
||||||
std::string PoolStrategy{"none"};
|
|
||||||
bool UseGWProxy=true;
|
|
||||||
std::string Index;
|
|
||||||
std::vector<std::string> UsedBy;
|
|
||||||
std::vector<RADIUSEndPointRadiusType> RadiusServers;
|
|
||||||
std::vector<RADIUSEndPointRadsecType> RadsecServers;
|
|
||||||
std::string NasIdentifier;
|
|
||||||
std::uint64_t AccountingInterval=600;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct RADIUSEndpointUpdateStatus {
|
|
||||||
std::uint64_t lastUpdate=0;
|
|
||||||
std::uint64_t lastConfigurationChange=0;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
|
||||||
bool Read();
|
|
||||||
bool Save();
|
|
||||||
bool ChangeConfiguration();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}; // namespace OpenWifi::ProvObjects
|
}; // namespace OpenWifi::ProvObjects
|
||||||
|
|||||||
@@ -11,12 +11,10 @@
|
|||||||
|
|
||||||
#include "Poco/File.h"
|
#include "Poco/File.h"
|
||||||
#include "Poco/StreamCopier.h"
|
#include "Poco/StreamCopier.h"
|
||||||
#include "Poco/JSON/Object.h"
|
|
||||||
#include "Poco/JSON/Parser.h"
|
|
||||||
|
|
||||||
#include "framework/MicroServiceFuncs.h"
|
#include "framework/MicroServiceFuncs.h"
|
||||||
|
|
||||||
// #include "nlohmann/json.hpp"
|
#include "nlohmann/json.hpp"
|
||||||
|
|
||||||
namespace OpenWifi {
|
namespace OpenWifi {
|
||||||
|
|
||||||
@@ -30,11 +28,11 @@ namespace OpenWifi {
|
|||||||
if (F.exists()) {
|
if (F.exists()) {
|
||||||
std::ostringstream OS;
|
std::ostringstream OS;
|
||||||
std::ifstream IF(FileName);
|
std::ifstream IF(FileName);
|
||||||
Poco::JSON::Parser P;
|
Poco::StreamCopier::copyStream(IF, OS);
|
||||||
Registry_ = P.parse(IF).extract<Poco::JSON::Object::Ptr>();
|
Registry_ = nlohmann::json::parse(OS.str());
|
||||||
}
|
}
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
Registry_ = Poco::makeShared<Poco::JSON::Object>();
|
Registry_ = nlohmann::json::parse("{}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,39 +44,46 @@ namespace OpenWifi {
|
|||||||
inline ~AppServiceRegistry() { Save(); }
|
inline ~AppServiceRegistry() { Save(); }
|
||||||
|
|
||||||
inline void Save() {
|
inline void Save() {
|
||||||
|
std::istringstream IS(to_string(Registry_));
|
||||||
std::ofstream OF;
|
std::ofstream OF;
|
||||||
OF.open(FileName, std::ios::binary | std::ios::trunc);
|
OF.open(FileName, std::ios::binary | std::ios::trunc);
|
||||||
Registry_->stringify(OF);
|
Poco::StreamCopier::copyStream(IS, OF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Set(const char *key, const std::vector<std::string> &V) {
|
inline void Set(const char *Key, uint64_t Value) {
|
||||||
Poco::JSON::Array Arr;
|
Registry_[Key] = Value;
|
||||||
for(const auto &s:V) {
|
|
||||||
Arr.add(s);
|
|
||||||
}
|
|
||||||
Registry_->set(key,Arr);
|
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> void Set(const char *key, const T &Value) {
|
inline void Set(const char *Key, const std::string &Value) {
|
||||||
Registry_->set(key,Value);
|
Registry_[Key] = Value;
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Get(const char *key, std::vector<std::string> &Value) {
|
inline void Set(const char *Key, bool Value) {
|
||||||
if(Registry_->has(key) && !Registry_->isNull(key) && Registry_->isArray(key)) {
|
Registry_[Key] = Value;
|
||||||
auto Arr = Registry_->get(key);
|
Save();
|
||||||
for(const auto &v:Arr) {
|
|
||||||
Value.emplace_back(v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool Get(const char *Key, bool &Value) {
|
||||||
|
if (Registry_[Key].is_boolean()) {
|
||||||
|
Value = Registry_[Key].get<bool>();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> bool Get(const char *key, T &Value) {
|
inline bool Get(const char *Key, uint64_t &Value) {
|
||||||
if(Registry_->has(key) && !Registry_->isNull(key)) {
|
if (Registry_[Key].is_number_unsigned()) {
|
||||||
Value = Registry_->getValue<T>(key);
|
Value = Registry_[Key].get<uint64_t>();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool Get(const char *Key, std::string &Value) {
|
||||||
|
if (Registry_[Key].is_string()) {
|
||||||
|
Value = Registry_[Key].get<std::string>();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -86,7 +91,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::string FileName;
|
std::string FileName;
|
||||||
Poco::JSON::Object::Ptr Registry_;
|
nlohmann::json Registry_;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline auto AppServiceRegistry() { return AppServiceRegistry::instance(); }
|
inline auto AppServiceRegistry() { return AppServiceRegistry::instance(); }
|
||||||
|
|||||||
@@ -307,8 +307,10 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] std::string KafkaManager::WrapSystemId(const std::string & PayLoad) {
|
[[nodiscard]] std::string KafkaManager::WrapSystemId(const std::string & PayLoad) {
|
||||||
return fmt::format( R"lit({{ "system" : {{ "id" : {}, "host" : "{}" }}, "payload" : {} }})lit",
|
return fmt::format( R"lit({{ "system" : {{ "id" : {},
|
||||||
MicroServiceID(), MicroServicePrivateEndPoint(), PayLoad ) ;
|
"host" : "{}" }},
|
||||||
|
"payload" : {} }})lit", MicroServiceID(),
|
||||||
|
MicroServicePrivateEndPoint(), PayLoad ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KafkaManager::PartitionAssignment(const cppkafka::TopicPartitionList &partitions) {
|
void KafkaManager::PartitionAssignment(const cppkafka::TopicPartitionList &partitions) {
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ namespace OpenWifi::KafkaTopics {
|
|||||||
inline const char * DEVICE_EVENT_QUEUE = "device_event_queue";
|
inline const char * DEVICE_EVENT_QUEUE = "device_event_queue";
|
||||||
inline const char * DEVICE_TELEMETRY = "device_telemetry";
|
inline const char * DEVICE_TELEMETRY = "device_telemetry";
|
||||||
inline const char * PROVISIONING_CHANGE = "provisioning_change";
|
inline const char * PROVISIONING_CHANGE = "provisioning_change";
|
||||||
inline const char * RRM = "rrm";
|
|
||||||
|
|
||||||
namespace ServiceEvents {
|
namespace ServiceEvents {
|
||||||
inline const char * EVENT_JOIN = "join";
|
inline const char * EVENT_JOIN = "join";
|
||||||
|
|||||||
@@ -129,8 +129,4 @@ namespace OpenWifi {
|
|||||||
return ALBHealthCheckServer()->RegisterExtendedHealthMessage(Callback);
|
return ALBHealthCheckServer()->RegisterExtendedHealthMessage(Callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MicroServiceAccessKey() {
|
|
||||||
return MicroService::instance().Hash();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace OpenWifi
|
} // namespace OpenWifi
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ namespace OpenWifi {
|
|||||||
std::string MicroServicePublicEndPoint();
|
std::string MicroServicePublicEndPoint();
|
||||||
std::string MicroServiceConfigGetString(const std::string &Key,
|
std::string MicroServiceConfigGetString(const std::string &Key,
|
||||||
const std::string &DefaultValue);
|
const std::string &DefaultValue);
|
||||||
std::string MicroServiceAccessKey();
|
|
||||||
bool MicroServiceConfigGetBool(const std::string &Key, bool DefaultValue);
|
bool MicroServiceConfigGetBool(const std::string &Key, bool DefaultValue);
|
||||||
std::uint64_t MicroServiceConfigGetInt(const std::string &Key, std::uint64_t DefaultValue);
|
std::uint64_t MicroServiceConfigGetInt(const std::string &Key, std::uint64_t DefaultValue);
|
||||||
std::string MicroServicePrivateEndPoint();
|
std::string MicroServicePrivateEndPoint();
|
||||||
|
|||||||
@@ -414,24 +414,10 @@ namespace OpenWifi::RESTAPI::Errors {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const struct msg DefFirmwareNameExists { 1175, "Firmware name already exists." };
|
static const struct msg DefFirmwareNameExists { 1175, "Firmware name already exists." };
|
||||||
static const struct msg NotAValidECKey { 1176, "Not a valid Signing Key." };
|
|
||||||
static const struct msg NotAValidRadiusPoolType { 1177, "Not a valid RADIUS pool type." };
|
|
||||||
static const struct msg InvalidRadiusTypeEndpoint { 1178, "Invalid RADIUS Server Endpoint type." };
|
|
||||||
static const struct msg InvalidRadiusEndpointPoolStrategy { 1179, "Invalid RADIUS Server Endpoint Pool strategy." };
|
|
||||||
static const struct msg EndpointMustHaveOneTypeOfServers { 1180, "All servers must be either RADIUS or RADSEC." };
|
|
||||||
static const struct msg RadiusEndpointIndexInvalid { 1181, "Index must be an address between 0.0.1.1 and 0.0.2.254" };
|
|
||||||
static const struct msg RadiusEndpointIndexMustBeUnique { 1182, "Index must be unique." };
|
|
||||||
static const struct msg OrionAccountMustExist { 1183, "Orion account must exist." };
|
|
||||||
static const struct msg GlobalReachCertMustExist { 1184, "Global Reach certificate must exist." };
|
|
||||||
static const struct msg InvalidRadsecMainCertificate { 1185, "Invalid Radsec main certificate." };
|
|
||||||
static const struct msg InvalidRadsecCaCertificate { 1186, "Invalid Radsec CA certificates." };
|
|
||||||
static const struct msg InvalidRadsecPrivteKey { 1187, "Invalid Radsec Private key." };
|
|
||||||
static const struct msg InvalidRadsecIPAddress { 1188, "Invalid Radsec IP Address." };
|
|
||||||
static const struct msg InvalidRadsecPort { 1189, "Invalid Radsec Port." };
|
|
||||||
static const struct msg InvalidRadsecSecret { 1190, "Invalid Radsec Secret." };
|
|
||||||
static const struct msg InvalidRadiusServer { 1191, "Invalid Radius Server." };
|
|
||||||
|
|
||||||
static const struct msg InvalidRRMAction { 1192, "Invalid RRM Action." };
|
static const struct msg NotAValidECKey { 1176, "Not a valid Signing Key." };
|
||||||
|
|
||||||
|
static const struct msg NotAValidRadiusPoolType { 1177, "Not a valid RADIUS pool type." };
|
||||||
|
|
||||||
static const struct msg SimulationDoesNotExist {
|
static const struct msg SimulationDoesNotExist {
|
||||||
7000, "Simulation Instance ID does not exist."
|
7000, "Simulation Instance ID does not exist."
|
||||||
@@ -563,10 +549,6 @@ namespace OpenWifi::RESTAPI::Protocol {
|
|||||||
static const char *CONTENTDISPOSITION = "Content-Disposition";
|
static const char *CONTENTDISPOSITION = "Content-Disposition";
|
||||||
static const char *CONTENTTYPE = "Content-Type";
|
static const char *CONTENTTYPE = "Content-Type";
|
||||||
|
|
||||||
static const char *TRANSFER = "transfer";
|
|
||||||
static const char *CERTUPDATE = "certupdate";
|
|
||||||
static const char *RRM = "rrm";
|
|
||||||
|
|
||||||
static const char *REQUIREMENTS = "requirements";
|
static const char *REQUIREMENTS = "requirements";
|
||||||
static const char *PASSWORDPATTERN = "passwordPattern";
|
static const char *PASSWORDPATTERN = "passwordPattern";
|
||||||
static const char *ACCESSPOLICY = "accessPolicy";
|
static const char *ACCESSPOLICY = "accessPolicy";
|
||||||
@@ -684,12 +666,6 @@ namespace OpenWifi::uCentralProtocol {
|
|||||||
static const char *RADIUSCOA = "coa";
|
static const char *RADIUSCOA = "coa";
|
||||||
static const char *RADIUSDST = "dst";
|
static const char *RADIUSDST = "dst";
|
||||||
static const char *IES = "ies";
|
static const char *IES = "ies";
|
||||||
|
|
||||||
static const char *TRANSFER = "transfer";
|
|
||||||
static const char *CERTUPDATE = "certupdate";
|
|
||||||
static const char *RRM = "rrm";
|
|
||||||
static const char *ACTIONS = "actions";
|
|
||||||
|
|
||||||
} // namespace OpenWifi::uCentralProtocol
|
} // namespace OpenWifi::uCentralProtocol
|
||||||
|
|
||||||
namespace OpenWifi::uCentralProtocol::Events {
|
namespace OpenWifi::uCentralProtocol::Events {
|
||||||
@@ -782,9 +758,6 @@ namespace OpenWifi::APCommands {
|
|||||||
telemetry,
|
telemetry,
|
||||||
ping,
|
ping,
|
||||||
script,
|
script,
|
||||||
rrm,
|
|
||||||
certupdate,
|
|
||||||
transfer,
|
|
||||||
unknown
|
unknown
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -797,10 +770,7 @@ namespace OpenWifi::APCommands {
|
|||||||
RESTAPI::Protocol::LEDS, RESTAPI::Protocol::TRACE,
|
RESTAPI::Protocol::LEDS, RESTAPI::Protocol::TRACE,
|
||||||
RESTAPI::Protocol::REQUEST, RESTAPI::Protocol::WIFISCAN,
|
RESTAPI::Protocol::REQUEST, RESTAPI::Protocol::WIFISCAN,
|
||||||
RESTAPI::Protocol::EVENTQUEUE, RESTAPI::Protocol::TELEMETRY,
|
RESTAPI::Protocol::EVENTQUEUE, RESTAPI::Protocol::TELEMETRY,
|
||||||
RESTAPI::Protocol::PING, RESTAPI::Protocol::SCRIPT,
|
RESTAPI::Protocol::PING, RESTAPI::Protocol::SCRIPT};
|
||||||
RESTAPI::Protocol::RRM, RESTAPI::Protocol::CERTUPDATE,
|
|
||||||
RESTAPI::Protocol::TRANSFER
|
|
||||||
};
|
|
||||||
|
|
||||||
inline const char *to_string(Commands Cmd) { return uCentralAPCommands[(uint8_t)Cmd]; }
|
inline const char *to_string(Commands Cmd) { return uCentralAPCommands[(uint8_t)Cmd]; }
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <resolv.h>
|
|
||||||
|
|
||||||
namespace OpenWifi::Utils {
|
namespace OpenWifi::Utils {
|
||||||
|
|
||||||
bool NormalizeMac(std::string &Mac) {
|
bool NormalizeMac(std::string &Mac) {
|
||||||
@@ -785,10 +783,6 @@ namespace OpenWifi::Utils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VerifyPrivateKey(const std::string &key) {
|
|
||||||
return VerifyECKey(key) || VerifyRSAKey(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ValidX509Certificate([[
|
bool ValidX509Certificate([[
|
||||||
maybe_unused]] const std::string &Cert) {
|
maybe_unused]] const std::string &Cert) {
|
||||||
try {
|
try {
|
||||||
@@ -868,78 +862,4 @@ namespace OpenWifi::Utils {
|
|||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to query NAPTR records for a domain and return them in a vector
|
|
||||||
std::vector<NAPTRRecord> getNAPTRRecords(const std::string& domain) {
|
|
||||||
std::vector<NAPTRRecord> naptrRecords;
|
|
||||||
|
|
||||||
unsigned char buf[4096];
|
|
||||||
ns_msg handle;
|
|
||||||
ns_initparse(buf, NS_PACKETSZ, &handle);
|
|
||||||
|
|
||||||
// Query NAPTR records for the given domain
|
|
||||||
int response = res_query(domain.c_str(), ns_c_in, ns_t_naptr, buf, sizeof(buf));
|
|
||||||
if (response < 0) {
|
|
||||||
return naptrRecords;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ns_initparse(buf, response, &handle) < 0) {
|
|
||||||
return naptrRecords;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Iterate through the DNS response and extract NAPTR records
|
|
||||||
int count = ns_msg_count(handle, ns_s_an);
|
|
||||||
for (int i = 0; i < count; ++i) {
|
|
||||||
ns_rr rr;
|
|
||||||
if (ns_parserr(&handle, ns_s_an, i, &rr) == 0) {
|
|
||||||
char rdata[256];
|
|
||||||
ns_sprintrr(&handle, &rr, nullptr, nullptr, rdata, sizeof(rdata));
|
|
||||||
NAPTRRecord record;
|
|
||||||
std::istringstream os(rdata);
|
|
||||||
os >> record.name >> record.ttl >> record.rclass >> record.rtype >> record.order >> record.preference >> record.flags
|
|
||||||
>> record.service >> record.regexp >> record.replacement;
|
|
||||||
naptrRecords.push_back(record);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return naptrRecords;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<SrvRecord> getSRVRecords(const std::string& domain) {
|
|
||||||
std::vector<SrvRecord> srvRecords;
|
|
||||||
|
|
||||||
// Buffer to hold the DNS response
|
|
||||||
unsigned char buf[4096];
|
|
||||||
ns_msg handle;
|
|
||||||
ns_initparse(buf, NS_PACKETSZ, &handle);
|
|
||||||
|
|
||||||
// Query NAPTR records for the given domain
|
|
||||||
int response = res_query(domain.c_str(), ns_c_in, ns_t_srv, buf, sizeof(buf));
|
|
||||||
if (response < 0) {
|
|
||||||
std::cerr << "DNS query failed for " << domain << ": " << hstrerror(h_errno) << std::endl;
|
|
||||||
return srvRecords;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ns_initparse(buf, response, &handle) < 0) {
|
|
||||||
return srvRecords;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Iterate through the DNS response and extract NAPTR records
|
|
||||||
int count = ns_msg_count(handle, ns_s_an);
|
|
||||||
for (int i = 0; i < count; ++i) {
|
|
||||||
ns_rr rr;
|
|
||||||
if (ns_parserr(&handle, ns_s_an, i, &rr) == 0) {
|
|
||||||
char rdata[256];
|
|
||||||
ns_sprintrr(&handle, &rr, nullptr, nullptr, rdata, sizeof(rdata));
|
|
||||||
SrvRecord record;
|
|
||||||
std::istringstream os(rdata);
|
|
||||||
os >> record.name >> record.ttl >> record.rclass >> record.rtype >> record.pref >> record.weight >>
|
|
||||||
record.port >> record.srvname ;
|
|
||||||
srvRecords.push_back(record);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return srvRecords;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace OpenWifi::Utils
|
} // namespace OpenWifi::Utils
|
||||||
|
|||||||
@@ -247,24 +247,6 @@ namespace OpenWifi::Utils {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::uint32_t IPtoInt(const std::string &A) {
|
|
||||||
Poco::Net::IPAddress IP;
|
|
||||||
std::uint32_t Result=0;
|
|
||||||
|
|
||||||
if(Poco::Net::IPAddress::tryParse(A,IP)) {
|
|
||||||
for(const auto i:IP.toBytes()) {
|
|
||||||
Result <<= 8;
|
|
||||||
Result += i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool ValidIP(const std::string &IPstr) {
|
|
||||||
Poco::Net::IPAddress IP;
|
|
||||||
return Poco::Net::IPAddress::tryParse(IPstr,IP);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct CSRCreationParameters {
|
struct CSRCreationParameters {
|
||||||
std::string Country, Province, City,
|
std::string Country, Province, City,
|
||||||
Organization, CommonName;
|
Organization, CommonName;
|
||||||
@@ -279,42 +261,7 @@ namespace OpenWifi::Utils {
|
|||||||
std::string generateStrongPassword(int minLength, int maxLength, int numDigits, int minLowercase, int minSpecial, int minUppercase);
|
std::string generateStrongPassword(int minLength, int maxLength, int numDigits, int minLowercase, int minSpecial, int minUppercase);
|
||||||
bool VerifyECKey(const std::string &key);
|
bool VerifyECKey(const std::string &key);
|
||||||
bool VerifyRSAKey(const std::string &key);
|
bool VerifyRSAKey(const std::string &key);
|
||||||
bool VerifyPrivateKey(const std::string &key);
|
|
||||||
bool ValidX509Certificate(const std::string &Cert);
|
bool ValidX509Certificate(const std::string &Cert);
|
||||||
bool ValidX509Certificate(const std::vector<std::string> &Certs);
|
bool ValidX509Certificate(const std::vector<std::string> &Certs);
|
||||||
|
|
||||||
struct NAPTRRecord {
|
|
||||||
std::string name;
|
|
||||||
std::string ttl;
|
|
||||||
std::string rclass;
|
|
||||||
std::string rtype;
|
|
||||||
uint32_t order=0;
|
|
||||||
uint32_t preference=0;
|
|
||||||
std::string flags;
|
|
||||||
std::string service;
|
|
||||||
std::string regexp;
|
|
||||||
std::string replacement;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Function to query NAPTR records for a domain and return them in a vector
|
|
||||||
std::vector<NAPTRRecord> getNAPTRRecords(const std::string& domain);
|
|
||||||
struct SrvRecord {
|
|
||||||
std::string name;
|
|
||||||
std::string ttl;
|
|
||||||
std::string rclass;
|
|
||||||
std::string rtype;
|
|
||||||
uint32_t pref = 0;
|
|
||||||
uint32_t weight = 0;
|
|
||||||
uint32_t port = 0;
|
|
||||||
std::string srvname;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::vector<SrvRecord> getSRVRecords(const std::string& domain);
|
|
||||||
|
|
||||||
struct HostNameServerResult{
|
|
||||||
std::string Hostname;
|
|
||||||
uint32_t Port;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace OpenWifi::Utils
|
} // namespace OpenWifi::Utils
|
||||||
|
|||||||
Reference in New Issue
Block a user