Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
75119520
Commit
75119520
authored
Jan 07, 2021
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed build with --disable-api
parent
11024403
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
26 deletions
+52
-26
codeql-analysis.yml
.github/workflows/codeql-analysis.yml
+4
-2
configure.ac
configure.ac
+1
-0
Makefile.am
extensions/HttpResolver/Makefile.am
+3
-0
LogDB.cc
extensions/LogDB/LogDB.cc
+37
-21
LogDB.h
extensions/LogDB/LogDB.h
+3
-3
Makefile.am
tests/UHttpTest/Makefile.am
+3
-0
UProxyObject.cc
wrappers/core/UProxyObject.cc
+1
-0
No files found.
.github/workflows/codeql-analysis.yml
View file @
75119520
...
@@ -46,7 +46,9 @@ jobs:
...
@@ -46,7 +46,9 @@ jobs:
-
name
:
install packages
-
name
:
install packages
run
:
|
run
:
|
sudo apt-get install libcomedi-dev libpoco-dev libmysqlclient-dev libomniorb4-dev libev-dev omniidl xsltproc libpqxx3-dev librrd-dev libsigc++-2.0-dev libsqlite3-dev python-dev libmosquittopp-dev
sudo apt-get install libcomedi-dev libpoco-dev libmysqlclient-dev libomniorb4-dev \
libev-dev omniidl xsltproc libpqxx3-dev librrd-dev libsigc++-2.0-dev \
libsqlite3-dev python-dev libmosquittopp-dev libpoco-dev
wget https://github.com/catchorg/Catch2/releases/download/v1.11.0/catch.hpp -O include/catch.hpp
wget https://github.com/catchorg/Catch2/releases/download/v1.11.0/catch.hpp -O include/catch.hpp
-
name
:
build
-
name
:
build
...
@@ -55,7 +57,7 @@ jobs:
...
@@ -55,7 +57,7 @@ jobs:
# due broken comedi
# due broken comedi
export CXXFLAGS="$CXXFLAGS -Wl,--unresolved-symbols=ignore-in-shared-libs"
export CXXFLAGS="$CXXFLAGS -Wl,--unresolved-symbols=ignore-in-shared-libs"
autoreconf -fiv
autoreconf -fiv
./configure --
enable-mysql --enable-sqlite --enable-rrd --enable-io --disable-python --disable-mqtt --disable-pgsql --disable-api --disable-netdata --disable-logdb
./configure --
disable-python --disable-netdata
make
make
-
name
:
Perform CodeQL Analysis
-
name
:
Perform CodeQL Analysis
...
...
configure.ac
View file @
75119520
...
@@ -74,6 +74,7 @@ else
...
@@ -74,6 +74,7 @@ else
fi
fi
AM_CONDITIONAL(DISABLE_REST_API, test ${buildapi} = false)
AM_CONDITIONAL(DISABLE_REST_API, test ${buildapi} = false)
AM_CONDITIONAL(ENABLE_REST_API, test ${buildapi} = true)
AC_SUBST(DISABLE_REST_API)
AC_SUBST(DISABLE_REST_API)
AC_SUBST(REST_API_CFLAGS)
AC_SUBST(REST_API_CFLAGS)
AC_SUBST(REST_API_CLIBS)
AC_SUBST(REST_API_CLIBS)
...
...
extensions/HttpResolver/Makefile.am
View file @
75119520
if
ENABLE_REST_API
bin_PROGRAMS
=
@PACKAGE@-httpresolver
bin_PROGRAMS
=
@PACKAGE@-httpresolver
@PACKAGE@
_httpresolver_LDADD
=
$(top_builddir)
/lib/libUniSet2.la
@PACKAGE@
_httpresolver_LDADD
=
$(top_builddir)
/lib/libUniSet2.la
@PACKAGE@
_httpresolver_SOURCES
=
HttpResolver.cc main.cc
@PACKAGE@
_httpresolver_SOURCES
=
HttpResolver.cc main.cc
include
$(top_builddir)/include.mk
include
$(top_builddir)/include.mk
endif
\ No newline at end of file
extensions/LogDB/LogDB.cc
View file @
75119520
...
@@ -99,18 +99,12 @@ LogDB::LogDB( const string& name, int argc, const char* const* argv, const strin
...
@@ -99,18 +99,12 @@ LogDB::LogDB( const string& name, int argc, const char* const* argv, const strin
qbufSize
=
uniset
::
getArgPInt
(
"--"
+
prefix
+
"db-buffer-size"
,
argc
,
argv
,
it
.
getProp
(
"dbBufferSize"
),
qbufSize
);
qbufSize
=
uniset
::
getArgPInt
(
"--"
+
prefix
+
"db-buffer-size"
,
argc
,
argv
,
it
.
getProp
(
"dbBufferSize"
),
qbufSize
);
maxdbRecords
=
uniset
::
getArgPInt
(
"--"
+
prefix
+
"db-max-records"
,
argc
,
argv
,
it
.
getProp
(
"dbMaxRecords"
),
qbufSize
);
maxdbRecords
=
uniset
::
getArgPInt
(
"--"
+
prefix
+
"db-max-records"
,
argc
,
argv
,
it
.
getProp
(
"dbMaxRecords"
),
qbufSize
);
maxwsocks
=
uniset
::
getArgPInt
(
"--"
+
prefix
+
"ws-max"
,
argc
,
argv
,
it
.
getProp
(
"wsMax"
),
maxwsocks
);
string
tformat
=
uniset
::
getArg2Param
(
"--"
+
prefix
+
"db-timestamp-format"
,
argc
,
argv
,
it
.
getProp
(
"dbTeimastampFormat"
),
"localtime"
);
string
tformat
=
uniset
::
getArg2Param
(
"--"
+
prefix
+
"db-timestamp-format"
,
argc
,
argv
,
it
.
getProp
(
"dbTeimastampFormat"
),
"localtime"
);
if
(
tformat
==
"localtime"
||
tformat
==
"utc"
)
if
(
tformat
==
"localtime"
||
tformat
==
"utc"
)
tmsFormat
=
tformat
;
tmsFormat
=
tformat
;
bgColor
=
uniset
::
getArg2Param
(
"--"
+
prefix
+
"bg-color"
,
argc
,
argv
,
it
.
getProp
(
"bgColor"
),
bgColor
);
fgColor
=
uniset
::
getArg2Param
(
"--"
+
prefix
+
"fg-color"
,
argc
,
argv
,
it
.
getProp
(
"fgColor"
),
fgColor
);
fgColorTitle
=
uniset
::
getArg2Param
(
"--"
+
prefix
+
"fg-color-title"
,
argc
,
argv
,
it
.
getProp
(
"fgColorTitle"
),
fgColorTitle
);
bgColorTitle
=
uniset
::
getArg2Param
(
"--"
+
prefix
+
"bg-color-title"
,
argc
,
argv
,
it
.
getProp
(
"bgColorTitle"
),
bgColorTitle
);
double
checkConnection_sec
=
atof
(
uniset
::
getArg2Param
(
"--"
+
prefix
+
"ls-check-connection-sec"
,
argc
,
argv
,
it
.
getProp
(
"lsCheckConnectionSec"
),
"5"
).
c_str
());
double
checkConnection_sec
=
atof
(
uniset
::
getArg2Param
(
"--"
+
prefix
+
"ls-check-connection-sec"
,
argc
,
argv
,
it
.
getProp
(
"lsCheckConnectionSec"
),
"5"
).
c_str
());
int
bufSize
=
uniset
::
getArgPInt
(
"--"
+
prefix
+
"ls-read-buffer-size"
,
argc
,
argv
,
it
.
getProp
(
"lsReadBufferSize"
),
10001
);
int
bufSize
=
uniset
::
getArgPInt
(
"--"
+
prefix
+
"ls-read-buffer-size"
,
argc
,
argv
,
it
.
getProp
(
"lsReadBufferSize"
),
10001
);
...
@@ -255,6 +249,13 @@ LogDB::LogDB( const string& name, int argc, const char* const* argv, const strin
...
@@ -255,6 +249,13 @@ LogDB::LogDB( const string& name, int argc, const char* const* argv, const strin
dblog1
<<
myname
<<
"(init): http server parameters "
<<
httpHost
<<
":"
<<
httpPort
<<
endl
;
dblog1
<<
myname
<<
"(init): http server parameters "
<<
httpHost
<<
":"
<<
httpPort
<<
endl
;
Poco
::
Net
::
SocketAddress
sa
(
httpHost
,
httpPort
);
Poco
::
Net
::
SocketAddress
sa
(
httpHost
,
httpPort
);
maxwsocks
=
uniset
::
getArgPInt
(
"--"
+
prefix
+
"ws-max"
,
argc
,
argv
,
it
.
getProp
(
"wsMax"
),
maxwsocks
);
bgColor
=
uniset
::
getArg2Param
(
"--"
+
prefix
+
"bg-color"
,
argc
,
argv
,
it
.
getProp
(
"bgColor"
),
bgColor
);
fgColor
=
uniset
::
getArg2Param
(
"--"
+
prefix
+
"fg-color"
,
argc
,
argv
,
it
.
getProp
(
"fgColor"
),
fgColor
);
fgColorTitle
=
uniset
::
getArg2Param
(
"--"
+
prefix
+
"fg-color-title"
,
argc
,
argv
,
it
.
getProp
(
"fgColorTitle"
),
fgColorTitle
);
bgColorTitle
=
uniset
::
getArg2Param
(
"--"
+
prefix
+
"bg-color-title"
,
argc
,
argv
,
it
.
getProp
(
"bgColorTitle"
),
bgColorTitle
);
try
try
{
{
Poco
::
Net
::
HTTPServerParams
*
httpParams
=
new
Poco
::
Net
::
HTTPServerParams
;
Poco
::
Net
::
HTTPServerParams
*
httpParams
=
new
Poco
::
Net
::
HTTPServerParams
;
...
@@ -281,9 +282,13 @@ LogDB::~LogDB()
...
@@ -281,9 +282,13 @@ LogDB::~LogDB()
if
(
evIsActive
()
)
if
(
evIsActive
()
)
evstop
();
evstop
();
#ifndef DISABLE_REST_API
if
(
httpserv
)
if
(
httpserv
)
httpserv
->
stop
();
httpserv
->
stop
();
#endif
if
(
db
)
if
(
db
)
db
->
close
();
db
->
close
();
}
}
...
@@ -311,6 +316,8 @@ void LogDB::onTerminate( ev::sig& evsig, int revents )
...
@@ -311,6 +316,8 @@ void LogDB::onTerminate( ev::sig& evsig, int revents )
evsig
.
stop
();
evsig
.
stop
();
//evsig.loop.break_loop();
//evsig.loop.break_loop();
#ifndef DISABLE_REST_API
try
try
{
{
httpserv
->
stop
();
httpserv
->
stop
();
...
@@ -320,6 +327,8 @@ void LogDB::onTerminate( ev::sig& evsig, int revents )
...
@@ -320,6 +327,8 @@ void LogDB::onTerminate( ev::sig& evsig, int revents )
dbinfo
<<
myname
<<
"(onTerminate): "
<<
ex
.
what
()
<<
endl
;
dbinfo
<<
myname
<<
"(onTerminate): "
<<
ex
.
what
()
<<
endl
;
}
}
#endif
try
try
{
{
evstop
();
evstop
();
...
@@ -499,9 +508,13 @@ void LogDB::help_print()
...
@@ -499,9 +508,13 @@ void LogDB::help_print()
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
LogDB
::
run
(
bool
async
)
void
LogDB
::
run
(
bool
async
)
{
{
#ifndef DISABLE_REST_API
if
(
httpserv
)
if
(
httpserv
)
httpserv
->
start
();
httpserv
->
start
();
#endif
if
(
async
)
if
(
async
)
async_evrun
();
async_evrun
();
else
else
...
@@ -556,6 +569,7 @@ void LogDB::onActivate( ev::async& watcher, int revents )
...
@@ -556,6 +569,7 @@ void LogDB::onActivate( ev::async& watcher, int revents )
return
;
return
;
}
}
#ifndef DISABLE_REST_API
uniset_rwmutex_rlock
lk
(
wsocksMutex
);
uniset_rwmutex_rlock
lk
(
wsocksMutex
);
for
(
const
auto
&
s
:
wsocks
)
for
(
const
auto
&
s
:
wsocks
)
...
@@ -563,6 +577,8 @@ void LogDB::onActivate( ev::async& watcher, int revents )
...
@@ -563,6 +577,8 @@ void LogDB::onActivate( ev::async& watcher, int revents )
if
(
!
s
->
isActive
()
)
if
(
!
s
->
isActive
()
)
s
->
set
(
loop
);
s
->
set
(
loop
);
}
}
#endif
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
bool
LogDB
::
Log
::
isConnected
()
const
bool
LogDB
::
Log
::
isConnected
()
const
...
@@ -787,6 +803,21 @@ void LogDB::Log::close()
...
@@ -787,6 +803,21 @@ void LogDB::Log::close()
//tcp = nullptr;
//tcp = nullptr;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
std
::
string
LogDB
::
qEscapeString
(
const
string
&
txt
)
{
ostringstream
ret
;
for
(
const
auto
&
c
:
txt
)
{
ret
<<
c
;
if
(
c
==
'\''
||
c
==
'"'
)
ret
<<
c
;
}
return
ret
.
str
();
}
// -----------------------------------------------------------------------------
#ifndef DISABLE_REST_API
#ifndef DISABLE_REST_API
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
class
LogDBRequestHandler
:
class
LogDBRequestHandler
:
...
@@ -1173,21 +1204,6 @@ string LogDB::qDate( const string& p, const char sep )
...
@@ -1173,21 +1204,6 @@ string LogDB::qDate( const string& p, const char sep )
return
p
.
substr
(
0
,
4
)
+
"-"
+
p
.
substr
(
4
,
2
)
+
"-"
+
p
.
substr
(
6
,
2
);
return
p
.
substr
(
0
,
4
)
+
"-"
+
p
.
substr
(
4
,
2
)
+
"-"
+
p
.
substr
(
6
,
2
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
std
::
string
LogDB
::
qEscapeString
(
const
string
&
txt
)
{
ostringstream
ret
;
for
(
const
auto
&
c
:
txt
)
{
ret
<<
c
;
if
(
c
==
'\''
||
c
==
'"'
)
ret
<<
c
;
}
return
ret
.
str
();
}
// -----------------------------------------------------------------------------
void
LogDB
::
onWebSocketSession
(
Poco
::
Net
::
HTTPServerRequest
&
req
,
Poco
::
Net
::
HTTPServerResponse
&
resp
)
void
LogDB
::
onWebSocketSession
(
Poco
::
Net
::
HTTPServerRequest
&
req
,
Poco
::
Net
::
HTTPServerResponse
&
resp
)
{
{
using
Poco
::
Net
::
WebSocket
;
using
Poco
::
Net
::
WebSocket
;
...
...
extensions/LogDB/LogDB.h
View file @
75119520
...
@@ -216,6 +216,9 @@ namespace uniset
...
@@ -216,6 +216,9 @@ namespace uniset
size_t
getCountOfRecords
(
const
std
::
string
&
logname
=
""
);
size_t
getCountOfRecords
(
const
std
::
string
&
logname
=
""
);
size_t
getFirstOfOldRecord
(
size_t
maxnum
);
size_t
getFirstOfOldRecord
(
size_t
maxnum
);
// экранирование кавычек (удваивание для sqlite)
static
std
::
string
qEscapeString
(
const
std
::
string
&
s
);
#ifndef DISABLE_REST_API
#ifndef DISABLE_REST_API
Poco
::
JSON
::
Object
::
Ptr
respError
(
Poco
::
Net
::
HTTPServerResponse
&
resp
,
Poco
::
Net
::
HTTPResponse
::
HTTPStatus
s
,
const
std
::
string
&
message
);
Poco
::
JSON
::
Object
::
Ptr
respError
(
Poco
::
Net
::
HTTPServerResponse
&
resp
,
Poco
::
Net
::
HTTPResponse
::
HTTPStatus
s
,
const
std
::
string
&
message
);
Poco
::
JSON
::
Object
::
Ptr
httpGetRequest
(
const
std
::
string
&
cmd
,
const
Poco
::
URI
::
QueryParameters
&
p
);
Poco
::
JSON
::
Object
::
Ptr
httpGetRequest
(
const
std
::
string
&
cmd
,
const
Poco
::
URI
::
QueryParameters
&
p
);
...
@@ -232,9 +235,6 @@ namespace uniset
...
@@ -232,9 +235,6 @@ namespace uniset
// преобразование в дату 'YYYY-MM-DD' из строки 'YYYYMMDD' или 'YYYY/MM/DD'
// преобразование в дату 'YYYY-MM-DD' из строки 'YYYYMMDD' или 'YYYY/MM/DD'
static
std
::
string
qDate
(
const
std
::
string
&
p
,
const
char
sep
=
'-'
);
static
std
::
string
qDate
(
const
std
::
string
&
p
,
const
char
sep
=
'-'
);
// экранирование кавычек (удваивание для sqlite)
static
std
::
string
qEscapeString
(
const
std
::
string
&
s
);
std
::
shared_ptr
<
LogWebSocket
>
newWebSocket
(
Poco
::
Net
::
HTTPServerRequest
*
req
,
Poco
::
Net
::
HTTPServerResponse
*
resp
,
const
std
::
string
&
logname
);
std
::
shared_ptr
<
LogWebSocket
>
newWebSocket
(
Poco
::
Net
::
HTTPServerRequest
*
req
,
Poco
::
Net
::
HTTPServerResponse
*
resp
,
const
std
::
string
&
logname
);
void
delWebSocket
(
std
::
shared_ptr
<
LogWebSocket
>&
ws
);
void
delWebSocket
(
std
::
shared_ptr
<
LogWebSocket
>&
ws
);
#endif
#endif
...
...
tests/UHttpTest/Makefile.am
View file @
75119520
if
ENABLE_REST_API
noinst_PROGRAMS
=
uhttp-test
noinst_PROGRAMS
=
uhttp-test
uhttp_test_LDADD
=
$(top_builddir)
/lib/libUniSet2.la
$(SIGC_LIBS)
$(POCO_LIBS)
uhttp_test_LDADD
=
$(top_builddir)
/lib/libUniSet2.la
$(SIGC_LIBS)
$(POCO_LIBS)
uhttp_test_CPPFLAGS
=
-I
$(top_builddir)
/include
-I
$(top_builddir)
/extensions/include
$(SIGC_CFLAGS)
$(POCO_CFLAGS)
uhttp_test_CPPFLAGS
=
-I
$(top_builddir)
/include
-I
$(top_builddir)
/extensions/include
$(SIGC_CFLAGS)
$(POCO_CFLAGS)
uhttp_test_SOURCES
=
uhttp-test.cc
uhttp_test_SOURCES
=
uhttp-test.cc
endif
\ No newline at end of file
wrappers/core/UProxyObject.cc
View file @
75119520
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
#include <cmath>
#include <sstream>
#include <sstream>
#include <mutex>
#include <mutex>
#include <string>
#include <string>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment