Framework update.

This commit is contained in:
stephb9959
2022-05-06 23:17:03 -07:00
parent 052472ae66
commit 7e4fb0e707
6 changed files with 209 additions and 145 deletions

2
build
View File

@@ -1 +1 @@
55
57

View File

@@ -20,7 +20,7 @@ namespace OpenWifi {
Rec.to_json(Obj);
ObjArr.add(Obj);
} else {
return R.BadRequest(RESTAPI::Errors::UnknownId + i);
return R.BadRequest(RESTAPI::Errors::UnknownId);
}
}
Poco::JSON::Object Answer;

View File

@@ -48,7 +48,7 @@ namespace OpenWifi {
return BadRequest(RESTAPI::Errors::MissingUUID);
}
auto RawObject = ParseStream();
const auto & RawObject = ParsedBody_;
AnalyticsObjects::BoardInfo NewObject;
if(!NewObject.from_json(RawObject)) {
return BadRequest(RESTAPI::Errors::InvalidJSONDocument);
@@ -77,7 +77,7 @@ namespace OpenWifi {
return NotFound();
}
auto RawObject = ParseStream();
const auto & RawObject = ParsedBody_;
AnalyticsObjects::BoardInfo NewObject;
if(!NewObject.from_json(RawObject)) {
return BadRequest(RESTAPI::Errors::InvalidJSONDocument);
@@ -87,7 +87,7 @@ namespace OpenWifi {
if(RawObject->has("venueList")) {
if(NewObject.venueList.empty()) {
return BadRequest("Invalid VenueList.");
return BadRequest(RESTAPI::Errors::VenueMustExist);
}
Existing.venueList = NewObject.venueList;
}
@@ -100,6 +100,6 @@ namespace OpenWifi {
NewBoard.to_json(Answer);
return ReturnObject(Answer);
}
return InternalError("Board could nto be modified. Verify and try again.");
return InternalError(RESTAPI::Errors::RecordNotUpdated);
}
}

View File

@@ -1812,8 +1812,14 @@ namespace OpenWifi {
Poco::Thread::current()->setName("WebServerThread_" + std::to_string(TransactionId_));
if(Request->getContentLength()>0) {
if(Request->getContentType().find("application/json")!=std::string::npos) {
ParsedBody_ = IncomingParser_.parse(Request->stream()).extract<Poco::JSON::Object::Ptr>();
}
}
if(RateLimited_ && RESTAPI_RateLimiter()->IsRateLimited(RequestIn,MyRates_.Interval, MyRates_.MaxCalls)) {
return UnAuthorized("Rate limit exceeded.",RATE_LIMIT_EXCEEDED);
return UnAuthorized(RESTAPI::Errors::RATE_LIMIT_EXCEEDED);
}
if (!ContinueProcessing())
@@ -1822,16 +1828,16 @@ namespace OpenWifi {
bool Expired=false, Contacted=false;
if (AlwaysAuthorize_ && !IsAuthorized(Expired, Contacted, SubOnlyService_)) {
if(Expired)
return UnAuthorized(RESTAPI::Errors::ExpiredToken, EXPIRED_TOKEN);
return UnAuthorized(RESTAPI::Errors::EXPIRED_TOKEN);
if(Contacted)
return UnAuthorized(RESTAPI::Errors::InvalidCredentials, INVALID_TOKEN);
return UnAuthorized(RESTAPI::Errors::INVALID_TOKEN);
else
return UnAuthorized(RESTAPI::Errors::InvalidCredentials, SECURITY_SERVICE_UNREACHABLE);
return UnAuthorized(RESTAPI::Errors::SECURITY_SERVICE_UNREACHABLE);
}
std::string Reason;
if(!RoleIsAuthorized(RequestIn.getURI(), Request->getMethod(), Reason)) {
return UnAuthorized(Reason, ACCESS_DENIED);
return UnAuthorized(RESTAPI::Errors::ACCESS_DENIED);
}
ParseParameters();
@@ -1853,10 +1859,10 @@ namespace OpenWifi {
[[nodiscard]] inline bool NeedAdditionalInfo() const { return QB_.AdditionalInfo; }
[[nodiscard]] inline const std::vector<std::string> & SelectedRecords() const { return QB_.Select; }
[[nodiscard]] inline const Poco::JSON::Object::Ptr ParseStream() {
/* [[nodiscard]] inline const Poco::JSON::Object::Ptr ParseStream() {
return IncomingParser_.parse(Request->stream()).extract<Poco::JSON::Object::Ptr>();
}
*/
inline static bool ParseBindings(const std::string & Request, const std::list<std::string> & EndPoints, BindingMap &bindings) {
bindings.clear();
@@ -2011,7 +2017,7 @@ namespace OpenWifi {
return false;
}
inline void SetCommonHeaders(bool CloseConnection=false) {
inline void SetCommonHeaders(bool CloseConnection=false) {
Response->setVersion(Poco::Net::HTTPMessage::HTTP_1_1);
Response->setChunkedTransferEncoding(true);
Response->setContentType("application/json");
@@ -2032,21 +2038,6 @@ namespace OpenWifi {
}
}
/* inline void AddCORS() {
SetCommonHeaders();
auto Origin = Request->find("Origin");
if (Origin != Request->end()) {
Response->set("Access-Control-Allow-Origin", Origin->second);
Response->set("Vary", "Origin");
} else {
Response->set("Access-Control-Allow-Origin", "*");
}
Response->set("Access-Control-Allow-Headers", "*");
Response->set("Access-Control-Allow-Methods", MakeList(Methods_));
Response->set("Access-Control-Max-Age", "86400");
}
*/
inline void ProcessOptions() {
Response->setVersion(Poco::Net::HTTPMessage::HTTP_1_1);
Response->setChunkedTransferEncoding(true);
@@ -2077,17 +2068,17 @@ namespace OpenWifi {
SetCommonHeaders(CloseConnection);
}
inline void BadRequest(const std::string & Reason) {
inline void BadRequest(const OpenWifi::RESTAPI::Errors::msg &E) {
PrepareResponse(Poco::Net::HTTPResponse::HTTP_BAD_REQUEST);
Poco::JSON::Object ErrorObject;
ErrorObject.set("ErrorCode",400);
ErrorObject.set("ErrorDetails",Request->getMethod());
ErrorObject.set("ErrorDescription",Reason.empty() ? "Command is missing parameters or wrong values." : Reason) ;
ErrorObject.set("ErrorDescription",fmt::format("{}: {}",E.err_num,E.err_txt)) ;
std::ostream &Answer = Response->send();
Poco::JSON::Stringifier::stringify(ErrorObject, Answer);
}
inline void BadRequest(uint64_t ErrorCode, const std::string & ErrorText) {
/* inline void BadRequest(uint64_t ErrorCode, const std::string & ErrorText) {
PrepareResponse(Poco::Net::HTTPResponse::HTTP_BAD_REQUEST);
Poco::JSON::Object ErrorObject;
ErrorObject.set("ErrorCode", ErrorCode);
@@ -2096,23 +2087,23 @@ namespace OpenWifi {
std::ostream &Answer = Response->send();
Poco::JSON::Stringifier::stringify(ErrorObject, Answer);
}
inline void InternalError(const std::string & Reason = "") {
*/
inline void InternalError(const OpenWifi::RESTAPI::Errors::msg &E) {
PrepareResponse(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR);
Poco::JSON::Object ErrorObject;
ErrorObject.set("ErrorCode",500);
ErrorObject.set("ErrorDetails",Request->getMethod());
ErrorObject.set("ErrorDescription",Reason.empty() ? "Please try later or review the data submitted." : Reason) ;
ErrorObject.set("ErrorDescription",fmt::format("{}: {}",E.err_num,E.err_txt)) ;
std::ostream &Answer = Response->send();
Poco::JSON::Stringifier::stringify(ErrorObject, Answer);
}
inline void UnAuthorized(const std::string & Reason = "", int Code = INVALID_CREDENTIALS ) {
inline void UnAuthorized(const OpenWifi::RESTAPI::Errors::msg &E) {
PrepareResponse(Poco::Net::HTTPResponse::HTTP_FORBIDDEN);
Poco::JSON::Object ErrorObject;
ErrorObject.set("ErrorCode",Code);
ErrorObject.set("ErrorCode",E.err_num);
ErrorObject.set("ErrorDetails",Request->getMethod());
ErrorObject.set("ErrorDescription",Reason.empty() ? "No access allowed." : Reason) ;
ErrorObject.set("ErrorDescription",fmt::format("{}: {}",E.err_num,E.err_txt)) ;
std::ostream &Answer = Response->send();
Poco::JSON::Stringifier::stringify(ErrorObject, Answer);
}
@@ -2122,7 +2113,8 @@ namespace OpenWifi {
Poco::JSON::Object ErrorObject;
ErrorObject.set("ErrorCode",404);
ErrorObject.set("ErrorDetails",Request->getMethod());
ErrorObject.set("ErrorDescription","This resource does not exist.");
const auto & E = OpenWifi::RESTAPI::Errors::Error404;
ErrorObject.set("ErrorDescription",fmt::format("{}: {}",E.err_num,E.err_txt)) ;
std::ostream &Answer = Response->send();
Poco::JSON::Stringifier::stringify(ErrorObject, Answer);
Logger_.debug(fmt::format("RES-NOTFOUND: User='{}@{}' Method='{}' Path='{}",
@@ -2261,28 +2253,28 @@ namespace OpenWifi {
return true;
}
inline bool IsAuthorized(bool & Expired, bool & Contacted, bool SubOnly = false );
inline bool IsAuthorized(bool & Expired, bool & Contacted, bool SubOnly = false );
inline void ReturnObject(Poco::JSON::Object &Object) {
PrepareResponse();
if(Request!= nullptr) {
// can we compress ???
auto AcceptedEncoding = Request->find("Accept-Encoding");
if(AcceptedEncoding!=Request->end()) {
if( AcceptedEncoding->second.find("gzip")!=std::string::npos ||
AcceptedEncoding->second.find("compress")!=std::string::npos) {
Response->set("Content-Encoding", "gzip");
std::ostream &Answer = Response->send();
Poco::DeflatingOutputStream deflater(Answer, Poco::DeflatingStreamBuf::STREAM_GZIP);
Poco::JSON::Stringifier::stringify(Object, deflater);
deflater.close();
return;
}
inline void ReturnObject(Poco::JSON::Object &Object) {
PrepareResponse();
if(Request!= nullptr) {
// can we compress ???
auto AcceptedEncoding = Request->find("Accept-Encoding");
if(AcceptedEncoding!=Request->end()) {
if( AcceptedEncoding->second.find("gzip")!=std::string::npos ||
AcceptedEncoding->second.find("compress")!=std::string::npos) {
Response->set("Content-Encoding", "gzip");
std::ostream &Answer = Response->send();
Poco::DeflatingOutputStream deflater(Answer, Poco::DeflatingStreamBuf::STREAM_GZIP);
Poco::JSON::Stringifier::stringify(Object, deflater);
deflater.close();
return;
}
}
std::ostream &Answer = Response->send();
Poco::JSON::Stringifier::stringify(Object, Answer);
}
}
std::ostream &Answer = Response->send();
Poco::JSON::Stringifier::stringify(Object, Answer);
}
inline void ReturnCountOnly(uint64_t Count) {
Poco::JSON::Object Answer;
@@ -2372,6 +2364,7 @@ namespace OpenWifi {
RESTAPI_GenericServer & Server_;
RateLimit MyRates_;
uint64_t TransactionId_;
Poco::JSON::Object::Ptr ParsedBody_;
};
class RESTAPI_UnknownRequestHandler : public RESTAPIHandler {
@@ -4262,7 +4255,7 @@ namespace OpenWifi {
}
inline void DoPost() final {
auto Obj = ParseStream();
const auto & Obj = ParsedBody_;
if (Obj->has(RESTAPI::Protocol::COMMAND)) {
auto Command = Poco::toLower(Obj->get(RESTAPI::Protocol::COMMAND).toString());
if (Command == RESTAPI::Protocol::SETLOGLEVEL) {

View File

@@ -25,6 +25,30 @@ namespace OpenWifi {
}
};
struct WebNotificationSingleDeviceConfigurationChange {
std::string serialNumber;
uint64_t oldUUID;
uint64_t newUUID;
inline void to_json(Poco::JSON::Object &Obj) const {
RESTAPI_utils::field_to_json(Obj,"serialNumber", serialNumber);
RESTAPI_utils::field_to_json(Obj,"oldUUID", oldUUID);
RESTAPI_utils::field_to_json(Obj,"newUUID", newUUID);
}
inline bool from_json(const Poco::JSON::Object::Ptr &Obj) {
try {
RESTAPI_utils::field_from_json(Obj,"serialNumber", serialNumber);
RESTAPI_utils::field_from_json(Obj,"oldUUID", oldUUID);
RESTAPI_utils::field_from_json(Obj,"newUUID", newUUID);
return true;
} catch (...) {
}
return false;
}
};
struct WebNotificationSingleDeviceFirmwareChange {
std::string serialNumber;
std::string newFirmware;
@@ -45,6 +69,15 @@ namespace OpenWifi {
}
};
inline void WebSocketClientNotificationDeviceConfigurationChange(const std::string &SerialNumber, uint64_t oldUUID, uint64_t newUUID) {
WebSocketNotification<WebNotificationSingleDeviceConfigurationChange> N;
N.content.serialNumber = SerialNumber;
N.content.oldUUID = oldUUID;
N.content.newUUID = newUUID;
N.type = "device_configuration_upgrade";
WebSocketClientServer()->SendNotification(N);
}
inline void WebSocketClientNotificationDeviceFirmwareUpdated(const std::string &SerialNumber, const std::string &Firmware) {
WebSocketNotification<WebNotificationSingleDeviceFirmwareChange> N;
N.content.serialNumber = SerialNumber;

View File

@@ -18,92 +18,130 @@
#endif
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"};
static const std::string SerialNumberAlreadyProvisioned{"This device has already been provisioned to a subscriber."};
static const std::string SerialNumberNotTheProperClass{"Device is not available to subscribers. It ahs been assigned to another class of devices."};
static const std::string UserAlreadyExists{"Username already exists."};
static const std::string NotImplemented{"Function not implemented."};
static const std::string VariableMustExist{"Specified variable does not exist."};
static const std::string InvalidEntityType{"Invalid entity type."};
static const std::string CannotDeleteSubEntity{"Cannot delete the default subscriber entity."};
static const std::string OperatorIdMustExist{"Missing or bad Operator ID"};
static const std::string CannotDeleteDefaultOperator{"Cannot delete the default operator."};
static const std::string CannotCreateDefaultOperator{"Cannot create the default operator."};
static const std::string InvalidRRM{"Invalid RRM value."};
static const std::string InvalidIPAddresses{"Invalid IP addresses."};
static const std::string InvalidBillingCode{"Empty of invalid billing code."};
static const std::string InvalidBillingPeriod{"Invalid billing period."};
static const std::string InvalidSubscriberId{"Invalid subscriber ID."};
static const std::string InvalidContactId{"Invalid contact ID."};
static const std::string InvalidLocationId{"Invalid location ID."};
static const std::string InvalidContactType{"Invalid contact type."};
static const std::string InvalidLocationType{"Invalid location type."};
static const std::string InvalidOperatorId{"Invalid operator ID."};
static const std::string InvalidServiceClassId{"Invalid service class ID."};
static const std::string InvalidSubscriberDeviceId{"Invalid subscriber device ID."};
static const std::string InvalidRegistrationOperatorId{"Invalid registration operator ID."};
static const std::string InvalidRegistrationOperatorName{"Invalid registration operator name."};
static const std::string RegistrationNameDuplicate{"Registration name must be unique."};
static const std::string SMSMFANotEnabled{"SMS is not enabled in the security service."};
static const std::string EMailMFANotEnabled{"email is not enabled in the security service."};
struct msg { uint64_t err_num; std::string err_txt; };
static const struct msg Error404{404,"Resource does not exist."};
static const struct msg PASSWORD_CHANGE_REQUIRED{1,"Password change required"};
static const struct msg INVALID_CREDENTIALS{2,"Invalid credentials."};
static const struct msg PASSWORD_ALREADY_USED{3,"Password already used."};
static const struct msg USERNAME_PENDING_VERIFICATION{4,"Username pending verification."};
static const struct msg PASSWORD_INVALID{5,"Password is invalid"};
static const struct msg INTERNAL_ERROR{6,"Internal error."};
static const struct msg ACCESS_DENIED{7,"Access denied."};
static const struct msg INVALID_TOKEN{8,"Invalid token."};
static const struct msg EXPIRED_TOKEN{9,"Expired token."};
static const struct msg RATE_LIMIT_EXCEEDED{10,"Rate limit exceeded."};
static const struct msg BAD_MFA_TRANSACTION{11,"Bad MFA transaction."};
static const struct msg MFA_FAILURE{12,"MFA failure."};
static const struct msg SECURITY_SERVICE_UNREACHABLE{13,"Security service is unreachable, try again later."};
static const struct msg CANNOT_REFRESH_TOKEN{14,"Cannot refresh token."};
static const struct msg MissingUUID{1000,"Missing UUID."};
static const struct msg MissingSerialNumber{1001,"Missing Serial Number."};
static const struct msg InternalError{1002,"Internal error. Please try later."};
static const struct msg InvalidJSONDocument{1003,"Invalid JSON document."};
static const struct msg UnsupportedHTTPMethod{1004,"Unsupported HTTP Method"};
static const struct msg StillInUse{1005,"Element still in use."};
static const struct msg CouldNotBeDeleted{1006,"Element could not be deleted."};
static const struct msg NameMustBeSet{1007,"The name property must be set."};
static const struct msg ConfigBlockInvalid{1008,"Configuration block type invalid."};
static const struct msg UnknownId{1009,"Unknown UUID."};
static const struct msg InvalidDeviceTypes{1010,"Unknown or invalid device type(s)."};
static const struct msg RecordNotCreated{1011,"Record could not be created."};
static const struct msg RecordNotUpdated{1012,"Record could not be updated."};
static const struct msg UnknownManagementPolicyUUID{1013,"Unknown management policy UUID."};
static const struct msg CannotDeleteRoot{1014,"Root Entity cannot be removed, only modified."};
static const struct msg MustCreateRootFirst{1015,"Root entity must be created first."};
static const struct msg ParentUUIDMustExist{1016,"Parent UUID must exist."};
static const struct msg ConfigurationMustExist{1017,"Configuration must exist."};
static const struct msg MissingOrInvalidParameters{1018,"Invalid or missing parameters."};
static const struct msg UnknownSerialNumber{1019,"Unknown Serial Number."};
static const struct msg InvalidSerialNumber{1020,"Invalid Serial Number."};
static const struct msg SerialNumberExists{1021,"Serial Number already exists."};
static const struct msg ValidNonRootUUID{1022,"Must be a non-root, and valid UUID."};
static const struct msg VenueMustExist{1023,"Venue does not exist."};
static const struct msg NotBoth{1024,"You cannot specify both Entity and Venue"};
static const struct msg EntityMustExist{1025,"Entity must exist."};
static const struct msg ParentOrEntityMustBeSet{1026,"Parent or Entity must be set."};
static const struct msg ContactMustExist{1027,"Contact must exist."};
static const struct msg LocationMustExist{1028,"Location must exist."};
static const struct msg OnlyWSSupported{1029,"This endpoint only supports WebSocket."};
static const struct msg SerialNumberMismatch{1030,"Serial Number mismatch."};
static const struct msg InvalidCommand{1031,"Invalid command."};
static const struct msg NoRecordsDeleted{1032,"No records deleted."};
static const struct msg DeviceNotConnected{1033,"Device is not currently connected."};
static const struct msg CannotCreateWS{1034,"Telemetry system could not create WS endpoint. Please try again."};
static const struct msg BothDeviceTypeRevision{1035,"Both deviceType and revision must be set."};
static const struct msg IdOrSerialEmpty{1036,"SerialNumber and Id must not be empty."};
static const struct msg MissingUserID{1037,"Missing user ID."};
static const struct msg IdMustBe0{1038,"To create a user, you must set the ID to 0"};
static const struct msg InvalidUserRole{1039,"Invalid userRole."};
static const struct msg InvalidEmailAddress{1040,"Invalid email address."};
static const struct msg PasswordRejected{1041,"Password was rejected. This maybe an old password."};
static const struct msg InvalidIPRanges{1042,"Invalid IP range specifications."};
static const struct msg InvalidLOrderBy{1043,"Invalid orderBy specification."};
static const struct msg NeedMobileNumber{1044,"You must provide at least one validated phone number."};
static const struct msg BadMFAMethod{1045,"MFA only supports sms or email."};
static const struct msg InvalidCredentials{1046,"Invalid credentials (username/password)."};
static const struct msg InvalidPassword{1047,"Password does not conform to basic password rules."};
static const struct msg UserPendingVerification{1048,"User access denied pending email verification."};
static const struct msg PasswordMustBeChanged{1049,"Password must be changed."};
static const struct msg UnrecognizedRequest{1050,"Ill-formed request. Please consult documentation."};
static const struct msg MissingAuthenticationInformation{1051,"Missing authentication information."};
static const struct msg InsufficientAccessRights{1052,"Insufficient access rights to complete the operation."};
static const struct msg ExpiredToken{1053,"Token has expired, user must login."};
static const struct msg SubscriberMustExist{1054,"Subscriber must exist."};
static const struct msg AuthenticatorVerificationIncomplete{1055,"Authenticator validation is not complete."};
static const struct msg SMSCouldNotBeSentRetry{1056,"SMS could not be sent to validate device, try later or change the phone number."};
static const struct msg SMSCouldNotValidate{1057,"Code and number could not be validated"};
static const struct msg InvalidDeviceClass{1058,"Invalid device class. Must be: any, venue, entity, or subscriber"};
static const struct msg SerialNumberAlreadyProvisioned{1059,"This device has already been provisioned to a subscriber."};
static const struct msg SerialNumberNotTheProperClass{1060,"Device is not available to subscribers. It ahs been assigned to another class of devices."};
static const struct msg UserAlreadyExists{1061,"Username already exists."};
static const struct msg NotImplemented{1062,"Function not implemented."};
static const struct msg VariableMustExist{1063,"Specified variable does not exist."};
static const struct msg InvalidEntityType{1064,"Invalid entity type."};
static const struct msg CannotDeleteSubEntity{1065,"Cannot delete the default subscriber entity."};
static const struct msg OperatorIdMustExist{1066,"Missing or bad Operator ID"};
static const struct msg CannotDeleteDefaultOperator{1067,"Cannot delete the default operator."};
static const struct msg CannotCreateDefaultOperator{1068,"Cannot create the default operator."};
static const struct msg InvalidRRM{1069,"Invalid RRM value."};
static const struct msg InvalidIPAddresses{1070,"Invalid IP addresses."};
static const struct msg InvalidBillingCode{1071,"Empty of invalid billing code."};
static const struct msg InvalidBillingPeriod{1072,"Invalid billing period."};
static const struct msg InvalidSubscriberId{1073,"Invalid subscriber ID."};
static const struct msg InvalidContactId{1074,"Invalid contact ID."};
static const struct msg InvalidLocationId{1075,"Invalid location ID."};
static const struct msg InvalidContactType{1076,"Invalid contact type."};
static const struct msg InvalidLocationType{1077,"Invalid location type."};
static const struct msg InvalidOperatorId{1078,"Invalid operator ID."};
static const struct msg InvalidServiceClassId{1079,"Invalid service class ID."};
static const struct msg InvalidSubscriberDeviceId{1080,"Invalid subscriber device ID."};
static const struct msg InvalidRegistrationOperatorId{1081,"Invalid registration operator ID."};
static const struct msg InvalidRegistrationOperatorName{1082,"Invalid registration operator name."};
static const struct msg RegistrationNameDuplicate{1083,"Registration name must be unique."};
static const struct msg SMSMFANotEnabled{1084,"SMS is not enabled in the security service."};
static const struct msg EMailMFANotEnabled{1085,"email is not enabled in the security service."};
static const struct msg TOTInvalidCode{1086,"Invalid code."};
static const struct msg TOTInvalidIndex{1087,"Invalid index."};
static const struct msg TOTRepeatedCode{1088,"Code is repeated. Must be new code."};
static const struct msg TOTInvalidProtocol{1089,"Invalid protocol sequence."};
static const struct msg TOTNoSession{1090,"No validation session present."};
static const struct msg SignupAlreadySigned{1091,"Code is repeated. Must be new code."};
static const struct msg SignupEmailCheck{1092,"Waiting for email check completion."};
static const struct msg SignupWaitingForDevice{1093,"Waiting for device."};
static const struct msg SMSMissingPhoneNumber{1094,"Missing phone number"};
static const struct msg SMSTryLater{1095,"SMS could not be sent. Verify the number or try again later."};
static const struct msg SMSMissingChallenge{1096,"Missing 'challengeCode'"};
static const struct msg MustHaveConfigElement{1097,"Must have 'configuration' element."};
static const struct msg ModelIDListCannotBeEmpty{1098,"Model ID list cannot be empty."};
static const struct msg DefConfigNameExists{1099,"Configuration name already exists."};
}
namespace OpenWifi::RESTAPI::Protocol {