mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-11-01 19:17:47 +00:00
Refactoring
This commit is contained in:
@@ -72,12 +72,10 @@ add_executable(owprov
|
||||
src/framework/MicroService.h
|
||||
src/framework/OpenWifiTypes.h
|
||||
src/framework/orm.h
|
||||
src/framework/RESTAPI_errors.h
|
||||
src/framework/RESTAPI_protocol.h
|
||||
src/framework/StorageClass.h
|
||||
src/framework/uCentral_Protocol.h
|
||||
src/framework/ConfigurationValidator.cpp
|
||||
src/framework/ConfigurationValidator.h
|
||||
src/framework/ow_constants.h
|
||||
src/RESTObjects/RESTAPI_SecurityObjects.h src/RESTObjects/RESTAPI_SecurityObjects.cpp
|
||||
src/RESTObjects/RESTAPI_ProvObjects.cpp src/RESTObjects/RESTAPI_ProvObjects.h
|
||||
src/RESTObjects/RESTAPI_GWobjects.h src/RESTObjects/RESTAPI_GWobjects.cpp
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//
|
||||
|
||||
#include "AutoDiscovery.h"
|
||||
#include "framework/uCentral_Protocol.h"
|
||||
#include "framework/ow_constants.h"
|
||||
#include "framework/KafkaTopics.h"
|
||||
#include "StorageService.h"
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "RESTAPI_configurations_handler.h"
|
||||
#include "RESTObjects/RESTAPI_ProvObjects.h"
|
||||
#include "StorageService.h"
|
||||
#include "framework/RESTAPI_errors.h"
|
||||
#include "framework/ConfigurationValidator.h"
|
||||
#include "RESTAPI/RESTAPI_db_helpers.h"
|
||||
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
|
||||
#include "RESTAPI_contact_handler.h"
|
||||
|
||||
#include "framework/RESTAPI_protocol.h"
|
||||
#include "framework/RESTAPI_errors.h"
|
||||
#include "framework/ow_constants.h"
|
||||
#include "RESTObjects/RESTAPI_ProvObjects.h"
|
||||
#include "RESTAPI_db_helpers.h"
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "RESTObjects/RESTAPI_ProvObjects.h"
|
||||
#include "StorageService.h"
|
||||
#include "framework/MicroService.h"
|
||||
#include "framework/RESTAPI_errors.h"
|
||||
|
||||
namespace OpenWifi {
|
||||
|
||||
|
||||
@@ -8,10 +8,8 @@
|
||||
|
||||
#include "RESTAPI_inventory_handler.h"
|
||||
|
||||
#include "framework/RESTAPI_protocol.h"
|
||||
#include "StorageService.h"
|
||||
#include "APConfig.h"
|
||||
#include "framework/RESTAPI_errors.h"
|
||||
#include "AutoDiscovery.h"
|
||||
#include "sdks/SDK_gw.h"
|
||||
#include "sdks/SDK_sec.h"
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "RESTAPI_inventory_list_handler.h"
|
||||
#include "StorageService.h"
|
||||
#include "framework/RESTAPI_errors.h"
|
||||
#include "RESTAPI/RESTAPI_db_helpers.h"
|
||||
|
||||
namespace OpenWifi{
|
||||
|
||||
@@ -8,11 +8,8 @@
|
||||
|
||||
|
||||
#include "RESTAPI_location_handler.h"
|
||||
#include "framework/RESTAPI_errors.h"
|
||||
|
||||
#include "RESTObjects/RESTAPI_ProvObjects.h"
|
||||
#include "StorageService.h"
|
||||
#include "framework/RESTAPI_protocol.h"
|
||||
#include "Daemon.h"
|
||||
#include "RESTAPI/RESTAPI_db_helpers.h"
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "StorageService.h"
|
||||
#include "Poco/JSON/Parser.h"
|
||||
#include "Daemon.h"
|
||||
#include "framework/RESTAPI_errors.h"
|
||||
#include "RESTAPI/RESTAPI_db_helpers.h"
|
||||
|
||||
namespace OpenWifi{
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include "RESTObjects/RESTAPI_ProvObjects.h"
|
||||
#include "StorageService.h"
|
||||
#include "framework/RESTAPI_errors.h"
|
||||
#include "RESTAPI/RESTAPI_db_helpers.h"
|
||||
|
||||
namespace OpenWifi{
|
||||
|
||||
@@ -4,12 +4,10 @@
|
||||
|
||||
#include "RESTAPI_managementRole_handler.h"
|
||||
|
||||
#include "framework/RESTAPI_protocol.h"
|
||||
#include "RESTObjects/RESTAPI_ProvObjects.h"
|
||||
#include "StorageService.h"
|
||||
#include "Poco/JSON/Parser.h"
|
||||
#include "Poco/StringTokenizer.h"
|
||||
#include "framework/RESTAPI_errors.h"
|
||||
#include "RESTAPI/RESTAPI_db_helpers.h"
|
||||
|
||||
namespace OpenWifi{
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "RESTAPI_managementRole_list_handler.h"
|
||||
#include "RESTObjects/RESTAPI_ProvObjects.h"
|
||||
#include "StorageService.h"
|
||||
#include "framework/RESTAPI_errors.h"
|
||||
#include "RESTAPI/RESTAPI_db_helpers.h"
|
||||
|
||||
namespace OpenWifi{
|
||||
|
||||
@@ -4,12 +4,10 @@
|
||||
|
||||
#include "RESTAPI_map_handler.h"
|
||||
|
||||
#include "framework/RESTAPI_protocol.h"
|
||||
#include "RESTObjects/RESTAPI_ProvObjects.h"
|
||||
#include "StorageService.h"
|
||||
#include "Poco/JSON/Parser.h"
|
||||
#include "Poco/StringTokenizer.h"
|
||||
#include "framework/RESTAPI_errors.h"
|
||||
#include "RESTAPI/RESTAPI_db_helpers.h"
|
||||
|
||||
namespace OpenWifi{
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "RESTObjects/RESTAPI_ProvObjects.h"
|
||||
#include "StorageService.h"
|
||||
#include "framework/RESTAPI_errors.h"
|
||||
#include "RESTAPI/RESTAPI_db_helpers.h"
|
||||
|
||||
namespace OpenWifi{
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include "Poco/Net/HTTPResponse.h"
|
||||
#include "Poco/JSON/Object.h"
|
||||
#include "Poco/JSON/Parser.h"
|
||||
#include "Poco/JSON/Stringifier.h"
|
||||
#include "Poco/Net/HTTPSClientSession.h"
|
||||
|
||||
|
||||
@@ -177,8 +177,8 @@ namespace OpenWifi::SecurityObjects {
|
||||
|
||||
bool UserLoginLoginExtensions::from_json(Poco::JSON::Object::Ptr &Obj) {
|
||||
try {
|
||||
field_from_json(Obj,"mobiles",mobiles);
|
||||
field_from_json(Obj,"mfa",mfa);
|
||||
field_from_json(Obj, "mobiles",mobiles);
|
||||
field_from_json(Obj, "mfa",mfa);
|
||||
field_from_json(Obj, "authenticatorSecret", authenticatorSecret);
|
||||
return true;
|
||||
} catch (...) {
|
||||
@@ -257,6 +257,7 @@ namespace OpenWifi::SecurityObjects {
|
||||
field_to_json(Obj,"oauthType",oauthType);
|
||||
field_to_json(Obj,"oauthUserInfo",oauthUserInfo);
|
||||
field_to_json(Obj,"modified",modified);
|
||||
field_to_json(Obj,"signingUp",signingUp);
|
||||
};
|
||||
|
||||
bool UserInfo::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||
@@ -292,6 +293,7 @@ namespace OpenWifi::SecurityObjects {
|
||||
field_from_json(Obj,"oauthType",oauthType);
|
||||
field_from_json(Obj,"oauthUserInfo",oauthUserInfo);
|
||||
field_from_json(Obj,"modified",modified);
|
||||
field_from_json(Obj,"signingUp",signingUp);
|
||||
return true;
|
||||
} catch (const Poco::Exception &E) {
|
||||
|
||||
|
||||
@@ -138,6 +138,7 @@ namespace OpenWifi {
|
||||
std::string oauthType;
|
||||
std::string oauthUserInfo;
|
||||
uint64_t modified;
|
||||
std::string signingUp;
|
||||
|
||||
void to_json(Poco::JSON::Object &Obj) const;
|
||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||
@@ -233,7 +234,8 @@ namespace OpenWifi {
|
||||
FORGOT_PASSWORD=1,
|
||||
VERIFY_EMAIL,
|
||||
SUB_FORGOT_PASSWORD,
|
||||
SUB_VERIFY_EMAIL
|
||||
SUB_VERIFY_EMAIL,
|
||||
SUB_SIGNUP
|
||||
};
|
||||
|
||||
struct ActionLink {
|
||||
|
||||
@@ -76,9 +76,7 @@ using namespace std::chrono_literals;
|
||||
|
||||
#include "framework/OpenWifiTypes.h"
|
||||
#include "framework/KafkaTopics.h"
|
||||
#include "framework/RESTAPI_protocol.h"
|
||||
#include "framework/RESTAPI_errors.h"
|
||||
#include "framework/uCentral_Protocol.h"
|
||||
#include "framework/ow_constants.h"
|
||||
#include "RESTObjects/RESTAPI_SecurityObjects.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
//
|
||||
// Created by stephane bourque on 2021-09-12.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace OpenWifi::RESTAPI::Errors {
|
||||
static const std::string MissingUUID{"Missing UUID."};
|
||||
static const std::string MissingSerialNumber{"Missing Serial Number."};
|
||||
static const std::string InternalError{"Internal error. Please try later."};
|
||||
static const std::string InvalidJSONDocument{"Invalid JSON document."};
|
||||
static const std::string UnsupportedHTTPMethod{"Unsupported HTTP Method"};
|
||||
static const std::string StillInUse{"Element still in use."};
|
||||
static const std::string CouldNotBeDeleted{"Element could not be deleted."};
|
||||
static const std::string NameMustBeSet{"The name property must be set."};
|
||||
static const std::string ConfigBlockInvalid{"Configuration block type invalid."};
|
||||
static const std::string UnknownId{"Unknown UUID."};
|
||||
static const std::string InvalidDeviceTypes{"Unknown or invalid device type(s)."};
|
||||
static const std::string RecordNotCreated{"Record could not be created."};
|
||||
static const std::string RecordNotUpdated{"Record could not be updated."};
|
||||
static const std::string UnknownManagementPolicyUUID{"Unknown management policy UUID."};
|
||||
static const std::string CannotDeleteRoot{"Root Entity cannot be removed, only modified."};
|
||||
static const std::string MustCreateRootFirst{"Root entity must be created first."};
|
||||
static const std::string ParentUUIDMustExist{"Parent UUID must exist."};
|
||||
static const std::string ConfigurationMustExist{"Configuration must exist."};
|
||||
static const std::string MissingOrInvalidParameters{"Invalid or missing parameters."};
|
||||
static const std::string UnknownSerialNumber{"Unknown Serial Number."};
|
||||
static const std::string InvalidSerialNumber{"Invalid Serial Number."};
|
||||
static const std::string SerialNumberExists{"Serial Number already exists."};
|
||||
static const std::string ValidNonRootUUID{"Must be a non-root, and valid UUID."};
|
||||
static const std::string VenueMustExist{"Venue does not exist."};
|
||||
static const std::string NotBoth{"You cannot specify both Entity and Venue"};
|
||||
static const std::string EntityMustExist{"Entity must exist."};
|
||||
static const std::string ParentOrEntityMustBeSet{"Parent or Entity must be set."};
|
||||
static const std::string ContactMustExist{"Contact must exist."};
|
||||
static const std::string LocationMustExist{"Location must exist."};
|
||||
static const std::string OnlyWSSupported{"This endpoint only supports WebSocket."};
|
||||
static const std::string SerialNumberMismatch{"Serial Number mismatch."};
|
||||
static const std::string InvalidCommand{"Invalid command."};
|
||||
static const std::string NoRecordsDeleted{"No records deleted."};
|
||||
static const std::string DeviceNotConnected{"Device is not currently connected."};
|
||||
static const std::string CannotCreateWS{"Telemetry system could not create WS endpoint. Please try again."};
|
||||
static const std::string BothDeviceTypeRevision{"Both deviceType and revision must be set."};
|
||||
static const std::string IdOrSerialEmpty{"SerialNumber and Id must not be empty."};
|
||||
static const std::string MissingUserID{"Missing user ID."};
|
||||
static const std::string IdMustBe0{"To create a user, you must set the ID to 0"};
|
||||
static const std::string InvalidUserRole{"Invalid userRole."};
|
||||
static const std::string InvalidEmailAddress{"Invalid email address."};
|
||||
static const std::string PasswordRejected{"Password was rejected. This maybe an old password."};
|
||||
static const std::string InvalidIPRanges{"Invalid IP range specifications."};
|
||||
static const std::string InvalidLOrderBy{"Invalid orderBy specification."};
|
||||
static const std::string NeedMobileNumber{"You must provide at least one validated phone number."};
|
||||
static const std::string BadMFAMethod{"MFA only supports sms or email."};
|
||||
static const std::string InvalidCredentials{"Invalid credentials (username/password)."};
|
||||
static const std::string InvalidPassword{"Password does not conform to basic password rules."};
|
||||
static const std::string UserPendingVerification{"User access denied pending email verification."};
|
||||
static const std::string PasswordMustBeChanged{"Password must be changed."};
|
||||
static const std::string UnrecognizedRequest{"Ill-formed request. Please consult documentation."};
|
||||
static const std::string MissingAuthenticationInformation{"Missing authentication information."};
|
||||
static const std::string InsufficientAccessRights{"Insufficient access rights to complete the operation."};
|
||||
static const std::string ExpiredToken{"Token has expired, user must login."};
|
||||
static const std::string SubscriberMustExist{"Subscriber must exist."};
|
||||
static const std::string AuthenticatorVerificationIncomplete{"Authenticator validation is not complete."};
|
||||
static const std::string SMSCouldNotBeSentRetry{"SMS could not be sent to validate device, try later or change the phone number."};
|
||||
static const std::string SMSCouldNotValidate{"Code and number could not be validated"};
|
||||
static const std::string InvalidDeviceClass{"Invalid device class. Must be: any, venue, entity, or subscriber"};
|
||||
}
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
//
|
||||
// License type: BSD 3-Clause License
|
||||
// License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
|
||||
//
|
||||
// Created by Stephane Bourque on 2021-03-04.
|
||||
// Arilia Wireless Inc.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace OpenWifi::RESTAPI::Protocol {
|
||||
static const char * CAPABILITIES = "capabilities";
|
||||
static const char * LOGS = "logs";
|
||||
static const char * HEALTHCHECKS = "healthchecks";
|
||||
static const char * STATISTICS = "statistics";
|
||||
static const char * STATUS = "status";
|
||||
static const char * SERIALNUMBER = "serialNumber";
|
||||
static const char * PERFORM = "perform";
|
||||
static const char * CONFIGURE = "configure";
|
||||
static const char * UPGRADE = "upgrade";
|
||||
static const char * REBOOT = "reboot";
|
||||
static const char * FACTORY = "factory";
|
||||
static const char * LEDS = "leds";
|
||||
static const char * TRACE = "trace";
|
||||
static const char * REQUEST = "request";
|
||||
static const char * WIFISCAN = "wifiscan";
|
||||
static const char * EVENTQUEUE = "eventqueue";
|
||||
static const char * RTTY = "rtty";
|
||||
static const char * COMMAND = "command";
|
||||
static const char * STARTDATE = "startDate";
|
||||
static const char * ENDDATE = "endDate";
|
||||
static const char * OFFSET = "offset";
|
||||
static const char * LIMIT = "limit";
|
||||
static const char * LIFETIME = "lifetime";
|
||||
static const char * UUID = "UUID";
|
||||
static const char * DATA = "data";
|
||||
static const char * CONFIGURATION = "configuration";
|
||||
static const char * WHEN = "when";
|
||||
static const char * URI = "uri";
|
||||
static const char * LOGTYPE = "logType";
|
||||
static const char * VALUES = "values";
|
||||
static const char * TYPES = "types";
|
||||
static const char * PAYLOAD = "payload";
|
||||
static const char * KEEPREDIRECTOR = "keepRedirector";
|
||||
static const char * NETWORK = "network";
|
||||
static const char * INTERFACE = "interface";
|
||||
static const char * BANDS = "bands";
|
||||
static const char * CHANNELS = "channels";
|
||||
static const char * VERBOSE = "verbose";
|
||||
static const char * MESSAGE = "message";
|
||||
static const char * STATE = "state";
|
||||
static const char * HEALTHCHECK = "healthcheck";
|
||||
static const char * PCAP_FILE_TYPE = "pcap";
|
||||
static const char * DURATION = "duration";
|
||||
static const char * NUMBEROFPACKETS = "numberOfPackets";
|
||||
static const char * FILTER = "filter";
|
||||
static const char * SELECT = "select";
|
||||
static const char * SERIALONLY = "serialOnly";
|
||||
static const char * COUNTONLY = "countOnly";
|
||||
static const char * DEVICEWITHSTATUS = "deviceWithStatus";
|
||||
static const char * DEVICESWITHSTATUS = "devicesWithStatus";
|
||||
static const char * DEVICES = "devices";
|
||||
static const char * COUNT = "count";
|
||||
static const char * SERIALNUMBERS = "serialNumbers";
|
||||
static const char * CONFIGURATIONS = "configurations";
|
||||
static const char * NAME = "name";
|
||||
static const char * COMMANDS = "commands";
|
||||
static const char * COMMANDUUID = "commandUUID";
|
||||
static const char * FIRMWARES = "firmwares";
|
||||
static const char * TOPIC = "topic";
|
||||
static const char * HOST = "host";
|
||||
static const char * OS = "os";
|
||||
static const char * HOSTNAME = "hostname";
|
||||
static const char * PROCESSORS = "processors";
|
||||
static const char * REASON = "reason";
|
||||
static const char * RELOAD = "reload";
|
||||
static const char * SUBSYSTEMS = "subsystems";
|
||||
static const char * FILEUUID = "uuid";
|
||||
static const char * USERID = "userId";
|
||||
static const char * PASSWORD = "password";
|
||||
static const char * TOKEN = "token";
|
||||
static const char * SETLOGLEVEL = "setloglevel";
|
||||
static const char * GETLOGLEVELS = "getloglevels";
|
||||
static const char * GETSUBSYSTEMNAMES = "getsubsystemnames";
|
||||
static const char * GETLOGLEVELNAMES = "getloglevelnames";
|
||||
static const char * STATS = "stats";
|
||||
static const char * PING = "ping";
|
||||
static const char * PARAMETERS = "parameters";
|
||||
static const char * VALUE = "value";
|
||||
static const char * LASTONLY = "lastOnly";
|
||||
static const char * NEWEST = "newest";
|
||||
static const char * ACTIVESCAN = "activeScan";
|
||||
static const char * OVERRIDEDFS = "override_dfs";
|
||||
static const char * LIST = "list";
|
||||
static const char * TAG = "tag";
|
||||
static const char * TAGLIST = "tagList";
|
||||
static const char * DESCRIPTION = "description";
|
||||
static const char * NOTES = "notes";
|
||||
static const char * DEVICETYPE = "deviceType";
|
||||
static const char * REVISION = "revision";
|
||||
static const char * AGES = "ages";
|
||||
static const char * REVISIONS = "revisions";
|
||||
static const char * DEVICETYPES = "deviceTypes";
|
||||
static const char * LATESTONLY = "latestOnly";
|
||||
static const char * IDONLY = "idOnly";
|
||||
static const char * REVISIONSET = "revisionSet";
|
||||
static const char * DEVICESET = "deviceSet";
|
||||
static const char * HISTORY = "history";
|
||||
static const char * ID = "id";
|
||||
static const char * VERSION = "version";
|
||||
static const char * TIMES = "times";
|
||||
static const char * UPTIME = "uptime";
|
||||
static const char * START = "start";
|
||||
|
||||
static const char * NEWPASSWORD = "newPassword";
|
||||
static const char * USERS = "users";
|
||||
static const char * WITHEXTENDEDINFO = "withExtendedInfo";
|
||||
|
||||
static const char * ERRORTEXT = "errorText";
|
||||
static const char * ERRORCODE = "errorCode";
|
||||
static const char * AVATARID = "avatarId";
|
||||
static const char * UNNAMED = "(unnamed)";
|
||||
static const char * UNSPECIFIED = "(unspecified)";
|
||||
static const char * CONTENTDISPOSITION = "Content-Disposition";
|
||||
static const char * CONTENTTYPE = "Content-Type";
|
||||
|
||||
static const char * REQUIREMENTS = "requirements";
|
||||
static const char * PASSWORDPATTERN = "passwordPattern";
|
||||
static const char * ACCESSPOLICY = "accessPolicy";
|
||||
static const char * PASSWORDPOLICY = "passwordPolicy";
|
||||
static const char * FORGOTPASSWORD = "forgotPassword";
|
||||
static const char * RESENDMFACODE = "resendMFACode";
|
||||
static const char * COMPLETEMFACHALLENGE = "completeMFAChallenge";
|
||||
static const char * ME = "me";
|
||||
static const char * TELEMETRY = "telemetry";
|
||||
static const char * INTERVAL = "interval";
|
||||
static const char * UI = "UI";
|
||||
|
||||
}
|
||||
324
src/framework/ow_constants.h
Normal file
324
src/framework/ow_constants.h
Normal file
@@ -0,0 +1,324 @@
|
||||
//
|
||||
// Created by stephane bourque on 2022-02-21.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "Poco/String.h"
|
||||
|
||||
namespace OpenWifi::RESTAPI::Errors {
|
||||
static const std::string MissingUUID{"Missing UUID."};
|
||||
static const std::string MissingSerialNumber{"Missing Serial Number."};
|
||||
static const std::string InternalError{"Internal error. Please try later."};
|
||||
static const std::string InvalidJSONDocument{"Invalid JSON document."};
|
||||
static const std::string UnsupportedHTTPMethod{"Unsupported HTTP Method"};
|
||||
static const std::string StillInUse{"Element still in use."};
|
||||
static const std::string CouldNotBeDeleted{"Element could not be deleted."};
|
||||
static const std::string NameMustBeSet{"The name property must be set."};
|
||||
static const std::string ConfigBlockInvalid{"Configuration block type invalid."};
|
||||
static const std::string UnknownId{"Unknown UUID."};
|
||||
static const std::string InvalidDeviceTypes{"Unknown or invalid device type(s)."};
|
||||
static const std::string RecordNotCreated{"Record could not be created."};
|
||||
static const std::string RecordNotUpdated{"Record could not be updated."};
|
||||
static const std::string UnknownManagementPolicyUUID{"Unknown management policy UUID."};
|
||||
static const std::string CannotDeleteRoot{"Root Entity cannot be removed, only modified."};
|
||||
static const std::string MustCreateRootFirst{"Root entity must be created first."};
|
||||
static const std::string ParentUUIDMustExist{"Parent UUID must exist."};
|
||||
static const std::string ConfigurationMustExist{"Configuration must exist."};
|
||||
static const std::string MissingOrInvalidParameters{"Invalid or missing parameters."};
|
||||
static const std::string UnknownSerialNumber{"Unknown Serial Number."};
|
||||
static const std::string InvalidSerialNumber{"Invalid Serial Number."};
|
||||
static const std::string SerialNumberExists{"Serial Number already exists."};
|
||||
static const std::string ValidNonRootUUID{"Must be a non-root, and valid UUID."};
|
||||
static const std::string VenueMustExist{"Venue does not exist."};
|
||||
static const std::string NotBoth{"You cannot specify both Entity and Venue"};
|
||||
static const std::string EntityMustExist{"Entity must exist."};
|
||||
static const std::string ParentOrEntityMustBeSet{"Parent or Entity must be set."};
|
||||
static const std::string ContactMustExist{"Contact must exist."};
|
||||
static const std::string LocationMustExist{"Location must exist."};
|
||||
static const std::string OnlyWSSupported{"This endpoint only supports WebSocket."};
|
||||
static const std::string SerialNumberMismatch{"Serial Number mismatch."};
|
||||
static const std::string InvalidCommand{"Invalid command."};
|
||||
static const std::string NoRecordsDeleted{"No records deleted."};
|
||||
static const std::string DeviceNotConnected{"Device is not currently connected."};
|
||||
static const std::string CannotCreateWS{"Telemetry system could not create WS endpoint. Please try again."};
|
||||
static const std::string BothDeviceTypeRevision{"Both deviceType and revision must be set."};
|
||||
static const std::string IdOrSerialEmpty{"SerialNumber and Id must not be empty."};
|
||||
static const std::string MissingUserID{"Missing user ID."};
|
||||
static const std::string IdMustBe0{"To create a user, you must set the ID to 0"};
|
||||
static const std::string InvalidUserRole{"Invalid userRole."};
|
||||
static const std::string InvalidEmailAddress{"Invalid email address."};
|
||||
static const std::string PasswordRejected{"Password was rejected. This maybe an old password."};
|
||||
static const std::string InvalidIPRanges{"Invalid IP range specifications."};
|
||||
static const std::string InvalidLOrderBy{"Invalid orderBy specification."};
|
||||
static const std::string NeedMobileNumber{"You must provide at least one validated phone number."};
|
||||
static const std::string BadMFAMethod{"MFA only supports sms or email."};
|
||||
static const std::string InvalidCredentials{"Invalid credentials (username/password)."};
|
||||
static const std::string InvalidPassword{"Password does not conform to basic password rules."};
|
||||
static const std::string UserPendingVerification{"User access denied pending email verification."};
|
||||
static const std::string PasswordMustBeChanged{"Password must be changed."};
|
||||
static const std::string UnrecognizedRequest{"Ill-formed request. Please consult documentation."};
|
||||
static const std::string MissingAuthenticationInformation{"Missing authentication information."};
|
||||
static const std::string InsufficientAccessRights{"Insufficient access rights to complete the operation."};
|
||||
static const std::string ExpiredToken{"Token has expired, user must login."};
|
||||
static const std::string SubscriberMustExist{"Subscriber must exist."};
|
||||
static const std::string AuthenticatorVerificationIncomplete{"Authenticator validation is not complete."};
|
||||
static const std::string SMSCouldNotBeSentRetry{"SMS could not be sent to validate device, try later or change the phone number."};
|
||||
static const std::string SMSCouldNotValidate{"Code and number could not be validated"};
|
||||
static const std::string InvalidDeviceClass{"Invalid device class. Must be: any, venue, entity, or subscriber"};
|
||||
}
|
||||
|
||||
namespace OpenWifi::RESTAPI::Protocol {
|
||||
static const char * CAPABILITIES = "capabilities";
|
||||
static const char * LOGS = "logs";
|
||||
static const char * HEALTHCHECKS = "healthchecks";
|
||||
static const char * STATISTICS = "statistics";
|
||||
static const char * STATUS = "status";
|
||||
static const char * SERIALNUMBER = "serialNumber";
|
||||
static const char * PERFORM = "perform";
|
||||
static const char * CONFIGURE = "configure";
|
||||
static const char * UPGRADE = "upgrade";
|
||||
static const char * REBOOT = "reboot";
|
||||
static const char * FACTORY = "factory";
|
||||
static const char * LEDS = "leds";
|
||||
static const char * TRACE = "trace";
|
||||
static const char * REQUEST = "request";
|
||||
static const char * WIFISCAN = "wifiscan";
|
||||
static const char * EVENTQUEUE = "eventqueue";
|
||||
static const char * RTTY = "rtty";
|
||||
static const char * COMMAND = "command";
|
||||
static const char * STARTDATE = "startDate";
|
||||
static const char * ENDDATE = "endDate";
|
||||
static const char * OFFSET = "offset";
|
||||
static const char * LIMIT = "limit";
|
||||
static const char * LIFETIME = "lifetime";
|
||||
static const char * UUID = "UUID";
|
||||
static const char * DATA = "data";
|
||||
static const char * CONFIGURATION = "configuration";
|
||||
static const char * WHEN = "when";
|
||||
static const char * URI = "uri";
|
||||
static const char * LOGTYPE = "logType";
|
||||
static const char * VALUES = "values";
|
||||
static const char * TYPES = "types";
|
||||
static const char * PAYLOAD = "payload";
|
||||
static const char * KEEPREDIRECTOR = "keepRedirector";
|
||||
static const char * NETWORK = "network";
|
||||
static const char * INTERFACE = "interface";
|
||||
static const char * BANDS = "bands";
|
||||
static const char * CHANNELS = "channels";
|
||||
static const char * VERBOSE = "verbose";
|
||||
static const char * MESSAGE = "message";
|
||||
static const char * STATE = "state";
|
||||
static const char * HEALTHCHECK = "healthcheck";
|
||||
static const char * PCAP_FILE_TYPE = "pcap";
|
||||
static const char * DURATION = "duration";
|
||||
static const char * NUMBEROFPACKETS = "numberOfPackets";
|
||||
static const char * FILTER = "filter";
|
||||
static const char * SELECT = "select";
|
||||
static const char * SERIALONLY = "serialOnly";
|
||||
static const char * COUNTONLY = "countOnly";
|
||||
static const char * DEVICEWITHSTATUS = "deviceWithStatus";
|
||||
static const char * DEVICESWITHSTATUS = "devicesWithStatus";
|
||||
static const char * DEVICES = "devices";
|
||||
static const char * COUNT = "count";
|
||||
static const char * SERIALNUMBERS = "serialNumbers";
|
||||
static const char * CONFIGURATIONS = "configurations";
|
||||
static const char * NAME = "name";
|
||||
static const char * COMMANDS = "commands";
|
||||
static const char * COMMANDUUID = "commandUUID";
|
||||
static const char * FIRMWARES = "firmwares";
|
||||
static const char * TOPIC = "topic";
|
||||
static const char * HOST = "host";
|
||||
static const char * OS = "os";
|
||||
static const char * HOSTNAME = "hostname";
|
||||
static const char * PROCESSORS = "processors";
|
||||
static const char * REASON = "reason";
|
||||
static const char * RELOAD = "reload";
|
||||
static const char * SUBSYSTEMS = "subsystems";
|
||||
static const char * FILEUUID = "uuid";
|
||||
static const char * USERID = "userId";
|
||||
static const char * PASSWORD = "password";
|
||||
static const char * TOKEN = "token";
|
||||
static const char * SETLOGLEVEL = "setloglevel";
|
||||
static const char * GETLOGLEVELS = "getloglevels";
|
||||
static const char * GETSUBSYSTEMNAMES = "getsubsystemnames";
|
||||
static const char * GETLOGLEVELNAMES = "getloglevelnames";
|
||||
static const char * STATS = "stats";
|
||||
static const char * PING = "ping";
|
||||
static const char * PARAMETERS = "parameters";
|
||||
static const char * VALUE = "value";
|
||||
static const char * LASTONLY = "lastOnly";
|
||||
static const char * NEWEST = "newest";
|
||||
static const char * ACTIVESCAN = "activeScan";
|
||||
static const char * OVERRIDEDFS = "override_dfs";
|
||||
static const char * LIST = "list";
|
||||
static const char * TAG = "tag";
|
||||
static const char * TAGLIST = "tagList";
|
||||
static const char * DESCRIPTION = "description";
|
||||
static const char * NOTES = "notes";
|
||||
static const char * DEVICETYPE = "deviceType";
|
||||
static const char * REVISION = "revision";
|
||||
static const char * AGES = "ages";
|
||||
static const char * REVISIONS = "revisions";
|
||||
static const char * DEVICETYPES = "deviceTypes";
|
||||
static const char * LATESTONLY = "latestOnly";
|
||||
static const char * IDONLY = "idOnly";
|
||||
static const char * REVISIONSET = "revisionSet";
|
||||
static const char * DEVICESET = "deviceSet";
|
||||
static const char * HISTORY = "history";
|
||||
static const char * ID = "id";
|
||||
static const char * VERSION = "version";
|
||||
static const char * TIMES = "times";
|
||||
static const char * UPTIME = "uptime";
|
||||
static const char * START = "start";
|
||||
|
||||
static const char * NEWPASSWORD = "newPassword";
|
||||
static const char * USERS = "users";
|
||||
static const char * WITHEXTENDEDINFO = "withExtendedInfo";
|
||||
|
||||
static const char * ERRORTEXT = "errorText";
|
||||
static const char * ERRORCODE = "errorCode";
|
||||
static const char * AVATARID = "avatarId";
|
||||
static const char * UNNAMED = "(unnamed)";
|
||||
static const char * UNSPECIFIED = "(unspecified)";
|
||||
static const char * CONTENTDISPOSITION = "Content-Disposition";
|
||||
static const char * CONTENTTYPE = "Content-Type";
|
||||
|
||||
static const char * REQUIREMENTS = "requirements";
|
||||
static const char * PASSWORDPATTERN = "passwordPattern";
|
||||
static const char * ACCESSPOLICY = "accessPolicy";
|
||||
static const char * PASSWORDPOLICY = "passwordPolicy";
|
||||
static const char * FORGOTPASSWORD = "forgotPassword";
|
||||
static const char * RESENDMFACODE = "resendMFACode";
|
||||
static const char * COMPLETEMFACHALLENGE = "completeMFAChallenge";
|
||||
static const char * ME = "me";
|
||||
static const char * TELEMETRY = "telemetry";
|
||||
static const char * INTERVAL = "interval";
|
||||
static const char * UI = "UI";
|
||||
static const char * BANDWIDTH = "bandwidth";
|
||||
}
|
||||
|
||||
namespace OpenWifi::uCentralProtocol {
|
||||
|
||||
const int SERIAL_NUMBER_LENGTH = 30;
|
||||
|
||||
// vocabulary used in the PROTOCOL.md file
|
||||
static const char * JSONRPC = "jsonrpc";
|
||||
static const char * ID = "id";
|
||||
static const char * UUID = "uuid";
|
||||
static const char * JSONRPC_VERSION = "2.0";
|
||||
static const char * METHOD = "method";
|
||||
static const char * PARAMS = "params";
|
||||
static const char * SERIAL = "serial";
|
||||
static const char * FIRMWARE = "firmware";
|
||||
static const char * CONNECT = "connect";
|
||||
static const char * STATE = "state";
|
||||
static const char * HEALTHCHECK = "healthcheck";
|
||||
static const char * LOG = "log";
|
||||
static const char * CRASHLOG = "crashlog";
|
||||
static const char * PING = "ping";
|
||||
static const char * CFGPENDING = "cfgpending";
|
||||
static const char * RECOVERY = "recovery";
|
||||
static const char * COMPRESS_64 = "compress_64";
|
||||
static const char * CAPABILITIES = "capabilities";
|
||||
static const char * REQUEST_UUID = "request_uuid";
|
||||
static const char * SANITY = "sanity";
|
||||
static const char * DATA = "data";
|
||||
static const char * LOGLINES = "loglines";
|
||||
static const char * SEVERITY = "severity";
|
||||
static const char * ACTIVE = "active";
|
||||
static const char * OVERRIDEDFS = "override_dfs";
|
||||
static const char * REBOOT = "reboot";
|
||||
static const char * WHEN = "when";
|
||||
static const char * CONFIG = "config";
|
||||
static const char * EMPTY_JSON_DOC = "{}";
|
||||
static const char * RESULT = "result";
|
||||
static const char * REQUEST = "request";
|
||||
static const char * PERFORM = "perform";
|
||||
static const char * CONFIGURE = "configure";
|
||||
static const char * PENDING = "pending";
|
||||
static const char * SUBMITTED_BY_SYSTEM = "*system";
|
||||
static const char * URI = "uri";
|
||||
static const char * COMMAND = "command";
|
||||
static const char * PAYLOAD = "payload";
|
||||
static const char * KEEP_REDIRECTOR = "keep_redirector";
|
||||
static const char * DURATION = "duration";
|
||||
static const char * PATTERN = "pattern";
|
||||
static const char * LEDS = "leds";
|
||||
static const char * ON = "on";
|
||||
static const char * OFF = "off";
|
||||
static const char * BLINK = "blink";
|
||||
static const char * PACKETS = "packets";
|
||||
static const char * NETWORK = "network";
|
||||
static const char * INTERFACE = "interface";
|
||||
static const char * TRACE = "trace";
|
||||
static const char * WIFISCAN = "wifiscan";
|
||||
static const char * TYPES = "types";
|
||||
static const char * EVENT = "event";
|
||||
static const char * MESSAGE = "message";
|
||||
static const char * RTTY = "rtty";
|
||||
static const char * TOKEN = "token";
|
||||
static const char * SERVER = "server";
|
||||
static const char * PORT = "port";
|
||||
static const char * USER = "user";
|
||||
static const char * TIMEOUT = "timeout";
|
||||
static const char * UPGRADE = "upgrade";
|
||||
static const char * FACTORY = "factory";
|
||||
static const char * VERBOSE = "verbose";
|
||||
static const char * BANDS = "bands";
|
||||
static const char * CHANNELS = "channels";
|
||||
static const char * PASSWORD = "password";
|
||||
static const char * DEVICEUPDATE = "deviceupdate";
|
||||
|
||||
static const char * SERIALNUMBER = "serialNumber";
|
||||
static const char * COMPATIBLE = "compatible";
|
||||
static const char * DISCONNECTION = "disconnection";
|
||||
static const char * TIMESTAMP = "timestamp";
|
||||
static const char * SYSTEM = "system";
|
||||
static const char * HOST = "host";
|
||||
static const char * CONNECTIONIP = "connectionIp";
|
||||
static const char * TELEMETRY = "telemetry";
|
||||
static const char * BANDWIDTH = "bandwidth";
|
||||
|
||||
enum EVENT_MSG {
|
||||
ET_UNKNOWN,
|
||||
ET_CONNECT,
|
||||
ET_STATE,
|
||||
ET_HEALTHCHECK,
|
||||
ET_LOG,
|
||||
ET_CRASHLOG,
|
||||
ET_PING,
|
||||
ET_CFGPENDING,
|
||||
ET_RECOVERY,
|
||||
ET_DEVICEUPDATE,
|
||||
ET_TELEMETRY
|
||||
};
|
||||
|
||||
inline static EVENT_MSG EventFromString(const std::string & Method) {
|
||||
if (!Poco::icompare(Method, CONNECT)) {
|
||||
return ET_CONNECT;
|
||||
} else if (!Poco::icompare(Method, STATE)) {
|
||||
return ET_STATE;
|
||||
} else if (!Poco::icompare(Method, HEALTHCHECK)) {
|
||||
return ET_HEALTHCHECK;
|
||||
} else if (!Poco::icompare(Method, LOG)) {
|
||||
return ET_LOG;
|
||||
} else if (!Poco::icompare(Method, CRASHLOG)) {
|
||||
return ET_CRASHLOG;
|
||||
} else if (!Poco::icompare(Method, PING)) {
|
||||
return ET_PING;
|
||||
} else if (!Poco::icompare(Method, CFGPENDING)) {
|
||||
return ET_CFGPENDING;
|
||||
} else if (!Poco::icompare(Method, RECOVERY)) {
|
||||
return ET_RECOVERY;
|
||||
} else if (!Poco::icompare(Method, DEVICEUPDATE)) {
|
||||
return ET_DEVICEUPDATE;
|
||||
} else if (!Poco::icompare(Method, TELEMETRY)) {
|
||||
return ET_TELEMETRY;
|
||||
} else
|
||||
return ET_UNKNOWN;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
//
|
||||
// License type: BSD 3-Clause License
|
||||
// License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
|
||||
//
|
||||
// Created by Stephane Bourque on 2021-03-04.
|
||||
// Arilia Wireless Inc.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "Poco/String.h"
|
||||
|
||||
namespace OpenWifi::uCentralProtocol {
|
||||
|
||||
const int SERIAL_NUMBER_LENGTH = 30;
|
||||
|
||||
// vocabulary used in the PROTOCOL.md file
|
||||
static const char * JSONRPC = "jsonrpc";
|
||||
static const char * ID = "id";
|
||||
static const char * UUID = "uuid";
|
||||
static const char * JSONRPC_VERSION = "2.0";
|
||||
static const char * METHOD = "method";
|
||||
static const char * PARAMS = "params";
|
||||
static const char * SERIAL = "serial";
|
||||
static const char * FIRMWARE = "firmware";
|
||||
static const char * CONNECT = "connect";
|
||||
static const char * STATE = "state";
|
||||
static const char * HEALTHCHECK = "healthcheck";
|
||||
static const char * LOG = "log";
|
||||
static const char * CRASHLOG = "crashlog";
|
||||
static const char * PING = "ping";
|
||||
static const char * CFGPENDING = "cfgpending";
|
||||
static const char * RECOVERY = "recovery";
|
||||
static const char * COMPRESS_64 = "compress_64";
|
||||
static const char * CAPABILITIES = "capabilities";
|
||||
static const char * REQUEST_UUID = "request_uuid";
|
||||
static const char * SANITY = "sanity";
|
||||
static const char * DATA = "data";
|
||||
static const char * LOGLINES = "loglines";
|
||||
static const char * SEVERITY = "severity";
|
||||
static const char * ACTIVE = "active";
|
||||
static const char * OVERRIDEDFS = "override_dfs";
|
||||
static const char * REBOOT = "reboot";
|
||||
static const char * WHEN = "when";
|
||||
static const char * CONFIG = "config";
|
||||
static const char * EMPTY_JSON_DOC = "{}";
|
||||
static const char * RESULT = "result";
|
||||
static const char * REQUEST = "request";
|
||||
static const char * PERFORM = "perform";
|
||||
static const char * CONFIGURE = "configure";
|
||||
static const char * PENDING = "pending";
|
||||
static const char * SUBMITTED_BY_SYSTEM = "*system";
|
||||
static const char * URI = "uri";
|
||||
static const char * COMMAND = "command";
|
||||
static const char * PAYLOAD = "payload";
|
||||
static const char * KEEP_REDIRECTOR = "keep_redirector";
|
||||
static const char * DURATION = "duration";
|
||||
static const char * PATTERN = "pattern";
|
||||
static const char * LEDS = "leds";
|
||||
static const char * ON = "on";
|
||||
static const char * OFF = "off";
|
||||
static const char * BLINK = "blink";
|
||||
static const char * PACKETS = "packets";
|
||||
static const char * NETWORK = "network";
|
||||
static const char * INTERFACE = "interface";
|
||||
static const char * TRACE = "trace";
|
||||
static const char * WIFISCAN = "wifiscan";
|
||||
static const char * TYPES = "types";
|
||||
static const char * EVENT = "event";
|
||||
static const char * MESSAGE = "message";
|
||||
static const char * RTTY = "rtty";
|
||||
static const char * TOKEN = "token";
|
||||
static const char * SERVER = "server";
|
||||
static const char * PORT = "port";
|
||||
static const char * USER = "user";
|
||||
static const char * TIMEOUT = "timeout";
|
||||
static const char * UPGRADE = "upgrade";
|
||||
static const char * FACTORY = "factory";
|
||||
static const char * VERBOSE = "verbose";
|
||||
static const char * BANDS = "bands";
|
||||
static const char * CHANNELS = "channels";
|
||||
static const char * PASSWORD = "password";
|
||||
static const char * DEVICEUPDATE = "deviceupdate";
|
||||
|
||||
static const char * SERIALNUMBER = "serialNumber";
|
||||
static const char * COMPATIBLE = "compatible";
|
||||
static const char * DISCONNECTION = "disconnection";
|
||||
static const char * TIMESTAMP = "timestamp";
|
||||
static const char * SYSTEM = "system";
|
||||
static const char * HOST = "host";
|
||||
static const char * CONNECTIONIP = "connectionIp";
|
||||
static const char * TELEMETRY = "telemetry";
|
||||
|
||||
enum EVENT_MSG {
|
||||
ET_UNKNOWN,
|
||||
ET_CONNECT,
|
||||
ET_STATE,
|
||||
ET_HEALTHCHECK,
|
||||
ET_LOG,
|
||||
ET_CRASHLOG,
|
||||
ET_PING,
|
||||
ET_CFGPENDING,
|
||||
ET_RECOVERY,
|
||||
ET_DEVICEUPDATE,
|
||||
ET_TELEMETRY
|
||||
};
|
||||
|
||||
inline static EVENT_MSG EventFromString(const std::string & Method) {
|
||||
if (!Poco::icompare(Method, CONNECT)) {
|
||||
return ET_CONNECT;
|
||||
} else if (!Poco::icompare(Method, STATE)) {
|
||||
return ET_STATE;
|
||||
} else if (!Poco::icompare(Method, HEALTHCHECK)) {
|
||||
return ET_HEALTHCHECK;
|
||||
} else if (!Poco::icompare(Method, LOG)) {
|
||||
return ET_LOG;
|
||||
} else if (!Poco::icompare(Method, CRASHLOG)) {
|
||||
return ET_CRASHLOG;
|
||||
} else if (!Poco::icompare(Method, PING)) {
|
||||
return ET_PING;
|
||||
} else if (!Poco::icompare(Method, CFGPENDING)) {
|
||||
return ET_CFGPENDING;
|
||||
} else if (!Poco::icompare(Method, RECOVERY)) {
|
||||
return ET_RECOVERY;
|
||||
} else if (!Poco::icompare(Method, DEVICEUPDATE)) {
|
||||
return ET_DEVICEUPDATE;
|
||||
} else if (!Poco::icompare(Method, TELEMETRY)) {
|
||||
return ET_TELEMETRY;
|
||||
} else
|
||||
return ET_UNKNOWN;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user