mirror of
				https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
				synced 2025-11-03 20:27:45 +00:00 
			
		
		
		
	Compare commits
	
		
			32 Commits
		
	
	
		
			release/v2
			...
			v3.2.0
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					85e24b430d | ||
| 
						 | 
					d5b54a67f4 | ||
| 
						 | 
					cb5dcde0ca | ||
| 
						 | 
					1977ecdfb7 | ||
| 
						 | 
					7be170a0bd | ||
| 
						 | 
					1d703e1737 | ||
| 
						 | 
					22ddb40d4c | ||
| 
						 | 
					791b72aec4 | ||
| 
						 | 
					46b9524903 | ||
| 
						 | 
					bb09f919e6 | ||
| 
						 | 
					8d04cbc059 | ||
| 
						 | 
					073856d385 | ||
| 
						 | 
					c782981ca7 | ||
| 
						 | 
					ca3691e665 | ||
| 
						 | 
					be2ffc86ec | ||
| 
						 | 
					75ebc0771c | ||
| 
						 | 
					d050635a99 | ||
| 
						 | 
					e3592b5fe6 | ||
| 
						 | 
					9eec54effb | ||
| 
						 | 
					6a7ae342dc | ||
| 
						 | 
					5b3205823e | ||
| 
						 | 
					db45a01bce | ||
| 
						 | 
					d2f70ec82d | ||
| 
						 | 
					2b01453970 | ||
| 
						 | 
					68ccc4da93 | ||
| 
						 | 
					1b4a58c95c | ||
| 
						 | 
					bd20abacdf | ||
| 
						 | 
					f0ca087d48 | ||
| 
						 | 
					21bf1ff148 | ||
| 
						 | 
					66c010dd28 | ||
| 
						 | 
					0fb18e8a32 | ||
| 
						 | 
					da21df49ce | 
							
								
								
									
										62
									
								
								BUILDING.md
									
									
									
									
									
								
							
							
						
						
									
										62
									
								
								BUILDING.md
									
									
									
									
									
								
							@@ -1,6 +1,6 @@
 | 
				
			|||||||
# Building from source
 | 
					# Building from source
 | 
				
			||||||
 | 
					
 | 
				
			||||||
In order to build the OWSEC, you will need to install its dependencies, which includes the following:
 | 
					In order to build OWSEC, you will need to install its dependencies, which includes the following:
 | 
				
			||||||
- cmake
 | 
					- cmake
 | 
				
			||||||
- boost
 | 
					- boost
 | 
				
			||||||
- POCO 1.10.1 or later
 | 
					- POCO 1.10.1 or later
 | 
				
			||||||
@@ -13,43 +13,43 @@ In order to build the OWSEC, you will need to install its dependencies, which in
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
The build is done in 2 parts. The first part is to build a local copy of the framework tailored to your environment. This
 | 
					The build is done in 2 parts. The first part is to build a local copy of the framework tailored to your environment. This
 | 
				
			||||||
framework is called [Poco](https://github.com/pocoproject/poco). The version used in this project has a couple of fixes
 | 
					framework is called [Poco](https://github.com/pocoproject/poco). The version used in this project has a couple of fixes
 | 
				
			||||||
from the master copy needed for cmake. Please use the version of this [Poco fix](https://github.com/AriliaWireless/poco). Building
 | 
					from the master copy needed for cmake. Please use the version of this [Poco fix](https://github.com/Telecominfraproject/wlan-cloud-lib-poco). Building
 | 
				
			||||||
Poco may take several minutes depending on the platform you are building on.
 | 
					Poco may take several minutes depending on the platform you are building on.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Ubuntu
 | 
					## Ubuntu
 | 
				
			||||||
These instructions have proven to work on Ubuntu 20.4.
 | 
					These instructions have proven to work on Ubuntu 20.4.
 | 
				
			||||||
```bash
 | 
					```bash
 | 
				
			||||||
sudo apt install git cmake g++ libssl-dev libmariadb-dev 
 | 
					sudo apt install git cmake g++ libssl-dev libmariadb-dev \
 | 
				
			||||||
sudo apt install libpq-dev libaprutil1-dev apache2-dev libboost-all-dev
 | 
					    libpq-dev libaprutil1-dev apache2-dev libboost-all-dev \
 | 
				
			||||||
sudo apt install librdkafka-dev default-libmysqlclient-dev
 | 
					    librdkafka-dev default-libmysqlclient-dev \
 | 
				
			||||||
sudo apt install nlohmann-json-dev
 | 
					    nlohmann-json-dev
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd ~
 | 
					git clone https://github.com/Telecominfraproject/wlan-cloud-lib-poco --branch poco-tip-v1 poco
 | 
				
			||||||
git clone https://github.com/AriliaWireless/poco --branch poco-tip-v1
 | 
					 | 
				
			||||||
cd poco
 | 
					cd poco
 | 
				
			||||||
mkdir cmake-build
 | 
					mkdir cmake-build
 | 
				
			||||||
cd cmake-build
 | 
					cd cmake-build
 | 
				
			||||||
cmake ..
 | 
					cmake ..
 | 
				
			||||||
cmake --build . --config Release
 | 
					cmake --build . --config Release
 | 
				
			||||||
sudo cmake --build . --target install
 | 
					sudo cmake --build . --target install
 | 
				
			||||||
 | 
					cd ../..
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd ~
 | 
					git clone https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka --branch tip-v1 cppkafka
 | 
				
			||||||
git clone https://github.com/AriliaWireless/cppkafka --branch tip-v1
 | 
					 | 
				
			||||||
cd cppkafka
 | 
					cd cppkafka
 | 
				
			||||||
mkdir cmake-build
 | 
					mkdir cmake-build
 | 
				
			||||||
cd cmake-build
 | 
					cd cmake-build
 | 
				
			||||||
cmake ..
 | 
					cmake ..
 | 
				
			||||||
cmake --build . --config Release
 | 
					cmake --build . --config Release
 | 
				
			||||||
sudo cmake --build . --target install
 | 
					sudo cmake --build . --target install
 | 
				
			||||||
 | 
					cd ../..
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd ~
 | 
					git clone https://github.com/Telecominfraproject/wlan-cloud-lib-valijson --branch tip-v1 valijson
 | 
				
			||||||
git clone https://github.com/AriliaWireless/valijson --branch tip-v1
 | 
					 | 
				
			||||||
cd valijson
 | 
					cd valijson
 | 
				
			||||||
mkdir cmake-build
 | 
					mkdir cmake-build
 | 
				
			||||||
cd cmake-build
 | 
					cd cmake-build
 | 
				
			||||||
cmake ..
 | 
					cmake ..
 | 
				
			||||||
cmake --build . --config Release
 | 
					cmake --build . --config Release
 | 
				
			||||||
sudo cmake --build . --target install
 | 
					sudo cmake --build . --target install
 | 
				
			||||||
 | 
					cd ../..
 | 
				
			||||||
 | 
					
 | 
				
			||||||
git clone https://github.com/fmtlib/fmt --branch 9.0.0 /fmtlib
 | 
					git clone https://github.com/fmtlib/fmt --branch 9.0.0 /fmtlib
 | 
				
			||||||
cd fmtlib
 | 
					cd fmtlib
 | 
				
			||||||
@@ -58,56 +58,59 @@ cd cmake-build
 | 
				
			|||||||
cmake ..
 | 
					cmake ..
 | 
				
			||||||
make
 | 
					make
 | 
				
			||||||
make install
 | 
					make install
 | 
				
			||||||
 | 
					cd ../..
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd ~
 | 
					 | 
				
			||||||
git clone https://github.com/Telecominfraproject/wlan-cloud-ucentralsec
 | 
					git clone https://github.com/Telecominfraproject/wlan-cloud-ucentralsec
 | 
				
			||||||
cd wlan-cloud-ucentralsec
 | 
					cd wlan-cloud-ucentralsec
 | 
				
			||||||
mkdir cmake-build
 | 
					mkdir cmake-build
 | 
				
			||||||
cd cmake-build
 | 
					cd cmake-build
 | 
				
			||||||
cmake ..
 | 
					cmake ..
 | 
				
			||||||
make -j 8
 | 
					make -j 8
 | 
				
			||||||
 | 
					cd ../..
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Fedora
 | 
					## Fedora
 | 
				
			||||||
The following instructions have proven to work on Fedora 33
 | 
					The following instructions have proven to work on Fedora 33
 | 
				
			||||||
```bash
 | 
					```bash
 | 
				
			||||||
sudo yum install cmake g++ openssl-devel mysql-devel mysql apr-util-devel boost boost-devel
 | 
					sudo yum install cmake g++ openssl-devel mysql-devel mysql apr-util-devel boost boost-devel \
 | 
				
			||||||
sudo yum install yaml-cpp-devel lua-devel 
 | 
					    yaml-cpp-devel lua-devel
 | 
				
			||||||
sudo dnf install postgresql.x86_64 librdkafka-devel
 | 
					sudo dnf install postgresql.x86_64 librdkafka-devel
 | 
				
			||||||
sudo dnf install postgresql-devel json-devel
 | 
					sudo dnf install postgresql-devel json-devel
 | 
				
			||||||
 | 
					
 | 
				
			||||||
git clone https://github.com/AriliaWireless/poco --branch poco-tip-v1
 | 
					git clone https://github.com/Telecominfraproject/wlan-cloud-lib-poco --branch poco-tip-v1 poco
 | 
				
			||||||
cd poco
 | 
					cd poco
 | 
				
			||||||
mkdir cmake-build
 | 
					mkdir cmake-build
 | 
				
			||||||
cd cmake-build
 | 
					cd cmake-build
 | 
				
			||||||
cmake ..
 | 
					cmake ..
 | 
				
			||||||
cmake --build . --config Release
 | 
					cmake --build . --config Release
 | 
				
			||||||
sudo cmake --build . --target install
 | 
					sudo cmake --build . --target install
 | 
				
			||||||
 | 
					cd ../..
 | 
				
			||||||
 | 
					
 | 
				
			||||||
git clone https://github.com/AriliaWireless/cppkafka --branch tip-v1
 | 
					git clone https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka --branch tip-v1 cppkafka
 | 
				
			||||||
cd cppkafka
 | 
					cd cppkafka
 | 
				
			||||||
mkdir cmake-build
 | 
					mkdir cmake-build
 | 
				
			||||||
cd cmake-build
 | 
					cd cmake-build
 | 
				
			||||||
cmake ..
 | 
					cmake ..
 | 
				
			||||||
cmake --build . --config Release
 | 
					cmake --build . --config Release
 | 
				
			||||||
sudo cmake --build . --target install
 | 
					sudo cmake --build . --target install
 | 
				
			||||||
 | 
					cd ../..
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd ~
 | 
					git clone https://github.com/Telecominfraproject/wlan-cloud-lib-valijson --branch tip-v1 valijson
 | 
				
			||||||
git clone https://github.com/AriliaWireless/valijson --branch tip-v1
 | 
					 | 
				
			||||||
cd valijson
 | 
					cd valijson
 | 
				
			||||||
mkdir cmake-build
 | 
					mkdir cmake-build
 | 
				
			||||||
cd cmake-build
 | 
					cd cmake-build
 | 
				
			||||||
cmake ..
 | 
					cmake ..
 | 
				
			||||||
cmake --build . --config Release
 | 
					cmake --build . --config Release
 | 
				
			||||||
sudo cmake --build . --target install
 | 
					sudo cmake --build . --target install
 | 
				
			||||||
 | 
					cd ../..
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd ~
 | 
					 | 
				
			||||||
git clone https://github.com/Telecominfraproject/wlan-cloud-ucentralsec
 | 
					git clone https://github.com/Telecominfraproject/wlan-cloud-ucentralsec
 | 
				
			||||||
cd wlan-cloud-ucentralsec
 | 
					cd wlan-cloud-ucentralsec
 | 
				
			||||||
mkdir cmake-build
 | 
					mkdir cmake-build
 | 
				
			||||||
cd cmake-build
 | 
					cd cmake-build
 | 
				
			||||||
cmake ..
 | 
					cmake ..
 | 
				
			||||||
make
 | 
					make
 | 
				
			||||||
 | 
					cd ../..
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## macOS Build
 | 
					## macOS Build
 | 
				
			||||||
@@ -126,7 +129,7 @@ brew install openssl \
 | 
				
			|||||||
	nlohmann-json \
 | 
						nlohmann-json \
 | 
				
			||||||
	fmt
 | 
						fmt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
git clone https://github.com/AriliaWireless/poco --branch poco-tip-v1
 | 
					git clone https://github.com/Telecominfraproject/wlan-cloud-lib-poco --branch poco-tip-v1 poco
 | 
				
			||||||
pushd poco
 | 
					pushd poco
 | 
				
			||||||
mkdir cmake-build
 | 
					mkdir cmake-build
 | 
				
			||||||
push cmake-build
 | 
					push cmake-build
 | 
				
			||||||
@@ -136,7 +139,7 @@ sudo cmake --build . --target install
 | 
				
			|||||||
popd
 | 
					popd
 | 
				
			||||||
popd
 | 
					popd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
git clone https://github.com/AriliaWireless/cppkafka --branch tip-v1
 | 
					git clone https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka --branch tip-v1 cppkafka
 | 
				
			||||||
pushd cppkafka
 | 
					pushd cppkafka
 | 
				
			||||||
mkdir cmake-build
 | 
					mkdir cmake-build
 | 
				
			||||||
pushd cmake-build
 | 
					pushd cmake-build
 | 
				
			||||||
@@ -146,10 +149,10 @@ sudo cmake --build . --target install
 | 
				
			|||||||
popd
 | 
					popd
 | 
				
			||||||
popd
 | 
					popd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
git clone https://github.com/AriliaWireless/valijson --branch tip-v1
 | 
					git clone https://github.com/Telecominfraproject/wlan-cloud-lib-valijson --branch tip-v1 valijson
 | 
				
			||||||
cd valijson
 | 
					pushd valijson
 | 
				
			||||||
mkdir cmake-build
 | 
					mkdir cmake-build
 | 
				
			||||||
cd cmake-build
 | 
					pushd cmake-build
 | 
				
			||||||
cmake ..
 | 
					cmake ..
 | 
				
			||||||
cmake --build . --config Release
 | 
					cmake --build . --config Release
 | 
				
			||||||
sudo cmake --build . --target install
 | 
					sudo cmake --build . --target install
 | 
				
			||||||
@@ -172,20 +175,23 @@ support. You can build with only SQLite support by not installing the packages f
 | 
				
			|||||||
adding -DSMALL_BUILD=1 on the cmake build line.
 | 
					adding -DSMALL_BUILD=1 on the cmake build line.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```bash
 | 
					```bash
 | 
				
			||||||
sudo apt install git cmake g++ libssl-dev libaprutil1-dev apache2-dev libboost-all-dev libyaml-cpp-dev
 | 
					sudo apt install git cmake g++ libssl-dev libaprutil1-dev apache2-dev \
 | 
				
			||||||
git clone https://github.com/stephb9959/poco
 | 
					    libboost-all-dev libyaml-cpp-dev
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					git clone https://github.com/Telecominfraproject/wlan-cloud-lib-poco --branch poco-tip-v1 poco
 | 
				
			||||||
cd poco
 | 
					cd poco
 | 
				
			||||||
mkdir cmake-build
 | 
					mkdir cmake-build
 | 
				
			||||||
cd cmake-build
 | 
					cd cmake-build
 | 
				
			||||||
cmake ..
 | 
					cmake ..
 | 
				
			||||||
cmake --build . --config Release
 | 
					cmake --build . --config Release
 | 
				
			||||||
sudo cmake --build . --target install
 | 
					sudo cmake --build . --target install
 | 
				
			||||||
 | 
					cd ../..
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd ~
 | 
					 | 
				
			||||||
git clone https://github.com/Telecominfraproject/wlan-cloud-ucentralsec
 | 
					git clone https://github.com/Telecominfraproject/wlan-cloud-ucentralsec
 | 
				
			||||||
cd wlan-cloud-ucentralsec
 | 
					cd wlan-cloud-ucentralsec
 | 
				
			||||||
mkdir cmake-build
 | 
					mkdir cmake-build
 | 
				
			||||||
cd cmake-build
 | 
					cd cmake-build
 | 
				
			||||||
cmake -DSMALL_BUILD=1 ..
 | 
					cmake -DSMALL_BUILD=1 ..
 | 
				
			||||||
make
 | 
					make
 | 
				
			||||||
 | 
					cd ../..
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
cmake_minimum_required(VERSION 3.13)
 | 
					cmake_minimum_required(VERSION 3.13)
 | 
				
			||||||
project(owsec VERSION 2.11.0)
 | 
					project(owsec VERSION 3.2.0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set(CMAKE_CXX_STANDARD 17)
 | 
					set(CMAKE_CXX_STANDARD 17)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -185,6 +185,7 @@ if(NOT SMALL_BUILD)
 | 
				
			|||||||
            CppKafka::cppkafka
 | 
					            CppKafka::cppkafka
 | 
				
			||||||
            ${AWSSDK_LINK_LIBRARIES}
 | 
					            ${AWSSDK_LINK_LIBRARIES}
 | 
				
			||||||
            fmt::fmt
 | 
					            fmt::fmt
 | 
				
			||||||
 | 
					            resolv
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
    if(UNIX AND NOT APPLE)
 | 
					    if(UNIX AND NOT APPLE)
 | 
				
			||||||
        target_link_libraries(owsec PUBLIC PocoJSON)
 | 
					        target_link_libraries(owsec PUBLIC PocoJSON)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										12
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								Dockerfile
									
									
									
									
									
								
							@@ -15,8 +15,8 @@ FROM build-base AS poco-build
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
ARG POCO_VERSION
 | 
					ARG POCO_VERSION
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ADD https://api.github.com/repos/AriliaWireless/poco/git/refs/tags/${POCO_VERSION} version.json
 | 
					ADD https://api.github.com/repos/Telecominfraproject/wlan-cloud-lib-poco/git/refs/tags/${POCO_VERSION} version.json
 | 
				
			||||||
RUN git clone https://github.com/AriliaWireless/poco --branch ${POCO_VERSION} /poco
 | 
					RUN git clone https://github.com/Telecominfraproject/wlan-cloud-lib-poco --branch ${POCO_VERSION} /poco
 | 
				
			||||||
 | 
					
 | 
				
			||||||
WORKDIR /poco
 | 
					WORKDIR /poco
 | 
				
			||||||
RUN mkdir cmake-build
 | 
					RUN mkdir cmake-build
 | 
				
			||||||
@@ -29,8 +29,8 @@ FROM build-base AS cppkafka-build
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
ARG CPPKAFKA_VERSION
 | 
					ARG CPPKAFKA_VERSION
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ADD https://api.github.com/repos/AriliaWireless/cppkafka/git/refs/tags/${CPPKAFKA_VERSION} version.json
 | 
					ADD https://api.github.com/repos/Telecominfraproject/wlan-cloud-lib-cppkafka/git/refs/tags/${CPPKAFKA_VERSION} version.json
 | 
				
			||||||
RUN git clone https://github.com/AriliaWireless/cppkafka --branch ${CPPKAFKA_VERSION} /cppkafka
 | 
					RUN git clone https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka --branch ${CPPKAFKA_VERSION} /cppkafka
 | 
				
			||||||
 | 
					
 | 
				
			||||||
WORKDIR /cppkafka
 | 
					WORKDIR /cppkafka
 | 
				
			||||||
RUN mkdir cmake-build
 | 
					RUN mkdir cmake-build
 | 
				
			||||||
@@ -43,8 +43,8 @@ FROM build-base AS valijson-build
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
ARG VALIJASON_VERSION
 | 
					ARG VALIJASON_VERSION
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ADD https://api.github.com/repos/AriliaWireless/valijson/git/refs/tags/${VALIJASON_VERSION} version.json
 | 
					ADD https://api.github.com/repos/Telecominfraproject/wlan-cloud-lib-valijson/git/refs/tags/${VALIJASON_VERSION} version.json
 | 
				
			||||||
RUN git clone https://github.com/AriliaWireless/valijson --branch ${VALIJASON_VERSION} /valijson
 | 
					RUN git clone https://github.com/Telecominfraproject/wlan-cloud-lib-valijson --branch ${VALIJASON_VERSION} /valijson
 | 
				
			||||||
 | 
					
 | 
				
			||||||
WORKDIR /valijson
 | 
					WORKDIR /valijson
 | 
				
			||||||
RUN mkdir cmake-build
 | 
					RUN mkdir cmake-build
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@ fullnameOverride: ""
 | 
				
			|||||||
images:
 | 
					images:
 | 
				
			||||||
  owsec:
 | 
					  owsec:
 | 
				
			||||||
    repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owsec
 | 
					    repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owsec
 | 
				
			||||||
    tag: main
 | 
					    tag: v3.2.0
 | 
				
			||||||
    pullPolicy: Always
 | 
					    pullPolicy: Always
 | 
				
			||||||
#    regcred:
 | 
					#    regcred:
 | 
				
			||||||
#      registry: tip-tip-wlan-cloud-ucentral.jfrog.io
 | 
					#      registry: tip-tip-wlan-cloud-ucentral.jfrog.io
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -218,7 +218,7 @@ namespace OpenWifi {
 | 
				
			|||||||
				Expired = (WT.created_ + WT.expires_in_) < now;
 | 
									Expired = (WT.created_ + WT.expires_in_) < now;
 | 
				
			||||||
				if (StorageService()->UserDB().GetUserById(UserId, UInfo.userinfo)) {
 | 
									if (StorageService()->UserDB().GetUserById(UserId, UInfo.userinfo)) {
 | 
				
			||||||
					UInfo.webtoken = WT;
 | 
										UInfo.webtoken = WT;
 | 
				
			||||||
					poco_debug(Logger(), fmt::format("TokenValidation success for TID={} Token={}",
 | 
										poco_trace(Logger(), fmt::format("TokenValidation success for TID={} Token={}",
 | 
				
			||||||
													 TID, Utils::SanitizeToken(CallToken)));
 | 
																		 TID, Utils::SanitizeToken(CallToken)));
 | 
				
			||||||
					return true;
 | 
										return true;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -171,6 +171,31 @@ namespace OpenWifi::GWObjects {
 | 
				
			|||||||
		field_to_json(Obj, "lastModified", LastModified);
 | 
							field_to_json(Obj, "lastModified", LastModified);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						void DefaultFirmware::to_json(Poco::JSON::Object &Obj) const {
 | 
				
			||||||
 | 
							field_to_json(Obj, "deviceType", deviceType);
 | 
				
			||||||
 | 
							field_to_json(Obj, "description", Description);
 | 
				
			||||||
 | 
							field_to_json(Obj, "uri", uri);
 | 
				
			||||||
 | 
							field_to_json(Obj, "revision", revision);
 | 
				
			||||||
 | 
							field_to_json(Obj, "imageCreationDate", imageCreationDate);
 | 
				
			||||||
 | 
							field_to_json(Obj, "created", Created);
 | 
				
			||||||
 | 
							field_to_json(Obj, "lastModified", LastModified);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						bool DefaultFirmware::from_json(const Poco::JSON::Object::Ptr &Obj) {
 | 
				
			||||||
 | 
							try {
 | 
				
			||||||
 | 
								field_from_json(Obj, "deviceType", deviceType);
 | 
				
			||||||
 | 
								field_from_json(Obj, "description", Description);
 | 
				
			||||||
 | 
								field_from_json(Obj, "uri", uri);
 | 
				
			||||||
 | 
								field_from_json(Obj, "revision", revision);
 | 
				
			||||||
 | 
								field_from_json(Obj, "imageCreationDate", imageCreationDate);
 | 
				
			||||||
 | 
								field_from_json(Obj, "created", Created);
 | 
				
			||||||
 | 
								field_from_json(Obj, "lastModified", LastModified);
 | 
				
			||||||
 | 
								return true;
 | 
				
			||||||
 | 
							} catch (const Poco::Exception &E) {
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void CommandDetails::to_json(Poco::JSON::Object &Obj) const {
 | 
						void CommandDetails::to_json(Poco::JSON::Object &Obj) const {
 | 
				
			||||||
		EmbedDocument("details", Obj, Details);
 | 
							EmbedDocument("details", Obj, Details);
 | 
				
			||||||
		EmbedDocument("results", Obj, Results);
 | 
							EmbedDocument("results", Obj, Results);
 | 
				
			||||||
@@ -246,6 +271,8 @@ namespace OpenWifi::GWObjects {
 | 
				
			|||||||
		field_to_json(Obj, "connectionCompletionTime", connectionCompletionTime);
 | 
							field_to_json(Obj, "connectionCompletionTime", connectionCompletionTime);
 | 
				
			||||||
		field_to_json(Obj, "totalConnectionTime", Utils::Now() - started);
 | 
							field_to_json(Obj, "totalConnectionTime", Utils::Now() - started);
 | 
				
			||||||
		field_to_json(Obj, "certificateExpiryDate", certificateExpiryDate);
 | 
							field_to_json(Obj, "certificateExpiryDate", certificateExpiryDate);
 | 
				
			||||||
 | 
							field_to_json(Obj, "connectReason", connectReason);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef TIP_GATEWAY_SERVICE
 | 
					#ifdef TIP_GATEWAY_SERVICE
 | 
				
			||||||
		hasRADIUSSessions = RADIUSSessionTracker()->HasSessions(SerialNumber);
 | 
							hasRADIUSSessions = RADIUSSessionTracker()->HasSessions(SerialNumber);
 | 
				
			||||||
		AP_WS_Server()->ExtendedAttributes(SerialNumber, hasGPS, sanity,
 | 
							AP_WS_Server()->ExtendedAttributes(SerialNumber, hasGPS, sanity,
 | 
				
			||||||
@@ -403,6 +430,10 @@ namespace OpenWifi::GWObjects {
 | 
				
			|||||||
		field_to_json(Obj, "acctConfig", acctConfig);
 | 
							field_to_json(Obj, "acctConfig", acctConfig);
 | 
				
			||||||
		field_to_json(Obj, "coaConfig", coaConfig);
 | 
							field_to_json(Obj, "coaConfig", coaConfig);
 | 
				
			||||||
		field_to_json(Obj, "useByDefault", useByDefault);
 | 
							field_to_json(Obj, "useByDefault", useByDefault);
 | 
				
			||||||
 | 
							field_to_json(Obj, "radsecKeepAlive", radsecKeepAlive);
 | 
				
			||||||
 | 
							field_to_json(Obj, "poolProxyIp", poolProxyIp);
 | 
				
			||||||
 | 
							field_to_json(Obj, "radsecPoolType", radsecPoolType);
 | 
				
			||||||
 | 
							field_to_json(Obj, "enabled", enabled);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool RadiusProxyPool::from_json(const Poco::JSON::Object::Ptr &Obj) {
 | 
						bool RadiusProxyPool::from_json(const Poco::JSON::Object::Ptr &Obj) {
 | 
				
			||||||
@@ -413,6 +444,10 @@ namespace OpenWifi::GWObjects {
 | 
				
			|||||||
			field_from_json(Obj, "acctConfig", acctConfig);
 | 
								field_from_json(Obj, "acctConfig", acctConfig);
 | 
				
			||||||
			field_from_json(Obj, "coaConfig", coaConfig);
 | 
								field_from_json(Obj, "coaConfig", coaConfig);
 | 
				
			||||||
			field_from_json(Obj, "useByDefault", useByDefault);
 | 
								field_from_json(Obj, "useByDefault", useByDefault);
 | 
				
			||||||
 | 
								field_from_json(Obj, "radsecKeepAlive", radsecKeepAlive);
 | 
				
			||||||
 | 
								field_from_json(Obj, "poolProxyIp", poolProxyIp);
 | 
				
			||||||
 | 
								field_from_json(Obj, "radsecPoolType", radsecPoolType);
 | 
				
			||||||
 | 
								field_from_json(Obj, "enabled", enabled);
 | 
				
			||||||
			return true;
 | 
								return true;
 | 
				
			||||||
		} catch (const Poco::Exception &E) {
 | 
							} catch (const Poco::Exception &E) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -630,18 +665,50 @@ namespace OpenWifi::GWObjects {
 | 
				
			|||||||
		field_to_json(Obj, "chargeableUserIdentity", chargeableUserIdentity);
 | 
							field_to_json(Obj, "chargeableUserIdentity", chargeableUserIdentity);
 | 
				
			||||||
		field_to_json(Obj, "interface", interface);
 | 
							field_to_json(Obj, "interface", interface);
 | 
				
			||||||
		field_to_json(Obj, "secret", secret);
 | 
							field_to_json(Obj, "secret", secret);
 | 
				
			||||||
 | 
							field_to_json(Obj, "nasId", nasId);
 | 
				
			||||||
 | 
							field_to_json(Obj, "calledStationId", calledStationId);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void RADIUSSessionList::to_json(Poco::JSON::Object &Obj) const {
 | 
						void RADIUSSessionList::to_json(Poco::JSON::Object &Obj) const {
 | 
				
			||||||
		field_to_json(Obj, "sessions", sessions);
 | 
							field_to_json(Obj, "sessions", sessions);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						void RadiusCoADMParameters::to_json(Poco::JSON::Object &Obj) const {
 | 
				
			||||||
 | 
							field_to_json(Obj, "accountingSessionId", accountingSessionId);
 | 
				
			||||||
 | 
							field_to_json(Obj, "accountingMultiSessionId", accountingMultiSessionId);
 | 
				
			||||||
 | 
							field_to_json(Obj, "callingStationId", callingStationId);
 | 
				
			||||||
 | 
							field_to_json(Obj, "chargeableUserIdentity", chargeableUserIdentity);
 | 
				
			||||||
 | 
							field_to_json(Obj, "userName", userName);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool RadiusCoADMParameters::from_json(const Poco::JSON::Object::Ptr &Obj) {
 | 
						bool RadiusCoADMParameters::from_json(const Poco::JSON::Object::Ptr &Obj) {
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			field_from_json(Obj, "accountingSessionId", accountingSessionId);
 | 
								field_from_json(Obj, "accountingSessionId", accountingSessionId);
 | 
				
			||||||
			field_from_json(Obj, "accountingMultiSessionId", accountingMultiSessionId);
 | 
								field_from_json(Obj, "accountingMultiSessionId", accountingMultiSessionId);
 | 
				
			||||||
			field_from_json(Obj, "callingStationId", callingStationId);
 | 
								field_from_json(Obj, "callingStationId", callingStationId);
 | 
				
			||||||
			field_from_json(Obj, "chargeableUserIdentity", chargeableUserIdentity);
 | 
								field_from_json(Obj, "chargeableUserIdentity", chargeableUserIdentity);
 | 
				
			||||||
 | 
								field_from_json(Obj, "userName", userName);
 | 
				
			||||||
 | 
								return true;
 | 
				
			||||||
 | 
							} catch (const Poco::Exception &E) {
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						bool DeviceTransferRequest::from_json(const Poco::JSON::Object::Ptr &Obj) {
 | 
				
			||||||
 | 
							try {
 | 
				
			||||||
 | 
								field_from_json(Obj, "serialNumber", serialNumber);
 | 
				
			||||||
 | 
								field_from_json(Obj, "server", server);
 | 
				
			||||||
 | 
								field_from_json(Obj, "port", port);
 | 
				
			||||||
 | 
								return true;
 | 
				
			||||||
 | 
							} catch (const Poco::Exception &E) {
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						bool DeviceCertificateUpdateRequest::from_json(const Poco::JSON::Object::Ptr &Obj) {
 | 
				
			||||||
 | 
							try {
 | 
				
			||||||
 | 
								field_from_json(Obj, "serialNumber", serialNumber);
 | 
				
			||||||
 | 
								field_from_json(Obj, "encodedCertificate", encodedCertificate);
 | 
				
			||||||
			return true;
 | 
								return true;
 | 
				
			||||||
		} catch (const Poco::Exception &E) {
 | 
							} catch (const Poco::Exception &E) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,12 +42,13 @@ namespace OpenWifi::GWObjects {
 | 
				
			|||||||
		uint64_t sessionId = 0;
 | 
							uint64_t sessionId = 0;
 | 
				
			||||||
		double connectionCompletionTime = 0.0;
 | 
							double connectionCompletionTime = 0.0;
 | 
				
			||||||
		std::uint64_t certificateExpiryDate = 0;
 | 
							std::uint64_t certificateExpiryDate = 0;
 | 
				
			||||||
		bool hasRADIUSSessions = false;
 | 
							std::uint64_t hasRADIUSSessions = 0;
 | 
				
			||||||
		bool hasGPS = false;
 | 
							bool hasGPS = false;
 | 
				
			||||||
		std::uint64_t sanity=0;
 | 
							std::uint64_t sanity=0;
 | 
				
			||||||
		std::double_t memoryUsed=0.0;
 | 
							std::double_t memoryUsed=0.0;
 | 
				
			||||||
		std::double_t load=0.0;
 | 
							std::double_t load=0.0;
 | 
				
			||||||
		std::double_t temperature=0.0;
 | 
							std::double_t temperature=0.0;
 | 
				
			||||||
 | 
							std::string 	connectReason;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		void to_json(const std::string &SerialNumber, Poco::JSON::Object &Obj) ;
 | 
							void to_json(const std::string &SerialNumber, Poco::JSON::Object &Obj) ;
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
@@ -181,6 +182,26 @@ namespace OpenWifi::GWObjects {
 | 
				
			|||||||
		bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
							bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct DefaultFirmware {
 | 
				
			||||||
 | 
							std::string deviceType;
 | 
				
			||||||
 | 
							std::string Description;
 | 
				
			||||||
 | 
							std::string uri;
 | 
				
			||||||
 | 
							std::string revision;
 | 
				
			||||||
 | 
							uint64_t imageCreationDate;
 | 
				
			||||||
 | 
							uint64_t Created;
 | 
				
			||||||
 | 
							uint64_t LastModified;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
							bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct DefaultFirmwareList {
 | 
				
			||||||
 | 
							std::vector<DefaultFirmware>	firmwares;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
							bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct CommandDetails {
 | 
						struct CommandDetails {
 | 
				
			||||||
		std::string UUID;
 | 
							std::string UUID;
 | 
				
			||||||
		std::string SerialNumber;
 | 
							std::string SerialNumber;
 | 
				
			||||||
@@ -339,6 +360,10 @@ namespace OpenWifi::GWObjects {
 | 
				
			|||||||
		RadiusProxyServerConfig acctConfig;
 | 
							RadiusProxyServerConfig acctConfig;
 | 
				
			||||||
		RadiusProxyServerConfig coaConfig;
 | 
							RadiusProxyServerConfig coaConfig;
 | 
				
			||||||
		bool useByDefault = false;
 | 
							bool useByDefault = false;
 | 
				
			||||||
 | 
							std::string 	radsecPoolType;
 | 
				
			||||||
 | 
							std::string 	poolProxyIp;
 | 
				
			||||||
 | 
							std::uint64_t 	radsecKeepAlive=25;
 | 
				
			||||||
 | 
							bool			enabled=true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		void to_json(Poco::JSON::Object &Obj) const;
 | 
							void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
		bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
							bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
@@ -393,7 +418,8 @@ namespace OpenWifi::GWObjects {
 | 
				
			|||||||
					 			callingStationId,
 | 
										 			callingStationId,
 | 
				
			||||||
								chargeableUserIdentity,
 | 
													chargeableUserIdentity,
 | 
				
			||||||
								secret,
 | 
													secret,
 | 
				
			||||||
								interface;
 | 
													interface,
 | 
				
			||||||
 | 
													nasId;
 | 
				
			||||||
		std::uint64_t 			inputPackets = 0,
 | 
							std::uint64_t 			inputPackets = 0,
 | 
				
			||||||
								outputPackets = 0,
 | 
													outputPackets = 0,
 | 
				
			||||||
								inputOctets = 0,
 | 
													inputOctets = 0,
 | 
				
			||||||
@@ -401,6 +427,7 @@ namespace OpenWifi::GWObjects {
 | 
				
			|||||||
								inputGigaWords = 0,
 | 
													inputGigaWords = 0,
 | 
				
			||||||
								outputGigaWords = 0;
 | 
													outputGigaWords = 0;
 | 
				
			||||||
		std::uint32_t 			sessionTime = 0;
 | 
							std::uint32_t 			sessionTime = 0;
 | 
				
			||||||
 | 
							std::string 			calledStationId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef TIP_GATEWAY_SERVICE
 | 
					#ifdef TIP_GATEWAY_SERVICE
 | 
				
			||||||
		RADIUS::RadiusPacket	accountingPacket;
 | 
							RADIUS::RadiusPacket	accountingPacket;
 | 
				
			||||||
@@ -418,7 +445,68 @@ namespace OpenWifi::GWObjects {
 | 
				
			|||||||
		std::string 			accountingSessionId,
 | 
							std::string 			accountingSessionId,
 | 
				
			||||||
								accountingMultiSessionId,
 | 
													accountingMultiSessionId,
 | 
				
			||||||
								callingStationId,
 | 
													callingStationId,
 | 
				
			||||||
								chargeableUserIdentity;
 | 
													chargeableUserIdentity,
 | 
				
			||||||
 | 
													userName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
 | 
							void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						enum class RadiusPoolStrategy {
 | 
				
			||||||
 | 
							round_robin, random, weighted, unknown
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						enum class RadiusEndpointType {
 | 
				
			||||||
 | 
							generic, radsec, globalreach, orion, unknown
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						static inline RadiusEndpointType RadiusEndpointType(const std::string &T) {
 | 
				
			||||||
 | 
							if(T=="generic") return RadiusEndpointType::generic;
 | 
				
			||||||
 | 
							if(T=="radsec") return RadiusEndpointType::radsec;
 | 
				
			||||||
 | 
							if(T=="globalreach") return RadiusEndpointType::globalreach;
 | 
				
			||||||
 | 
							if(T=="orion") return RadiusEndpointType::orion;
 | 
				
			||||||
 | 
							return RadiusEndpointType::unknown;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						static inline RadiusPoolStrategy RadiusPoolStrategy(const std::string &T) {
 | 
				
			||||||
 | 
							if(T=="round_robin") return RadiusPoolStrategy::round_robin;
 | 
				
			||||||
 | 
							if(T=="random") return RadiusPoolStrategy::random;
 | 
				
			||||||
 | 
							if(T=="weighted") return RadiusPoolStrategy::weighted;
 | 
				
			||||||
 | 
							return RadiusPoolStrategy::unknown;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						static inline std::string to_string(enum RadiusEndpointType T) {
 | 
				
			||||||
 | 
							switch(T) {
 | 
				
			||||||
 | 
							case RadiusEndpointType::generic: return "generic";
 | 
				
			||||||
 | 
							case RadiusEndpointType::radsec: return "radsec";
 | 
				
			||||||
 | 
							case RadiusEndpointType::globalreach: return "globalreach";
 | 
				
			||||||
 | 
							case RadiusEndpointType::orion: return "orion";
 | 
				
			||||||
 | 
							default:
 | 
				
			||||||
 | 
								return "unknown";
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						static inline std::string to_string(enum RadiusPoolStrategy T) {
 | 
				
			||||||
 | 
							switch(T) {
 | 
				
			||||||
 | 
							case RadiusPoolStrategy::round_robin: return "round_robin";
 | 
				
			||||||
 | 
							case RadiusPoolStrategy::random: return "random";
 | 
				
			||||||
 | 
							case RadiusPoolStrategy::weighted: return "weighted";
 | 
				
			||||||
 | 
							default:
 | 
				
			||||||
 | 
								return "unknown";
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct DeviceTransferRequest {
 | 
				
			||||||
 | 
							std::string 	serialNumber;
 | 
				
			||||||
 | 
							std::string 	server;
 | 
				
			||||||
 | 
							std::uint64_t 	port;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct DeviceCertificateUpdateRequest {
 | 
				
			||||||
 | 
							std::string 	serialNumber;
 | 
				
			||||||
 | 
							std::string 	encodedCertificate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
							bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -92,6 +92,7 @@ namespace OpenWifi::OWLSObjects {
 | 
				
			|||||||
        field_to_json(Obj, "endTime", endTime);
 | 
					        field_to_json(Obj, "endTime", endTime);
 | 
				
			||||||
        field_to_json(Obj, "errorDevices", errorDevices);
 | 
					        field_to_json(Obj, "errorDevices", errorDevices);
 | 
				
			||||||
        field_to_json(Obj, "owner", owner);
 | 
					        field_to_json(Obj, "owner", owner);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "expectedDevices", expectedDevices);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void Dashboard::to_json([[maybe_unused]] Poco::JSON::Object &Obj) const {}
 | 
						void Dashboard::to_json([[maybe_unused]] Poco::JSON::Object &Obj) const {}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -57,6 +57,7 @@ namespace OpenWifi::OWLSObjects {
 | 
				
			|||||||
        uint64_t endTime;
 | 
					        uint64_t endTime;
 | 
				
			||||||
        uint64_t errorDevices;
 | 
					        uint64_t errorDevices;
 | 
				
			||||||
        std::string owner;
 | 
					        std::string owner;
 | 
				
			||||||
 | 
					        uint64_t expectedDevices;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -587,6 +587,9 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
		field_to_json(Obj, "locale", locale);
 | 
							field_to_json(Obj, "locale", locale);
 | 
				
			||||||
		field_to_json(Obj, "realMacAddress", realMacAddress);
 | 
							field_to_json(Obj, "realMacAddress", realMacAddress);
 | 
				
			||||||
		field_to_json(Obj, "doNotAllowOverrides", doNotAllowOverrides);
 | 
							field_to_json(Obj, "doNotAllowOverrides", doNotAllowOverrides);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "imported", imported);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "connected", connected);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "platform", platform);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool InventoryTag::from_json(const Poco::JSON::Object::Ptr &Obj) {
 | 
						bool InventoryTag::from_json(const Poco::JSON::Object::Ptr &Obj) {
 | 
				
			||||||
@@ -609,6 +612,9 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
			field_from_json(Obj, "locale", locale);
 | 
								field_from_json(Obj, "locale", locale);
 | 
				
			||||||
			field_from_json(Obj, "realMacAddress", realMacAddress);
 | 
								field_from_json(Obj, "realMacAddress", realMacAddress);
 | 
				
			||||||
			field_from_json(Obj, "doNotAllowOverrides", doNotAllowOverrides);
 | 
								field_from_json(Obj, "doNotAllowOverrides", doNotAllowOverrides);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "imported", imported);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "connected", connected);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "platform", platform);
 | 
				
			||||||
			return true;
 | 
								return true;
 | 
				
			||||||
		} catch (...) {
 | 
							} catch (...) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -1194,4 +1200,243 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void GLBLRAccountInfo::to_json(Poco::JSON::Object &Obj) const {
 | 
				
			||||||
 | 
					        info.to_json(Obj);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "privateKey", privateKey);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "country", country);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "province", province);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "city", city);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "organization", organization);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "commonName", commonName);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "CSR", CSR);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "CSRPrivateKey", CSRPrivateKey);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "CSRPublicKey", CSRPublicKey);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "GlobalReachAcctId", GlobalReachAcctId);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool GLBLRAccountInfo::from_json(const Poco::JSON::Object::Ptr &Obj) {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            info.from_json(Obj);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "privateKey", privateKey);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "country", country);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "province", province);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "city", city);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "organization", organization);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "commonName", commonName);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "CSR", CSR);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "CSRPrivateKey", CSRPrivateKey);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "CSRPublicKey", CSRPublicKey);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "GlobalReachAcctId", GlobalReachAcctId);
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        } catch (const Poco::Exception &E) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void GLBLRCertificateInfo::to_json(Poco::JSON::Object &Obj) const {
 | 
				
			||||||
 | 
					        field_to_json(Obj, "id", id);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "name", name);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "accountId", accountId);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "csr", csr);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "certificate", certificate);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "certificateChain", certificateChain);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "certificateId", certificateId);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "expiresAt", expiresAt);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "created", created);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool GLBLRCertificateInfo::from_json(const Poco::JSON::Object::Ptr &Obj) {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            field_from_json(Obj, "id", id);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "name", name);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "accountId", accountId);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "csr", csr);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "certificate", certificate);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "certificateChain", certificateChain);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "certificateId", certificateId);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "expiresAt", expiresAt);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "created", created);
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        } catch (const Poco::Exception &E) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void GooglOrionAccountInfo::to_json(Poco::JSON::Object &Obj) const {
 | 
				
			||||||
 | 
					        info.to_json(Obj);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "privateKey", privateKey);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "certificate", certificate);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "cacerts", cacerts);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool GooglOrionAccountInfo::from_json(const Poco::JSON::Object::Ptr &Obj) {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            info.from_json(Obj);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "privateKey", privateKey);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "certificate", certificate);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "cacerts", cacerts);
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        } catch (const Poco::Exception &E) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void RADIUSServer::to_json(Poco::JSON::Object &Obj) const {
 | 
				
			||||||
 | 
					        field_to_json(Obj, "Hostname", Hostname);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "IP", IP);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "Port", Port);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "Secret", Secret);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool RADIUSServer::from_json(const Poco::JSON::Object::Ptr &Obj) {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            field_from_json(Obj, "Hostname", Hostname);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "IP", IP);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "Port", Port);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "Secret", Secret);
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        } catch (const Poco::Exception &E) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void RADIUSEndPointRadiusType::to_json(Poco::JSON::Object &Obj) const {
 | 
				
			||||||
 | 
					        field_to_json(Obj, "Authentication", Authentication);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "Accounting", Accounting);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "CoA", CoA);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "AccountingInterval", AccountingInterval);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool RADIUSEndPointRadiusType::from_json(const Poco::JSON::Object::Ptr &Obj) {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            field_from_json(Obj, "Authentication", Authentication);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "Accounting", Accounting);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "CoA", CoA);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "AccountingInterval", AccountingInterval);
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        } catch (const Poco::Exception &E) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void RADIUSEndPointRadsecType::to_json(Poco::JSON::Object &Obj) const {
 | 
				
			||||||
 | 
					        field_to_json(Obj, "Hostname", Hostname);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "IP", IP);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "Port", Port);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "Secret", Secret);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "OpenRoamingType", OpenRoamingType);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "UseOpenRoamingAccount", UseOpenRoamingAccount);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "Weight", Weight);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "Certificate", Certificate);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "PrivateKey", PrivateKey);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "CaCerts", CaCerts);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "AllowSelfSigned", AllowSelfSigned);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool RADIUSEndPointRadsecType::from_json(const Poco::JSON::Object::Ptr &Obj) {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            field_from_json(Obj, "Hostname", Hostname);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "IP", IP);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "Port", Port);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "Secret", Secret);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "OpenRoamingType", OpenRoamingType);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "UseOpenRoamingAccount", UseOpenRoamingAccount);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "Weight", Weight);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "Certificate", Certificate);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "PrivateKey", PrivateKey);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "CaCerts", CaCerts);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "AllowSelfSigned", AllowSelfSigned);
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        } catch (const Poco::Exception &E) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void RADIUSEndPoint::to_json(Poco::JSON::Object &Obj) const {
 | 
				
			||||||
 | 
					        info.to_json(Obj);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "Type", Type);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "RadsecServers", RadsecServers);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "RadiusServers", RadiusServers);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "PoolStrategy", PoolStrategy);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "Index", Index);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "UsedBy", UsedBy);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "UseGWProxy", UseGWProxy);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "NasIdentifier", NasIdentifier);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "AccountingInterval", AccountingInterval);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool RADIUSEndPoint::from_json(const Poco::JSON::Object::Ptr &Obj) {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            info.from_json(Obj);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "Type", Type);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "RadsecServers", RadsecServers);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "RadiusServers", RadiusServers);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "PoolStrategy", PoolStrategy);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "Index", Index);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "UsedBy", UsedBy);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "UseGWProxy", UseGWProxy);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "NasIdentifier", NasIdentifier);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "AccountingInterval", AccountingInterval);
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        } catch (const Poco::Exception &E) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void RADIUSEndpointUpdateStatus::to_json(Poco::JSON::Object &Obj) const {
 | 
				
			||||||
 | 
					        field_to_json(Obj, "lastUpdate", lastUpdate);
 | 
				
			||||||
 | 
					        field_to_json(Obj, "lastConfigurationChange", lastConfigurationChange);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool RADIUSEndpointUpdateStatus::from_json(const Poco::JSON::Object::Ptr &Obj) {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            field_from_json(Obj, "lastUpdate", lastUpdate);
 | 
				
			||||||
 | 
					            field_from_json(Obj, "lastConfigurationChange", lastConfigurationChange);
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        } catch (const Poco::Exception &E) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool RADIUSEndpointUpdateStatus::Read() {
 | 
				
			||||||
 | 
					        Poco::File  F(OpenWifi::MicroServiceDataDirectory()+"/RADIUSEndpointUpdateStatus.json");
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            if (F.exists()) {
 | 
				
			||||||
 | 
					                Poco::JSON::Parser P;
 | 
				
			||||||
 | 
					                std::ifstream ifs(F.path(), std::ios_base::in | std::ios_base::binary);
 | 
				
			||||||
 | 
					                auto Obj = P.parse(ifs);
 | 
				
			||||||
 | 
					                return from_json(Obj.extract<Poco::JSON::Object::Ptr>());
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        } catch (...) {
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool RADIUSEndpointUpdateStatus::Save() {
 | 
				
			||||||
 | 
					        Poco::File  F(OpenWifi::MicroServiceDataDirectory()+"/RADIUSEndpointUpdateStatus.json");
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            Poco::JSON::Object Obj;
 | 
				
			||||||
 | 
					            to_json(Obj);
 | 
				
			||||||
 | 
					            std::ofstream O(F.path(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary);
 | 
				
			||||||
 | 
					            Poco::JSON::Stringifier::stringify(Obj, O);
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        } catch (...) {
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool RADIUSEndpointUpdateStatus::ChangeConfiguration() {
 | 
				
			||||||
 | 
					        Read();
 | 
				
			||||||
 | 
					        lastConfigurationChange = Utils::Now();
 | 
				
			||||||
 | 
					        return Save();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} // namespace OpenWifi::ProvObjects
 | 
					} // namespace OpenWifi::ProvObjects
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,6 +29,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        Types::TagList tags;
 | 
					        Types::TagList tags;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -36,6 +37,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        Types::UUIDvec_t serialNumbers;
 | 
					        Types::UUIDvec_t serialNumbers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -46,6 +48,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::string policy;
 | 
					        std::string policy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -57,14 +60,18 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        Types::UUID_t venue;
 | 
					        Types::UUID_t venue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    typedef std::vector<ManagementPolicy> ManagementPolicyVec;
 | 
					    typedef std::vector<ManagementPolicy> ManagementPolicyVec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct RRMAlgorithmDetails {
 | 
					    struct RRMAlgorithmDetails {
 | 
				
			||||||
        std::string name;
 | 
					        std::string name;
 | 
				
			||||||
        std::string parameters;
 | 
					        std::string parameters;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -72,7 +79,9 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::string vendor;
 | 
					        std::string vendor;
 | 
				
			||||||
        std::string schedule;
 | 
					        std::string schedule;
 | 
				
			||||||
        std::vector<RRMAlgorithmDetails> algorithms;
 | 
					        std::vector<RRMAlgorithmDetails> algorithms;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -82,6 +91,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::string firmwareUpgrade{"inherit"};
 | 
					        std::string firmwareUpgrade{"inherit"};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -104,8 +114,10 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        Types::UUIDvec_t configurations;
 | 
					        Types::UUIDvec_t configurations;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    typedef std::vector<Entity> EntityVec;
 | 
					    typedef std::vector<Entity> EntityVec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct DiGraphEntry {
 | 
					    struct DiGraphEntry {
 | 
				
			||||||
@@ -113,6 +125,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        Types::UUID_t child;
 | 
					        Types::UUID_t child;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -140,8 +153,10 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        Types::UUIDvec_t boards;
 | 
					        Types::UUIDvec_t boards;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    typedef std::vector<Venue> VenueVec;
 | 
					    typedef std::vector<Venue> VenueVec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct UserInfoDigest {
 | 
					    struct UserInfoDigest {
 | 
				
			||||||
@@ -150,6 +165,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::string userType;
 | 
					        std::string userType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -162,8 +178,10 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        Types::UUID_t venue;
 | 
					        Types::UUID_t venue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    typedef std::vector<ManagementRole> ManagementRoleVec;
 | 
					    typedef std::vector<ManagementRole> ManagementRoleVec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    enum LocationType {
 | 
					    enum LocationType {
 | 
				
			||||||
@@ -232,8 +250,10 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        Types::UUID_t managementPolicy;
 | 
					        Types::UUID_t managementPolicy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    typedef std::vector<Location> LocationVec;
 | 
					    typedef std::vector<Location> LocationVec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct OperatorLocation {
 | 
					    struct OperatorLocation {
 | 
				
			||||||
@@ -253,8 +273,10 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        Types::UUID_t managementPolicy;
 | 
					        Types::UUID_t managementPolicy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    typedef std::vector<Location> LocationVec;
 | 
					    typedef std::vector<Location> LocationVec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct SubLocation {
 | 
					    struct SubLocation {
 | 
				
			||||||
@@ -270,6 +292,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::string geoCode;
 | 
					        std::string geoCode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -277,6 +300,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::vector<OperatorLocation> locations;
 | 
					        std::vector<OperatorLocation> locations;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -356,8 +380,10 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        Types::UUID_t managementPolicy;
 | 
					        Types::UUID_t managementPolicy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    typedef std::vector<Contact> ContactVec;
 | 
					    typedef std::vector<Contact> ContactVec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct OperatorContact {
 | 
					    struct OperatorContact {
 | 
				
			||||||
@@ -379,6 +405,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        Types::UUID_t managementPolicy;
 | 
					        Types::UUID_t managementPolicy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -397,6 +424,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::string accessPIN;
 | 
					        std::string accessPIN;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -404,6 +432,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::vector<OperatorContact> contacts;
 | 
					        std::vector<OperatorContact> contacts;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -416,8 +445,10 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::string configuration;
 | 
					        std::string configuration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    typedef std::vector<DeviceConfigurationElement> DeviceConfigurationElementVec;
 | 
					    typedef std::vector<DeviceConfigurationElement> DeviceConfigurationElementVec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct DeviceConfiguration {
 | 
					    struct DeviceConfiguration {
 | 
				
			||||||
@@ -434,8 +465,10 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::string subscriber;
 | 
					        std::string subscriber;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    typedef std::vector<DeviceConfiguration> DeviceConfigurationVec;
 | 
					    typedef std::vector<DeviceConfiguration> DeviceConfigurationVec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct InventoryTag {
 | 
					    struct InventoryTag {
 | 
				
			||||||
@@ -457,6 +490,9 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::string locale;
 | 
					        std::string locale;
 | 
				
			||||||
        std::string realMacAddress;
 | 
					        std::string realMacAddress;
 | 
				
			||||||
        bool doNotAllowOverrides = false;
 | 
					        bool doNotAllowOverrides = false;
 | 
				
			||||||
 | 
					        std::uint64_t imported=0;
 | 
				
			||||||
 | 
					        std::uint64_t connected=0;
 | 
				
			||||||
 | 
					        std::string platform{"AP"};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
@@ -468,6 +504,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        InventoryTagVec taglist;
 | 
					        InventoryTagVec taglist;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -478,6 +515,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        uint64_t errorCode;
 | 
					        uint64_t errorCode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -486,6 +524,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        Types::CountedMap tenants;
 | 
					        Types::CountedMap tenants;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void reset();
 | 
					        void reset();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -495,6 +534,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::string description;
 | 
					        std::string description;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -503,6 +543,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::vector<ExpandedUseEntry> entries;
 | 
					        std::vector<ExpandedUseEntry> entries;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -510,6 +551,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::vector<ExpandedUseEntryList> entries;
 | 
					        std::vector<ExpandedUseEntryList> entries;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -517,17 +559,21 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        Types::UUIDvec_t list;
 | 
					        Types::UUIDvec_t list;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	enum ACLACCESS { NONE = 0, READ = 1, MODIFY = 2, CREATE = 3, DELETE = 4 };
 | 
					    enum ACLACCESS {
 | 
				
			||||||
 | 
					        NONE = 0, READ = 1, MODIFY = 2, CREATE = 3, DELETE = 4
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct ObjectACL {
 | 
					    struct ObjectACL {
 | 
				
			||||||
        UuidList users;
 | 
					        UuidList users;
 | 
				
			||||||
        UuidList roles;
 | 
					        UuidList roles;
 | 
				
			||||||
		uint64_t access = (uint64_t)NONE;
 | 
					        uint64_t access = (uint64_t) NONE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -535,6 +581,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::vector<ObjectACL> list;
 | 
					        std::vector<ObjectACL> list;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -549,6 +596,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::string venue;
 | 
					        std::string venue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -556,6 +604,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::vector<Map> list;
 | 
					        std::vector<Map> list;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -585,6 +634,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::string operatorId;
 | 
					        std::string operatorId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -595,6 +645,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::string value;
 | 
					        std::string value;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -602,6 +653,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::vector<Variable> variables;
 | 
					        std::vector<Variable> variables;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -616,6 +668,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        Types::UUID_t managementPolicy;
 | 
					        Types::UUID_t managementPolicy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -623,6 +676,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::vector<VariableBlock> variableBlocks;
 | 
					        std::vector<VariableBlock> variableBlocks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -637,6 +691,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::string registrationId;
 | 
					        std::string registrationId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -644,6 +699,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::vector<Operator> operators;
 | 
					        std::vector<Operator> operators;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -654,6 +710,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        Types::UUIDvec_t devices;
 | 
					        Types::UUIDvec_t devices;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -669,6 +726,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        bool defaultService = false;
 | 
					        bool defaultService = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -676,6 +734,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::vector<ServiceClass> serviceClasses;
 | 
					        std::vector<ServiceClass> serviceClasses;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -686,6 +745,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::string firmwareRCOnly{"inherit"};
 | 
					        std::string firmwareRCOnly{"inherit"};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -710,6 +770,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::string realMacAddress;
 | 
					        std::string realMacAddress;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -717,6 +778,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::vector<SubscriberDevice> subscriberDevices;
 | 
					        std::vector<SubscriberDevice> subscriberDevices;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -729,6 +791,7 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::uint64_t modified;
 | 
					        std::uint64_t modified;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -738,12 +801,119 @@ namespace OpenWifi::ProvObjects {
 | 
				
			|||||||
        std::vector<ConfigurationOverride> overrides;
 | 
					        std::vector<ConfigurationOverride> overrides;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void to_json(Poco::JSON::Object &Obj) const;
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool UpdateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U,
 | 
					    bool UpdateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U,
 | 
				
			||||||
                          ObjectInfo &I);
 | 
					                          ObjectInfo &I);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool CreateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U,
 | 
					    bool CreateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U,
 | 
				
			||||||
                          ObjectInfo &I);
 | 
					                          ObjectInfo &I);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool CreateObjectInfo(const SecurityObjects::UserInfo &U, ObjectInfo &I);
 | 
					    bool CreateObjectInfo(const SecurityObjects::UserInfo &U, ObjectInfo &I);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    struct GLBLRAccountInfo {
 | 
				
			||||||
 | 
					        ObjectInfo info;
 | 
				
			||||||
 | 
					        std::string privateKey;
 | 
				
			||||||
 | 
					        std::string country, province, city, organization, commonName;
 | 
				
			||||||
 | 
					        std::string CSR, CSRPrivateKey, CSRPublicKey;
 | 
				
			||||||
 | 
					        std::string GlobalReachAcctId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    struct GLBLRCertificateInfo {
 | 
				
			||||||
 | 
					        std::string id;
 | 
				
			||||||
 | 
					        std::string name;
 | 
				
			||||||
 | 
					        std::string accountId;
 | 
				
			||||||
 | 
					        std::string csr;
 | 
				
			||||||
 | 
					        std::string certificate;
 | 
				
			||||||
 | 
					        std::string certificateChain;
 | 
				
			||||||
 | 
					        std::string certificateId;
 | 
				
			||||||
 | 
					        std::uint64_t expiresAt = 0;
 | 
				
			||||||
 | 
					        std::uint64_t created = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    struct GooglOrionAccountInfo {
 | 
				
			||||||
 | 
					        ObjectInfo info;
 | 
				
			||||||
 | 
					        std::string privateKey;
 | 
				
			||||||
 | 
					        std::string certificate;
 | 
				
			||||||
 | 
					        std::vector<std::string> cacerts;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    struct RADIUSServer {
 | 
				
			||||||
 | 
					        std::string     Hostname;
 | 
				
			||||||
 | 
					        std::string     IP;
 | 
				
			||||||
 | 
					        std::uint64_t   Port=0;
 | 
				
			||||||
 | 
					        std::string     Secret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    struct RADIUSEndPointRadiusType {
 | 
				
			||||||
 | 
					        std::vector<RADIUSServer>    Authentication;
 | 
				
			||||||
 | 
					        std::vector<RADIUSServer>    Accounting;
 | 
				
			||||||
 | 
					        std::vector<RADIUSServer>    CoA;
 | 
				
			||||||
 | 
					        std::uint64_t AccountingInterval = 60;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    struct RADIUSEndPointRadsecType {
 | 
				
			||||||
 | 
					        std::string     Hostname;
 | 
				
			||||||
 | 
					        std::string     IP;
 | 
				
			||||||
 | 
					        std::uint64_t   Port=2083;
 | 
				
			||||||
 | 
					        std::string     Secret{"radsec"};
 | 
				
			||||||
 | 
					        std::string     OpenRoamingType;
 | 
				
			||||||
 | 
					        std::string     UseOpenRoamingAccount;
 | 
				
			||||||
 | 
					        std::uint64_t   Weight=0;
 | 
				
			||||||
 | 
					        std::string     Certificate;
 | 
				
			||||||
 | 
					        std::string     PrivateKey;
 | 
				
			||||||
 | 
					        std::vector<std::string>    CaCerts;
 | 
				
			||||||
 | 
					        bool AllowSelfSigned=false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    struct RADIUSEndPoint {
 | 
				
			||||||
 | 
					        ObjectInfo                  info;
 | 
				
			||||||
 | 
					        std::string                 Type{"radius"};
 | 
				
			||||||
 | 
					        std::string                 PoolStrategy{"none"};
 | 
				
			||||||
 | 
					        bool                        UseGWProxy=true;
 | 
				
			||||||
 | 
					        std::string                 Index;
 | 
				
			||||||
 | 
					        std::vector<std::string>    UsedBy;
 | 
				
			||||||
 | 
					        std::vector<RADIUSEndPointRadiusType>   RadiusServers;
 | 
				
			||||||
 | 
					        std::vector<RADIUSEndPointRadsecType>   RadsecServers;
 | 
				
			||||||
 | 
					        std::string                 NasIdentifier;
 | 
				
			||||||
 | 
					        std::uint64_t               AccountingInterval=600;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    struct RADIUSEndpointUpdateStatus {
 | 
				
			||||||
 | 
					        std::uint64_t   lastUpdate=0;
 | 
				
			||||||
 | 
					        std::uint64_t   lastConfigurationChange=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        void to_json(Poco::JSON::Object &Obj) const;
 | 
				
			||||||
 | 
					        bool from_json(const Poco::JSON::Object::Ptr &Obj);
 | 
				
			||||||
 | 
					        bool Read();
 | 
				
			||||||
 | 
					        bool Save();
 | 
				
			||||||
 | 
					        bool ChangeConfiguration();
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}; // namespace OpenWifi::ProvObjects
 | 
					}; // namespace OpenWifi::ProvObjects
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,10 +11,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "Poco/File.h"
 | 
					#include "Poco/File.h"
 | 
				
			||||||
#include "Poco/StreamCopier.h"
 | 
					#include "Poco/StreamCopier.h"
 | 
				
			||||||
 | 
					#include "Poco/JSON/Object.h"
 | 
				
			||||||
 | 
					#include "Poco/JSON/Parser.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "framework/MicroServiceFuncs.h"
 | 
					#include "framework/MicroServiceFuncs.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "nlohmann/json.hpp"
 | 
					// #include "nlohmann/json.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace OpenWifi {
 | 
					namespace OpenWifi {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -28,11 +30,11 @@ namespace OpenWifi {
 | 
				
			|||||||
				if (F.exists()) {
 | 
									if (F.exists()) {
 | 
				
			||||||
					std::ostringstream OS;
 | 
										std::ostringstream OS;
 | 
				
			||||||
					std::ifstream IF(FileName);
 | 
										std::ifstream IF(FileName);
 | 
				
			||||||
					Poco::StreamCopier::copyStream(IF, OS);
 | 
					                    Poco::JSON::Parser  P;
 | 
				
			||||||
					Registry_ = nlohmann::json::parse(OS.str());
 | 
										Registry_ = P.parse(IF).extract<Poco::JSON::Object::Ptr>();
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			} catch (...) {
 | 
								} catch (...) {
 | 
				
			||||||
				Registry_ = nlohmann::json::parse("{}");
 | 
									Registry_ = Poco::makeShared<Poco::JSON::Object>();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -44,46 +46,39 @@ namespace OpenWifi {
 | 
				
			|||||||
		inline ~AppServiceRegistry() { Save(); }
 | 
							inline ~AppServiceRegistry() { Save(); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		inline void Save() {
 | 
							inline void Save() {
 | 
				
			||||||
			std::istringstream IS(to_string(Registry_));
 | 
					 | 
				
			||||||
			std::ofstream OF;
 | 
								std::ofstream OF;
 | 
				
			||||||
			OF.open(FileName, std::ios::binary | std::ios::trunc);
 | 
								OF.open(FileName, std::ios::binary | std::ios::trunc);
 | 
				
			||||||
			Poco::StreamCopier::copyStream(IS, OF);
 | 
					            Registry_->stringify(OF);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		inline void Set(const char *Key, uint64_t Value) {
 | 
					        void Set(const char *key, const std::vector<std::string> &V) {
 | 
				
			||||||
			Registry_[Key] = Value;
 | 
					            Poco::JSON::Array   Arr;
 | 
				
			||||||
 | 
					            for(const auto &s:V) {
 | 
				
			||||||
 | 
					                Arr.add(s);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            Registry_->set(key,Arr);
 | 
				
			||||||
            Save();
 | 
					            Save();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		inline void Set(const char *Key, const std::string &Value) {
 | 
					        template<class T> void Set(const char *key, const T &Value) {
 | 
				
			||||||
			Registry_[Key] = Value;
 | 
					            Registry_->set(key,Value);
 | 
				
			||||||
			Save();
 | 
								Save();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		inline void Set(const char *Key, bool Value) {
 | 
					        bool Get(const char *key, std::vector<std::string> &Value) {
 | 
				
			||||||
			Registry_[Key] = Value;
 | 
					            if(Registry_->has(key) && !Registry_->isNull(key) && Registry_->isArray(key)) {
 | 
				
			||||||
			Save();
 | 
					                auto Arr = Registry_->get(key);
 | 
				
			||||||
 | 
					                for(const auto &v:Arr) {
 | 
				
			||||||
 | 
					                    Value.emplace_back(v);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					 | 
				
			||||||
		inline bool Get(const char *Key, bool &Value) {
 | 
					 | 
				
			||||||
			if (Registry_[Key].is_boolean()) {
 | 
					 | 
				
			||||||
				Value = Registry_[Key].get<bool>();
 | 
					 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		inline bool Get(const char *Key, uint64_t &Value) {
 | 
					        template<class T> bool Get(const char *key, T &Value) {
 | 
				
			||||||
			if (Registry_[Key].is_number_unsigned()) {
 | 
					            if(Registry_->has(key) && !Registry_->isNull(key)) {
 | 
				
			||||||
				Value = Registry_[Key].get<uint64_t>();
 | 
					                Value = Registry_->getValue<T>(key);
 | 
				
			||||||
				return true;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			return false;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		inline bool Get(const char *Key, std::string &Value) {
 | 
					 | 
				
			||||||
			if (Registry_[Key].is_string()) {
 | 
					 | 
				
			||||||
				Value = Registry_[Key].get<std::string>();
 | 
					 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -91,7 +86,7 @@ namespace OpenWifi {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	  private:
 | 
						  private:
 | 
				
			||||||
		std::string FileName;
 | 
							std::string FileName;
 | 
				
			||||||
		nlohmann::json Registry_;
 | 
							Poco::JSON::Object::Ptr Registry_;
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	inline auto AppServiceRegistry() { return AppServiceRegistry::instance(); }
 | 
						inline auto AppServiceRegistry() { return AppServiceRegistry::instance(); }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,8 +9,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace OpenWifi {
 | 
					namespace OpenWifi {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EventBusManager::EventBusManager(Poco::Logger &L) : Logger_(L) {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	void EventBusManager::run() {
 | 
						void EventBusManager::run() {
 | 
				
			||||||
		Running_ = true;
 | 
							Running_ = true;
 | 
				
			||||||
		Utils::SetThreadName("fmwk:EventMgr");
 | 
							Utils::SetThreadName("fmwk:EventMgr");
 | 
				
			||||||
@@ -18,9 +16,9 @@ namespace OpenWifi {
 | 
				
			|||||||
		KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(), Msg,
 | 
							KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(), Msg,
 | 
				
			||||||
									false);
 | 
														false);
 | 
				
			||||||
		while (Running_) {
 | 
							while (Running_) {
 | 
				
			||||||
			Poco::Thread::trySleep((unsigned long)MicroServiceDaemonBusTimer());
 | 
								if(!Poco::Thread::trySleep((unsigned long)MicroServiceDaemonBusTimer())) {
 | 
				
			||||||
			if (!Running_)
 | 
					 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
			Msg = (MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE));
 | 
								Msg = (MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE));
 | 
				
			||||||
			KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(),
 | 
								KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(),
 | 
				
			||||||
										Msg, false);
 | 
															Msg, false);
 | 
				
			||||||
@@ -31,7 +29,7 @@ namespace OpenWifi {
 | 
				
			|||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void EventBusManager::Start() {
 | 
						void EventBusManager::Start() {
 | 
				
			||||||
		poco_information(Logger(), "Starting...");
 | 
							poco_information(Logger_, "Starting...");
 | 
				
			||||||
		if (KafkaManager()->Enabled()) {
 | 
							if (KafkaManager()->Enabled()) {
 | 
				
			||||||
			Thread_.start(*this);
 | 
								Thread_.start(*this);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -39,11 +37,11 @@ namespace OpenWifi {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	void EventBusManager::Stop() {
 | 
						void EventBusManager::Stop() {
 | 
				
			||||||
		if (KafkaManager()->Enabled()) {
 | 
							if (KafkaManager()->Enabled()) {
 | 
				
			||||||
			poco_information(Logger(), "Stopping...");
 | 
								poco_information(Logger_, "Stopping...");
 | 
				
			||||||
			Running_ = false;
 | 
								Running_ = false;
 | 
				
			||||||
			Thread_.wakeUp();
 | 
								Thread_.wakeUp();
 | 
				
			||||||
			Thread_.join();
 | 
								Thread_.join();
 | 
				
			||||||
			poco_information(Logger(), "Stopped...");
 | 
								poco_information(Logger_, "Stopped...");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,16 @@ namespace OpenWifi {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	class EventBusManager : public Poco::Runnable {
 | 
						class EventBusManager : public Poco::Runnable {
 | 
				
			||||||
	  public:
 | 
						  public:
 | 
				
			||||||
		explicit EventBusManager(Poco::Logger &L);
 | 
							EventBusManager() :
 | 
				
			||||||
 | 
								Logger_(Poco::Logger::create(
 | 
				
			||||||
 | 
									"EventBusManager", Poco::Logger::root().getChannel(), Poco::Logger::root().getLevel())) {
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							static auto instance() {
 | 
				
			||||||
 | 
								static auto instance_ = new EventBusManager;
 | 
				
			||||||
 | 
								return instance_;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		void run() final;
 | 
							void run() final;
 | 
				
			||||||
		void Start();
 | 
							void Start();
 | 
				
			||||||
		void Stop();
 | 
							void Stop();
 | 
				
			||||||
@@ -24,4 +33,6 @@ namespace OpenWifi {
 | 
				
			|||||||
		Poco::Logger &Logger_;
 | 
							Poco::Logger &Logger_;
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						inline auto EventBusManager() { return EventBusManager::instance(); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} // namespace OpenWifi
 | 
					} // namespace OpenWifi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -79,8 +79,10 @@ namespace OpenWifi {
 | 
				
			|||||||
		Utils::SetThreadName("Kafka:Prod");
 | 
							Utils::SetThreadName("Kafka:Prod");
 | 
				
			||||||
		cppkafka::Configuration Config(
 | 
							cppkafka::Configuration Config(
 | 
				
			||||||
			{{"client.id", MicroServiceConfigGetString("openwifi.kafka.client.id", "")},
 | 
								{{"client.id", MicroServiceConfigGetString("openwifi.kafka.client.id", "")},
 | 
				
			||||||
			 {"metadata.broker.list",
 | 
								 {"metadata.broker.list",MicroServiceConfigGetString("openwifi.kafka.brokerlist", "")} // ,
 | 
				
			||||||
			  MicroServiceConfigGetString("openwifi.kafka.brokerlist", "")}});
 | 
								 // {"send.buffer.bytes", KafkaManager()->KafkaManagerMaximumPayloadSize() }
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					 		);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		AddKafkaSecurity(Config);
 | 
							AddKafkaSecurity(Config);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -105,8 +107,17 @@ namespace OpenWifi {
 | 
				
			|||||||
					NewMessage.partition(0);
 | 
										NewMessage.partition(0);
 | 
				
			||||||
					NewMessage.payload(Msg->Payload());
 | 
										NewMessage.payload(Msg->Payload());
 | 
				
			||||||
					Producer.produce(NewMessage);
 | 
										Producer.produce(NewMessage);
 | 
				
			||||||
 | 
										if (Queue_.size() < 100) {
 | 
				
			||||||
 | 
											// use flush when internal queue is lightly loaded, i.e. flush after each
 | 
				
			||||||
 | 
											// message
 | 
				
			||||||
						Producer.flush();
 | 
											Producer.flush();
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
										else {
 | 
				
			||||||
 | 
											// use poll when internal queue is loaded to allow messages to be sent in
 | 
				
			||||||
 | 
											// batches
 | 
				
			||||||
 | 
											Producer.poll((std::chrono::milliseconds) 0);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			} catch (const cppkafka::HandleException &E) {
 | 
								} catch (const cppkafka::HandleException &E) {
 | 
				
			||||||
				poco_warning(Logger_,
 | 
									poco_warning(Logger_,
 | 
				
			||||||
							 fmt::format("Caught a Kafka exception (producer): {}", E.what()));
 | 
												 fmt::format("Caught a Kafka exception (producer): {}", E.what()));
 | 
				
			||||||
@@ -115,8 +126,13 @@ namespace OpenWifi {
 | 
				
			|||||||
			} catch (...) {
 | 
								} catch (...) {
 | 
				
			||||||
				poco_error(Logger_, "std::exception");
 | 
									poco_error(Logger_, "std::exception");
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								if (Queue_.size() == 0) {
 | 
				
			||||||
 | 
									// message queue is empty, flush all previously sent messages
 | 
				
			||||||
 | 
									Producer.flush();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			Note = Queue_.waitDequeueNotification();
 | 
								Note = Queue_.waitDequeueNotification();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							Producer.flush();
 | 
				
			||||||
		poco_information(Logger_, "Stopped...");
 | 
							poco_information(Logger_, "Stopped...");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -275,6 +291,7 @@ namespace OpenWifi {
 | 
				
			|||||||
	int KafkaManager::Start() {
 | 
						int KafkaManager::Start() {
 | 
				
			||||||
		if (!KafkaEnabled_)
 | 
							if (!KafkaEnabled_)
 | 
				
			||||||
			return 0;
 | 
								return 0;
 | 
				
			||||||
 | 
							MaxPayloadSize_ = MicroServiceConfigGetInt("openwifi.kafka.max.payload", 250000);
 | 
				
			||||||
		ConsumerThr_.Start();
 | 
							ConsumerThr_.Start();
 | 
				
			||||||
		ProducerThr_.Start();
 | 
							ProducerThr_.Start();
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
@@ -307,10 +324,8 @@ namespace OpenWifi {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	[[nodiscard]] std::string KafkaManager::WrapSystemId(const std::string & PayLoad) {
 | 
						[[nodiscard]] std::string KafkaManager::WrapSystemId(const std::string & PayLoad) {
 | 
				
			||||||
		return fmt::format(	R"lit({{ "system" : {{ "id" : {},
 | 
							return fmt::format(	R"lit({{ "system" : {{ "id" : {}, "host" : "{}" }}, "payload" : {} }})lit",
 | 
				
			||||||
									"host" : "{}" }},
 | 
											   MicroServiceID(), MicroServicePrivateEndPoint(), PayLoad ) ;
 | 
				
			||||||
									"payload" : {} }})lit", MicroServiceID(),
 | 
					 | 
				
			||||||
						   				MicroServicePrivateEndPoint(), PayLoad ) ;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void KafkaManager::PartitionAssignment(const cppkafka::TopicPartitionList &partitions) {
 | 
						void KafkaManager::PartitionAssignment(const cppkafka::TopicPartitionList &partitions) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -94,11 +94,14 @@ namespace OpenWifi {
 | 
				
			|||||||
			return ConsumerThr_.UnregisterTopicWatcher(Topic,Id);
 | 
								return ConsumerThr_.UnregisterTopicWatcher(Topic,Id);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							std::uint64_t KafkaManagerMaximumPayloadSize() const { return MaxPayloadSize_; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	  private:
 | 
						  private:
 | 
				
			||||||
		bool KafkaEnabled_ = false;
 | 
							bool KafkaEnabled_ = false;
 | 
				
			||||||
		std::string SystemInfoWrapper_;
 | 
							std::string SystemInfoWrapper_;
 | 
				
			||||||
		KafkaProducer ProducerThr_;
 | 
							KafkaProducer ProducerThr_;
 | 
				
			||||||
		KafkaConsumer ConsumerThr_;
 | 
							KafkaConsumer ConsumerThr_;
 | 
				
			||||||
 | 
							std::uint64_t MaxPayloadSize_ = 250000;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		void PartitionAssignment(const cppkafka::TopicPartitionList &partitions);
 | 
							void PartitionAssignment(const cppkafka::TopicPartitionList &partitions);
 | 
				
			||||||
		void PartitionRevocation(const cppkafka::TopicPartitionList &partitions);
 | 
							void PartitionRevocation(const cppkafka::TopicPartitionList &partitions);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,6 +20,7 @@ namespace OpenWifi::KafkaTopics {
 | 
				
			|||||||
	inline const char * DEVICE_EVENT_QUEUE = "device_event_queue";
 | 
						inline const char * DEVICE_EVENT_QUEUE = "device_event_queue";
 | 
				
			||||||
	inline const char * DEVICE_TELEMETRY = "device_telemetry";
 | 
						inline const char * DEVICE_TELEMETRY = "device_telemetry";
 | 
				
			||||||
	inline const char * PROVISIONING_CHANGE = "provisioning_change";
 | 
						inline const char * PROVISIONING_CHANGE = "provisioning_change";
 | 
				
			||||||
 | 
						inline const char * RRM = "rrm";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	namespace ServiceEvents {
 | 
						namespace ServiceEvents {
 | 
				
			||||||
		inline const char * EVENT_JOIN = "join";
 | 
							inline const char * EVENT_JOIN = "join";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,13 +29,29 @@
 | 
				
			|||||||
#include "framework/WebSocketLogger.h"
 | 
					#include "framework/WebSocketLogger.h"
 | 
				
			||||||
#include "framework/utils.h"
 | 
					#include "framework/utils.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef  USE_MEDUSA_CLIENT
 | 
				
			||||||
 | 
					#include <medusa/MedusaClient.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace OpenWifi {
 | 
					namespace OpenWifi {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void MicroService::Exit(int Reason) { std::exit(Reason); }
 | 
						static std::string MakeServiceListString(const Types::MicroServiceMetaMap &Services) {
 | 
				
			||||||
 | 
					        std::string SvcList;
 | 
				
			||||||
 | 
					        for (const auto &Svc : Services) {
 | 
				
			||||||
 | 
					            if (SvcList.empty())
 | 
				
			||||||
 | 
					                SvcList = Svc.second.Type;
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					                SvcList += ", " + Svc.second.Type;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return SvcList;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void MicroService::BusMessageReceived([[maybe_unused]] const std::string &Key,
 | 
						void MicroService::BusMessageReceived([[maybe_unused]] const std::string &Key,
 | 
				
			||||||
										  const std::string &Payload) {
 | 
															  const std::string &Payload) {
 | 
				
			||||||
		std::lock_guard G(InfraMutex_);
 | 
							std::lock_guard G(InfraMutex_);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							Poco::Logger &BusLogger = EventBusManager()->Logger();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			Poco::JSON::Parser P;
 | 
								Poco::JSON::Parser P;
 | 
				
			||||||
			auto Object = P.parse(Payload).extract<Poco::JSON::Object::Ptr>();
 | 
								auto Object = P.parse(Payload).extract<Poco::JSON::Object::Ptr>();
 | 
				
			||||||
@@ -55,13 +71,10 @@ namespace OpenWifi {
 | 
				
			|||||||
							Object->has(KafkaTopics::ServiceEvents::Fields::KEY)) {
 | 
												Object->has(KafkaTopics::ServiceEvents::Fields::KEY)) {
 | 
				
			||||||
							auto PrivateEndPoint =
 | 
												auto PrivateEndPoint =
 | 
				
			||||||
								Object->get(KafkaTopics::ServiceEvents::Fields::PRIVATE).toString();
 | 
													Object->get(KafkaTopics::ServiceEvents::Fields::PRIVATE).toString();
 | 
				
			||||||
							if (Event == KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE &&
 | 
												if (Event == KafkaTopics::ServiceEvents::EVENT_LEAVE) {
 | 
				
			||||||
								Services_.find(PrivateEndPoint) != Services_.end()) {
 | 
					 | 
				
			||||||
								Services_[PrivateEndPoint].LastUpdate = Utils::Now();
 | 
					 | 
				
			||||||
							} else if (Event == KafkaTopics::ServiceEvents::EVENT_LEAVE) {
 | 
					 | 
				
			||||||
								Services_.erase(PrivateEndPoint);
 | 
													Services_.erase(PrivateEndPoint);
 | 
				
			||||||
								poco_debug(
 | 
													poco_information(
 | 
				
			||||||
									logger(),
 | 
														BusLogger,
 | 
				
			||||||
									fmt::format(
 | 
														fmt::format(
 | 
				
			||||||
										"Service {} ID={} leaving system.",
 | 
															"Service {} ID={} leaving system.",
 | 
				
			||||||
										Object->get(KafkaTopics::ServiceEvents::Fields::PRIVATE)
 | 
															Object->get(KafkaTopics::ServiceEvents::Fields::PRIVATE)
 | 
				
			||||||
@@ -69,14 +82,7 @@ namespace OpenWifi {
 | 
				
			|||||||
										ID));
 | 
															ID));
 | 
				
			||||||
							} else if (Event == KafkaTopics::ServiceEvents::EVENT_JOIN ||
 | 
												} else if (Event == KafkaTopics::ServiceEvents::EVENT_JOIN ||
 | 
				
			||||||
									   Event == KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE) {
 | 
														   Event == KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE) {
 | 
				
			||||||
								poco_debug(
 | 
													auto ServiceInfo = Types::MicroServiceMeta{
 | 
				
			||||||
									logger(),
 | 
					 | 
				
			||||||
									fmt::format(
 | 
					 | 
				
			||||||
										"Service {} ID={} joining system.",
 | 
					 | 
				
			||||||
										Object->get(KafkaTopics::ServiceEvents::Fields::PRIVATE)
 | 
					 | 
				
			||||||
											.toString(),
 | 
					 | 
				
			||||||
										ID));
 | 
					 | 
				
			||||||
								Services_[PrivateEndPoint] = Types::MicroServiceMeta{
 | 
					 | 
				
			||||||
									.Id = ID,
 | 
														.Id = ID,
 | 
				
			||||||
									.Type = Poco::toLower(
 | 
														.Type = Poco::toLower(
 | 
				
			||||||
										Object->get(KafkaTopics::ServiceEvents::Fields::TYPE)
 | 
															Object->get(KafkaTopics::ServiceEvents::Fields::TYPE)
 | 
				
			||||||
@@ -94,6 +100,22 @@ namespace OpenWifi {
 | 
				
			|||||||
												   .toString(),
 | 
																	   .toString(),
 | 
				
			||||||
									.LastUpdate = Utils::Now()};
 | 
														.LastUpdate = Utils::Now()};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                                auto s1 = MakeServiceListString(Services_);
 | 
				
			||||||
 | 
													auto PreviousSize = Services_.size();
 | 
				
			||||||
 | 
													Services_[PrivateEndPoint] = ServiceInfo;
 | 
				
			||||||
 | 
													auto CurrentSize = Services_.size();
 | 
				
			||||||
 | 
													if(Event == KafkaTopics::ServiceEvents::EVENT_JOIN) {
 | 
				
			||||||
 | 
														if(!s1.empty()) {
 | 
				
			||||||
 | 
															poco_information(
 | 
				
			||||||
 | 
																BusLogger,
 | 
				
			||||||
 | 
																fmt::format(
 | 
				
			||||||
 | 
																	"Service {} ID={} is joining the system.",
 | 
				
			||||||
 | 
																	Object
 | 
				
			||||||
 | 
																		->get(
 | 
				
			||||||
 | 
																			KafkaTopics::ServiceEvents::Fields::PRIVATE)
 | 
				
			||||||
 | 
																		.toString(),
 | 
				
			||||||
 | 
																	ID));
 | 
				
			||||||
 | 
														}
 | 
				
			||||||
									std::string SvcList;
 | 
														std::string SvcList;
 | 
				
			||||||
									for (const auto &Svc : Services_) {
 | 
														for (const auto &Svc : Services_) {
 | 
				
			||||||
										if (SvcList.empty())
 | 
															if (SvcList.empty())
 | 
				
			||||||
@@ -102,12 +124,22 @@ namespace OpenWifi {
 | 
				
			|||||||
											SvcList += ", " + Svc.second.Type;
 | 
																SvcList += ", " + Svc.second.Type;
 | 
				
			||||||
									}
 | 
														}
 | 
				
			||||||
									poco_information(
 | 
														poco_information(
 | 
				
			||||||
									logger(),
 | 
															BusLogger,
 | 
				
			||||||
										fmt::format("Current list of microservices: {}", SvcList));
 | 
															fmt::format("Current list of microservices: {}", SvcList));
 | 
				
			||||||
 | 
													} else if(CurrentSize!=PreviousSize) {
 | 
				
			||||||
 | 
														poco_information(
 | 
				
			||||||
 | 
															BusLogger,
 | 
				
			||||||
 | 
															fmt::format(
 | 
				
			||||||
 | 
																"Service {} ID={} is being added back in.",
 | 
				
			||||||
 | 
																Object
 | 
				
			||||||
 | 
																	->get(KafkaTopics::ServiceEvents::Fields::PRIVATE)
 | 
				
			||||||
 | 
																	.toString(),
 | 
				
			||||||
 | 
																ID));
 | 
				
			||||||
 | 
													}
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
						} else {
 | 
											} else {
 | 
				
			||||||
							poco_error(
 | 
												poco_information(
 | 
				
			||||||
								logger(),
 | 
													BusLogger,
 | 
				
			||||||
								fmt::format("KAFKA-MSG: invalid event '{}', missing a field.",
 | 
													fmt::format("KAFKA-MSG: invalid event '{}', missing a field.",
 | 
				
			||||||
											Event));
 | 
																Event));
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
@@ -118,32 +150,39 @@ namespace OpenWifi {
 | 
				
			|||||||
								Object->get(KafkaTopics::ServiceEvents::Fields::TOKEN).toString());
 | 
													Object->get(KafkaTopics::ServiceEvents::Fields::TOKEN).toString());
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
						} else {
 | 
											} else {
 | 
				
			||||||
							poco_error(
 | 
												poco_information(
 | 
				
			||||||
								logger(),
 | 
													BusLogger,
 | 
				
			||||||
								fmt::format("KAFKA-MSG: invalid event '{}', missing token", Event));
 | 
													fmt::format("KAFKA-MSG: invalid event '{}', missing token", Event));
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					} else {
 | 
										} else {
 | 
				
			||||||
						poco_error(logger(),
 | 
											poco_information(BusLogger,
 | 
				
			||||||
								   fmt::format("Unknown Event: {} Source: {}", Event, ID));
 | 
													   fmt::format("Unknown Event: {} Source: {}", Event, ID));
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				poco_error(logger(), "Bad bus message.");
 | 
					 | 
				
			||||||
				std::ostringstream os;
 | 
									std::ostringstream os;
 | 
				
			||||||
				Object->stringify(std::cout);
 | 
									Object->stringify(std::cout);
 | 
				
			||||||
 | 
									poco_error(BusLogger, fmt::format("Bad bus message: {}", os.str()));
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			auto i = Services_.begin();
 | 
								auto ServiceHint = Services_.begin();
 | 
				
			||||||
			auto now = Utils::Now();
 | 
								auto now = Utils::Now();
 | 
				
			||||||
			for (; i != Services_.end();) {
 | 
					            auto si1 = Services_.size();
 | 
				
			||||||
				if ((now - i->second.LastUpdate) > 60) {
 | 
					            auto ss1 = MakeServiceListString(Services_);
 | 
				
			||||||
					i = Services_.erase(i);
 | 
								while(ServiceHint!=Services_.end()) {
 | 
				
			||||||
 | 
									if ((now - ServiceHint->second.LastUpdate) > 120) {
 | 
				
			||||||
 | 
										poco_information(BusLogger, fmt::format("ZombieService: Removing service {}, ", ServiceHint->second.PublicEndPoint));
 | 
				
			||||||
 | 
										ServiceHint = Services_.erase(ServiceHint);
 | 
				
			||||||
				} else
 | 
									} else
 | 
				
			||||||
					++i;
 | 
										++ServiceHint;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					            if(Services_.size() != si1) {
 | 
				
			||||||
 | 
					                auto ss2 = MakeServiceListString(Services_);
 | 
				
			||||||
 | 
					                poco_information(BusLogger, fmt::format("Current list of microservices: {} -> {}", ss1, ss2));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		} catch (const Poco::Exception &E) {
 | 
							} catch (const Poco::Exception &E) {
 | 
				
			||||||
			logger().log(E);
 | 
								BusLogger.log(E);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -167,9 +206,11 @@ namespace OpenWifi {
 | 
				
			|||||||
			Res.push_back(ServiceRec);
 | 
								Res.push_back(ServiceRec);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return Res;
 | 
							return Res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void MicroService::LoadConfigurationFile() {
 | 
						void MicroService::LoadConfigurationFile() {
 | 
				
			||||||
 | 
					        if(ConfigContent_.empty()) {
 | 
				
			||||||
            std::string Location = Poco::Environment::get(DAEMON_CONFIG_ENV_VAR, ".");
 | 
					            std::string Location = Poco::Environment::get(DAEMON_CONFIG_ENV_VAR, ".");
 | 
				
			||||||
            ConfigFileName_ =
 | 
					            ConfigFileName_ =
 | 
				
			||||||
                ConfigFileName_.empty() ? Location + "/" + DAEMON_PROPERTIES_FILENAME : ConfigFileName_;
 | 
					                ConfigFileName_.empty() ? Location + "/" + DAEMON_PROPERTIES_FILENAME : ConfigFileName_;
 | 
				
			||||||
@@ -183,9 +224,11 @@ namespace OpenWifi {
 | 
				
			|||||||
                          << std::endl;
 | 
					                          << std::endl;
 | 
				
			||||||
                std::exit(Poco::Util::Application::EXIT_CONFIG);
 | 
					                std::exit(Poco::Util::Application::EXIT_CONFIG);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					 | 
				
			||||||
		// 	    loadConfiguration(ConfigFile.toString());
 | 
					 | 
				
			||||||
            PropConfigurationFile_ = new Poco::Util::PropertyFileConfiguration(ConfigFile.toString());
 | 
					            PropConfigurationFile_ = new Poco::Util::PropertyFileConfiguration(ConfigFile.toString());
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            std::istringstream is(ConfigContent_);
 | 
				
			||||||
 | 
					            PropConfigurationFile_ = new Poco::Util::PropertyFileConfiguration(is);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
		configPtr()->addWriteable(PropConfigurationFile_, PRIO_DEFAULT);
 | 
							configPtr()->addWriteable(PropConfigurationFile_, PRIO_DEFAULT);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -388,11 +431,13 @@ namespace OpenWifi {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	void DaemonPostInitialization(Poco::Util::Application &self);
 | 
						void DaemonPostInitialization(Poco::Util::Application &self);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void MicroService::initialize(Poco::Util::Application &self) {
 | 
					    void MicroService::StartEverything(Poco::Util::Application &self) {
 | 
				
			||||||
		// add the default services
 | 
					 | 
				
			||||||
        LoadConfigurationFile();
 | 
					        LoadConfigurationFile();
 | 
				
			||||||
        InitializeLoggingSystem();
 | 
					        InitializeLoggingSystem();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        static bool InitializedBaseService=false;
 | 
				
			||||||
 | 
					        if(!InitializedBaseService) {
 | 
				
			||||||
 | 
					            InitializedBaseService = true;
 | 
				
			||||||
            SubSystems_.push_back(KafkaManager());
 | 
					            SubSystems_.push_back(KafkaManager());
 | 
				
			||||||
            SubSystems_.push_back(ALBHealthCheckServer());
 | 
					            SubSystems_.push_back(ALBHealthCheckServer());
 | 
				
			||||||
            SubSystems_.push_back(RESTAPI_ExtServer());
 | 
					            SubSystems_.push_back(RESTAPI_ExtServer());
 | 
				
			||||||
@@ -400,11 +445,13 @@ namespace OpenWifi {
 | 
				
			|||||||
#ifndef TIP_SECURITY_SERVICE
 | 
					#ifndef TIP_SECURITY_SERVICE
 | 
				
			||||||
            SubSystems_.push_back(AuthClient());
 | 
					            SubSystems_.push_back(AuthClient());
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Poco::Net::initializeSSL();
 | 
					            Poco::Net::initializeSSL();
 | 
				
			||||||
            Poco::Net::HTTPStreamFactory::registerFactory();
 | 
					            Poco::Net::HTTPStreamFactory::registerFactory();
 | 
				
			||||||
            Poco::Net::HTTPSStreamFactory::registerFactory();
 | 
					            Poco::Net::HTTPSStreamFactory::registerFactory();
 | 
				
			||||||
            Poco::Net::FTPStreamFactory::registerFactory();
 | 
					            Poco::Net::FTPStreamFactory::registerFactory();
 | 
				
			||||||
            Poco::Net::FTPSStreamFactory::registerFactory();
 | 
					            Poco::Net::FTPSStreamFactory::registerFactory();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Poco::File DataDir(ConfigPath("openwifi.system.data"));
 | 
					        Poco::File DataDir(ConfigPath("openwifi.system.data"));
 | 
				
			||||||
        DataDir_ = DataDir.path();
 | 
					        DataDir_ = DataDir.path();
 | 
				
			||||||
@@ -412,7 +459,7 @@ namespace OpenWifi {
 | 
				
			|||||||
            try {
 | 
					            try {
 | 
				
			||||||
                DataDir.createDirectory();
 | 
					                DataDir.createDirectory();
 | 
				
			||||||
            } catch (const Poco::Exception &E) {
 | 
					            } catch (const Poco::Exception &E) {
 | 
				
			||||||
				logger().log(E);
 | 
					                Logger_.log(E);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        WWWAssetsDir_ = ConfigPath("openwifi.restapi.wwwassets", "");
 | 
					        WWWAssetsDir_ = ConfigPath("openwifi.restapi.wwwassets", "");
 | 
				
			||||||
@@ -433,6 +480,12 @@ namespace OpenWifi {
 | 
				
			|||||||
        KafkaManager()->RegisterTopicWatcher(KafkaTopics::SERVICE_EVENTS, F);
 | 
					        KafkaManager()->RegisterTopicWatcher(KafkaTopics::SERVICE_EVENTS, F);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						void MicroService::initialize([[maybe_unused]] Poco::Util::Application &self) {
 | 
				
			||||||
 | 
					#ifndef USE_MEDUSA_CLIENT
 | 
				
			||||||
 | 
					        StartEverything(self);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void MicroService::uninitialize() {
 | 
						void MicroService::uninitialize() {
 | 
				
			||||||
		// add your own uninitialization code here
 | 
							// add your own uninitialization code here
 | 
				
			||||||
		ServerApplication::uninitialize();
 | 
							ServerApplication::uninitialize();
 | 
				
			||||||
@@ -530,14 +583,12 @@ namespace OpenWifi {
 | 
				
			|||||||
		for (auto i : SubSystems_) {
 | 
							for (auto i : SubSystems_) {
 | 
				
			||||||
			i->Start();
 | 
								i->Start();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		EventBusManager_ = std::make_unique<EventBusManager>(Poco::Logger::create(
 | 
							EventBusManager()->Start();
 | 
				
			||||||
			"EventBusManager", Poco::Logger::root().getChannel(), Poco::Logger::root().getLevel()));
 | 
					 | 
				
			||||||
		EventBusManager_->Start();
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void MicroService::StopSubSystemServers() {
 | 
						void MicroService::StopSubSystemServers() {
 | 
				
			||||||
		AddActivity("Stopping");
 | 
							AddActivity("Stopping");
 | 
				
			||||||
		EventBusManager_->Stop();
 | 
							EventBusManager()->Stop();
 | 
				
			||||||
		for (auto i = SubSystems_.rbegin(); i != SubSystems_.rend(); ++i) {
 | 
							for (auto i = SubSystems_.rbegin(); i != SubSystems_.rend(); ++i) {
 | 
				
			||||||
			(*i)->Stop();
 | 
								(*i)->Stop();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -697,7 +748,7 @@ namespace OpenWifi {
 | 
				
			|||||||
			auto APIKEY = Request.get("X-API-KEY");
 | 
								auto APIKEY = Request.get("X-API-KEY");
 | 
				
			||||||
			return APIKEY == MyHash_;
 | 
								return APIKEY == MyHash_;
 | 
				
			||||||
		} catch (const Poco::Exception &E) {
 | 
							} catch (const Poco::Exception &E) {
 | 
				
			||||||
			logger().log(E);
 | 
								Logger_.log(E);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -718,6 +769,8 @@ namespace OpenWifi {
 | 
				
			|||||||
		MicroServiceErrorHandler ErrorHandler(*this);
 | 
							MicroServiceErrorHandler ErrorHandler(*this);
 | 
				
			||||||
		Poco::ErrorHandler::set(&ErrorHandler);
 | 
							Poco::ErrorHandler::set(&ErrorHandler);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Args_ = args;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!HelpRequested_) {
 | 
							if (!HelpRequested_) {
 | 
				
			||||||
			SavePID();
 | 
								SavePID();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -733,11 +786,18 @@ namespace OpenWifi {
 | 
				
			|||||||
				poco_information(logger, "Starting as a daemon.");
 | 
									poco_information(logger, "Starting as a daemon.");
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef USE_MEDUSA_CLIENT
 | 
				
			||||||
 | 
					            MedusaClient::instance()->SetSubSystems(SubSystems_);
 | 
				
			||||||
 | 
					            MedusaClient::instance()->Start();
 | 
				
			||||||
 | 
								waitForTerminationRequest();
 | 
				
			||||||
 | 
					            MedusaClient::instance()->Stop();
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
			poco_information(logger, fmt::format("System ID set to {}", ID_));
 | 
								poco_information(logger, fmt::format("System ID set to {}", ID_));
 | 
				
			||||||
			StartSubSystemServers();
 | 
								StartSubSystemServers();
 | 
				
			||||||
			waitForTerminationRequest();
 | 
								waitForTerminationRequest();
 | 
				
			||||||
			StopSubSystemServers();
 | 
								StopSubSystemServers();
 | 
				
			||||||
			logger.notice(fmt::format("Stopped {}...", DAEMON_APP_NAME));
 | 
								logger.notice(fmt::format("Stopped {}...", DAEMON_APP_NAME));
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return Application::EXIT_OK;
 | 
							return Application::EXIT_OK;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -55,9 +55,6 @@ namespace OpenWifi {
 | 
				
			|||||||
#include "nlohmann/json.hpp"
 | 
					#include "nlohmann/json.hpp"
 | 
				
			||||||
#include "ow_version.h"
 | 
					#include "ow_version.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define _OWDEBUG_ std::cout << __FILE__ << ":" << __LINE__ << std::endl;
 | 
					 | 
				
			||||||
// #define _OWDEBUG_ Logger().debug(Poco::format("%s: %lu",__FILE__,__LINE__));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace OpenWifi {
 | 
					namespace OpenWifi {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	class MicroService : public Poco::Util::ServerApplication {
 | 
						class MicroService : public Poco::Util::ServerApplication {
 | 
				
			||||||
@@ -70,7 +67,6 @@ namespace OpenWifi {
 | 
				
			|||||||
			  SubSystems_(std::move(Subsystems)), Logger_(Poco::Logger::get("FRAMEWORK")) {
 | 
								  SubSystems_(std::move(Subsystems)), Logger_(Poco::Logger::get("FRAMEWORK")) {
 | 
				
			||||||
			instance_ = this;
 | 
								instance_ = this;
 | 
				
			||||||
			RandomEngine_.seed(std::chrono::steady_clock::now().time_since_epoch().count());
 | 
								RandomEngine_.seed(std::chrono::steady_clock::now().time_since_epoch().count());
 | 
				
			||||||
			// Logger_ = Poco::Logger::root().get("BASE-SVC");
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		inline static const char *ExtraConfigurationFilename = "/configuration_override.json";
 | 
							inline static const char *ExtraConfigurationFilename = "/configuration_override.json";
 | 
				
			||||||
@@ -92,7 +88,7 @@ namespace OpenWifi {
 | 
				
			|||||||
		inline uint64_t DaemonBusTimer() const { return DAEMON_BUS_TIMER; };
 | 
							inline uint64_t DaemonBusTimer() const { return DAEMON_BUS_TIMER; };
 | 
				
			||||||
		[[nodiscard]] const std::string &AppName() { return DAEMON_APP_NAME; }
 | 
							[[nodiscard]] const std::string &AppName() { return DAEMON_APP_NAME; }
 | 
				
			||||||
		static inline uint64_t GetPID() { return Poco::Process::id(); };
 | 
							static inline uint64_t GetPID() { return Poco::Process::id(); };
 | 
				
			||||||
		[[nodiscard]] inline const std::string GetPublicAPIEndPoint() {
 | 
							[[nodiscard]] inline std::string GetPublicAPIEndPoint() const {
 | 
				
			||||||
			return MyPublicEndPoint_ + "/api/v1";
 | 
								return MyPublicEndPoint_ + "/api/v1";
 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
		[[nodiscard]] inline const std::string &GetUIURI() const { return UIURI_; };
 | 
							[[nodiscard]] inline const std::string &GetUIURI() const { return UIURI_; };
 | 
				
			||||||
@@ -107,7 +103,8 @@ namespace OpenWifi {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		static MicroService &instance() { return *instance_; }
 | 
							static MicroService &instance() { return *instance_; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		inline void Exit(int Reason);
 | 
							inline void Exit(int Reason) { std::exit(Reason); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		void BusMessageReceived(const std::string &Key, const std::string &Payload);
 | 
							void BusMessageReceived(const std::string &Key, const std::string &Payload);
 | 
				
			||||||
		Types::MicroServiceMetaVec GetServices(const std::string &Type);
 | 
							Types::MicroServiceMetaVec GetServices(const std::string &Type);
 | 
				
			||||||
		Types::MicroServiceMetaVec GetServices();
 | 
							Types::MicroServiceMetaVec GetServices();
 | 
				
			||||||
@@ -115,6 +112,7 @@ namespace OpenWifi {
 | 
				
			|||||||
		void Reload();
 | 
							void Reload();
 | 
				
			||||||
		void LoadMyConfig();
 | 
							void LoadMyConfig();
 | 
				
			||||||
		void initialize(Poco::Util::Application &self) override;
 | 
							void initialize(Poco::Util::Application &self) override;
 | 
				
			||||||
 | 
					        void StartEverything(Poco::Util::Application &self);
 | 
				
			||||||
		void uninitialize() override;
 | 
							void uninitialize() override;
 | 
				
			||||||
		void reinitialize(Poco::Util::Application &self) override;
 | 
							void reinitialize(Poco::Util::Application &self) override;
 | 
				
			||||||
		void defineOptions(Poco::Util::OptionSet &options) override;
 | 
							void defineOptions(Poco::Util::OptionSet &options) override;
 | 
				
			||||||
@@ -132,7 +130,7 @@ namespace OpenWifi {
 | 
				
			|||||||
		void Reload(const std::string &Sub);
 | 
							void Reload(const std::string &Sub);
 | 
				
			||||||
		Types::StringVec GetSubSystems() const;
 | 
							Types::StringVec GetSubSystems() const;
 | 
				
			||||||
		Types::StringPairVec GetLogLevels();
 | 
							Types::StringPairVec GetLogLevels();
 | 
				
			||||||
		const Types::StringVec &GetLogLevelNames();
 | 
							static const Types::StringVec &GetLogLevelNames();
 | 
				
			||||||
		uint64_t ConfigGetInt(const std::string &Key, uint64_t Default);
 | 
							uint64_t ConfigGetInt(const std::string &Key, uint64_t Default);
 | 
				
			||||||
		uint64_t ConfigGetInt(const std::string &Key);
 | 
							uint64_t ConfigGetInt(const std::string &Key);
 | 
				
			||||||
		uint64_t ConfigGetBool(const std::string &Key, bool Default);
 | 
							uint64_t ConfigGetBool(const std::string &Key, bool Default);
 | 
				
			||||||
@@ -166,12 +164,16 @@ namespace OpenWifi {
 | 
				
			|||||||
								const std::string &FormatterPattern,
 | 
													const std::string &FormatterPattern,
 | 
				
			||||||
								const std::string &root_env_var);
 | 
													const std::string &root_env_var);
 | 
				
			||||||
		inline bool AllowExternalMicroServices() const { return AllowExternalMicroServices_; }
 | 
							inline bool AllowExternalMicroServices() const { return AllowExternalMicroServices_; }
 | 
				
			||||||
 | 
					        const ArgVec &Args() const { return Args_; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        inline void SetConfigContent(const std::string &Content) { ConfigContent_ = Content; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	  private:
 | 
						  private:
 | 
				
			||||||
		static MicroService *instance_;
 | 
							static MicroService *instance_;
 | 
				
			||||||
		bool HelpRequested_ = false;
 | 
							bool HelpRequested_ = false;
 | 
				
			||||||
		std::string LogDir_;
 | 
							std::string LogDir_;
 | 
				
			||||||
		std::string ConfigFileName_;
 | 
							std::string ConfigFileName_;
 | 
				
			||||||
 | 
					        std::string ConfigContent_;
 | 
				
			||||||
		uint64_t ID_ = 1;
 | 
							uint64_t ID_ = 1;
 | 
				
			||||||
		Poco::SharedPtr<Poco::Crypto::RSAKey> AppKey_;
 | 
							Poco::SharedPtr<Poco::Crypto::RSAKey> AppKey_;
 | 
				
			||||||
		bool DebugMode_ = false;
 | 
							bool DebugMode_ = false;
 | 
				
			||||||
@@ -201,7 +203,7 @@ namespace OpenWifi {
 | 
				
			|||||||
		Poco::JWT::Signer Signer_;
 | 
							Poco::JWT::Signer Signer_;
 | 
				
			||||||
		Poco::Logger &Logger_;
 | 
							Poco::Logger &Logger_;
 | 
				
			||||||
		Poco::ThreadPool TimerPool_{"timer:pool", 2, 32};
 | 
							Poco::ThreadPool TimerPool_{"timer:pool", 2, 32};
 | 
				
			||||||
		std::unique_ptr<EventBusManager> EventBusManager_;
 | 
					        ArgVec Args_;
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	inline MicroService *MicroService::instance_ = nullptr;
 | 
						inline MicroService *MicroService::instance_ = nullptr;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -129,4 +129,8 @@ namespace OpenWifi {
 | 
				
			|||||||
		return ALBHealthCheckServer()->RegisterExtendedHealthMessage(Callback);
 | 
							return ALBHealthCheckServer()->RegisterExtendedHealthMessage(Callback);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						std::string MicroServiceAccessKey() {
 | 
				
			||||||
 | 
							return MicroService::instance().Hash();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} // namespace OpenWifi
 | 
					} // namespace OpenWifi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,6 +22,7 @@ namespace OpenWifi {
 | 
				
			|||||||
	std::string MicroServicePublicEndPoint();
 | 
						std::string MicroServicePublicEndPoint();
 | 
				
			||||||
	std::string MicroServiceConfigGetString(const std::string &Key,
 | 
						std::string MicroServiceConfigGetString(const std::string &Key,
 | 
				
			||||||
											const std::string &DefaultValue);
 | 
																const std::string &DefaultValue);
 | 
				
			||||||
 | 
						std::string MicroServiceAccessKey();
 | 
				
			||||||
	bool MicroServiceConfigGetBool(const std::string &Key, bool DefaultValue);
 | 
						bool MicroServiceConfigGetBool(const std::string &Key, bool DefaultValue);
 | 
				
			||||||
	std::uint64_t MicroServiceConfigGetInt(const std::string &Key, std::uint64_t DefaultValue);
 | 
						std::uint64_t MicroServiceConfigGetInt(const std::string &Key, std::uint64_t DefaultValue);
 | 
				
			||||||
	std::string MicroServicePrivateEndPoint();
 | 
						std::string MicroServicePrivateEndPoint();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,6 +47,8 @@ namespace OpenWifi {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							Poco::Data::SessionPool &Pool() { return *Pool_; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	  private:
 | 
						  private:
 | 
				
			||||||
		inline int Setup_SQLite();
 | 
							inline int Setup_SQLite();
 | 
				
			||||||
		inline int Setup_MySQL();
 | 
							inline int Setup_MySQL();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -58,11 +58,9 @@ namespace OpenWifi {
 | 
				
			|||||||
	void UI_WebSocketClientServer::run() {
 | 
						void UI_WebSocketClientServer::run() {
 | 
				
			||||||
		Running_ = true;
 | 
							Running_ = true;
 | 
				
			||||||
		while (Running_) {
 | 
							while (Running_) {
 | 
				
			||||||
			Poco::Thread::trySleep(2000);
 | 
								if(!Poco::Thread::trySleep(2000)) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
			if (!Running_)
 | 
					 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
			std::lock_guard G(LocalMutex_);
 | 
								std::lock_guard G(LocalMutex_);
 | 
				
			||||||
			for (const auto i : ToBeRemoved_) {
 | 
								for (const auto i : ToBeRemoved_) {
 | 
				
			||||||
				// std::cout << "Erasing old WS UI connection..." << std::endl;
 | 
									// std::cout << "Erasing old WS UI connection..." << std::endl;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -576,8 +576,8 @@ namespace ORM {
 | 
				
			|||||||
		bool UpdateRecord(field_name_t FieldName, const T &Value, const RecordType &R) {
 | 
							bool UpdateRecord(field_name_t FieldName, const T &Value, const RecordType &R) {
 | 
				
			||||||
			try {
 | 
								try {
 | 
				
			||||||
				assert(ValidFieldName(FieldName));
 | 
									assert(ValidFieldName(FieldName));
 | 
				
			||||||
 | 
					 | 
				
			||||||
				Poco::Data::Session Session = Pool_.get();
 | 
									Poco::Data::Session Session = Pool_.get();
 | 
				
			||||||
 | 
					                Session.begin();
 | 
				
			||||||
				Poco::Data::Statement Update(Session);
 | 
									Poco::Data::Statement Update(Session);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				RecordTuple RT;
 | 
									RecordTuple RT;
 | 
				
			||||||
@@ -593,6 +593,7 @@ namespace ORM {
 | 
				
			|||||||
				Update.execute();
 | 
									Update.execute();
 | 
				
			||||||
				if (Cache_)
 | 
									if (Cache_)
 | 
				
			||||||
					Cache_->UpdateCache(R);
 | 
										Cache_->UpdateCache(R);
 | 
				
			||||||
 | 
					                Session.commit();
 | 
				
			||||||
				return true;
 | 
									return true;
 | 
				
			||||||
			} catch (const Poco::Exception &E) {
 | 
								} catch (const Poco::Exception &E) {
 | 
				
			||||||
				Logger_.log(E);
 | 
									Logger_.log(E);
 | 
				
			||||||
@@ -662,6 +663,7 @@ namespace ORM {
 | 
				
			|||||||
				assert(ValidFieldName(FieldName));
 | 
									assert(ValidFieldName(FieldName));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				Poco::Data::Session Session = Pool_.get();
 | 
									Poco::Data::Session Session = Pool_.get();
 | 
				
			||||||
 | 
					                Session.begin();
 | 
				
			||||||
				Poco::Data::Statement Delete(Session);
 | 
									Poco::Data::Statement Delete(Session);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				std::string St = "delete from " + TableName_ + " where " + FieldName + "=?";
 | 
									std::string St = "delete from " + TableName_ + " where " + FieldName + "=?";
 | 
				
			||||||
@@ -671,6 +673,7 @@ namespace ORM {
 | 
				
			|||||||
				Delete.execute();
 | 
									Delete.execute();
 | 
				
			||||||
				if (Cache_)
 | 
									if (Cache_)
 | 
				
			||||||
					Cache_->Delete(FieldName, Value);
 | 
										Cache_->Delete(FieldName, Value);
 | 
				
			||||||
 | 
					                Session.commit();
 | 
				
			||||||
				return true;
 | 
									return true;
 | 
				
			||||||
			} catch (const Poco::Exception &E) {
 | 
								} catch (const Poco::Exception &E) {
 | 
				
			||||||
				Logger_.log(E);
 | 
									Logger_.log(E);
 | 
				
			||||||
@@ -682,11 +685,13 @@ namespace ORM {
 | 
				
			|||||||
			try {
 | 
								try {
 | 
				
			||||||
				assert(!WhereClause.empty());
 | 
									assert(!WhereClause.empty());
 | 
				
			||||||
				Poco::Data::Session Session = Pool_.get();
 | 
									Poco::Data::Session Session = Pool_.get();
 | 
				
			||||||
 | 
					                Session.begin();
 | 
				
			||||||
				Poco::Data::Statement Delete(Session);
 | 
									Poco::Data::Statement Delete(Session);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				std::string St = "delete from " + TableName_ + " where " + WhereClause;
 | 
									std::string St = "delete from " + TableName_ + " where " + WhereClause;
 | 
				
			||||||
				Delete << St;
 | 
									Delete << St;
 | 
				
			||||||
				Delete.execute();
 | 
									Delete.execute();
 | 
				
			||||||
 | 
					                Session.commit();
 | 
				
			||||||
				return true;
 | 
									return true;
 | 
				
			||||||
			} catch (const Poco::Exception &E) {
 | 
								} catch (const Poco::Exception &E) {
 | 
				
			||||||
				Logger_.log(E);
 | 
									Logger_.log(E);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -414,10 +414,24 @@ namespace OpenWifi::RESTAPI::Errors {
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    static const struct msg DefFirmwareNameExists { 1175, "Firmware name already exists." };
 | 
					    static const struct msg DefFirmwareNameExists { 1175, "Firmware name already exists." };
 | 
				
			||||||
 | 
					 | 
				
			||||||
    static const struct msg NotAValidECKey { 1176, "Not a valid Signing Key." };
 | 
					    static const struct msg NotAValidECKey { 1176, "Not a valid Signing Key." };
 | 
				
			||||||
 | 
					 | 
				
			||||||
	static const struct msg NotAValidRadiusPoolType { 1177, "Not a valid RADIUS pool type." };
 | 
						static const struct msg NotAValidRadiusPoolType { 1177, "Not a valid RADIUS pool type." };
 | 
				
			||||||
 | 
					    static const struct msg InvalidRadiusTypeEndpoint { 1178, "Invalid RADIUS Server Endpoint type." };
 | 
				
			||||||
 | 
					    static const struct msg InvalidRadiusEndpointPoolStrategy { 1179, "Invalid RADIUS Server Endpoint Pool strategy." };
 | 
				
			||||||
 | 
					    static const struct msg EndpointMustHaveOneTypeOfServers { 1180, "All servers must be either RADIUS or RADSEC." };
 | 
				
			||||||
 | 
					    static const struct msg RadiusEndpointIndexInvalid { 1181, "Index must be an address between 0.0.1.1 and 0.0.2.254" };
 | 
				
			||||||
 | 
					    static const struct msg RadiusEndpointIndexMustBeUnique { 1182, "Index must be unique." };
 | 
				
			||||||
 | 
					    static const struct msg OrionAccountMustExist { 1183, "Orion account must exist." };
 | 
				
			||||||
 | 
					    static const struct msg GlobalReachCertMustExist { 1184, "Global Reach certificate must exist." };
 | 
				
			||||||
 | 
					    static const struct msg InvalidRadsecMainCertificate { 1185, "Invalid Radsec main certificate." };
 | 
				
			||||||
 | 
					    static const struct msg InvalidRadsecCaCertificate { 1186, "Invalid Radsec CA certificates." };
 | 
				
			||||||
 | 
					    static const struct msg InvalidRadsecPrivteKey { 1187, "Invalid Radsec Private key." };
 | 
				
			||||||
 | 
					    static const struct msg InvalidRadsecIPAddress { 1188, "Invalid Radsec IP Address." };
 | 
				
			||||||
 | 
					    static const struct msg InvalidRadsecPort { 1189, "Invalid Radsec Port." };
 | 
				
			||||||
 | 
					    static const struct msg InvalidRadsecSecret { 1190, "Invalid Radsec Secret." };
 | 
				
			||||||
 | 
					    static const struct msg InvalidRadiusServer { 1191, "Invalid Radius Server." };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						static const struct msg InvalidRRMAction { 1192, "Invalid RRM Action." };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    static const struct msg SimulationDoesNotExist {
 | 
					    static const struct msg SimulationDoesNotExist {
 | 
				
			||||||
        7000, "Simulation Instance ID does not exist."
 | 
					        7000, "Simulation Instance ID does not exist."
 | 
				
			||||||
@@ -549,6 +563,11 @@ namespace OpenWifi::RESTAPI::Protocol {
 | 
				
			|||||||
	static const char *CONTENTDISPOSITION = "Content-Disposition";
 | 
						static const char *CONTENTDISPOSITION = "Content-Disposition";
 | 
				
			||||||
	static const char *CONTENTTYPE = "Content-Type";
 | 
						static const char *CONTENTTYPE = "Content-Type";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						static const char *TRANSFER = "transfer";
 | 
				
			||||||
 | 
						static const char *CERTUPDATE = "certupdate";
 | 
				
			||||||
 | 
						static const char *POWERCYCLE = "powercycle";
 | 
				
			||||||
 | 
						static const char *RRM = "rrm";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static const char *REQUIREMENTS = "requirements";
 | 
						static const char *REQUIREMENTS = "requirements";
 | 
				
			||||||
	static const char *PASSWORDPATTERN = "passwordPattern";
 | 
						static const char *PASSWORDPATTERN = "passwordPattern";
 | 
				
			||||||
	static const char *ACCESSPOLICY = "accessPolicy";
 | 
						static const char *ACCESSPOLICY = "accessPolicy";
 | 
				
			||||||
@@ -666,6 +685,13 @@ namespace OpenWifi::uCentralProtocol {
 | 
				
			|||||||
	static const char *RADIUSCOA = "coa";
 | 
						static const char *RADIUSCOA = "coa";
 | 
				
			||||||
	static const char *RADIUSDST = "dst";
 | 
						static const char *RADIUSDST = "dst";
 | 
				
			||||||
	static const char *IES = "ies";
 | 
						static const char *IES = "ies";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						static const char *TRANSFER = "transfer";
 | 
				
			||||||
 | 
						static const char *CERTUPDATE = "certupdate";
 | 
				
			||||||
 | 
						static const char *POWERCYCLE = "powercycle";
 | 
				
			||||||
 | 
						static const char *RRM = "rrm";
 | 
				
			||||||
 | 
						static const char *ACTIONS = "actions";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} // namespace OpenWifi::uCentralProtocol
 | 
					} // namespace OpenWifi::uCentralProtocol
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace OpenWifi::uCentralProtocol::Events {
 | 
					namespace OpenWifi::uCentralProtocol::Events {
 | 
				
			||||||
@@ -758,6 +784,10 @@ namespace OpenWifi::APCommands {
 | 
				
			|||||||
		telemetry,
 | 
							telemetry,
 | 
				
			||||||
		ping,
 | 
							ping,
 | 
				
			||||||
		script,
 | 
							script,
 | 
				
			||||||
 | 
							rrm,
 | 
				
			||||||
 | 
							certupdate,
 | 
				
			||||||
 | 
							transfer,
 | 
				
			||||||
 | 
							powercycle,
 | 
				
			||||||
		unknown
 | 
							unknown
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -770,7 +800,10 @@ namespace OpenWifi::APCommands {
 | 
				
			|||||||
		RESTAPI::Protocol::LEDS,		 RESTAPI::Protocol::TRACE,
 | 
							RESTAPI::Protocol::LEDS,		 RESTAPI::Protocol::TRACE,
 | 
				
			||||||
		RESTAPI::Protocol::REQUEST,		 RESTAPI::Protocol::WIFISCAN,
 | 
							RESTAPI::Protocol::REQUEST,		 RESTAPI::Protocol::WIFISCAN,
 | 
				
			||||||
		RESTAPI::Protocol::EVENTQUEUE,	 RESTAPI::Protocol::TELEMETRY,
 | 
							RESTAPI::Protocol::EVENTQUEUE,	 RESTAPI::Protocol::TELEMETRY,
 | 
				
			||||||
		RESTAPI::Protocol::PING,		 RESTAPI::Protocol::SCRIPT};
 | 
							RESTAPI::Protocol::PING,		 RESTAPI::Protocol::SCRIPT,
 | 
				
			||||||
 | 
							RESTAPI::Protocol::RRM,		 	 RESTAPI::Protocol::CERTUPDATE,
 | 
				
			||||||
 | 
							RESTAPI::Protocol::TRANSFER,	 RESTAPI::Protocol::POWERCYCLE
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	inline const char *to_string(Commands Cmd) { return uCentralAPCommands[(uint8_t)Cmd]; }
 | 
						inline const char *to_string(Commands Cmd) { return uCentralAPCommands[(uint8_t)Cmd]; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,6 +14,8 @@
 | 
				
			|||||||
#include <string>
 | 
					#include <string>
 | 
				
			||||||
#include <algorithm>
 | 
					#include <algorithm>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <resolv.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace OpenWifi::Utils {
 | 
					namespace OpenWifi::Utils {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool NormalizeMac(std::string &Mac) {
 | 
						bool NormalizeMac(std::string &Mac) {
 | 
				
			||||||
@@ -783,6 +785,10 @@ namespace OpenWifi::Utils {
 | 
				
			|||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool VerifyPrivateKey(const std::string &key) {
 | 
				
			||||||
 | 
					        return VerifyECKey(key) || VerifyRSAKey(key);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool ValidX509Certificate([[
 | 
					    bool ValidX509Certificate([[
 | 
				
			||||||
                              maybe_unused]] const std::string &Cert) {
 | 
					                              maybe_unused]] const std::string &Cert) {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
@@ -862,4 +868,78 @@ namespace OpenWifi::Utils {
 | 
				
			|||||||
        return password;
 | 
					        return password;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Function to query NAPTR records for a domain and return them in a vector
 | 
				
			||||||
 | 
					    std::vector<NAPTRRecord> getNAPTRRecords(const std::string& domain) {
 | 
				
			||||||
 | 
					        std::vector<NAPTRRecord> naptrRecords;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        unsigned char buf[4096];
 | 
				
			||||||
 | 
					        ns_msg handle;
 | 
				
			||||||
 | 
					        ns_initparse(buf, NS_PACKETSZ, &handle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Query NAPTR records for the given domain
 | 
				
			||||||
 | 
					        int response = res_query(domain.c_str(), ns_c_in, ns_t_naptr, buf, sizeof(buf));
 | 
				
			||||||
 | 
					        if (response < 0) {
 | 
				
			||||||
 | 
					            return naptrRecords;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(ns_initparse(buf, response, &handle) < 0) {
 | 
				
			||||||
 | 
					            return naptrRecords;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Iterate through the DNS response and extract NAPTR records
 | 
				
			||||||
 | 
					        int count = ns_msg_count(handle, ns_s_an);
 | 
				
			||||||
 | 
					        for (int i = 0; i < count; ++i) {
 | 
				
			||||||
 | 
					            ns_rr rr;
 | 
				
			||||||
 | 
					            if (ns_parserr(&handle, ns_s_an, i, &rr) == 0) {
 | 
				
			||||||
 | 
					                char rdata[256];
 | 
				
			||||||
 | 
					                ns_sprintrr(&handle, &rr, nullptr, nullptr, rdata, sizeof(rdata));
 | 
				
			||||||
 | 
					                NAPTRRecord record;
 | 
				
			||||||
 | 
					                std::istringstream os(rdata);
 | 
				
			||||||
 | 
					                os  >> record.name >> record.ttl >> record.rclass >> record.rtype >> record.order >> record.preference >> record.flags
 | 
				
			||||||
 | 
					                    >> record.service >> record.regexp >>  record.replacement;
 | 
				
			||||||
 | 
					                naptrRecords.push_back(record);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return naptrRecords;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    std::vector<SrvRecord> getSRVRecords(const std::string& domain) {
 | 
				
			||||||
 | 
					        std::vector<SrvRecord> srvRecords;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Buffer to hold the DNS response
 | 
				
			||||||
 | 
					        unsigned char buf[4096];
 | 
				
			||||||
 | 
					        ns_msg handle;
 | 
				
			||||||
 | 
					        ns_initparse(buf, NS_PACKETSZ, &handle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Query NAPTR records for the given domain
 | 
				
			||||||
 | 
					        int response = res_query(domain.c_str(), ns_c_in, ns_t_srv, buf, sizeof(buf));
 | 
				
			||||||
 | 
					        if (response < 0) {
 | 
				
			||||||
 | 
					            std::cerr << "DNS query failed for " << domain << ": " << hstrerror(h_errno) << std::endl;
 | 
				
			||||||
 | 
					            return srvRecords;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(ns_initparse(buf, response, &handle) < 0) {
 | 
				
			||||||
 | 
					            return srvRecords;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Iterate through the DNS response and extract NAPTR records
 | 
				
			||||||
 | 
					        int count = ns_msg_count(handle, ns_s_an);
 | 
				
			||||||
 | 
					        for (int i = 0; i < count; ++i) {
 | 
				
			||||||
 | 
					            ns_rr rr;
 | 
				
			||||||
 | 
					            if (ns_parserr(&handle, ns_s_an, i, &rr) == 0) {
 | 
				
			||||||
 | 
					                char rdata[256];
 | 
				
			||||||
 | 
					                ns_sprintrr(&handle, &rr, nullptr, nullptr, rdata, sizeof(rdata));
 | 
				
			||||||
 | 
					                SrvRecord record;
 | 
				
			||||||
 | 
					                std::istringstream os(rdata);
 | 
				
			||||||
 | 
					                os  >>  record.name >> record.ttl >> record.rclass >> record.rtype >> record.pref >> record.weight >>
 | 
				
			||||||
 | 
					                    record.port >> record.srvname ;
 | 
				
			||||||
 | 
					                srvRecords.push_back(record);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return srvRecords;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} // namespace OpenWifi::Utils
 | 
					} // namespace OpenWifi::Utils
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -247,6 +247,24 @@ namespace OpenWifi::Utils {
 | 
				
			|||||||
		return count;
 | 
							return count;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    inline std::uint32_t IPtoInt(const std::string &A) {
 | 
				
			||||||
 | 
					        Poco::Net::IPAddress    IP;
 | 
				
			||||||
 | 
					        std::uint32_t Result=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(Poco::Net::IPAddress::tryParse(A,IP)) {
 | 
				
			||||||
 | 
					            for(const auto i:IP.toBytes()) {
 | 
				
			||||||
 | 
					                Result <<= 8;
 | 
				
			||||||
 | 
					                Result += i;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return Result;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    inline bool ValidIP(const std::string &IPstr) {
 | 
				
			||||||
 | 
					        Poco::Net::IPAddress    IP;
 | 
				
			||||||
 | 
					        return Poco::Net::IPAddress::tryParse(IPstr,IP);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct CSRCreationParameters {
 | 
					    struct CSRCreationParameters {
 | 
				
			||||||
        std::string Country, Province, City,
 | 
					        std::string Country, Province, City,
 | 
				
			||||||
                    Organization, CommonName;
 | 
					                    Organization, CommonName;
 | 
				
			||||||
@@ -261,7 +279,127 @@ namespace OpenWifi::Utils {
 | 
				
			|||||||
    std::string generateStrongPassword(int minLength, int maxLength, int numDigits, int minLowercase, int minSpecial, int minUppercase);
 | 
					    std::string generateStrongPassword(int minLength, int maxLength, int numDigits, int minLowercase, int minSpecial, int minUppercase);
 | 
				
			||||||
    bool VerifyECKey(const std::string &key);
 | 
					    bool VerifyECKey(const std::string &key);
 | 
				
			||||||
    bool VerifyRSAKey(const std::string &key);
 | 
					    bool VerifyRSAKey(const std::string &key);
 | 
				
			||||||
 | 
					    bool VerifyPrivateKey(const std::string &key);
 | 
				
			||||||
    bool ValidX509Certificate(const std::string &Cert);
 | 
					    bool ValidX509Certificate(const std::string &Cert);
 | 
				
			||||||
    bool ValidX509Certificate(const std::vector<std::string> &Certs);
 | 
					    bool ValidX509Certificate(const std::vector<std::string> &Certs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    struct NAPTRRecord {
 | 
				
			||||||
 | 
					        std::string     name;
 | 
				
			||||||
 | 
					        std::string     ttl;
 | 
				
			||||||
 | 
					        std::string     rclass;
 | 
				
			||||||
 | 
					        std::string     rtype;
 | 
				
			||||||
 | 
					        uint32_t        order=0;
 | 
				
			||||||
 | 
					        uint32_t        preference=0;
 | 
				
			||||||
 | 
					        std::string     flags;
 | 
				
			||||||
 | 
					        std::string     service;
 | 
				
			||||||
 | 
					        std::string     regexp;
 | 
				
			||||||
 | 
					        std::string     replacement;
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Function to query NAPTR records for a domain and return them in a vector
 | 
				
			||||||
 | 
					    std::vector<NAPTRRecord> getNAPTRRecords(const std::string& domain);
 | 
				
			||||||
 | 
					    struct SrvRecord {
 | 
				
			||||||
 | 
					        std::string     name;
 | 
				
			||||||
 | 
					        std::string     ttl;
 | 
				
			||||||
 | 
					        std::string     rclass;
 | 
				
			||||||
 | 
					        std::string     rtype;
 | 
				
			||||||
 | 
					        uint32_t        pref = 0;
 | 
				
			||||||
 | 
					        uint32_t        weight = 0;
 | 
				
			||||||
 | 
					        uint32_t        port = 0;
 | 
				
			||||||
 | 
					        std::string     srvname;
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    std::vector<SrvRecord> getSRVRecords(const std::string& domain);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    struct HostNameServerResult{
 | 
				
			||||||
 | 
					        std::string     Hostname;
 | 
				
			||||||
 | 
					        uint32_t        Port;
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						class CompressedString {
 | 
				
			||||||
 | 
						  public:
 | 
				
			||||||
 | 
							CompressedString() {
 | 
				
			||||||
 | 
								DecompressedSize_ = 0;
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							explicit CompressedString(const std::string &Data) : DecompressedSize_(Data.size()) {
 | 
				
			||||||
 | 
								CompressIt(Data);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							CompressedString(const CompressedString &Data) {
 | 
				
			||||||
 | 
								this->DecompressedSize_ = Data.DecompressedSize_;
 | 
				
			||||||
 | 
								this->CompressedData_ = Data.CompressedData_;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							CompressedString& operator=(const CompressedString& rhs) {
 | 
				
			||||||
 | 
								if (this != &rhs) {
 | 
				
			||||||
 | 
									this->DecompressedSize_ = rhs.DecompressedSize_;
 | 
				
			||||||
 | 
									this->CompressedData_ = rhs.CompressedData_;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								return *this;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							CompressedString& operator=(CompressedString&& rhs) {
 | 
				
			||||||
 | 
								if (this != &rhs) {
 | 
				
			||||||
 | 
									this->DecompressedSize_ = rhs.DecompressedSize_;
 | 
				
			||||||
 | 
									this->CompressedData_ = rhs.CompressedData_;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								return *this;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							~CompressedString() = default;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							operator std::string() const {
 | 
				
			||||||
 | 
								return DecompressIt();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							CompressedString &operator=(const std::string &Data) {
 | 
				
			||||||
 | 
								DecompressedSize_ = Data.size();
 | 
				
			||||||
 | 
								CompressIt(Data);
 | 
				
			||||||
 | 
								return *this;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							auto CompressedSize() const { return CompressedData_.size(); }
 | 
				
			||||||
 | 
							auto DecompressedSize() const { return DecompressedSize_; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						  private:
 | 
				
			||||||
 | 
							std::string     CompressedData_;
 | 
				
			||||||
 | 
							std::size_t     DecompressedSize_;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							inline void CompressIt(const std::string &Data) {
 | 
				
			||||||
 | 
								z_stream strm; // = {0};
 | 
				
			||||||
 | 
								CompressedData_.resize(Data.size());
 | 
				
			||||||
 | 
								strm.next_in = (Bytef *)Data.data();
 | 
				
			||||||
 | 
								strm.avail_in = Data.size();
 | 
				
			||||||
 | 
								strm.next_out = (Bytef *)CompressedData_.data();
 | 
				
			||||||
 | 
								strm.avail_out = Data.size();
 | 
				
			||||||
 | 
								strm.zalloc = Z_NULL;
 | 
				
			||||||
 | 
								strm.zfree = Z_NULL;
 | 
				
			||||||
 | 
								strm.opaque = Z_NULL;
 | 
				
			||||||
 | 
								deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 15 + 16, 8, Z_DEFAULT_STRATEGY);
 | 
				
			||||||
 | 
								deflate(&strm, Z_FINISH);
 | 
				
			||||||
 | 
								deflateEnd(&strm);
 | 
				
			||||||
 | 
								CompressedData_.resize(strm.total_out);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							[[nodiscard]] std::string DecompressIt() const {
 | 
				
			||||||
 | 
								std::string Result;
 | 
				
			||||||
 | 
								if(DecompressedSize_!=0) {
 | 
				
			||||||
 | 
									Result.resize(DecompressedSize_);
 | 
				
			||||||
 | 
									z_stream strm ; //= {0};
 | 
				
			||||||
 | 
									strm.next_in = (Bytef *)CompressedData_.data();
 | 
				
			||||||
 | 
									strm.avail_in = CompressedData_.size();
 | 
				
			||||||
 | 
									strm.next_out = (Bytef *)Result.data();
 | 
				
			||||||
 | 
									strm.avail_out = Result.size();
 | 
				
			||||||
 | 
									strm.zalloc = Z_NULL;
 | 
				
			||||||
 | 
									strm.zfree = Z_NULL;
 | 
				
			||||||
 | 
									strm.opaque = Z_NULL;
 | 
				
			||||||
 | 
									inflateInit2(&strm, 15 + 32);
 | 
				
			||||||
 | 
									inflate(&strm, Z_FINISH);
 | 
				
			||||||
 | 
									inflateEnd(&strm);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								return Result;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} // namespace OpenWifi::Utils
 | 
					} // namespace OpenWifi::Utils
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user