mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-11-02 19:57:46 +00:00
Framework update.
This commit is contained in:
@@ -272,5 +272,100 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_to_json(Obj,"capabilities", capabilities);
|
field_to_json(Obj,"capabilities", capabilities);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void ScriptRequest::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"serialNumber",serialNumber);
|
||||||
|
field_to_json(Obj,"timeout",timeout);
|
||||||
|
field_to_json(Obj,"type",type);
|
||||||
|
field_to_json(Obj,"script",script);
|
||||||
|
field_to_json(Obj,"scriptId",scriptId);
|
||||||
|
field_to_json(Obj,"when",when);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ScriptRequest::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"serialNumber",serialNumber);
|
||||||
|
field_from_json(Obj,"timeout",timeout);
|
||||||
|
field_from_json(Obj,"type",type);
|
||||||
|
field_from_json(Obj,"script",script);
|
||||||
|
field_from_json(Obj,"scriptId",scriptId);
|
||||||
|
field_from_json(Obj,"when",when);
|
||||||
|
return true;
|
||||||
|
} catch (const Poco::Exception &E) {
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiusProxyPoolList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"pools",pools);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadiusProxyPoolList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"pools",pools);
|
||||||
|
return true;
|
||||||
|
} catch (const Poco::Exception &E) {
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiusProxyPool::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"name",name);
|
||||||
|
field_to_json(Obj,"description",description);
|
||||||
|
field_to_json(Obj,"authConfig",authConfig);
|
||||||
|
field_to_json(Obj,"acctConfig",acctConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadiusProxyPool::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"name",name);
|
||||||
|
field_from_json(Obj,"description",description);
|
||||||
|
field_from_json(Obj,"authConfig",authConfig);
|
||||||
|
field_from_json(Obj,"acctConfig",acctConfig);
|
||||||
|
return true;
|
||||||
|
} catch (const Poco::Exception &E) {
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiusProxyServerConfig::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"policy",strategy);
|
||||||
|
field_to_json(Obj,"monitor",monitor);
|
||||||
|
field_to_json(Obj,"monitorMethod",monitorMethod);
|
||||||
|
field_to_json(Obj,"methodParameters",methodParameters);
|
||||||
|
field_to_json(Obj,"servers",servers);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadiusProxyServerConfig::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"policy",strategy);
|
||||||
|
field_from_json(Obj,"monitor",monitor);
|
||||||
|
field_from_json(Obj,"monitorMethod",monitorMethod);
|
||||||
|
field_from_json(Obj,"methodParameters",methodParameters);
|
||||||
|
field_from_json(Obj,"servers",servers);
|
||||||
|
return true;
|
||||||
|
} catch (const Poco::Exception &E) {
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiusProxyServerEntry::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj,"name",name);
|
||||||
|
field_to_json(Obj,"ip",ip);
|
||||||
|
field_to_json(Obj,"port",port);
|
||||||
|
field_to_json(Obj,"weight",weight);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadiusProxyServerEntry::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj,"name",name);
|
||||||
|
field_from_json(Obj,"ip",ip);
|
||||||
|
field_from_json(Obj,"port",port);
|
||||||
|
field_from_json(Obj,"weight",weight);
|
||||||
|
return true;
|
||||||
|
} catch (const Poco::Exception &E) {
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -199,4 +199,53 @@ namespace OpenWifi::GWObjects {
|
|||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ScriptRequest {
|
||||||
|
uint64_t timeout=30;
|
||||||
|
std::string serialNumber;
|
||||||
|
std::string type;
|
||||||
|
std::string script;
|
||||||
|
std::string scriptId;
|
||||||
|
uint64_t when=0;
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RadiusProxyServerEntry {
|
||||||
|
std::string name;
|
||||||
|
std::string ip;
|
||||||
|
uint16_t port=0;
|
||||||
|
uint64_t weight=0;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RadiusProxyServerConfig {
|
||||||
|
std::string strategy;
|
||||||
|
bool monitor=false;
|
||||||
|
std::string monitorMethod;
|
||||||
|
std::vector<std::string> methodParameters;
|
||||||
|
std::vector<RadiusProxyServerEntry> servers;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RadiusProxyPool {
|
||||||
|
std::string name;
|
||||||
|
std::string description;
|
||||||
|
RadiusProxyServerConfig authConfig;
|
||||||
|
RadiusProxyServerConfig acctConfig;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RadiusProxyPoolList {
|
||||||
|
std::vector<RadiusProxyPool> pools;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,6 +188,13 @@ namespace OpenWifi::RESTAPI::Errors {
|
|||||||
static const struct msg FailedToVerifyDigicert{1136,"Failed to verify the DigiCert information provided."};
|
static const struct msg FailedToVerifyDigicert{1136,"Failed to verify the DigiCert information provided."};
|
||||||
static const struct msg CouldNotPerformCommand{1137,"Could not perform command."};
|
static const struct msg CouldNotPerformCommand{1137,"Could not perform command."};
|
||||||
|
|
||||||
|
static const struct msg PoolNameInvalid{1138,"Pool name is invalid."};
|
||||||
|
static const struct msg InvalidRadiusProxyStrategy{1139,"Strategy name must be: random, round_robin, weighted."};
|
||||||
|
static const struct msg InvalidRadiusProxyMonitorMethod{1140,"monitorMethod must be: none, https, radius."};
|
||||||
|
static const struct msg MustHaveAtLeastOneRadiusServer{1141,"Must have at least one RADIUS server."};
|
||||||
|
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."};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user