diff --git a/build b/build index 62f9457..c793025 100644 --- a/build +++ b/build @@ -1 +1 @@ -6 \ No newline at end of file +7 \ No newline at end of file diff --git a/src/RESTObjects/RESTAPI_GWobjects.cpp b/src/RESTObjects/RESTAPI_GWobjects.cpp index 285517d..d6b3f1d 100644 --- a/src/RESTObjects/RESTAPI_GWobjects.cpp +++ b/src/RESTObjects/RESTAPI_GWobjects.cpp @@ -203,6 +203,10 @@ namespace OpenWifi::GWObjects { field_to_json(Obj,"kafkaClients", kafkaClients); field_to_json(Obj,"kafkaPackets", kafkaPackets); field_to_json(Obj,"locale", locale); + field_to_json(Obj,"started", started); + field_to_json(Obj,"sessionId", sessionId); + field_to_json(Obj,"connectionCompletionTime", connectionCompletionTime); + field_to_json(Obj,"totalConnectionTime", OpenWifi::Now() - started); switch(VerifiedCertificate) { case NO_CERTIFICATE: @@ -218,6 +222,21 @@ namespace OpenWifi::GWObjects { } } + void DeviceConnectionStatistics::to_json(Poco::JSON::Object &Obj) const { + field_to_json(Obj,"averageConnectionTime", averageConnectionTime); + field_to_json(Obj,"connectedDevices", connectedDevices ); + } + + bool DeviceConnectionStatistics::from_json(const Poco::JSON::Object::Ptr &Obj) { + try { + field_from_json(Obj,"averageConnectionTime", averageConnectionTime); + field_from_json(Obj,"connectedDevices", connectedDevices ); + return true; + } catch (const Poco::Exception &E) { + } + return false; + } + void RttySessionDetails::to_json(Poco::JSON::Object &Obj) const { field_to_json(Obj,"serialNumber", SerialNumber); field_to_json(Obj,"server", Server); @@ -293,7 +312,6 @@ namespace OpenWifi::GWObjects { } catch (const Poco::Exception &E) { } return false; - } void RadiusProxyPoolList::to_json(Poco::JSON::Object &Obj) const { @@ -314,6 +332,8 @@ namespace OpenWifi::GWObjects { field_to_json(Obj,"description",description); field_to_json(Obj,"authConfig",authConfig); field_to_json(Obj,"acctConfig",acctConfig); + field_to_json(Obj,"coaConfig",coaConfig); + field_to_json(Obj,"useByDefault",useByDefault); } bool RadiusProxyPool::from_json(const Poco::JSON::Object::Ptr &Obj) { @@ -322,6 +342,8 @@ namespace OpenWifi::GWObjects { field_from_json(Obj,"description",description); field_from_json(Obj,"authConfig",authConfig); field_from_json(Obj,"acctConfig",acctConfig); + field_from_json(Obj,"coaConfig",coaConfig); + field_from_json(Obj,"useByDefault",useByDefault); return true; } catch (const Poco::Exception &E) { } @@ -329,7 +351,7 @@ namespace OpenWifi::GWObjects { } void RadiusProxyServerConfig::to_json(Poco::JSON::Object &Obj) const { - field_to_json(Obj,"policy",strategy); + field_to_json(Obj,"strategy",strategy); field_to_json(Obj,"monitor",monitor); field_to_json(Obj,"monitorMethod",monitorMethod); field_to_json(Obj,"methodParameters",methodParameters); @@ -338,7 +360,7 @@ namespace OpenWifi::GWObjects { bool RadiusProxyServerConfig::from_json(const Poco::JSON::Object::Ptr &Obj) { try { - field_from_json(Obj,"policy",strategy); + field_from_json(Obj,"strategy",strategy); field_from_json(Obj,"monitor",monitor); field_from_json(Obj,"monitorMethod",monitorMethod); field_from_json(Obj,"methodParameters",methodParameters); @@ -354,6 +376,16 @@ namespace OpenWifi::GWObjects { field_to_json(Obj,"ip",ip); field_to_json(Obj,"port",port); field_to_json(Obj,"weight",weight); + field_to_json(Obj,"secret",secret); + field_to_json(Obj,"certificate",certificate); + field_to_json(Obj,"radsec",radsec); + field_to_json(Obj,"radsecPort",radsecPort); + field_to_json(Obj,"radsecSecret",radsecSecret); + field_to_json(Obj,"radsecCacerts",radsecCacerts); + field_to_json(Obj,"radsecCert",radsecCert); + field_to_json(Obj,"radsecKey",radsecKey); + field_to_json(Obj,"radsecRealms",radsecRealms); + field_to_json(Obj,"ignore",ignore); } bool RadiusProxyServerEntry::from_json(const Poco::JSON::Object::Ptr &Obj) { @@ -362,6 +394,16 @@ namespace OpenWifi::GWObjects { field_from_json(Obj,"ip",ip); field_from_json(Obj,"port",port); field_from_json(Obj,"weight",weight); + field_from_json(Obj,"secret",secret); + field_from_json(Obj,"certificate",certificate); + field_from_json(Obj,"radsec",radsec); + field_from_json(Obj,"radsecSecret",radsecSecret); + field_from_json(Obj,"radsecPort",radsecPort); + field_from_json(Obj,"radsecCacerts",radsecCacerts); + field_from_json(Obj,"radsecCert",radsecCert); + field_from_json(Obj,"radsecKey",radsecKey); + field_from_json(Obj,"radsecRealms",radsecRealms); + field_from_json(Obj,"ignore",ignore); return true; } catch (const Poco::Exception &E) { } diff --git a/src/RESTObjects/RESTAPI_GWobjects.h b/src/RESTObjects/RESTAPI_GWobjects.h index 7395545..2a2b2a9 100644 --- a/src/RESTObjects/RESTAPI_GWobjects.h +++ b/src/RESTObjects/RESTAPI_GWobjects.h @@ -38,6 +38,10 @@ namespace OpenWifi::GWObjects { uint64_t kafkaPackets=0; uint64_t websocketPackets=0; std::string locale; + uint64_t started=0; + uint64_t sessionId=0; + double connectionCompletionTime=0.0; + void to_json(Poco::JSON::Object &Obj) const; }; @@ -71,6 +75,13 @@ namespace OpenWifi::GWObjects { void Print() const; }; + struct DeviceConnectionStatistics { + std::uint64_t connectedDevices = 0; + std::uint64_t averageConnectionTime = 0; + void to_json(Poco::JSON::Object &Obj) const; + bool from_json(const Poco::JSON::Object::Ptr &Obj); + }; + struct Statistics { std::string SerialNumber; uint64_t UUID = 0 ; @@ -216,6 +227,16 @@ namespace OpenWifi::GWObjects { std::string ip; uint16_t port=0; uint64_t weight=0; + std::string secret; + std::string certificate; + bool radsec=false; + uint16_t radsecPort=2083; + std::string radsecSecret; + std::string radsecKey; + std::string radsecCert; + std::vector radsecCacerts; + std::vector radsecRealms; + bool ignore=false; void to_json(Poco::JSON::Object &Obj) const; bool from_json(const Poco::JSON::Object::Ptr &Obj); @@ -237,6 +258,8 @@ namespace OpenWifi::GWObjects { std::string description; RadiusProxyServerConfig authConfig; RadiusProxyServerConfig acctConfig; + RadiusProxyServerConfig coaConfig; + bool useByDefault=false; void to_json(Poco::JSON::Object &Obj) const; bool from_json(const Poco::JSON::Object::Ptr &Obj); diff --git a/src/framework/ConfigurationValidator.cpp b/src/framework/ConfigurationValidator.cpp index 7a4a571..5170ef6 100644 --- a/src/framework/ConfigurationValidator.cpp +++ b/src/framework/ConfigurationValidator.cpp @@ -44,7 +44,7 @@ static json DefaultUCentralSchema = R"( "switch": { "$ref": "#/$defs/switch" }, - "radios": { + "radiosgrep": { "type": "array", "items": { "$ref": "#/$defs/radio" diff --git a/src/framework/WebSocketClientNotifications.h b/src/framework/WebSocketClientNotifications.h index a0c3a02..435732c 100644 --- a/src/framework/WebSocketClientNotifications.h +++ b/src/framework/WebSocketClientNotifications.h @@ -146,6 +146,10 @@ namespace OpenWifi { WebSocketClientServer()->SendUserNotification(User,N); } + ///// + ///// + ///// + struct WebSocketNotificationRebootList { std::string title, details, @@ -189,5 +193,58 @@ namespace OpenWifi { WebSocketClientServer()->SendUserNotification(User,N); } + ///// + ///// + ///// + + struct WebSocketNotificationUpgradeList { + std::string title, + details, + jobId; + std::vector success, + skipped, + no_firmware, + not_connected; + uint64_t timeStamp=OpenWifi::Now(); + + void to_json(Poco::JSON::Object &Obj) const; + bool from_json(const Poco::JSON::Object::Ptr &Obj); + }; + + typedef WebSocketNotification WebSocketClientNotificationVenueUpgradeList_t; + + inline void WebSocketNotificationUpgradeList::to_json(Poco::JSON::Object &Obj) const { + RESTAPI_utils::field_to_json(Obj,"title",title); + RESTAPI_utils::field_to_json(Obj,"jobId",jobId); + RESTAPI_utils::field_to_json(Obj,"success",success); + RESTAPI_utils::field_to_json(Obj,"notConnected",not_connected); + RESTAPI_utils::field_to_json(Obj,"noFirmware",no_firmware); + RESTAPI_utils::field_to_json(Obj,"skipped",skipped); + RESTAPI_utils::field_to_json(Obj,"timeStamp",timeStamp); + RESTAPI_utils::field_to_json(Obj,"details",details); + } + + inline bool WebSocketNotificationUpgradeList::from_json(const Poco::JSON::Object::Ptr &Obj) { + try { + RESTAPI_utils::field_from_json(Obj,"title",title); + RESTAPI_utils::field_from_json(Obj,"jobId",jobId); + RESTAPI_utils::field_from_json(Obj,"success",success); + RESTAPI_utils::field_from_json(Obj,"notConnected",not_connected); + RESTAPI_utils::field_from_json(Obj,"noFirmware",no_firmware); + RESTAPI_utils::field_from_json(Obj,"skipped",skipped); + RESTAPI_utils::field_from_json(Obj,"timeStamp",timeStamp); + RESTAPI_utils::field_from_json(Obj,"details",details); + return true; + } catch(...) { + + } + return false; + } + + inline void WebSocketClientNotificationVenueUpgradeCompletionToUser( const std::string & User, WebSocketClientNotificationVenueUpgradeList_t &N) { + N.type = "venue_upgrader"; + WebSocketClientServer()->SendUserNotification(User,N); + } + } // namespace OpenWifi diff --git a/src/framework/ow_constants.h b/src/framework/ow_constants.h index 443a457..5d70763 100644 --- a/src/framework/ow_constants.h +++ b/src/framework/ow_constants.h @@ -196,6 +196,8 @@ namespace OpenWifi::RESTAPI::Errors { static const struct msg InvalidRadiusServerEntry{1142,"RADIUS Server IP address invalid or port missing."}; static const struct msg InvalidRadiusServerWeigth{1143,"RADIUS Server IP weight cannot be 0."}; + static const struct msg MaximumRTTYSessionsReached{1144,"Too many RTTY sessions currently active"}; + static const struct msg DeviceIsAlreadyBusy{1145,"Device is already executing a command. Please try later."}; } @@ -428,6 +430,7 @@ namespace OpenWifi::uCentralProtocol { static const char *RADIUSDATA = "data"; static const char *RADIUSACCT = "acct"; static const char *RADIUSAUTH = "auth"; + static const char *RADIUSCOA = "coa"; static const char *RADIUSDST = "dst"; static const char *IES = "ies"; } @@ -444,6 +447,7 @@ namespace OpenWifi::uCentralProtocol::Events { static const char *RECOVERY = "recovery"; static const char *TELEMETRY = "telemetry"; static const char *DEVICEUPDATE = "deviceupdate"; + static const char *VENUE_BROADCAST = "venue_broadcast"; enum EVENT_MSG { ET_UNKNOWN, @@ -456,7 +460,8 @@ namespace OpenWifi::uCentralProtocol::Events { ET_CFGPENDING, ET_RECOVERY, ET_DEVICEUPDATE, - ET_TELEMETRY + ET_TELEMETRY, + ET_VENUEBROADCAST }; inline EVENT_MSG EventFromString(const std::string & Method) { @@ -480,6 +485,8 @@ namespace OpenWifi::uCentralProtocol::Events { return ET_RECOVERY; else if(strcmp(TELEMETRY,Method.c_str())==0) return ET_TELEMETRY; + else if(strcmp(VENUE_BROADCAST,Method.c_str())==0) + return ET_VENUEBROADCAST; return ET_UNKNOWN; }; }