mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-11-01 19:17:47 +00:00
Merge pull request #81 from Telecominfraproject/WIFI-11974
https://telecominfraproject.atlassian.net/browse/WIFI-11974
This commit is contained in:
@@ -51,7 +51,13 @@ namespace OpenWifi {
|
|||||||
poco_information(Logger(),"Starting...");
|
poco_information(Logger(),"Starting...");
|
||||||
Running_=true;
|
Running_=true;
|
||||||
Port_ = (int)MicroServiceConfigGetInt("alb.port",15015);
|
Port_ = (int)MicroServiceConfigGetInt("alb.port",15015);
|
||||||
Socket_ = std::make_unique<Poco::Net::ServerSocket>(Port_);
|
Poco::Net::IPAddress Addr(Poco::Net::IPAddress::wildcard(
|
||||||
|
Poco::Net::Socket::supportsIPv6() ? Poco::Net::AddressFamily::IPv6
|
||||||
|
: Poco::Net::AddressFamily::IPv4));
|
||||||
|
Poco::Net::SocketAddress SockAddr(Addr, Port_);
|
||||||
|
Poco::Net::ServerSocket ClientSocket(SockAddr, 64);
|
||||||
|
|
||||||
|
Socket_ = std::make_unique<Poco::Net::ServerSocket>(SockAddr, Port_);
|
||||||
auto Params = new Poco::Net::HTTPServerParams;
|
auto Params = new Poco::Net::HTTPServerParams;
|
||||||
Params->setName("ws:alb");
|
Params->setName("ws:alb");
|
||||||
Server_ = std::make_unique<Poco::Net::HTTPServer>(new ALBRequestHandlerFactory(Logger()), *Socket_, Params);
|
Server_ = std::make_unique<Poco::Net::HTTPServer>(new ALBRequestHandlerFactory(Logger()), *Socket_, Params);
|
||||||
|
|||||||
@@ -633,6 +633,18 @@ namespace OpenWifi {
|
|||||||
ReturnObject(Answer);
|
ReturnObject(Answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T> void Object(const char *Name, const std::vector<T> & Objects) {
|
||||||
|
Poco::JSON::Object Answer;
|
||||||
|
RESTAPI_utils::field_to_json(Answer,Name,Objects);
|
||||||
|
ReturnObject(Answer);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> void Object(const T &O) {
|
||||||
|
Poco::JSON::Object Answer;
|
||||||
|
O.to_json(Answer);
|
||||||
|
ReturnObject(Answer);
|
||||||
|
}
|
||||||
|
|
||||||
Poco::Logger & Logger() { return Logger_; }
|
Poco::Logger & Logger() { return Logger_; }
|
||||||
|
|
||||||
virtual void DoGet() = 0 ;
|
virtual void DoGet() = 0 ;
|
||||||
|
|||||||
Reference in New Issue
Block a user