mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralgw.git
synced 2025-11-02 19:57:49 +00:00
Compare commits
13 Commits
openapi-fi
...
v3.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b703690b0 | ||
|
|
f8302ba9e1 | ||
|
|
62b99c2cb1 | ||
|
|
79ab67db50 | ||
|
|
5411b6b195 | ||
|
|
5ed98b724a | ||
|
|
00bc77feea | ||
|
|
4f00d77d2b | ||
|
|
c679d4ac40 | ||
|
|
4a150a9fcb | ||
|
|
68f5bb42ff | ||
|
|
83eb603f0a | ||
|
|
5867b6a1c0 |
@@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
project(owgw VERSION 3.1.0)
|
project(owgw VERSION 3.2.0)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ fullnameOverride: ""
|
|||||||
images:
|
images:
|
||||||
owgw:
|
owgw:
|
||||||
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owgw
|
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owgw
|
||||||
tag: master
|
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
|
||||||
|
|||||||
@@ -22,9 +22,15 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
std::string FileType;
|
std::string FileType;
|
||||||
std::string FileContent;
|
std::string FileContent;
|
||||||
if (!StorageService()->GetAttachedFileContent(UUID, SerialNumber, FileContent, FileType) || FileContent.empty()) {
|
int WaitingForFile = 0;
|
||||||
|
if (!StorageService()->GetAttachedFileContent(UUID, SerialNumber, FileContent, FileType, WaitingForFile) && !WaitingForFile) {
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
else if (WaitingForFile) {
|
||||||
|
// waiting for file to be uploaded, return Accepted
|
||||||
|
return Accepted();
|
||||||
|
}
|
||||||
|
|
||||||
if (FileType == "pcap") {
|
if (FileType == "pcap") {
|
||||||
SendFileContent(FileContent, "application/vnd.tcpdump.pcap", UUID + ".pcap");
|
SendFileContent(FileContent, "application/vnd.tcpdump.pcap", UUID + ".pcap");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ namespace OpenWifi {
|
|||||||
const std::string &Type);
|
const std::string &Type);
|
||||||
bool CancelWaitFile(std::string &UUID, std::string &ErrorText);
|
bool CancelWaitFile(std::string &UUID, std::string &ErrorText);
|
||||||
bool GetAttachedFileContent(std::string &UUID, const std::string &SerialNumber,
|
bool GetAttachedFileContent(std::string &UUID, const std::string &SerialNumber,
|
||||||
std::string &FileContent, std::string &Type);
|
std::string &FileContent, std::string &Type, int& WaitingForFile);
|
||||||
bool RemoveAttachedFile(std::string &UUID);
|
bool RemoveAttachedFile(std::string &UUID);
|
||||||
bool SetCommandResult(std::string &UUID, std::string &Result);
|
bool SetCommandResult(std::string &UUID, std::string &Result);
|
||||||
bool GetNewestCommands(std::string &SerialNumber, uint64_t HowMany,
|
bool GetNewestCommands(std::string &SerialNumber, uint64_t HowMany,
|
||||||
|
|||||||
@@ -431,6 +431,11 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void Accepted() {
|
||||||
|
PrepareResponse(Poco::Net::HTTPResponse::HTTP_ACCEPTED);
|
||||||
|
Response->send();
|
||||||
|
}
|
||||||
|
|
||||||
inline void SendCompressedTarFile(const std::string &FileName, const std::string &Content) {
|
inline void SendCompressedTarFile(const std::string &FileName, const std::string &Content) {
|
||||||
Response->setStatus(Poco::Net::HTTPResponse::HTTPStatus::HTTP_OK);
|
Response->setStatus(Poco::Net::HTTPResponse::HTTPStatus::HTTP_OK);
|
||||||
SetCommonHeaders();
|
SetCommonHeaders();
|
||||||
|
|||||||
@@ -647,18 +647,6 @@ namespace OpenWifi {
|
|||||||
Sess.begin();
|
Sess.begin();
|
||||||
Poco::Data::Statement Statement(Sess);
|
Poco::Data::Statement Statement(Sess);
|
||||||
|
|
||||||
std::string StatementStr;
|
|
||||||
|
|
||||||
// Get the existing command
|
|
||||||
|
|
||||||
StatementStr =
|
|
||||||
"UPDATE CommandList SET WaitingForFile=?, AttachDate=?, AttachSize=? WHERE UUID=?";
|
|
||||||
|
|
||||||
Statement << ConvertParams(StatementStr), Poco::Data::Keywords::use(WaitForFile),
|
|
||||||
Poco::Data::Keywords::use(Now), Poco::Data::Keywords::use(Size),
|
|
||||||
Poco::Data::Keywords::use(UUID);
|
|
||||||
Statement.execute();
|
|
||||||
Sess.commit();
|
|
||||||
if (Size < FileUploader()->MaxSize()) {
|
if (Size < FileUploader()->MaxSize()) {
|
||||||
|
|
||||||
Poco::Data::BLOB TheBlob;
|
Poco::Data::BLOB TheBlob;
|
||||||
@@ -681,6 +669,18 @@ namespace OpenWifi {
|
|||||||
poco_warning(Logger(), fmt::format("File {} is too large.", UUID));
|
poco_warning(Logger(), fmt::format("File {} is too large.", UUID));
|
||||||
}
|
}
|
||||||
Sess.commit();
|
Sess.commit();
|
||||||
|
|
||||||
|
// update CommandList here to ensure that file us uploaded
|
||||||
|
std::string StatementStr;
|
||||||
|
StatementStr =
|
||||||
|
"UPDATE CommandList SET WaitingForFile=?, AttachDate=?, AttachSize=? WHERE UUID=?";
|
||||||
|
|
||||||
|
Statement << ConvertParams(StatementStr), Poco::Data::Keywords::use(WaitForFile),
|
||||||
|
Poco::Data::Keywords::use(Now), Poco::Data::Keywords::use(Size),
|
||||||
|
Poco::Data::Keywords::use(UUID);
|
||||||
|
Statement.execute();
|
||||||
|
Sess.commit();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (const Poco::Exception &E) {
|
} catch (const Poco::Exception &E) {
|
||||||
Logger().log(E);
|
Logger().log(E);
|
||||||
@@ -689,7 +689,7 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Storage::GetAttachedFileContent(std::string &UUID, const std::string &SerialNumber,
|
bool Storage::GetAttachedFileContent(std::string &UUID, const std::string &SerialNumber,
|
||||||
std::string &FileContent, std::string &Type) {
|
std::string &FileContent, std::string &Type, int &WaitingForFile) {
|
||||||
try {
|
try {
|
||||||
Poco::Data::BLOB L;
|
Poco::Data::BLOB L;
|
||||||
/*
|
/*
|
||||||
@@ -702,10 +702,10 @@ namespace OpenWifi {
|
|||||||
Poco::Data::Statement Select1(Sess);
|
Poco::Data::Statement Select1(Sess);
|
||||||
|
|
||||||
std::string TmpSerialNumber;
|
std::string TmpSerialNumber;
|
||||||
std::string st1{"SELECT SerialNumber, Command FROM CommandList WHERE UUID=?"};
|
std::string st1{"SELECT SerialNumber, Command , WaitingForFile FROM CommandList WHERE UUID=?"};
|
||||||
std::string Command;
|
std::string Command;
|
||||||
Select1 << ConvertParams(st1), Poco::Data::Keywords::into(TmpSerialNumber),
|
Select1 << ConvertParams(st1), Poco::Data::Keywords::into(TmpSerialNumber),
|
||||||
Poco::Data::Keywords::into(Command), Poco::Data::Keywords::use(UUID);
|
Poco::Data::Keywords::into(Command), Poco::Data::Keywords::into(WaitingForFile), Poco::Data::Keywords::use(UUID);
|
||||||
Select1.execute();
|
Select1.execute();
|
||||||
|
|
||||||
if (TmpSerialNumber != SerialNumber) {
|
if (TmpSerialNumber != SerialNumber) {
|
||||||
|
|||||||
Reference in New Issue
Block a user