mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-11-01 19:27:59 +00:00
Adding "forgot password" action.
This commit is contained in:
@@ -148,6 +148,23 @@ namespace OpenWifi {
|
|||||||
return UnAuthorized("Insufficient access rights.", ACCESS_DENIED);
|
return UnAuthorized("Insufficient access rights.", ACCESS_DENIED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto forgotPassword= GetBoolParameter("forgotPassword");
|
||||||
|
if(forgotPassword) {
|
||||||
|
Existing.changePassword = true;
|
||||||
|
Logger_.information(fmt::format("FORGOTTEN-PASSWORD({}): Request for {}", Request->clientAddress().toString(), Existing.email));
|
||||||
|
|
||||||
|
SecurityObjects::ActionLink NewLink;
|
||||||
|
NewLink.action = OpenWifi::SecurityObjects::LinkActions::SUB_FORGOT_PASSWORD;
|
||||||
|
NewLink.id = MicroService::CreateUUID();
|
||||||
|
NewLink.userId = Existing.id;
|
||||||
|
NewLink.created = OpenWifi::Now();
|
||||||
|
NewLink.expires = NewLink.created + (24*60*60);
|
||||||
|
NewLink.userAction = false;
|
||||||
|
StorageService()->ActionLinksDB().CreateAction(NewLink);
|
||||||
|
|
||||||
|
return OK();
|
||||||
|
}
|
||||||
|
|
||||||
SecurityObjects::UserInfo NewUser;
|
SecurityObjects::UserInfo NewUser;
|
||||||
auto RawObject = ParseStream();
|
auto RawObject = ParseStream();
|
||||||
if(!NewUser.from_json(RawObject)) {
|
if(!NewUser.from_json(RawObject)) {
|
||||||
|
|||||||
@@ -153,6 +153,22 @@ namespace OpenWifi {
|
|||||||
return UnAuthorized("Insufficient access rights.", ACCESS_DENIED);
|
return UnAuthorized("Insufficient access rights.", ACCESS_DENIED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto forgotPassword= GetBoolParameter("forgotPassword");
|
||||||
|
if(forgotPassword) {
|
||||||
|
Existing.changePassword = true;
|
||||||
|
Logger_.information(fmt::format("FORGOTTEN-PASSWORD({}): Request for {}", Request->clientAddress().toString(), Existing.email));
|
||||||
|
SecurityObjects::ActionLink NewLink;
|
||||||
|
|
||||||
|
NewLink.action = OpenWifi::SecurityObjects::LinkActions::FORGOT_PASSWORD;
|
||||||
|
NewLink.id = MicroService::CreateUUID();
|
||||||
|
NewLink.userId = Existing.id;
|
||||||
|
NewLink.created = OpenWifi::Now();
|
||||||
|
NewLink.expires = NewLink.created + (24*60*60);
|
||||||
|
NewLink.userAction = true;
|
||||||
|
StorageService()->ActionLinksDB().CreateAction(NewLink);
|
||||||
|
return OK();
|
||||||
|
}
|
||||||
|
|
||||||
SecurityObjects::UserInfo NewUser;
|
SecurityObjects::UserInfo NewUser;
|
||||||
auto RawObject = ParseStream();
|
auto RawObject = ParseStream();
|
||||||
if(!NewUser.from_json(RawObject)) {
|
if(!NewUser.from_json(RawObject)) {
|
||||||
|
|||||||
360
src/RESTObjects/RESTAPI_AnalyticsObjects.cpp
Normal file
360
src/RESTObjects/RESTAPI_AnalyticsObjects.cpp
Normal file
@@ -0,0 +1,360 @@
|
|||||||
|
//
|
||||||
|
// Created by stephane bourque on 2022-01-10.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "RESTAPI_AnalyticsObjects.h"
|
||||||
|
#include "RESTAPI_ProvObjects.h"
|
||||||
|
#include "framework/MicroService.h"
|
||||||
|
|
||||||
|
using OpenWifi::RESTAPI_utils::field_to_json;
|
||||||
|
using OpenWifi::RESTAPI_utils::field_from_json;
|
||||||
|
|
||||||
|
namespace OpenWifi::AnalyticsObjects {
|
||||||
|
|
||||||
|
void Report::reset() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void Report::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
}
|
||||||
|
|
||||||
|
void VenueInfo::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"id",id);
|
||||||
|
field_to_json(Obj,"name",name);
|
||||||
|
field_to_json(Obj,"description",description);
|
||||||
|
field_to_json(Obj,"retention",retention);
|
||||||
|
field_to_json(Obj,"interval",interval);
|
||||||
|
field_to_json(Obj,"monitorSubVenues",monitorSubVenues);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VenueInfo::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,"description",description);
|
||||||
|
field_from_json(Obj,"retention",retention);
|
||||||
|
field_from_json(Obj,"interval",interval);
|
||||||
|
field_from_json(Obj,"monitorSubVenues",monitorSubVenues);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BoardInfo::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
info.to_json(Obj);
|
||||||
|
field_to_json(Obj,"venueList",venueList);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BoardInfo::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
info.from_json(Obj);
|
||||||
|
field_from_json(Obj,"venueList",venueList);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceInfo::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"boardId",boardId);
|
||||||
|
field_to_json(Obj,"type",type);
|
||||||
|
field_to_json(Obj,"serialNumber",serialNumber);
|
||||||
|
field_to_json(Obj,"deviceType",deviceType);
|
||||||
|
field_to_json(Obj,"lastContact",lastContact);
|
||||||
|
field_to_json(Obj,"lastPing",lastPing);
|
||||||
|
field_to_json(Obj,"lastState",lastState);
|
||||||
|
field_to_json(Obj,"lastFirmware",lastFirmware);
|
||||||
|
field_to_json(Obj,"lastFirmwareUpdate",lastFirmwareUpdate);
|
||||||
|
field_to_json(Obj,"lastConnection",lastConnection);
|
||||||
|
field_to_json(Obj,"lastDisconnection",lastDisconnection);
|
||||||
|
field_to_json(Obj,"pings",pings);
|
||||||
|
field_to_json(Obj,"states",states);
|
||||||
|
field_to_json(Obj,"connected",connected);
|
||||||
|
field_to_json(Obj,"connectionIp",connectionIp);
|
||||||
|
field_to_json(Obj,"associations_2g",associations_2g);
|
||||||
|
field_to_json(Obj,"associations_5g",associations_5g);
|
||||||
|
field_to_json(Obj,"associations_6g",associations_6g);
|
||||||
|
field_to_json(Obj,"health",health);
|
||||||
|
field_to_json(Obj,"lastHealth",lastHealth);
|
||||||
|
field_to_json(Obj,"locale",locale);
|
||||||
|
field_to_json(Obj,"uptime",uptime);
|
||||||
|
field_to_json(Obj,"memory",memory);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceInfo::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"boardId",boardId);
|
||||||
|
field_from_json(Obj,"type",type);
|
||||||
|
field_from_json(Obj,"serialNumber",serialNumber);
|
||||||
|
field_from_json(Obj,"deviceType",deviceType);
|
||||||
|
field_from_json(Obj,"lastContact",lastContact);
|
||||||
|
field_from_json(Obj,"lastPing",lastPing);
|
||||||
|
field_from_json(Obj,"lastState",lastState);
|
||||||
|
field_from_json(Obj,"lastFirmware",lastFirmware);
|
||||||
|
field_from_json(Obj,"lastFirmwareUpdate",lastFirmwareUpdate);
|
||||||
|
field_from_json(Obj,"lastConnection",lastConnection);
|
||||||
|
field_from_json(Obj,"lastDisconnection",lastDisconnection);
|
||||||
|
field_from_json(Obj,"pings",pings);
|
||||||
|
field_from_json(Obj,"states",states);
|
||||||
|
field_from_json(Obj,"connected",connected);
|
||||||
|
field_from_json(Obj,"connectionIp",connectionIp);
|
||||||
|
field_from_json(Obj,"associations_2g",associations_2g);
|
||||||
|
field_from_json(Obj,"associations_5g",associations_5g);
|
||||||
|
field_from_json(Obj,"associations_6g",associations_6g);
|
||||||
|
field_from_json(Obj,"health",health);
|
||||||
|
field_from_json(Obj,"lastHealth",lastHealth);
|
||||||
|
field_from_json(Obj,"locale",locale);
|
||||||
|
field_from_json(Obj,"uptime",uptime);
|
||||||
|
field_from_json(Obj,"memory",memory);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceInfoList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"devices",devices);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceInfoList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"devices",devices);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UE_rate::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"bitrate",bitrate);
|
||||||
|
field_to_json(Obj,"mcs",mcs);
|
||||||
|
field_to_json(Obj,"nss",nss);
|
||||||
|
field_to_json(Obj,"ht",ht);
|
||||||
|
field_to_json(Obj,"sgi",sgi);
|
||||||
|
field_to_json(Obj,"chwidth",chwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UE_rate::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"bitrate",bitrate);
|
||||||
|
field_from_json(Obj,"mcs",mcs);
|
||||||
|
field_from_json(Obj,"nss",nss);
|
||||||
|
field_from_json(Obj,"ht",ht);
|
||||||
|
field_from_json(Obj,"sgi",sgi);
|
||||||
|
field_from_json(Obj,"chwidth",chwidth);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UETimePoint::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"station",station);
|
||||||
|
field_to_json(Obj,"rssi",rssi);
|
||||||
|
field_to_json(Obj,"tx_bytes",tx_bytes);
|
||||||
|
field_to_json(Obj,"rx_bytes",rx_bytes);
|
||||||
|
field_to_json(Obj,"tx_duration",tx_duration);
|
||||||
|
field_to_json(Obj,"rx_packets",rx_packets);
|
||||||
|
field_to_json(Obj,"tx_packets",tx_packets);
|
||||||
|
field_to_json(Obj,"tx_retries",tx_retries);
|
||||||
|
field_to_json(Obj,"tx_failed",tx_failed);
|
||||||
|
field_to_json(Obj,"connected",connected);
|
||||||
|
field_to_json(Obj,"inactive",inactive);
|
||||||
|
field_to_json(Obj,"tx_rate",tx_rate);
|
||||||
|
field_to_json(Obj,"rx_rate",rx_rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UETimePoint::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"station",station);
|
||||||
|
field_from_json(Obj,"rssi",rssi);
|
||||||
|
field_from_json(Obj,"tx_bytes",tx_bytes);
|
||||||
|
field_from_json(Obj,"rx_bytes",rx_bytes);
|
||||||
|
field_from_json(Obj,"tx_duration",tx_duration);
|
||||||
|
field_from_json(Obj,"rx_packets",rx_packets);
|
||||||
|
field_from_json(Obj,"tx_packets",tx_packets);
|
||||||
|
field_from_json(Obj,"tx_retries",tx_retries);
|
||||||
|
field_from_json(Obj,"tx_failed",tx_failed);
|
||||||
|
field_from_json(Obj,"connected",connected);
|
||||||
|
field_from_json(Obj,"inactive",inactive);
|
||||||
|
field_from_json(Obj,"tx_rate",tx_rate);
|
||||||
|
field_from_json(Obj,"rx_rate",rx_rate);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void APTimePoint::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"collisions",collisions);
|
||||||
|
field_to_json(Obj,"multicast",multicast);
|
||||||
|
field_to_json(Obj,"rx_bytes",rx_bytes);
|
||||||
|
field_to_json(Obj,"rx_dropped",rx_dropped);
|
||||||
|
field_to_json(Obj,"rx_errors",rx_errors);
|
||||||
|
field_to_json(Obj,"rx_packets",rx_packets);
|
||||||
|
field_to_json(Obj,"tx_bytes",tx_bytes);
|
||||||
|
field_to_json(Obj,"tx_packets",tx_packets);
|
||||||
|
field_to_json(Obj,"tx_dropped",tx_dropped);
|
||||||
|
field_to_json(Obj,"tx_errors",tx_errors);
|
||||||
|
field_to_json(Obj,"tx_packets",tx_packets);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool APTimePoint::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"collisions",collisions);
|
||||||
|
field_from_json(Obj,"multicast",multicast);
|
||||||
|
field_from_json(Obj,"rx_bytes",rx_bytes);
|
||||||
|
field_from_json(Obj,"rx_dropped",rx_dropped);
|
||||||
|
field_from_json(Obj,"rx_errors",rx_errors);
|
||||||
|
field_from_json(Obj,"rx_packets",rx_packets);
|
||||||
|
field_from_json(Obj,"tx_bytes",tx_bytes);
|
||||||
|
field_from_json(Obj,"tx_packets",tx_packets);
|
||||||
|
field_from_json(Obj,"tx_dropped",tx_dropped);
|
||||||
|
field_from_json(Obj,"tx_errors",tx_errors);
|
||||||
|
field_from_json(Obj,"tx_packets",tx_packets);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TIDstat_entry::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"rx_msdu",rx_msdu);
|
||||||
|
field_to_json(Obj,"tx_msdu",tx_msdu);
|
||||||
|
field_to_json(Obj,"tx_msdu_failed",tx_msdu_failed);
|
||||||
|
field_to_json(Obj,"tx_msdu_retries",tx_msdu_retries);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TIDstat_entry::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"rx_msdu",rx_msdu);
|
||||||
|
field_from_json(Obj,"tx_msdu",tx_msdu);
|
||||||
|
field_from_json(Obj,"tx_msdu_failed",tx_msdu_failed);
|
||||||
|
field_from_json(Obj,"tx_msdu_retries",tx_msdu_retries);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioTimePoint::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"band",band);
|
||||||
|
field_to_json(Obj,"radio_channel",radio_channel);
|
||||||
|
field_to_json(Obj,"active_ms",active_ms);
|
||||||
|
field_to_json(Obj,"busy_ms",busy_ms);
|
||||||
|
field_to_json(Obj,"receive_ms",receive_ms);
|
||||||
|
field_to_json(Obj,"transmit_ms",transmit_ms);
|
||||||
|
field_to_json(Obj,"tx_power",tx_power);
|
||||||
|
field_to_json(Obj,"channel",channel);
|
||||||
|
field_to_json(Obj,"temperature",temperature);
|
||||||
|
field_to_json(Obj,"noise",noise);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadioTimePoint::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"band",band);
|
||||||
|
field_from_json(Obj,"radio_channel",radio_channel);
|
||||||
|
field_from_json(Obj,"active_ms",active_ms);
|
||||||
|
field_from_json(Obj,"busy_ms",busy_ms);
|
||||||
|
field_from_json(Obj,"receive_ms",receive_ms);
|
||||||
|
field_from_json(Obj,"transmit_ms",transmit_ms);
|
||||||
|
field_from_json(Obj,"tx_power",tx_power);
|
||||||
|
field_from_json(Obj,"channel",channel);
|
||||||
|
field_from_json(Obj,"temperature",temperature);
|
||||||
|
field_from_json(Obj,"noise",noise);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SSIDTimePoint::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"bssid",bssid);
|
||||||
|
field_to_json(Obj,"mode",mode);
|
||||||
|
field_to_json(Obj,"ssid",ssid);
|
||||||
|
field_to_json(Obj,"band",band);
|
||||||
|
field_to_json(Obj,"associations",associations);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SSIDTimePoint::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"bssid",bssid);
|
||||||
|
field_from_json(Obj,"mode",mode);
|
||||||
|
field_from_json(Obj,"ssid",ssid);
|
||||||
|
field_from_json(Obj,"band",band);
|
||||||
|
field_from_json(Obj,"associations",associations);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTimePoint::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"id",id);
|
||||||
|
field_to_json(Obj,"boardId",boardId);
|
||||||
|
field_to_json(Obj,"timestamp",timestamp);
|
||||||
|
field_to_json(Obj,"ap_data",ap_data);
|
||||||
|
field_to_json(Obj,"ssid_data",ssid_data);
|
||||||
|
field_to_json(Obj,"radio_data",radio_data);
|
||||||
|
field_to_json(Obj,"device_info",device_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceTimePoint::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"id",id);
|
||||||
|
field_from_json(Obj,"boardId",boardId);
|
||||||
|
field_from_json(Obj,"timestamp",timestamp);
|
||||||
|
field_from_json(Obj,"ap_data",ap_data);
|
||||||
|
field_from_json(Obj,"ssid_data",ssid_data);
|
||||||
|
field_from_json(Obj,"radio_data",radio_data);
|
||||||
|
field_from_json(Obj,"device_info",device_info);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTimePointList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"points",points);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceTimePointList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"points",points);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTimePointStats::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"firstPoint",firstPoint);
|
||||||
|
field_to_json(Obj,"lastPoint",lastPoint);
|
||||||
|
field_to_json(Obj,"count",count);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceTimePointStats::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"firstPoint",firstPoint);
|
||||||
|
field_from_json(Obj,"lastPoint",lastPoint);
|
||||||
|
field_from_json(Obj,"count",count);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
290
src/RESTObjects/RESTAPI_AnalyticsObjects.h
Normal file
290
src/RESTObjects/RESTAPI_AnalyticsObjects.h
Normal file
@@ -0,0 +1,290 @@
|
|||||||
|
//
|
||||||
|
// Created by stephane bourque on 2022-01-10.
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "RESTAPI_ProvObjects.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace OpenWifi {
|
||||||
|
|
||||||
|
namespace AnalyticsObjects {
|
||||||
|
|
||||||
|
struct Report {
|
||||||
|
uint64_t snapShot = 0;
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct VenueInfo {
|
||||||
|
OpenWifi::Types::UUID_t id;
|
||||||
|
std::string name;
|
||||||
|
std::string description;
|
||||||
|
uint64_t retention = 0;
|
||||||
|
uint64_t interval = 0;
|
||||||
|
bool monitorSubVenues = false;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct BoardInfo {
|
||||||
|
ProvObjects::ObjectInfo info;
|
||||||
|
std::vector<VenueInfo> venueList;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
|
||||||
|
inline bool operator<(const BoardInfo &bb) const {
|
||||||
|
return info.id < bb.info.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator==(const BoardInfo &bb) const {
|
||||||
|
return info.id == bb.info.id;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DeviceInfo {
|
||||||
|
std::string boardId;
|
||||||
|
std::string type;
|
||||||
|
std::string serialNumber;
|
||||||
|
std::string deviceType;
|
||||||
|
uint64_t lastContact = 0 ;
|
||||||
|
uint64_t lastPing = 0;
|
||||||
|
uint64_t lastState = 0;
|
||||||
|
std::string lastFirmware;
|
||||||
|
uint64_t lastFirmwareUpdate = 0;
|
||||||
|
uint64_t lastConnection = 0;
|
||||||
|
uint64_t lastDisconnection = 0;
|
||||||
|
uint64_t pings = 0;
|
||||||
|
uint64_t states = 0;
|
||||||
|
bool connected = false;
|
||||||
|
std::string connectionIp;
|
||||||
|
uint64_t associations_2g = 0;
|
||||||
|
uint64_t associations_5g = 0;
|
||||||
|
uint64_t associations_6g = 0;
|
||||||
|
uint64_t health = 0;
|
||||||
|
uint64_t lastHealth = 0;
|
||||||
|
std::string locale;
|
||||||
|
uint64_t uptime = 0;
|
||||||
|
double memory = 0.0;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DeviceInfoList {
|
||||||
|
std::vector<DeviceInfo> devices;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
enum wifi_band {
|
||||||
|
band_2g = 0, band_5g = 1, band_6g = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TIDstat_entry {
|
||||||
|
uint64_t rx_msdu = 0,
|
||||||
|
tx_msdu = 0,
|
||||||
|
tx_msdu_failed = 0,
|
||||||
|
tx_msdu_retries = 0;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct UE_rate {
|
||||||
|
uint64_t bitrate=0;
|
||||||
|
uint64_t mcs=0;
|
||||||
|
uint64_t nss=0;
|
||||||
|
bool ht=false;
|
||||||
|
bool sgi=false;
|
||||||
|
uint64_t chwidth=0;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct UETimePoint {
|
||||||
|
std::string station;
|
||||||
|
int64_t rssi = 0;
|
||||||
|
uint64_t tx_bytes = 0,
|
||||||
|
rx_bytes = 0,
|
||||||
|
tx_duration = 0,
|
||||||
|
rx_packets = 0,
|
||||||
|
tx_packets = 0,
|
||||||
|
tx_retries = 0,
|
||||||
|
tx_failed = 0,
|
||||||
|
connected = 0,
|
||||||
|
inactive = 0;
|
||||||
|
UE_rate tx_rate,
|
||||||
|
rx_rate;
|
||||||
|
std::vector<TIDstat_entry> tidstat;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
enum SSID_MODES {
|
||||||
|
unknown = 0,
|
||||||
|
ap,
|
||||||
|
mesh,
|
||||||
|
sta,
|
||||||
|
wds_ap,
|
||||||
|
wds_sta,
|
||||||
|
wds_repeater
|
||||||
|
};
|
||||||
|
|
||||||
|
inline SSID_MODES SSID_Mode(const std::string &m) {
|
||||||
|
if (m == "ap")
|
||||||
|
return ap;
|
||||||
|
if (m == "sta")
|
||||||
|
return sta;
|
||||||
|
if (m == "mesh")
|
||||||
|
return mesh;
|
||||||
|
if (m == "wds-ap")
|
||||||
|
return wds_ap;
|
||||||
|
if (m == "wds-sta")
|
||||||
|
return wds_sta;
|
||||||
|
if (m == "wds-repeater")
|
||||||
|
return wds_repeater;
|
||||||
|
return unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SSIDTimePoint {
|
||||||
|
std::string bssid,
|
||||||
|
mode,
|
||||||
|
ssid;
|
||||||
|
uint64_t band=0;
|
||||||
|
std::vector<UETimePoint> associations;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct APTimePoint {
|
||||||
|
uint64_t collisions = 0,
|
||||||
|
multicast = 0,
|
||||||
|
rx_bytes = 0,
|
||||||
|
rx_dropped = 0,
|
||||||
|
rx_errors = 0,
|
||||||
|
rx_packets = 0,
|
||||||
|
tx_bytes = 0,
|
||||||
|
tx_dropped = 0,
|
||||||
|
tx_errors = 0,
|
||||||
|
tx_packets = 0;
|
||||||
|
|
||||||
|
double tx_bytes_bw = 0.0 ,
|
||||||
|
rx_bytes_bw = 0.0 ,
|
||||||
|
rx_dropped_pct = 0.0,
|
||||||
|
tx_dropped_pct = 0.0,
|
||||||
|
rx_packets_bw = 0.0,
|
||||||
|
tx_packets_bw = 0.0;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RadioTimePoint {
|
||||||
|
uint64_t band = 0,
|
||||||
|
radio_channel = 0;
|
||||||
|
uint64_t active_ms = 0,
|
||||||
|
busy_ms = 0,
|
||||||
|
receive_ms = 0,
|
||||||
|
transmit_ms = 0,
|
||||||
|
tx_power = 0,
|
||||||
|
channel = 0;
|
||||||
|
int64_t temperature = 0,
|
||||||
|
noise = 0;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct DeviceTimePoint {
|
||||||
|
std::string id;
|
||||||
|
std::string boardId;
|
||||||
|
uint64_t timestamp = 0;
|
||||||
|
APTimePoint ap_data;
|
||||||
|
std::vector<SSIDTimePoint> ssid_data;
|
||||||
|
std::vector<RadioTimePoint> radio_data;
|
||||||
|
AnalyticsObjects::DeviceInfo device_info;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
|
||||||
|
inline bool operator<(const DeviceTimePoint &rhs) const {
|
||||||
|
if(timestamp < rhs.timestamp)
|
||||||
|
return true;
|
||||||
|
if(timestamp > rhs.timestamp)
|
||||||
|
return false;
|
||||||
|
if(device_info.serialNumber < rhs.device_info.serialNumber)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator==(const DeviceTimePoint &rhs) const {
|
||||||
|
return timestamp==rhs.timestamp && device_info.serialNumber==rhs.device_info.serialNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator>(const DeviceTimePoint &rhs) const {
|
||||||
|
if(timestamp > rhs.timestamp)
|
||||||
|
return true;
|
||||||
|
if(timestamp < rhs.timestamp)
|
||||||
|
return false;
|
||||||
|
if(device_info.serialNumber > rhs.device_info.serialNumber)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DeviceTimePointList {
|
||||||
|
std::vector<DeviceTimePoint> points;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct BandwidthAnalysisEntry {
|
||||||
|
uint64_t timestamp = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct BandwidthAnalysis {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AverageValueSigned {
|
||||||
|
int64_t peak=0, avg=0, low=0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AverageValueUnsigned {
|
||||||
|
uint64_t peak=0, avg=0, low=0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RadioAnalysis {
|
||||||
|
uint64_t timestamp=0;
|
||||||
|
AverageValueSigned noise, temperature;
|
||||||
|
AverageValueUnsigned active_ms,
|
||||||
|
busy_ms,
|
||||||
|
transmit_ms,
|
||||||
|
receive_ms;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DeviceTimePointStats {
|
||||||
|
uint64_t firstPoint=0;
|
||||||
|
uint64_t lastPoint=0;
|
||||||
|
uint64_t count=0;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -193,6 +193,91 @@ namespace OpenWifi::ProvObjects {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Operator::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
info.to_json(Obj);
|
||||||
|
field_to_json( Obj,"managementPolicy",managementPolicy);
|
||||||
|
field_to_json( Obj,"managementRoles",managementRoles);
|
||||||
|
field_to_json( Obj,"rrm",rrm);
|
||||||
|
field_to_json( Obj,"firmwareUpgrade",firmwareUpgrade);
|
||||||
|
field_to_json( Obj,"firmwareRCOnly",firmwareRCOnly);
|
||||||
|
field_to_json( Obj,"variables",variables);
|
||||||
|
field_to_json( Obj,"defaultOperator",defaultOperator);
|
||||||
|
field_to_json( Obj,"sourceIP",sourceIP);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Operator::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
info.from_json(Obj);
|
||||||
|
field_from_json( Obj,"managementPolicy",managementPolicy);
|
||||||
|
field_from_json( Obj,"managementRoles",managementRoles);
|
||||||
|
field_from_json( Obj,"rrm",rrm);
|
||||||
|
field_from_json( Obj,"firmwareUpgrade",firmwareUpgrade);
|
||||||
|
field_from_json( Obj,"firmwareRCOnly",firmwareRCOnly);
|
||||||
|
field_from_json( Obj,"variables",variables);
|
||||||
|
field_from_json( Obj,"defaultOperator",defaultOperator);
|
||||||
|
field_from_json( Obj,"sourceIP",sourceIP);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OperatorList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json( Obj,"operators",operators);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OperatorList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json( Obj,"operators",operators);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServiceClass::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
info.to_json(Obj);
|
||||||
|
field_to_json( Obj,"operatorId",operatorId);
|
||||||
|
field_to_json( Obj,"managementPolicy",managementPolicy);
|
||||||
|
field_to_json( Obj,"cost",cost);
|
||||||
|
field_to_json( Obj,"currency",currency);
|
||||||
|
field_to_json( Obj,"period",period);
|
||||||
|
field_to_json( Obj,"billingCode",billingCode);
|
||||||
|
field_to_json( Obj,"variables",variables);
|
||||||
|
field_to_json( Obj,"defaultService",defaultService);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ServiceClass::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
info.from_json(Obj);
|
||||||
|
field_from_json( Obj,"operatorId",operatorId);
|
||||||
|
field_from_json( Obj,"managementPolicy",managementPolicy);
|
||||||
|
field_from_json( Obj,"cost",cost);
|
||||||
|
field_from_json( Obj,"currency",currency);
|
||||||
|
field_from_json( Obj,"period",period);
|
||||||
|
field_from_json( Obj,"billingCode",billingCode);
|
||||||
|
field_from_json( Obj,"variables",variables);
|
||||||
|
field_from_json( Obj,"defaultService",defaultService);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServiceClassList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json( Obj,"serviceClasses",serviceClasses);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ServiceClassList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json( Obj,"serviceClasses",serviceClasses);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void UserInfoDigest::to_json(Poco::JSON::Object &Obj) const {
|
void UserInfoDigest::to_json(Poco::JSON::Object &Obj) const {
|
||||||
field_to_json( Obj,"id",id);
|
field_to_json( Obj,"id",id);
|
||||||
field_to_json( Obj,"entity",loginId);
|
field_to_json( Obj,"entity",loginId);
|
||||||
@@ -273,6 +358,92 @@ namespace OpenWifi::ProvObjects {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OperatorLocation::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
info.to_json(Obj);
|
||||||
|
field_to_json( Obj,"type",type);
|
||||||
|
field_to_json( Obj,"buildingName",buildingName);
|
||||||
|
field_to_json( Obj,"addressLines",addressLines);
|
||||||
|
field_to_json( Obj,"city",city);
|
||||||
|
field_to_json( Obj,"state",state);
|
||||||
|
field_to_json( Obj,"postal",postal);
|
||||||
|
field_to_json( Obj,"country",country);
|
||||||
|
field_to_json( Obj,"phones",phones);
|
||||||
|
field_to_json( Obj,"mobiles",mobiles);
|
||||||
|
field_to_json( Obj,"geoCode",geoCode);
|
||||||
|
field_to_json( Obj,"operatorId",operatorId);
|
||||||
|
field_to_json( Obj,"subscriberDeviceId",subscriberDeviceId);
|
||||||
|
field_to_json( Obj,"managementPolicy",managementPolicy);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OperatorLocation::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
info.from_json(Obj);
|
||||||
|
field_from_json( Obj,"type", type);
|
||||||
|
field_from_json( Obj,"buildingName",buildingName);
|
||||||
|
field_from_json( Obj,"addressLines",addressLines);
|
||||||
|
field_from_json( Obj,"city",city);
|
||||||
|
field_from_json( Obj,"state",state);
|
||||||
|
field_from_json( Obj,"postal",postal);
|
||||||
|
field_from_json( Obj,"country",country);
|
||||||
|
field_from_json( Obj,"phones",phones);
|
||||||
|
field_from_json( Obj,"mobiles",mobiles);
|
||||||
|
field_from_json( Obj,"geoCode",geoCode);
|
||||||
|
field_from_json( Obj,"operatorId",operatorId);
|
||||||
|
field_from_json( Obj,"subscriberDeviceId",subscriberDeviceId);
|
||||||
|
field_from_json( Obj,"managementPolicy",managementPolicy);
|
||||||
|
return true;
|
||||||
|
} catch (...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SubLocation::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json( Obj,"type",type);
|
||||||
|
field_to_json( Obj,"buildingName",buildingName);
|
||||||
|
field_to_json( Obj,"addressLines",addressLines);
|
||||||
|
field_to_json( Obj,"city",city);
|
||||||
|
field_to_json( Obj,"state",state);
|
||||||
|
field_to_json( Obj,"postal",postal);
|
||||||
|
field_to_json( Obj,"country",country);
|
||||||
|
field_to_json( Obj,"phones",phones);
|
||||||
|
field_to_json( Obj,"mobiles",mobiles);
|
||||||
|
field_to_json( Obj,"geoCode",geoCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SubLocation::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json( Obj,"type", type);
|
||||||
|
field_from_json( Obj,"buildingName",buildingName);
|
||||||
|
field_from_json( Obj,"addressLines",addressLines);
|
||||||
|
field_from_json( Obj,"city",city);
|
||||||
|
field_from_json( Obj,"state",state);
|
||||||
|
field_from_json( Obj,"postal",postal);
|
||||||
|
field_from_json( Obj,"country",country);
|
||||||
|
field_from_json( Obj,"phones",phones);
|
||||||
|
field_from_json( Obj,"mobiles",mobiles);
|
||||||
|
field_from_json( Obj,"geoCode",geoCode);
|
||||||
|
return true;
|
||||||
|
} catch (...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OperatorLocationList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json( Obj, "locations", locations);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OperatorLocationList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json( Obj, "locations", locations);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void Contact::to_json(Poco::JSON::Object &Obj) const {
|
void Contact::to_json(Poco::JSON::Object &Obj) const {
|
||||||
info.to_json(Obj);
|
info.to_json(Obj);
|
||||||
field_to_json( Obj,"type", to_string(type));
|
field_to_json( Obj,"type", to_string(type));
|
||||||
@@ -319,6 +490,100 @@ namespace OpenWifi::ProvObjects {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OperatorContact::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
info.to_json(Obj);
|
||||||
|
field_to_json( Obj,"type", type);
|
||||||
|
field_to_json( Obj,"title",title);
|
||||||
|
field_to_json( Obj,"salutation",salutation);
|
||||||
|
field_to_json( Obj,"firstname",firstname);
|
||||||
|
field_to_json( Obj,"lastname",lastname);
|
||||||
|
field_to_json( Obj,"initials",initials);
|
||||||
|
field_to_json( Obj,"visual",visual);
|
||||||
|
field_to_json( Obj,"mobiles",mobiles);
|
||||||
|
field_to_json( Obj,"phones",phones);
|
||||||
|
field_to_json( Obj,"primaryEmail",primaryEmail);
|
||||||
|
field_to_json( Obj,"secondaryEmail",secondaryEmail);
|
||||||
|
field_to_json( Obj,"accessPIN",accessPIN);
|
||||||
|
field_to_json( Obj,"operatorId",operatorId);
|
||||||
|
field_to_json( Obj,"subscriberDeviceId",subscriberDeviceId);
|
||||||
|
field_to_json( Obj,"managementPolicy",managementPolicy);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OperatorContact::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
info.from_json(Obj);
|
||||||
|
field_from_json( Obj,"type", type);
|
||||||
|
field_from_json( Obj,"title",title);
|
||||||
|
field_from_json( Obj,"salutation",salutation);
|
||||||
|
field_from_json( Obj,"firstname",firstname);
|
||||||
|
field_from_json( Obj,"lastname",lastname);
|
||||||
|
field_from_json( Obj,"initials",initials);
|
||||||
|
field_from_json( Obj,"visual",visual);
|
||||||
|
field_from_json( Obj,"mobiles",mobiles);
|
||||||
|
field_from_json( Obj,"phones",phones);
|
||||||
|
field_from_json( Obj,"primaryEmail",primaryEmail);
|
||||||
|
field_from_json( Obj,"secondaryEmail",secondaryEmail);
|
||||||
|
field_from_json( Obj,"accessPIN",accessPIN);
|
||||||
|
field_from_json( Obj,"operatorId",operatorId);
|
||||||
|
field_from_json( Obj,"subscriberDeviceId",subscriberDeviceId);
|
||||||
|
field_from_json( Obj,"managementPolicy",managementPolicy);
|
||||||
|
return true;
|
||||||
|
} catch (...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SubContact::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json( Obj,"type", type);
|
||||||
|
field_to_json( Obj,"title",title);
|
||||||
|
field_to_json( Obj,"salutation",salutation);
|
||||||
|
field_to_json( Obj,"firstname",firstname);
|
||||||
|
field_to_json( Obj,"lastname",lastname);
|
||||||
|
field_to_json( Obj,"initials",initials);
|
||||||
|
field_to_json( Obj,"visual",visual);
|
||||||
|
field_to_json( Obj,"mobiles",mobiles);
|
||||||
|
field_to_json( Obj,"phones",phones);
|
||||||
|
field_to_json( Obj,"primaryEmail",primaryEmail);
|
||||||
|
field_to_json( Obj,"secondaryEmail",secondaryEmail);
|
||||||
|
field_to_json( Obj,"accessPIN",accessPIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SubContact::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json( Obj,"type", type);
|
||||||
|
field_from_json( Obj,"title",title);
|
||||||
|
field_from_json( Obj,"salutation",salutation);
|
||||||
|
field_from_json( Obj,"firstname",firstname);
|
||||||
|
field_from_json( Obj,"lastname",lastname);
|
||||||
|
field_from_json( Obj,"initials",initials);
|
||||||
|
field_from_json( Obj,"visual",visual);
|
||||||
|
field_from_json( Obj,"mobiles",mobiles);
|
||||||
|
field_from_json( Obj,"phones",phones);
|
||||||
|
field_from_json( Obj,"primaryEmail",primaryEmail);
|
||||||
|
field_from_json( Obj,"secondaryEmail",secondaryEmail);
|
||||||
|
field_from_json( Obj,"accessPIN",accessPIN);
|
||||||
|
return true;
|
||||||
|
} catch (...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OperatorContactList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json( Obj, "contacts", contacts);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OperatorContactList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json( Obj, "contacts", contacts);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void InventoryTag::to_json(Poco::JSON::Object &Obj) const {
|
void InventoryTag::to_json(Poco::JSON::Object &Obj) const {
|
||||||
info.to_json(Obj);
|
info.to_json(Obj);
|
||||||
field_to_json( Obj, "serialNumber", serialNumber);
|
field_to_json( Obj, "serialNumber", serialNumber);
|
||||||
@@ -528,46 +793,16 @@ namespace OpenWifi::ProvObjects {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void field_to_json(Poco::JSON::Object &Obj, const char * FieldName, ACLACCESS A) {
|
|
||||||
switch(A) {
|
|
||||||
case READ: Obj.set(FieldName,"read"); break;
|
|
||||||
case MODIFY: Obj.set(FieldName,"modify"); break;
|
|
||||||
case CREATE: Obj.set(FieldName,"create"); break;
|
|
||||||
case DELETE: Obj.set(FieldName,"delete"); break;
|
|
||||||
case NONE:
|
|
||||||
default:
|
|
||||||
Obj.set(FieldName,"none");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void field_from_json(const Poco::JSON::Object::Ptr &Obj, const char * FieldName, ACLACCESS &A) {
|
|
||||||
if(Obj->has(FieldName)) {
|
|
||||||
auto V = Obj->getValue<std::string>(FieldName);
|
|
||||||
if(V=="read")
|
|
||||||
A = READ;
|
|
||||||
else if(V=="modify")
|
|
||||||
A = MODIFY;
|
|
||||||
else if(V=="create")
|
|
||||||
A = CREATE;
|
|
||||||
else if(V=="delete")
|
|
||||||
A = DELETE;
|
|
||||||
else if(V=="none")
|
|
||||||
A = NONE;
|
|
||||||
else
|
|
||||||
throw Poco::Exception("invalid JSON");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectACL::to_json(Poco::JSON::Object &Obj) const {
|
void ObjectACL::to_json(Poco::JSON::Object &Obj) const {
|
||||||
RESTAPI_utils::field_to_json(Obj, "users", users);
|
field_to_json(Obj, "users", users);
|
||||||
RESTAPI_utils::field_to_json(Obj, "roles", roles);
|
field_to_json(Obj, "roles", roles);
|
||||||
field_to_json(Obj, "access", access);
|
field_to_json(Obj, "access", access);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectACL::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool ObjectACL::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
RESTAPI_utils::field_from_json(Obj, "users", users);
|
field_from_json(Obj, "users", users);
|
||||||
RESTAPI_utils::field_from_json(Obj, "roles", roles);
|
field_from_json(Obj, "roles", roles);
|
||||||
field_from_json(Obj, "access", access);
|
field_from_json(Obj, "access", access);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
@@ -577,12 +812,12 @@ namespace OpenWifi::ProvObjects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ObjectACLList::to_json(Poco::JSON::Object &Obj) const {
|
void ObjectACLList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
RESTAPI_utils::field_to_json(Obj, "list", list);
|
field_to_json(Obj, "list", list);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectACLList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool ObjectACLList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
RESTAPI_utils::field_from_json(Obj, "list", list);
|
field_from_json(Obj, "list", list);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
@@ -590,46 +825,15 @@ namespace OpenWifi::ProvObjects {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string to_string(VISIBILITY A) {
|
|
||||||
switch(A) {
|
|
||||||
case PUBLIC: return "public";
|
|
||||||
case SELECT: return "select";
|
|
||||||
case PRIVATE:
|
|
||||||
default:
|
|
||||||
return "private";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void field_to_json(Poco::JSON::Object &Obj, const char * FieldName, VISIBILITY A) {
|
|
||||||
Obj.set(FieldName,to_string(A));
|
|
||||||
}
|
|
||||||
|
|
||||||
VISIBILITY visibility_from_string(const std::string &V) {
|
|
||||||
if(V=="public")
|
|
||||||
return PUBLIC;
|
|
||||||
else if(V=="select")
|
|
||||||
return SELECT;
|
|
||||||
else if(V=="private")
|
|
||||||
return PRIVATE;
|
|
||||||
throw Poco::Exception("invalid json");
|
|
||||||
}
|
|
||||||
|
|
||||||
void field_from_json(const Poco::JSON::Object::Ptr &Obj, const char * FieldName, VISIBILITY &A) {
|
|
||||||
if(Obj->has(FieldName)) {
|
|
||||||
auto V = Obj->getValue<std::string>(FieldName);
|
|
||||||
A = visibility_from_string(V);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Map::to_json(Poco::JSON::Object &Obj) const {
|
void Map::to_json(Poco::JSON::Object &Obj) const {
|
||||||
info.to_json(Obj);
|
info.to_json(Obj);
|
||||||
RESTAPI_utils::field_to_json( Obj,"data",data);
|
field_to_json( Obj,"data",data);
|
||||||
RESTAPI_utils::field_to_json( Obj,"entity",entity);
|
field_to_json( Obj,"entity",entity);
|
||||||
RESTAPI_utils::field_to_json( Obj,"creator",creator);
|
field_to_json( Obj,"creator",creator);
|
||||||
RESTAPI_utils::field_to_json( Obj,"visibility",visibility);
|
field_to_json( Obj,"visibility",visibility);
|
||||||
RESTAPI_utils::field_to_json( Obj,"access",access);
|
field_to_json( Obj,"access",access);
|
||||||
RESTAPI_utils::field_to_json( Obj,"managementPolicy", managementPolicy);
|
field_to_json( Obj,"managementPolicy", managementPolicy);
|
||||||
RESTAPI_utils::field_to_json( Obj,"venue", venue);
|
field_to_json( Obj,"venue", venue);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Map::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool Map::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
@@ -649,6 +853,20 @@ namespace OpenWifi::ProvObjects {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SerialNumberList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
RESTAPI_utils::field_to_json( Obj,"serialNumbers",serialNumbers);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SerialNumberList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
RESTAPI_utils::field_from_json( Obj,"serialNumbers",serialNumbers);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void MapList::to_json(Poco::JSON::Object &Obj) const {
|
void MapList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
RESTAPI_utils::field_to_json( Obj,"list",list);
|
RESTAPI_utils::field_to_json( Obj,"list",list);
|
||||||
}
|
}
|
||||||
@@ -665,31 +883,31 @@ namespace OpenWifi::ProvObjects {
|
|||||||
|
|
||||||
void SignupEntry::to_json(Poco::JSON::Object &Obj) const {
|
void SignupEntry::to_json(Poco::JSON::Object &Obj) const {
|
||||||
info.to_json(Obj);
|
info.to_json(Obj);
|
||||||
RESTAPI_utils::field_to_json( Obj,"email", email);
|
field_to_json( Obj,"email", email);
|
||||||
RESTAPI_utils::field_to_json( Obj,"userId", userId);
|
field_to_json( Obj,"userId", userId);
|
||||||
RESTAPI_utils::field_to_json( Obj,"macAddress", macAddress);
|
field_to_json( Obj,"macAddress", macAddress);
|
||||||
RESTAPI_utils::field_to_json( Obj,"serialNumber", serialNumber);
|
field_to_json( Obj,"serialNumber", serialNumber);
|
||||||
RESTAPI_utils::field_to_json( Obj,"submitted", submitted);
|
field_to_json( Obj,"submitted", submitted);
|
||||||
RESTAPI_utils::field_to_json( Obj,"completed", completed);
|
field_to_json( Obj,"completed", completed);
|
||||||
RESTAPI_utils::field_to_json( Obj,"status", status);
|
field_to_json( Obj,"status", status);
|
||||||
RESTAPI_utils::field_to_json( Obj,"error", error);
|
field_to_json( Obj,"error", error);
|
||||||
RESTAPI_utils::field_to_json( Obj,"statusCode", statusCode);
|
field_to_json( Obj,"statusCode", statusCode);
|
||||||
RESTAPI_utils::field_to_json( Obj,"deviceID", deviceID);
|
field_to_json( Obj,"deviceID", deviceID);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SignupEntry::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool SignupEntry::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
info.from_json(Obj);
|
info.from_json(Obj);
|
||||||
RESTAPI_utils::field_from_json( Obj,"email", email);
|
field_from_json( Obj,"email", email);
|
||||||
RESTAPI_utils::field_from_json( Obj,"userId", userId);
|
field_from_json( Obj,"userId", userId);
|
||||||
RESTAPI_utils::field_from_json( Obj,"macAddress", macAddress);
|
field_from_json( Obj,"macAddress", macAddress);
|
||||||
RESTAPI_utils::field_from_json( Obj,"serialNumber", serialNumber);
|
field_from_json( Obj,"serialNumber", serialNumber);
|
||||||
RESTAPI_utils::field_from_json( Obj,"submitted", submitted);
|
field_from_json( Obj,"submitted", submitted);
|
||||||
RESTAPI_utils::field_from_json( Obj,"completed", completed);
|
field_from_json( Obj,"completed", completed);
|
||||||
RESTAPI_utils::field_from_json( Obj,"status", status);
|
field_from_json( Obj,"status", status);
|
||||||
RESTAPI_utils::field_from_json( Obj,"error", error);
|
field_from_json( Obj,"error", error);
|
||||||
RESTAPI_utils::field_from_json( Obj,"statusCode", statusCode);
|
field_from_json( Obj,"statusCode", statusCode);
|
||||||
RESTAPI_utils::field_from_json( Obj,"deviceID", deviceID);
|
field_from_json( Obj,"deviceID", deviceID);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
@@ -698,18 +916,18 @@ namespace OpenWifi::ProvObjects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Variable::to_json(Poco::JSON::Object &Obj) const {
|
void Variable::to_json(Poco::JSON::Object &Obj) const {
|
||||||
RESTAPI_utils::field_to_json( Obj,"type", type);
|
field_to_json( Obj,"type", type);
|
||||||
RESTAPI_utils::field_to_json( Obj,"weight", weight);
|
field_to_json( Obj,"weight", weight);
|
||||||
RESTAPI_utils::field_to_json( Obj,"prefix", prefix);
|
field_to_json( Obj,"prefix", prefix);
|
||||||
RESTAPI_utils::field_to_json( Obj,"value", value);
|
field_to_json( Obj,"value", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Variable::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool Variable::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
RESTAPI_utils::field_from_json( Obj,"type", type);
|
field_from_json( Obj,"type", type);
|
||||||
RESTAPI_utils::field_from_json( Obj,"weight", weight);
|
field_from_json( Obj,"weight", weight);
|
||||||
RESTAPI_utils::field_from_json( Obj,"prefix", prefix);
|
field_from_json( Obj,"prefix", prefix);
|
||||||
RESTAPI_utils::field_from_json( Obj,"value", value);
|
field_from_json( Obj,"value", value);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
@@ -718,12 +936,12 @@ namespace OpenWifi::ProvObjects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void VariableList::to_json(Poco::JSON::Object &Obj) const {
|
void VariableList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
RESTAPI_utils::field_to_json( Obj,"variables", variables);
|
field_to_json( Obj,"variables", variables);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VariableList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool VariableList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
RESTAPI_utils::field_from_json( Obj,"variables", variables);
|
field_from_json( Obj,"variables", variables);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
@@ -733,25 +951,25 @@ namespace OpenWifi::ProvObjects {
|
|||||||
|
|
||||||
void VariableBlock::to_json(Poco::JSON::Object &Obj) const {
|
void VariableBlock::to_json(Poco::JSON::Object &Obj) const {
|
||||||
info.to_json(Obj);
|
info.to_json(Obj);
|
||||||
RESTAPI_utils::field_to_json( Obj,"variables", variables);
|
field_to_json( Obj,"variables", variables);
|
||||||
RESTAPI_utils::field_to_json( Obj,"entity", entity);
|
field_to_json( Obj,"entity", entity);
|
||||||
RESTAPI_utils::field_to_json( Obj,"venue", venue);
|
field_to_json( Obj,"venue", venue);
|
||||||
RESTAPI_utils::field_to_json( Obj,"subscriber", subscriber);
|
field_to_json( Obj,"subscriber", subscriber);
|
||||||
RESTAPI_utils::field_to_json( Obj,"inventory", inventory);
|
field_to_json( Obj,"inventory", inventory);
|
||||||
RESTAPI_utils::field_to_json( Obj,"configurations", configurations);
|
field_to_json( Obj,"configurations", configurations);
|
||||||
RESTAPI_utils::field_to_json( Obj,"managementPolicy", managementPolicy);
|
field_to_json( Obj,"managementPolicy", managementPolicy);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VariableBlock::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool VariableBlock::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
info.from_json(Obj);
|
info.from_json(Obj);
|
||||||
RESTAPI_utils::field_from_json( Obj,"variables", variables);
|
field_from_json( Obj,"variables", variables);
|
||||||
RESTAPI_utils::field_from_json( Obj,"entity", entity);
|
field_from_json( Obj,"entity", entity);
|
||||||
RESTAPI_utils::field_from_json( Obj,"venue", venue);
|
field_from_json( Obj,"venue", venue);
|
||||||
RESTAPI_utils::field_from_json( Obj,"subscriber", subscriber);
|
field_from_json( Obj,"subscriber", subscriber);
|
||||||
RESTAPI_utils::field_from_json( Obj,"inventory", inventory);
|
field_from_json( Obj,"inventory", inventory);
|
||||||
RESTAPI_utils::field_from_json( Obj,"configurations", configurations);
|
field_from_json( Obj,"configurations", configurations);
|
||||||
RESTAPI_utils::field_from_json( Obj,"managementPolicy", managementPolicy);
|
field_from_json( Obj,"managementPolicy", managementPolicy);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
}
|
}
|
||||||
@@ -759,12 +977,74 @@ namespace OpenWifi::ProvObjects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void VariableBlockList::to_json(Poco::JSON::Object &Obj) const {
|
void VariableBlockList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
RESTAPI_utils::field_to_json( Obj,"variableBlocks", variableBlocks);
|
field_to_json( Obj,"variableBlocks", variableBlocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VariableBlockList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool VariableBlockList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
RESTAPI_utils::field_from_json( Obj,"variableBlocks", variableBlocks);
|
field_from_json( Obj,"variableBlocks", variableBlocks);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SubscriberDevice::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
info.to_json(Obj);
|
||||||
|
field_to_json( Obj,"serialNumber", serialNumber);
|
||||||
|
field_to_json( Obj,"deviceType", deviceType);
|
||||||
|
field_to_json( Obj,"operatorId", operatorId);
|
||||||
|
field_to_json( Obj,"subscriberId", subscriberId);
|
||||||
|
field_to_json( Obj,"location", location);
|
||||||
|
field_to_json( Obj,"contact", contact);
|
||||||
|
field_to_json( Obj,"managementPolicy", managementPolicy);
|
||||||
|
field_to_json( Obj,"serviceClass", serviceClass);
|
||||||
|
field_to_json( Obj,"qrCode", qrCode);
|
||||||
|
field_to_json( Obj,"geoCode", geoCode);
|
||||||
|
field_to_json( Obj,"rrm", rrm);
|
||||||
|
field_to_json( Obj,"state", state);
|
||||||
|
field_to_json( Obj,"locale", locale);
|
||||||
|
field_to_json( Obj,"billingCode", billingCode);
|
||||||
|
field_to_json( Obj,"configuration", configuration);
|
||||||
|
field_to_json( Obj,"suspended", suspended);
|
||||||
|
field_to_json( Obj,"realMacAddress", realMacAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SubscriberDevice::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
info.from_json(Obj);
|
||||||
|
field_from_json( Obj,"serialNumber", serialNumber);
|
||||||
|
field_from_json( Obj,"deviceType", deviceType);
|
||||||
|
field_from_json( Obj,"operatorId", operatorId);
|
||||||
|
field_from_json( Obj,"subscriberId", subscriberId);
|
||||||
|
field_from_json( Obj,"location", location);
|
||||||
|
field_from_json( Obj,"contact", contact);
|
||||||
|
field_from_json( Obj,"managementPolicy", managementPolicy);
|
||||||
|
field_from_json( Obj,"serviceClass", serviceClass);
|
||||||
|
field_from_json( Obj,"qrCode", qrCode);
|
||||||
|
field_from_json( Obj,"geoCode", geoCode);
|
||||||
|
field_from_json( Obj,"rrm", rrm);
|
||||||
|
field_from_json( Obj,"state", state);
|
||||||
|
field_from_json( Obj,"locale", locale);
|
||||||
|
field_from_json( Obj,"billingCode", billingCode);
|
||||||
|
field_from_json( Obj,"configuration", configuration);
|
||||||
|
field_from_json( Obj,"suspended", suspended);
|
||||||
|
field_from_json( Obj,"realMacAddress", realMacAddress);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SubscriberDeviceList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json( Obj,"subscriberDevices", subscriberDevices);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SubscriberDeviceList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json( Obj,"subscriberDevices", subscriberDevices);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
@@ -773,18 +1053,18 @@ namespace OpenWifi::ProvObjects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void VenueDeviceList::to_json(Poco::JSON::Object &Obj) const {
|
void VenueDeviceList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
RESTAPI_utils::field_to_json(Obj,"id",id);
|
field_to_json(Obj,"id",id);
|
||||||
RESTAPI_utils::field_to_json(Obj,"name",name);
|
field_to_json(Obj,"name",name);
|
||||||
RESTAPI_utils::field_to_json(Obj,"description",description);
|
field_to_json(Obj,"description",description);
|
||||||
RESTAPI_utils::field_to_json(Obj,"devices",devices);
|
field_to_json(Obj,"devices",devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VenueDeviceList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool VenueDeviceList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
RESTAPI_utils::field_from_json(Obj,"id",id);
|
field_from_json(Obj,"id",id);
|
||||||
RESTAPI_utils::field_from_json(Obj,"name",name);
|
field_from_json(Obj,"name",name);
|
||||||
RESTAPI_utils::field_from_json(Obj,"description",description);
|
field_from_json(Obj,"description",description);
|
||||||
RESTAPI_utils::field_from_json(Obj,"devices",devices);
|
field_from_json(Obj,"devices",devices);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
@@ -843,5 +1123,47 @@ namespace OpenWifi::ProvObjects {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebSocketNotificationContent::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"title",title);
|
||||||
|
field_to_json(Obj,"type",type);
|
||||||
|
field_to_json(Obj,"success",success);
|
||||||
|
field_to_json(Obj,"errors",errors);
|
||||||
|
field_to_json(Obj,"warnings",warnings);
|
||||||
|
field_to_json(Obj,"timeStamp",timeStamp);
|
||||||
|
field_to_json(Obj,"details",details);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WebSocketNotificationContent::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"title",title);
|
||||||
|
field_from_json(Obj,"type",type);
|
||||||
|
field_from_json(Obj,"success",success);
|
||||||
|
field_from_json(Obj,"errors",errors);
|
||||||
|
field_from_json(Obj,"warnings",warnings);
|
||||||
|
field_from_json(Obj,"timeStamp",timeStamp);
|
||||||
|
field_from_json(Obj,"details",details);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebSocketNotification::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"notification_id",notification_id);
|
||||||
|
field_to_json(Obj,"content",content);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WebSocketNotification::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"notification_id",notification_id);
|
||||||
|
field_from_json(Obj,"content",content);
|
||||||
|
return true;
|
||||||
|
} catch(...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,13 @@ namespace OpenWifi::ProvObjects {
|
|||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct SerialNumberList {
|
||||||
|
Types::UUIDvec_t serialNumbers;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
struct ManagementPolicyEntry {
|
struct ManagementPolicyEntry {
|
||||||
Types::UUIDvec_t users;
|
Types::UUIDvec_t users;
|
||||||
Types::UUIDvec_t resources;
|
Types::UUIDvec_t resources;
|
||||||
@@ -193,6 +200,51 @@ namespace OpenWifi::ProvObjects {
|
|||||||
};
|
};
|
||||||
typedef std::vector<Location> LocationVec;
|
typedef std::vector<Location> LocationVec;
|
||||||
|
|
||||||
|
struct OperatorLocation {
|
||||||
|
ObjectInfo info;
|
||||||
|
std::string type;
|
||||||
|
std::string buildingName;
|
||||||
|
Types::StringVec addressLines;
|
||||||
|
std::string city;
|
||||||
|
std::string state;
|
||||||
|
std::string postal;
|
||||||
|
std::string country;
|
||||||
|
Types::StringVec phones;
|
||||||
|
Types::StringVec mobiles;
|
||||||
|
std::string geoCode;
|
||||||
|
Types::UUID_t operatorId;
|
||||||
|
Types::UUID_t subscriberDeviceId;
|
||||||
|
Types::UUID_t managementPolicy;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
typedef std::vector<Location> LocationVec;
|
||||||
|
|
||||||
|
struct SubLocation {
|
||||||
|
std::string type;
|
||||||
|
std::string buildingName;
|
||||||
|
Types::StringVec addressLines;
|
||||||
|
std::string city;
|
||||||
|
std::string state;
|
||||||
|
std::string postal;
|
||||||
|
std::string country;
|
||||||
|
Types::StringVec phones;
|
||||||
|
Types::StringVec mobiles;
|
||||||
|
std::string geoCode;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct OperatorLocationList {
|
||||||
|
std::vector<OperatorLocation> locations;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
enum ContactType {
|
enum ContactType {
|
||||||
CT_SUBSCRIBER, CT_USER, CT_INSTALLER, CT_CSR, CT_MANAGER,
|
CT_SUBSCRIBER, CT_USER, CT_INSTALLER, CT_CSR, CT_MANAGER,
|
||||||
CT_BUSINESSOWNER, CT_TECHNICIAN, CT_CORPORATE, CT_UNKNOWN
|
CT_BUSINESSOWNER, CT_TECHNICIAN, CT_CORPORATE, CT_UNKNOWN
|
||||||
@@ -256,6 +308,55 @@ namespace OpenWifi::ProvObjects {
|
|||||||
};
|
};
|
||||||
typedef std::vector<Contact> ContactVec;
|
typedef std::vector<Contact> ContactVec;
|
||||||
|
|
||||||
|
struct OperatorContact {
|
||||||
|
ObjectInfo info;
|
||||||
|
std::string type;
|
||||||
|
std::string title;
|
||||||
|
std::string salutation;
|
||||||
|
std::string firstname;
|
||||||
|
std::string lastname;
|
||||||
|
std::string initials;
|
||||||
|
std::string visual;
|
||||||
|
Types::StringVec mobiles;
|
||||||
|
Types::StringVec phones;
|
||||||
|
std::string primaryEmail;
|
||||||
|
std::string secondaryEmail;
|
||||||
|
std::string accessPIN;
|
||||||
|
Types::UUID_t operatorId;
|
||||||
|
Types::UUID_t subscriberDeviceId;
|
||||||
|
Types::UUID_t managementPolicy;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SubContact {
|
||||||
|
std::string type;
|
||||||
|
std::string title;
|
||||||
|
std::string salutation;
|
||||||
|
std::string firstname;
|
||||||
|
std::string lastname;
|
||||||
|
std::string initials;
|
||||||
|
std::string visual;
|
||||||
|
Types::StringVec mobiles;
|
||||||
|
Types::StringVec phones;
|
||||||
|
std::string primaryEmail;
|
||||||
|
std::string secondaryEmail;
|
||||||
|
std::string accessPIN;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct OperatorContactList {
|
||||||
|
std::vector<OperatorContact> contacts;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::vector<OperatorContact> OperatorContactVec;
|
||||||
|
|
||||||
struct DeviceConfigurationElement {
|
struct DeviceConfigurationElement {
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string description;
|
std::string description;
|
||||||
@@ -268,7 +369,7 @@ namespace OpenWifi::ProvObjects {
|
|||||||
typedef std::vector<DeviceConfigurationElement> DeviceConfigurationElementVec;
|
typedef std::vector<DeviceConfigurationElement> DeviceConfigurationElementVec;
|
||||||
|
|
||||||
struct DeviceConfiguration {
|
struct DeviceConfiguration {
|
||||||
ObjectInfo info;
|
ObjectInfo info;
|
||||||
Types::UUID_t managementPolicy;
|
Types::UUID_t managementPolicy;
|
||||||
Types::StringVec deviceTypes;
|
Types::StringVec deviceTypes;
|
||||||
DeviceConfigurationElementVec configuration;
|
DeviceConfigurationElementVec configuration;
|
||||||
@@ -287,6 +388,7 @@ namespace OpenWifi::ProvObjects {
|
|||||||
};
|
};
|
||||||
typedef std::vector<DeviceConfiguration> DeviceConfigurationVec;
|
typedef std::vector<DeviceConfiguration> DeviceConfigurationVec;
|
||||||
|
|
||||||
|
|
||||||
struct InventoryTag {
|
struct InventoryTag {
|
||||||
ObjectInfo info;
|
ObjectInfo info;
|
||||||
std::string serialNumber;
|
std::string serialNumber;
|
||||||
@@ -362,20 +464,20 @@ namespace OpenWifi::ProvObjects {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct UuidList {
|
struct UuidList {
|
||||||
std::vector<std::string> 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, READ, MODIFY, CREATE, DELETE
|
NONE = 0, READ=1, MODIFY=2, CREATE=3, DELETE=4
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ObjectACL {
|
struct ObjectACL {
|
||||||
UuidList users;
|
UuidList users;
|
||||||
UuidList roles;
|
UuidList roles;
|
||||||
ACLACCESS access = 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);
|
||||||
@@ -388,13 +490,6 @@ namespace OpenWifi::ProvObjects {
|
|||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
enum VISIBILITY {
|
|
||||||
PUBLIC, PRIVATE, SELECT
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string to_string(VISIBILITY A);
|
|
||||||
VISIBILITY visibility_from_string(const std::string &V);
|
|
||||||
|
|
||||||
struct Map {
|
struct Map {
|
||||||
ObjectInfo info;
|
ObjectInfo info;
|
||||||
std::string data;
|
std::string data;
|
||||||
@@ -481,6 +576,28 @@ namespace OpenWifi::ProvObjects {
|
|||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Operator {
|
||||||
|
ObjectInfo info;
|
||||||
|
Types::UUID_t managementPolicy;
|
||||||
|
Types::UUIDvec_t managementRoles;
|
||||||
|
std::string rrm;
|
||||||
|
std::string firmwareUpgrade;
|
||||||
|
bool firmwareRCOnly=true;
|
||||||
|
std::vector<Variable> variables;
|
||||||
|
bool defaultOperator=false;
|
||||||
|
Types::StringVec sourceIP;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct OperatorList {
|
||||||
|
std::vector<Operator> operators;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
struct VenueDeviceList {
|
struct VenueDeviceList {
|
||||||
std::string id;
|
std::string id;
|
||||||
std::string name;
|
std::string name;
|
||||||
@@ -491,6 +608,80 @@ namespace OpenWifi::ProvObjects {
|
|||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ServiceClass {
|
||||||
|
ObjectInfo info;
|
||||||
|
Types::UUID_t operatorId;
|
||||||
|
Types::UUID_t managementPolicy;
|
||||||
|
double cost=0.0;
|
||||||
|
std::string currency;
|
||||||
|
std::string period;
|
||||||
|
std::string billingCode;
|
||||||
|
std::vector<Variable> variables;
|
||||||
|
bool defaultService=false;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ServiceClassList {
|
||||||
|
std::vector<ServiceClass> serviceClasses;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SubscriberDevice {
|
||||||
|
ObjectInfo info;
|
||||||
|
std::string serialNumber;
|
||||||
|
std::string deviceType;
|
||||||
|
Types::UUID_t operatorId;
|
||||||
|
Types::UUID_t subscriberId;
|
||||||
|
SubLocation location;
|
||||||
|
SubContact contact;
|
||||||
|
Types::UUID_t managementPolicy;
|
||||||
|
Types::UUID_t serviceClass;
|
||||||
|
std::string qrCode;
|
||||||
|
std::string geoCode;
|
||||||
|
std::string rrm;
|
||||||
|
std::string state;
|
||||||
|
std::string locale;
|
||||||
|
std::string billingCode;
|
||||||
|
DeviceConfigurationElementVec configuration;
|
||||||
|
bool suspended=false;
|
||||||
|
std::string realMacAddress;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SubscriberDeviceList {
|
||||||
|
std::vector<SubscriberDevice> subscriberDevices;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct WebSocketNotificationContent {
|
||||||
|
std::string title,
|
||||||
|
type,
|
||||||
|
details;
|
||||||
|
std::vector<std::string> success,
|
||||||
|
errors,
|
||||||
|
warnings;
|
||||||
|
uint64_t timeStamp=std::time(nullptr);
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct WebSocketNotification {
|
||||||
|
inline static uint64_t xid=1;
|
||||||
|
uint64_t notification_id=++xid;
|
||||||
|
WebSocketNotificationContent content;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
bool UpdateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U, ObjectInfo &I);
|
bool UpdateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U, ObjectInfo &I);
|
||||||
bool CreateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U, ObjectInfo &I);
|
bool CreateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U, ObjectInfo &I);
|
||||||
|
|||||||
@@ -1994,6 +1994,14 @@ namespace OpenWifi {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T> bool AssignIfPresent(const Poco::JSON::Object::Ptr &O, const std::string &Field, const T &value, T & assignee) {
|
||||||
|
if(O->has(Field)) {
|
||||||
|
assignee = value;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
inline void AddCORS() {
|
inline void AddCORS() {
|
||||||
auto Origin = Request->find("Origin");
|
auto Origin = Request->find("Origin");
|
||||||
if (Origin != Request->end()) {
|
if (Origin != Request->end()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user