mirror of
				https://github.com/Telecominfraproject/wlan-cloud-owprov.git
				synced 2025-10-30 18:18:03 +00:00 
			
		
		
		
	Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
		| @@ -2749,7 +2749,7 @@ static json DefaultUCentralSchema = R"( | ||||
|             if(std::regex_match(value,host_regex)) | ||||
|                 return; | ||||
|             throw std::invalid_argument(value + " is not a proper FQDN."); | ||||
|         } else if(format == "fqdn") { | ||||
|         } else if(format == "fqdn" || format=="uc-fqdn") { | ||||
|             if(std::regex_match(value,host_regex)) | ||||
|                 return; | ||||
|             throw std::invalid_argument(value + " is not a proper FQDN."); | ||||
|   | ||||
| @@ -102,6 +102,48 @@ namespace OpenWifi { | ||||
| 													  E.displayText(), | ||||
| 													  E.message(), | ||||
| 													  E.what())); | ||||
| 			} catch (const Poco::TimeoutException &E) { | ||||
| 				poco_error(App_.logger(), fmt::format("Poco::TimeoutException thr_name={} thr_id={} code={} text={} msg={} what={}", | ||||
| 													  t_name, t_id, E.code(), | ||||
| 													  E.displayText(), | ||||
| 													  E.message(), | ||||
| 													  E.what())); | ||||
| 			} catch (const Poco::NoThreadAvailableException &E) { | ||||
| 				poco_error(App_.logger(), fmt::format("Poco::NoThreadAvailableException thr_name={} thr_id={} code={} text={} msg={} what={}", | ||||
| 													  t_name, t_id, E.code(), | ||||
| 													  E.displayText(), | ||||
| 													  E.message(), | ||||
| 													  E.what())); | ||||
| 			} catch (const Poco::OutOfMemoryException &E) { | ||||
| 				poco_error(App_.logger(), fmt::format("Poco::OutOfMemoryException thr_name={} thr_id={} code={} text={} msg={} what={}", | ||||
| 													  t_name, t_id, E.code(), | ||||
| 													  E.displayText(), | ||||
| 													  E.message(), | ||||
| 													  E.what())); | ||||
| 			} catch (const Poco::BadCastException &E) { | ||||
| 				poco_error(App_.logger(), fmt::format("Poco::BadCastException thr_name={} thr_id={} code={} text={} msg={} what={}", | ||||
| 													  t_name, t_id, E.code(), | ||||
| 													  E.displayText(), | ||||
| 													  E.message(), | ||||
| 													  E.what())); | ||||
| 			} catch (const Poco::DataException &E) { | ||||
| 				poco_error(App_.logger(), fmt::format("Poco::DataException thr_name={} thr_id={} code={} text={} msg={} what={}", | ||||
| 													  t_name, t_id, E.code(), | ||||
| 													  E.displayText(), | ||||
| 													  E.message(), | ||||
| 													  E.what())); | ||||
| 			} catch (const Poco::PoolOverflowException &E) { | ||||
| 				poco_error(App_.logger(), fmt::format("Poco::PoolOverflowException thr_name={} thr_id={} code={} text={} msg={} what={}", | ||||
| 													  t_name, t_id, E.code(), | ||||
| 													  E.displayText(), | ||||
| 													  E.message(), | ||||
| 													  E.what())); | ||||
| 			} catch (const Poco::SystemException &E) { | ||||
| 				poco_error(App_.logger(), fmt::format("Poco::SystemException thr_name={} thr_id={} code={} text={} msg={} what={}", | ||||
| 													  t_name, t_id, E.code(), | ||||
| 													  E.displayText(), | ||||
| 													  E.message(), | ||||
| 													  E.what())); | ||||
| 			} catch (const Poco::RuntimeException &E) { | ||||
| 				poco_error(App_.logger(), fmt::format("Poco::RuntimeException thr_name={} thr_id={} code={} text={} msg={} what={}", | ||||
| 													  t_name, t_id, E.code(), | ||||
|   | ||||
| @@ -119,7 +119,7 @@ namespace OpenWifi { | ||||
| 	} | ||||
|  | ||||
| 	bool UI_WebSocketClientServer::SendToUser(const std::string &UserName, std::uint64_t id, const std::string &Payload) { | ||||
| 		std::lock_guard G(Mutex_); | ||||
| 		std::lock_guard G(LocalMutex_); | ||||
|  | ||||
| 		for(const auto &Client:Clients_) { | ||||
| 			if(Client.second->UserName_ == UserName) { | ||||
| @@ -139,7 +139,7 @@ namespace OpenWifi { | ||||
| 	} | ||||
|  | ||||
| 	void UI_WebSocketClientServer::SendToAll(std::uint64_t id, const std::string &Payload) { | ||||
| 		std::lock_guard G(Mutex_); | ||||
| 		std::lock_guard G(LocalMutex_); | ||||
|  | ||||
| 		for(const auto &Client:Clients_) { | ||||
| 			try { | ||||
| @@ -189,7 +189,6 @@ namespace OpenWifi { | ||||
| 	void UI_WebSocketClientServer::OnSocketReadable([[maybe_unused]] const Poco::AutoPtr<Poco::Net::ReadableNotification> &pNf) { | ||||
|  | ||||
|         UI_WebSocketClientServer::ClientList::iterator Client; | ||||
|  | ||||
|         std::lock_guard     G(LocalMutex_); | ||||
|  | ||||
| 		try { | ||||
| @@ -295,6 +294,7 @@ namespace OpenWifi { | ||||
|  | ||||
| 	void UI_WebSocketClientServer::OnSocketShutdown([[maybe_unused]] const Poco::AutoPtr<Poco::Net::ShutdownNotification> &pNf) { | ||||
|         try { | ||||
| 			std::lock_guard     G(LocalMutex_); | ||||
| 			auto Client = Clients_.find(pNf->socket().impl()->sockfd()); | ||||
|             if (Client == end(Clients_)) | ||||
|                 return; | ||||
|   | ||||
| @@ -231,6 +231,8 @@ namespace OpenWifi::RESTAPI::Errors { | ||||
| 	static const struct msg DeviceIsRestricted{1151,"Device is protected by regulation. This function is not allowed."}; | ||||
| 	static const struct msg InvalidURI{1152,"Invalid URI."}; | ||||
| 	static const struct msg InvalidScriptSelection{1153,"Only script or scriptId must be specified. Not both."}; | ||||
|  | ||||
| 	static const struct msg NoDeviceStatisticsYet{1154,"Device statistics not available yet."}; | ||||
| 	} | ||||
|  | ||||
|  | ||||
| @@ -526,6 +528,63 @@ namespace OpenWifi::uCentralProtocol::Events { | ||||
| 	}; | ||||
| } | ||||
|  | ||||
| namespace OpenWifi::APCommands { | ||||
| 	enum class Commands:uint8_t { | ||||
| 		capabilities, | ||||
| 		logs, | ||||
| 		healthchecks, | ||||
| 		statistics, | ||||
| 		status, | ||||
| 		rtty, | ||||
| 		configure, | ||||
| 		upgrade, | ||||
| 		reboot, | ||||
| 		factory, | ||||
| 		leds, | ||||
| 		trace, | ||||
| 		request, | ||||
| 		wifiscan, | ||||
| 		eventqueue, | ||||
| 		telemetry, | ||||
| 		ping, | ||||
| 		script, | ||||
| 		unknown | ||||
| 	}; | ||||
|  | ||||
| 	inline static const std::vector<const char *> uCentralAPCommands { | ||||
| 		RESTAPI::Protocol::CAPABILITIES, | ||||
| 		RESTAPI::Protocol::LOGS, | ||||
| 		RESTAPI::Protocol::HEALTHCHECKS, | ||||
| 		RESTAPI::Protocol::STATISTICS, | ||||
| 		RESTAPI::Protocol::STATUS, | ||||
| 		RESTAPI::Protocol::RTTY, | ||||
| 		RESTAPI::Protocol::CONFIGURE, | ||||
| 		RESTAPI::Protocol::UPGRADE, | ||||
| 		RESTAPI::Protocol::REBOOT, | ||||
| 		RESTAPI::Protocol::FACTORY, | ||||
| 		RESTAPI::Protocol::LEDS, | ||||
| 		RESTAPI::Protocol::TRACE, | ||||
| 		RESTAPI::Protocol::REQUEST, | ||||
| 		RESTAPI::Protocol::WIFISCAN, | ||||
| 		RESTAPI::Protocol::EVENTQUEUE, | ||||
| 		RESTAPI::Protocol::TELEMETRY, | ||||
| 		RESTAPI::Protocol::PING, | ||||
| 		RESTAPI::Protocol::SCRIPT}; | ||||
|  | ||||
| 	inline const char * to_string(Commands Cmd) { | ||||
| 		return uCentralAPCommands[(uint8_t)Cmd]; | ||||
| 	} | ||||
|  | ||||
| 	inline Commands to_apcommand(const char *cmd) { | ||||
| 		for(auto i=(uint8_t)Commands::capabilities;i!=(uint8_t)Commands::unknown;++i) { | ||||
| 			if(strcmp(uCentralAPCommands[i],cmd)==0) | ||||
| 				return (Commands)i; | ||||
| 		} | ||||
| 		return Commands::unknown; | ||||
| 	} | ||||
|  | ||||
| } | ||||
|  | ||||
| namespace OpenWifi::Provisioning::DeviceClass { | ||||
|  | ||||
|     static const char * ANY = "any"; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 stephb9959
					stephb9959