Debugging

This commit is contained in:
stephb9959
2022-02-24 23:38:53 -08:00
parent a2d9e2a8a5
commit 7ea4b8b6c2
2 changed files with 2429 additions and 2302 deletions

View File

@@ -16,6 +16,7 @@ namespace OpenWifi {
static const std::string GitUCentralJSONSchemaFile{"https://raw.githubusercontent.com/blogic/ucentral-schema/main/ucentral.schema.json"};
static json DefaultUCentralSchema = R"(
{
"$id": "https://openwrt.org/ucentral.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
@@ -75,6 +76,10 @@ namespace OpenWifi {
"name": {
"type": "string"
},
"hostname": {
"type": "string",
"format": "hostname"
},
"location": {
"type": "string"
},
@@ -101,12 +106,14 @@ namespace OpenWifi {
"items": {
"type": "string",
"enum": [
"CS0",
"CS1",
"CS2",
"CS3",
"CS4",
"CS5",
"CS6",
"CS7",
"AF11",
"AF12",
"AF13",
@@ -120,12 +127,15 @@ namespace OpenWifi {
"AF42",
"AF43",
"DF",
"EF"
"EF",
"VA",
"LE"
]
}
},
"globals.wireless-multimedia": {
"globals.wireless-multimedia.table": {
"type": "object",
"additionalProperties": false,
"properties": {
"UP0": {
"$ref": "#/$defs/globals.wireless-multimedia.class-selector"
@@ -153,11 +163,19 @@ namespace OpenWifi {
}
}
},
"globals.wireless-multimedia-profile": {
"globals.wireless-multimedia.profile": {
"type": "object",
"additionalProperties": false,
"properties": {
"profile": {
"type": "string",
"enum": [
"enterprise"
"enterprise",
"rfc8325",
"3gpp"
]
}
}
},
"globals": {
"type": "object",
@@ -177,12 +195,11 @@ namespace OpenWifi {
]
},
"wireless-multimedia": {
"oneOf": [
{
"$ref": "#/$defs/globals.wireless-multimedia"
"anyOf": [{
"$ref": "#/$defs/globals.wireless-multimedia.table"
},
{
"$ref": "#/$defs/globals.wireless-multimedia-profile"
"$ref": "#/$defs/globals.wireless-multimedia.profile"
}
]
}
@@ -372,10 +389,9 @@ namespace OpenWifi {
]
},
"channel": {
"oneOf": [
{
"oneOf": [{
"type": "integer",
"maximum": 171,
"maximum": 196,
"minimum": 1
},
{
@@ -384,6 +400,14 @@ namespace OpenWifi {
}
]
},
"valid-channels": {
"type": "array",
"items": {
"type": "integer",
"maximum": 196,
"minimum": 1
}
},
"country": {
"type": "string",
"maxLength": 2,
@@ -392,6 +416,10 @@ namespace OpenWifi {
"US"
]
},
"allow-dfs": {
"type": "boolean",
"default": false
},
"channel-mode": {
"type": "string",
"enum": [
@@ -497,10 +525,10 @@ namespace OpenWifi {
"802.1q"
],
"default": "802.1q"
}
}
},
"interface.bridge": {
}
}
},
"interface.bridge": {
"type": "object",
"properties": {
"mtu": {
@@ -821,8 +849,7 @@ namespace OpenWifi {
}
},
"interface.broad-band": {
"oneOf": [
{
"oneOf": [{
"$ref": "#/$defs/interface.broad-band.wwan"
},
{
@@ -1074,8 +1101,7 @@ namespace OpenWifi {
"minimum": 1
},
"value": {
"anyOf": [
{
"anyOf": [{
"type": "integer",
"maximum": 4294967295,
"minimum": 0
@@ -1086,8 +1112,7 @@ namespace OpenWifi {
]
}
},
"examples": [
{
"examples": [{
"id": 27,
"value": 900
},
@@ -1124,12 +1149,49 @@ namespace OpenWifi {
"local": {
"$ref": "#/$defs/interface.ssid.radius.local"
},
"dynamic-authorization": {
"type": "object",
"properties": {
"host": {
"type": "string",
"format": "uc-ip",
"examples": [
"192.168.1.10"
]
},
"port": {
"type": "integer",
"maximum": 65535,
"minimum": 1024,
"examples": [
1812
]
},
"secret": {
"type": "string",
"examples": [
"secret"
]
}
}
},
"authentication": {
"allOf": [{
"$ref": "#/$defs/interface.ssid.radius.server"
},
"accounting": {
"allOf": [
{
"type": "object",
"properties": {
"mac-filter": {
"type": "boolean",
"default": false
}
}
}
]
},
"accounting": {
"allOf": [{
"$ref": "#/$defs/interface.ssid.radius.server"
},
{
@@ -1332,15 +1394,13 @@ namespace OpenWifi {
]
}
},
"examples": [
{
"examples": [{
"width": 32,
"height": 32,
"type": "image/png",
"language": "eng",
"icon": "R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7"
}
]
}]
}
},
"wan-metrics": {
@@ -1581,8 +1641,7 @@ namespace OpenWifi {
}
},
"interface.tunnel": {
"oneOf": [
{
"oneOf": [{
"$ref": "#/$defs/interface.tunnel.mesh"
},
{
@@ -1788,6 +1847,11 @@ namespace OpenWifi {
"type": "integer",
"minimum": 32,
"default": 1000
},
"priority": {
"type": "integer",
"minimum": 0,
"default": 7
}
}
},
@@ -1934,7 +1998,7 @@ namespace OpenWifi {
"properties": {
"controller": {
"type": "string",
"format": "ip",
"format": "uc-ip",
"example": "192.168.10.1"
},
"datapath-description": {
@@ -1951,6 +2015,11 @@ namespace OpenWifi {
],
"default": "ssl"
},
"port": {
"type": "integer",
"maximum": 65535,
"default": 6653
},
"ca-certificate": {
"type": "string"
},
@@ -2021,6 +2090,35 @@ namespace OpenWifi {
}
}
},
"service.quality-of-service.class-selector": {
"type": "string",
"enum": [
"CS0",
"CS1",
"CS2",
"CS3",
"CS4",
"CS5",
"CS6",
"CS7",
"AF11",
"AF12",
"AF13",
"AF21",
"AF22",
"AF23",
"AF31",
"AF32",
"AF33",
"AF41",
"AF42",
"AF43",
"DF",
"EF",
"VA",
"LE"
]
},
"service.quality-of-service": {
"type": "object",
"properties": {
@@ -2039,23 +2137,26 @@ namespace OpenWifi {
"type": "integer",
"default": 0
},
"bulk-detection": {
"type": "object",
"properties": {
"dscp": {
"$ref": "#/$defs/service.quality-of-service.class-selector",
"default": "CS0"
},
"packets-per-second": {
"type": "number",
"default": 0
}
}
},
"classifier": {
"type": "array",
"items": {
"type": "object",
"properties": {
"dscp": {
"type": "string",
"enum": [
"CS0",
"CS1",
"CS2",
"CS3",
"CS4",
"CS5",
"CS6",
"CS7"
],
"$ref": "#/$defs/service.quality-of-service.class-selector",
"default": "CS1"
},
"ports": {
@@ -2083,12 +2184,25 @@ namespace OpenWifi {
"default": true
}
}
}
},
"dns": {
"type": "array",
"items": {
"type": "object",
"properties": {
"fqdn": {
"type": "string",
"format": "fqdn"
},
"suffix-matching": {
"type": "boolean",
"default": true
},
"reclassify": {
"type": "boolean",
"default": true
}
}
}
}
@@ -2111,21 +2225,36 @@ namespace OpenWifi {
}
}
},
"service.airtime-policies": {
"service.airtime-fairness": {
"type": "object",
"properties": {
"dns-match": {
"type": "array",
"items": {
"type": "string",
"examples": [
"*.voice.example.com"
]
}
"voice-weight": {
"type": "number",
"default": 4
},
"dns-weight": {
"type": "integer",
"packet-threshold": {
"type": "number",
"default": 100
},
"bulk-threshold": {
"type": "number",
"default": 50
},
"priority-threshold": {
"type": "number",
"default": 30
},
"weight-normal": {
"type": "number",
"default": 256
},
"weight-priority": {
"type": "number",
"default": 394
},
"weight-bulk": {
"type": "number",
"default": 128
}
}
},
@@ -2180,8 +2309,8 @@ namespace OpenWifi {
"facebook-wifi": {
"$ref": "#/$defs/service.facebook-wifi"
},
"airtime-policies": {
"$ref": "#/$defs/service.airtime-policies"
"airtime-fairness": {
"$ref": "#/$defs/service.airtime-fairness"
}
}
},
@@ -2312,8 +2441,8 @@ namespace OpenWifi {
]
]
}
}
}
}
}
}
)"_json;

View File

@@ -14,9 +14,8 @@ namespace OpenWifi {
class ConfigurationValidator : public SubSystemServer {
public:
static ConfigurationValidator *instance() {
if(instance_== nullptr)
instance_ = new ConfigurationValidator;
static auto instance() {
static auto instance_ = new ConfigurationValidator;
return instance_;
}
@@ -27,7 +26,6 @@ namespace OpenWifi {
void reinitialize(Poco::Util::Application &self) override;
private:
static ConfigurationValidator * instance_;
bool Initialized_=false;
bool Working_=false;
void Init();
@@ -38,7 +36,7 @@ namespace OpenWifi {
}
};
inline ConfigurationValidator * ConfigurationValidator() { return ConfigurationValidator::instance(); }
inline auto ConfigurationValidator() { return ConfigurationValidator::instance(); }
inline bool ValidateUCentralConfiguration(const std::string &C, std::string &Error) { return ConfigurationValidator::instance()->Validate(C, Error); }
}