Browse Source

WebRTC and WebSocket added

AGP
Evgeny Gagua 7 years ago
parent
commit
fef27c8b7a
  1. 1
      Linux_Workspace.vpw
  2. 48
      Projects/argus/argus.vpj
  3. 88
      Projects/argus/makefile
  4. 38
      Projects/defender-dc-trig/Debug/default.conf
  5. 288
      Projects/defender-dc-trig/defender-dc-trig.vpj
  6. 6
      Projects/defender-dc-trig/defender-dc-trig.vpw
  7. 213
      Projects/defender-dc-trig/makefile
  8. 12
      lib/App/argus/RGoose_Kernel.cpp
  9. 4
      lib/App/argus/RGoose_Kernel.h
  10. 246
      lib/App/defender/ArgusBackend.cpp
  11. 50
      lib/App/defender/ArgusBackend.h
  12. 217
      lib/App/defender/RGoose_Kernel.cpp
  13. 58
      lib/App/defender/RGoose_Kernel.h
  14. 4
      lib/components/base/basicFunctionality.cpp
  15. 5
      lib/components/base/basicFunctionality.h
  16. 2
      lib/components/base/basicMutex.h
  17. 1
      lib/components/base/basicSettingsProvider.h
  18. 8
      lib/components/base/basicThread.h
  19. 12
      lib/data/json/json_reader.cpp
  20. 8
      lib/data/json/json_value.cpp
  21. 4
      lib/data/json/json_writer.cpp
  22. 220
      lib/data/protocol/protocolDefender.cpp
  23. 7
      lib/data/protocol/protocolDefender.h
  24. 75
      lib/data/protocol/protocolSafeShore.cpp
  25. 31
      lib/data/protocol/protocolSafeShore.h
  26. 97
      lib/data/protocol/protocolZLMEDIA.cpp
  27. 42
      lib/data/protocol/protocolZLMEDIA.h
  28. 174
      lib/data/servletWS/servletChannelWS.cpp
  29. 67
      lib/data/servletWS/servletChannelWS.h
  30. 17
      lib/data/servletWS/servletClientHandlerWS.cpp
  31. 23
      lib/data/servletWS/servletClientHandlerWS.h
  32. 158
      lib/data/servletWS/servletWS.cpp
  33. 27
      lib/data/servletWS/servletWS.h
  34. 0
      lib/data/servletWebRTC/servletChannelWebRTC.cpp
  35. 0
      lib/data/servletWebRTC/servletChannelWebRTC.h
  36. 451
      lib/data/servletWebRTC/servletClientHandlerWebRTC.bakup
  37. 192
      lib/data/servletWebRTC/servletClientHandlerWebRTC.cpp
  38. 29
      lib/data/servletWebRTC/servletClientHandlerWebRTC.h
  39. 0
      lib/data/servletWebRTC/servletWebRTC.cpp
  40. 0
      lib/data/servletWebRTC/servletWebRTC.h
  41. 117
      lib/data/webrtc/AUTHORS
  42. 712
      lib/data/webrtc/BUILD.gn
  43. 68
      lib/data/webrtc/CODE_OF_CONDUCT.md
  44. 2290
      lib/data/webrtc/DEPS
  45. 11
      lib/data/webrtc/ENG_REVIEW_OWNERS
  46. 29
      lib/data/webrtc/LICENSE
  47. 23
      lib/data/webrtc/OWNERS
  48. 24
      lib/data/webrtc/PATENTS
  49. 1212
      lib/data/webrtc/PRESUBMIT.py
  50. 13
      lib/data/webrtc/README.chromium
  51. 28
      lib/data/webrtc/README.md
  52. 190
      lib/data/webrtc/WATCHLISTS
  53. 63
      lib/data/webrtc/abseil-in-webrtc.md
  54. 0
      lib/data/webrtc/api/BUILD.gn
  55. 0
      lib/data/webrtc/api/DEPS
  56. 0
      lib/data/webrtc/api/DESIGN.md
  57. 0
      lib/data/webrtc/api/OWNERS
  58. 0
      lib/data/webrtc/api/README.md
  59. 0
      lib/data/webrtc/api/array_view.h
  60. 0
      lib/data/webrtc/api/array_view_unittest.cc
  61. 0
      lib/data/webrtc/api/async_resolver_factory.h
  62. 0
      lib/data/webrtc/api/audio/BUILD.gn
  63. 0
      lib/data/webrtc/api/audio/OWNERS
  64. 0
      lib/data/webrtc/api/audio/audio_frame.cc
  65. 0
      lib/data/webrtc/api/audio/audio_frame.h
  66. 0
      lib/data/webrtc/api/audio/audio_mixer.h
  67. 0
      lib/data/webrtc/api/audio/channel_layout.cc
  68. 0
      lib/data/webrtc/api/audio/channel_layout.h
  69. 0
      lib/data/webrtc/api/audio/echo_canceller3_config.cc
  70. 0
      lib/data/webrtc/api/audio/echo_canceller3_config.h
  71. 3
      lib/data/webrtc/api/audio/echo_canceller3_config_json.cc
  72. 0
      lib/data/webrtc/api/audio/echo_canceller3_config_json.h
  73. 0
      lib/data/webrtc/api/audio/echo_canceller3_factory.cc
  74. 0
      lib/data/webrtc/api/audio/echo_canceller3_factory.h
  75. 0
      lib/data/webrtc/api/audio/echo_control.h
  76. 0
      lib/data/webrtc/api/audio/test/BUILD.gn
  77. 0
      lib/data/webrtc/api/audio/test/audio_frame_unittest.cc
  78. 0
      lib/data/webrtc/api/audio/test/echo_canceller3_config_json_unittest.cc
  79. 0
      lib/data/webrtc/api/audio/test/echo_canceller3_config_unittest.cc
  80. 0
      lib/data/webrtc/api/audio_codecs/BUILD.gn
  81. 0
      lib/data/webrtc/api/audio_codecs/L16/BUILD.gn
  82. 0
      lib/data/webrtc/api/audio_codecs/L16/audio_decoder_L16.cc
  83. 0
      lib/data/webrtc/api/audio_codecs/L16/audio_decoder_L16.h
  84. 0
      lib/data/webrtc/api/audio_codecs/L16/audio_encoder_L16.cc
  85. 0
      lib/data/webrtc/api/audio_codecs/L16/audio_encoder_L16.h
  86. 0
      lib/data/webrtc/api/audio_codecs/OWNERS
  87. 0
      lib/data/webrtc/api/audio_codecs/audio_codec_pair_id.cc
  88. 0
      lib/data/webrtc/api/audio_codecs/audio_codec_pair_id.h
  89. 0
      lib/data/webrtc/api/audio_codecs/audio_decoder.cc
  90. 0
      lib/data/webrtc/api/audio_codecs/audio_decoder.h
  91. 0
      lib/data/webrtc/api/audio_codecs/audio_decoder_factory.h
  92. 0
      lib/data/webrtc/api/audio_codecs/audio_decoder_factory_template.h
  93. 0
      lib/data/webrtc/api/audio_codecs/audio_encoder.cc
  94. 0
      lib/data/webrtc/api/audio_codecs/audio_encoder.h
  95. 0
      lib/data/webrtc/api/audio_codecs/audio_encoder_factory.h
  96. 0
      lib/data/webrtc/api/audio_codecs/audio_encoder_factory_template.h
  97. 0
      lib/data/webrtc/api/audio_codecs/audio_format.cc
  98. 0
      lib/data/webrtc/api/audio_codecs/audio_format.h
  99. 0
      lib/data/webrtc/api/audio_codecs/builtin_audio_decoder_factory.cc
  100. 0
      lib/data/webrtc/api/audio_codecs/builtin_audio_decoder_factory.h

1
Linux_Workspace.vpw

@ -3,6 +3,7 @@
<Projects>
<Project File="Projects/3dClientGui/3dClientGui.vpj"/>
<Project File="Projects/argus/argus.vpj"/>
<Project File="Projects/defender-dc-trig/defender-dc-trig.vpj"/>
<Project File="Projects/DirectMemo/DirectMemo.vpj"/>
<Project File="Projects/DirectPRU/DirectPRU.vpj"/>
<Project File="Projects/JustADCTest/JustADCTest.vpj"/>

48
Projects/argus/argus.vpj

@ -26,7 +26,7 @@
RunFromDir="%rw">
<Exec
CmdLine='g++ -c %xup -x c++ %defd -g %~other -o "%bd%n%oe" %i %f'
OtherOptions="-std=c++11 -Wno-write-strings `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags`"/>
OtherOptions="-std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags`"/>
</Target>
<Target
Name="Link"
@ -39,7 +39,7 @@
RunFromDir="%rw">
<Exec
CmdLine='g++ %xup -g %~other -o "%o" %objs'
OtherOptions="-lpthread -lmysqlclient -lcurl -lm -lssl -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --libs`"/>
OtherOptions="-lpthread -lmysqlclient -lcurl -lm -lssl -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --libs` -lcurl"/>
</Target>
<Target
Name="Build"
@ -103,8 +103,10 @@
Name="LinkerOutputType"
Value="Executable"/>
</List>
<Includes/>
<Includes>
</Includes>
<Libs PreObjects="0">
<Lib File="-lcurl"/>
</Libs>
</Config>
<Config
@ -127,7 +129,7 @@
RunFromDir="%rw">
<Exec
CmdLine='g++ -c %xup -x c++ %defd %~other -o "%bd%n%oe" %i %f'
OtherOptions="-std=c++11 -Wno-write-strings `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags`"/>
OtherOptions="-std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags`"/>
</Target>
<Target
Name="Link"
@ -140,7 +142,7 @@
RunFromDir="%rw">
<Exec
CmdLine='g++ %xup %~other -o "%o" %objs'
OtherOptions="-lpthread -lmysqlclient -lcurl -lm -lssl -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --libs`"/>
OtherOptions="-lpthread -lmysqlclient -lcurl -lm -lssl -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --libs` -lcurl"/>
</Target>
<Target
Name="Build"
@ -204,8 +206,10 @@
Name="LinkerOutputType"
Value="Executable"/>
</List>
<Includes/>
<Includes>
</Includes>
<Libs PreObjects="0">
<Lib File="-lcurl"/>
</Libs>
</Config>
<Files>
@ -231,6 +235,8 @@
<F N="../../lib/components/base/basicThread.cpp"/>
<F N="../../lib/components/base/basicTimeStamp.cpp"/>
<F N="../../lib/components/base/basicTypes.cpp"/>
<F N="../../lib/data/curl/curlRequest.cpp"/>
<F N="../../lib/data/curl/curlRequestsManager.cpp"/>
<F N="../../lib/data/mysql/database_class.cpp"/>
<F N="../../lib/data/json/json_reader.cpp"/>
<F N="../../lib/data/json/json_value.cpp"/>
@ -242,19 +248,24 @@
<F N="../../lib/components/object/objectSystemAnchor.cpp"/>
<F N="../../lib/data/protocol/onvifMediaObserver.cpp"/>
<F N="../../lib/data/ponvif/ponvif.cpp"/>
<F N="../../lib/data/protocol/protocolDefender.cpp"/>
<F N="../../lib/data/protocol/protocolHTTP.cpp"/>
<F N="../../lib/data/protocol/protocolSafeShore.cpp"/>
<F N="../../lib/data/protocol/protocolZLMEDIA.cpp"/>
<F N="../../lib/App/argus/RGoose_Kernel.cpp"/>
<F N="../../lib/rgoose/rgooseDBConnector.cpp"/>
<F N="../../lib/rgoose/rgooseIPCamera.cpp"/>
<F N="../../lib/rgoose/rgooseNodeFactory.cpp"/>
<F N="../../lib/rgoose/rgooseServerModule.cpp"/>
<F N="../../lib/rgoose/rgooseUSBRelayModule.cpp"/>
<F N="../../lib/data/modWebRTC/servletChannelWebRTC.cpp"/>
<F N="../../lib/data/modWebRTC/servletClientHandlerWebRTC.cpp"/>
<F N="../../lib/data/modWebRTC/servletWebRTC.cpp"/>
<F N="../../lib/data/servletWS/servletChannelWS.cpp"/>
<F N="../../lib/data/servletWS/servletClientHandlerWS.cpp"/>
<F N="../../lib/data/servletWS/servletWS.cpp"/>
<F N="../../lib/data/ssdp/ssdpAnnouncer.cpp"/>
<F N="../../lib/alg/generic/Transform.cpp"/>
<F N="../../lib/alg/generic/utm.cpp"/>
<F N="../../lib/data/protocol/xmlParser.cpp"/>
<F N="../../lib/data/zlMediaServer/zlMediaConnector.cpp"/>
</Folder>
<Folder
Name="Header Files"
@ -263,28 +274,17 @@
<F N="../../lib/alg/generic/base64.h"/>
<F N="../../lib/components/base/basicEventHandler.h"/>
<F N="../../lib/components/base/basicFunctionality.h"/>
<F N="../../lib/components/base/basicSettingsProvider.h"/>
<F N="../../lib/components/base/basicThread.h"/>
<F N="../../lib/components/base/basicTypes.h"/>
<F N="../../lib/data/mysql/database_class.h"/>
<F N="../../lib/hardware/sensors/gps/gps.h"/>
<F N="../../lib/alg/generic/libzip.h"/>
<F N="../../lib/data/ponvif/ponvif.h"/>
<F N="../../lib/data/protocol/protocolNMEA.h"/>
<F N="../../lib/data/protocol/protocolUBX.h"/>
<F N="../../lib/data/protocol/protocolHTTP.h"/>
<F N="../../lib/data/protocol/protocolZLMEDIA.h"/>
<F N="../../lib/App/argus/RGoose_Kernel.h"/>
<F N="../../lib/rgoose/rgooseDBConnector.h"/>
<F N="../../lib/rgoose/rgooseIPCamera.h"/>
<F N="../../lib/rgoose/rgooseNode.h"/>
<F N="../../lib/rgoose/rgooseNodeFactory.h"/>
<F N="../../lib/rgoose/rgooseServerModule.h"/>
<F N="../../lib/rgoose/rgooseUSBRelayModule.h"/>
<F N="../../lib/rgoose/rgooseVideoTranscoderModule.h"/>
<F N="../../lib/data/modWebRTC/servletChannelWebRTC.h"/>
<F N="../../lib/data/modWebRTC/servletClientHandlerWebRTC.h"/>
<F N="../../lib/data/modWebRTC/servletWebRTC.h"/>
<F N="../../lib/data/ssdp/ssdpAnnouncer.h"/>
<F N="../../lib/hardware/sensors/gps/ublox-neo-6/ublogsNeo6.h"/>
<F N="../../lib/data/protocol/xmlParser.h"/>
<F N="../../lib/data/zlMediaServer/zlMediaConnector.h"/>
</Folder>
<Folder
Name="Resource Files"

88
Projects/argus/makefile

@ -21,7 +21,7 @@ ifeq "$(CFG)" "Debug"
OUTDIR=Debug
OUTFILE=$(OUTDIR)/argus
CFG_INC=
CFG_LIB=
CFG_LIB=-lcurl
CFG_OBJ=
COMMON_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
@ -32,19 +32,22 @@ COMMON_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicRing.o \
$(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTimeStamp.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/database_class.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/curlRequest.o \
$(OUTDIR)/curlRequestsManager.o $(OUTDIR)/database_class.o \
$(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \
$(OUTDIR)/protocolDefender.o $(OUTDIR)/protocolHTTP.o \
$(OUTDIR)/protocolSafeShore.o $(OUTDIR)/protocolZLMEDIA.o \
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseDBConnector.o \
$(OUTDIR)/rgooseIPCamera.o $(OUTDIR)/rgooseNodeFactory.o \
$(OUTDIR)/rgooseServerModule.o $(OUTDIR)/rgooseUSBRelayModule.o \
$(OUTDIR)/servletChannelWebRTC.o \
$(OUTDIR)/servletClientHandlerWebRTC.o $(OUTDIR)/servletWebRTC.o \
$(OUTDIR)/ssdpAnnouncer.o $(OUTDIR)/Transform.o $(OUTDIR)/utm.o \
$(OUTDIR)/xmlParser.o
$(OUTDIR)/servletChannelWS.o $(OUTDIR)/servletClientHandlerWS.o \
$(OUTDIR)/servletWS.o $(OUTDIR)/ssdpAnnouncer.o \
$(OUTDIR)/Transform.o $(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o \
$(OUTDIR)/zlMediaConnector.o
OBJ=$(COMMON_OBJ) $(CFG_OBJ)
ALL_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
@ -55,34 +58,37 @@ ALL_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicRing.o \
$(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTimeStamp.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/database_class.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/curlRequest.o \
$(OUTDIR)/curlRequestsManager.o $(OUTDIR)/database_class.o \
$(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \
$(OUTDIR)/protocolDefender.o $(OUTDIR)/protocolHTTP.o \
$(OUTDIR)/protocolSafeShore.o $(OUTDIR)/protocolZLMEDIA.o \
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseDBConnector.o \
$(OUTDIR)/rgooseIPCamera.o $(OUTDIR)/rgooseNodeFactory.o \
$(OUTDIR)/rgooseServerModule.o $(OUTDIR)/rgooseUSBRelayModule.o \
$(OUTDIR)/servletChannelWebRTC.o \
$(OUTDIR)/servletClientHandlerWebRTC.o $(OUTDIR)/servletWebRTC.o \
$(OUTDIR)/ssdpAnnouncer.o $(OUTDIR)/Transform.o $(OUTDIR)/utm.o \
$(OUTDIR)/xmlParser.o
$(OUTDIR)/servletChannelWS.o $(OUTDIR)/servletClientHandlerWS.o \
$(OUTDIR)/servletWS.o $(OUTDIR)/ssdpAnnouncer.o \
$(OUTDIR)/Transform.o $(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o \
$(OUTDIR)/zlMediaConnector.o -lcurl
COMPILE=g++ -c -x c++ "-DDEBUG" "-D__STDC_CONSTANT_MACROS" -g -std=c++11 -Wno-write-strings `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -g -lpthread -lmysqlclient -lcurl -lm -lssl -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --libs` -o "$(OUTFILE)" $(ALL_OBJ)
COMPILE=g++ -c -x c++ "-DDEBUG" "-D__STDC_CONSTANT_MACROS" -g -std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -g -lpthread -lmysqlclient -lcurl -lm -lssl -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --libs` -lcurl -o "$(OUTFILE)" $(ALL_OBJ)
# Pattern rules
$(OUTDIR)/%.o : ../../lib/data/protocol/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/App/argus/%.cpp
$(OUTDIR)/%.o : ../../lib/data/ssdp/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/modWebRTC/%.cpp
$(OUTDIR)/%.o : ../../lib/App/argus/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/ssdp/%.cpp
$(OUTDIR)/%.o : ../../lib/data/zlMediaServer/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp
@ -100,12 +106,18 @@ $(OUTDIR)/%.o : ../../lib/rgoose/%.cpp
$(OUTDIR)/%.o : ../../lib/components/object/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/curl/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/mysql/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/json/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/servletWS/%.cpp
$(COMPILE)
# Build rules
all: $(OUTFILE)
@ -134,7 +146,7 @@ ifeq "$(CFG)" "Release"
OUTDIR=Release
OUTFILE=$(OUTDIR)/argus
CFG_INC=
CFG_LIB=
CFG_LIB=-lcurl
CFG_OBJ=
COMMON_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
@ -145,19 +157,22 @@ COMMON_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicRing.o \
$(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTimeStamp.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/database_class.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/curlRequest.o \
$(OUTDIR)/curlRequestsManager.o $(OUTDIR)/database_class.o \
$(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \
$(OUTDIR)/protocolDefender.o $(OUTDIR)/protocolHTTP.o \
$(OUTDIR)/protocolSafeShore.o $(OUTDIR)/protocolZLMEDIA.o \
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseDBConnector.o \
$(OUTDIR)/rgooseIPCamera.o $(OUTDIR)/rgooseNodeFactory.o \
$(OUTDIR)/rgooseServerModule.o $(OUTDIR)/rgooseUSBRelayModule.o \
$(OUTDIR)/servletChannelWebRTC.o \
$(OUTDIR)/servletClientHandlerWebRTC.o $(OUTDIR)/servletWebRTC.o \
$(OUTDIR)/ssdpAnnouncer.o $(OUTDIR)/Transform.o $(OUTDIR)/utm.o \
$(OUTDIR)/xmlParser.o
$(OUTDIR)/servletChannelWS.o $(OUTDIR)/servletClientHandlerWS.o \
$(OUTDIR)/servletWS.o $(OUTDIR)/ssdpAnnouncer.o \
$(OUTDIR)/Transform.o $(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o \
$(OUTDIR)/zlMediaConnector.o
OBJ=$(COMMON_OBJ) $(CFG_OBJ)
ALL_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
@ -168,34 +183,37 @@ ALL_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicRing.o \
$(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTimeStamp.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/database_class.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/curlRequest.o \
$(OUTDIR)/curlRequestsManager.o $(OUTDIR)/database_class.o \
$(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \
$(OUTDIR)/protocolDefender.o $(OUTDIR)/protocolHTTP.o \
$(OUTDIR)/protocolSafeShore.o $(OUTDIR)/protocolZLMEDIA.o \
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseDBConnector.o \
$(OUTDIR)/rgooseIPCamera.o $(OUTDIR)/rgooseNodeFactory.o \
$(OUTDIR)/rgooseServerModule.o $(OUTDIR)/rgooseUSBRelayModule.o \
$(OUTDIR)/servletChannelWebRTC.o \
$(OUTDIR)/servletClientHandlerWebRTC.o $(OUTDIR)/servletWebRTC.o \
$(OUTDIR)/ssdpAnnouncer.o $(OUTDIR)/Transform.o $(OUTDIR)/utm.o \
$(OUTDIR)/xmlParser.o
$(OUTDIR)/servletChannelWS.o $(OUTDIR)/servletClientHandlerWS.o \
$(OUTDIR)/servletWS.o $(OUTDIR)/ssdpAnnouncer.o \
$(OUTDIR)/Transform.o $(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o \
$(OUTDIR)/zlMediaConnector.o -lcurl
COMPILE=g++ -c -x c++ "-DDEBUG" "-D__STDC_CONSTANT_MACROS" -std=c++11 -Wno-write-strings `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -lpthread -lmysqlclient -lcurl -lm -lssl -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --libs` -o "$(OUTFILE)" $(ALL_OBJ)
COMPILE=g++ -c -x c++ "-DDEBUG" "-D__STDC_CONSTANT_MACROS" -std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -lpthread -lmysqlclient -lcurl -lm -lssl -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --libs` -lcurl -o "$(OUTFILE)" $(ALL_OBJ)
# Pattern rules
$(OUTDIR)/%.o : ../../lib/data/protocol/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/App/argus/%.cpp
$(OUTDIR)/%.o : ../../lib/data/ssdp/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/modWebRTC/%.cpp
$(OUTDIR)/%.o : ../../lib/App/argus/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/ssdp/%.cpp
$(OUTDIR)/%.o : ../../lib/data/zlMediaServer/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp
@ -213,12 +231,18 @@ $(OUTDIR)/%.o : ../../lib/rgoose/%.cpp
$(OUTDIR)/%.o : ../../lib/components/object/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/curl/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/mysql/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/json/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/servletWS/%.cpp
$(COMPILE)
# Build rules
all: $(OUTFILE)

38
Projects/defender-dc-trig/Debug/default.conf

@ -0,0 +1,38 @@
KERNEL :
{
DBC :
{
DATABASE_HOST = "localhost";
DATABASE_NAME = "dfsl_gunter";
DATABASE_USER = "dbroot";
DATABASE_PASSWORD = "NoGud4U";
};
SSDP :
{
DEVICE_TYPE = "urn:schemas-upnp-org:device:InternetGatewayDevice:1";
SERVER_STRING = "Atom Argus App Server";
DEVICE_FRIENDLY_NAME = "Argus Application Server";
DEVICE_UUID = "47035424-731b-4d83-98c5-c4310993bbb3";
MANUFACTURER = "Dr.Frucht Systems";
MANUFACTURER_URL = "http://www.smartsecsystems.com";
MODEL_NAME = "Intel Atom Argus Server";
DEVICE_SERIAL_NUMBER = "1.0.12";
PRESENTATION_URL = "http://%%s/";
ICONS :
{
ICON_0 :
{
FORMAT = "png";
WIDTH = 32;
HEIGHT = 32;
DEPTH = 32;
URL = "http://%%s/favicon-32x32.png";
};
};
SERVICES :
{
};
};
IDENTITY = "d7d823703f68ba05c04efdb7474c2de5";
SITE_ID = 1;
};

288
Projects/defender-dc-trig/defender-dc-trig.vpj

@ -0,0 +1,288 @@
<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd">
<Project
Version="10.0"
VendorName="SlickEdit"
TemplateName="GNU C/C++"
WorkingDir="."
BuildSystem="automakefile"
BuildMakeFile="makefile">
<Config
Name="Debug"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bdtrigd"
CompilerConfigName="Latest Version"
Defines='"/DDEBUG" "/D__STDC_CONSTANT_MACROS"'>
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec
CmdLine='g++ -c %xup -x c++ %defd -g %~other -o "%bd%n%oe" %i %f'
OtherOptions="-std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags`"/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec
CmdLine='g++ %xup -g %~other -o "%o" %objs'
OtherOptions="-lpthread -lmysqlclient -lcurl -lm -lssl -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --libs`"/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine='make -f "makefile" CFG=%b'/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine='make -f "makefile" rebuild CFG=%b'/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine='vsdebugio -prog "%o"'/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine='"%o"'/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="Executable"/>
</List>
<Includes>
</Includes>
<Libs PreObjects="0">
</Libs>
</Config>
<Config
Name="Release"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bdtrigd"
CompilerConfigName="Latest Version"
Defines='"/DDEBUG" "/D__STDC_CONSTANT_MACROS"'>
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec
CmdLine='g++ -c %xup -x c++ %defd %~other -o "%bd%n%oe" %i %f'
OtherOptions="-std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags`"/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec
CmdLine='g++ %xup %~other -o "%o" %objs'
OtherOptions="-lpthread -lmysqlclient -lcurl -lm -lssl -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --libs`"/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine='make -f "makefile" CFG=%b'/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine='make -f "makefile" rebuild CFG=%b'/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine='vsdebugio -prog "%o"'/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine='"%o"'/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="Executable"/>
</List>
<Includes>
</Includes>
<Libs PreObjects="0">
</Libs>
</Config>
<Files>
<Folder
Name="Source Files"
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d">
<F N="../../lib/App/defender/ArgusBackend.cpp"/>
<F N="../../lib/alg/generic/base64.cpp"/>
<F N="../../lib/components/base/basicDualThread.cpp"/>
<F N="../../lib/components/base/basicEngine.cpp"/>
<F N="../../lib/components/base/basicEvent.cpp"/>
<F N="../../lib/components/base/basicEventHandler.cpp"/>
<F N="../../lib/components/base/basicEventHeap.cpp"/>
<F N="../../lib/components/base/basicFunctionality.cpp"/>
<F N="../../lib/components/base/basicLogCollection.cpp"/>
<F N="../../lib/components/base/basicLoggingService.cpp"/>
<F N="../../lib/components/base/basicMutex.cpp"/>
<F N="../../lib/components/base/basicObject.cpp"/>
<F N="../../lib/components/base/basicPosition.cpp"/>
<F N="../../lib/components/base/basicRing.cpp"/>
<F N="../../lib/components/base/basicSettings.cpp"/>
<F N="../../lib/components/base/basicSettingsProvider.cpp"/>
<F N="../../lib/components/base/basicThread.cpp"/>
<F N="../../lib/components/base/basicTimeStamp.cpp"/>
<F N="../../lib/components/base/basicTypes.cpp"/>
<F N="../../lib/data/mysql/database_class.cpp"/>
<F N="../../lib/data/json/json_reader.cpp"/>
<F N="../../lib/data/json/json_value.cpp"/>
<F N="../../lib/data/json/json_writer.cpp"/>
<F N="../../lib/alg/generic/libzip.cpp"/>
<F N="../../lib/alg/generic/md5.cpp"/>
<F N="../../lib/components/object/objectConsoleLoggingService.cpp"/>
<F N="../../lib/components/object/objectFileLoggingService.cpp"/>
<F N="../../lib/components/object/objectSystemAnchor.cpp"/>
<F N="../../lib/data/protocol/onvifMediaObserver.cpp"/>
<F N="../../lib/data/ponvif/ponvif.cpp"/>
<F N="../../lib/App/defender/RGoose_Kernel.cpp"/>
<F N="../../lib/defender-dc-trig/rgooseServerModule.cpp"/>
<F N="../../lib/defender-dc-trig/rgooseUSBRelayModule.cpp"/>
<F N="../../lib/alg/generic/Transform.cpp"/>
<F N="../../lib/alg/generic/utm.cpp"/>
<F N="../../lib/data/protocol/xmlParser.cpp"/>
</Folder>
<Folder
Name="Header Files"
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
<F N="../../lib/App/defender/ArgusBackend.h"/>
<F N="../../lib/alg/generic/base64.h"/>
<F N="../../lib/components/base/basicEventHandler.h"/>
<F N="../../lib/components/base/basicFunctionality.h"/>
<F N="../../lib/components/base/basicSettingsProvider.h"/>
<F N="../../lib/components/base/basicThread.h"/>
<F N="../../lib/components/base/basicTypes.h"/>
<F N="../../lib/data/mysql/database_class.h"/>
<F N="../../lib/alg/generic/libzip.h"/>
<F N="../../lib/data/ponvif/ponvif.h"/>
<F N="../../lib/data/protocol/protocolNMEA.h"/>
<F N="../../lib/data/protocol/protocolUBX.h"/>
<F N="../../lib/App/defender/RGoose_Kernel.h"/>
<F N="../../lib/defender-dc-trig/rgooseServerModule.h"/>
<F N="../../lib/defender-dc-trig/rgooseUSBRelayModule.h"/>
<F N="../../lib/data/protocol/xmlParser.h"/>
</Folder>
<Folder
Name="Resource Files"
Filters="*.ico;*.cur;*.dlg"/>
<Folder
Name="Bitmaps"
Filters="*.bmp"/>
<Folder
Name="Other Files"
Filters="">
<F
N="makefile"
Type="Makefile"/>
</Folder>
</Files>
</Project>

6
Projects/defender-dc-trig/defender-dc-trig.vpw

@ -0,0 +1,6 @@
<!DOCTYPE Workspace SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpw.dtd">
<Workspace Version="10.0" VendorName="SlickEdit">
<Projects>
<Project File="defender-dc-trig.vpj"/>
</Projects>
</Workspace>

213
Projects/defender-dc-trig/makefile

@ -0,0 +1,213 @@
# SlickEdit generated file. Do not edit this file except in designated areas.
# Make command to use for dependencies
MAKE=make
RM=rm
MKDIR=mkdir
# -----Begin user-editable area-----
# -----End user-editable area-----
# If no configuration is specified, "Debug" will be used
ifndef CFG
CFG=Debug
endif
#
# Configuration: Debug
#
ifeq "$(CFG)" "Debug"
OUTDIR=Debug
OUTFILE=$(OUTDIR)/trigd
CFG_INC=
CFG_LIB=
CFG_OBJ=
COMMON_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
$(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \
$(OUTDIR)/basicEventHeap.o $(OUTDIR)/basicFunctionality.o \
$(OUTDIR)/basicLogCollection.o $(OUTDIR)/basicLoggingService.o \
$(OUTDIR)/basicMutex.o $(OUTDIR)/basicObject.o \
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicRing.o \
$(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTimeStamp.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/database_class.o \
$(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseServerModule.o \
$(OUTDIR)/rgooseUSBRelayModule.o $(OUTDIR)/Transform.o \
$(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o
OBJ=$(COMMON_OBJ) $(CFG_OBJ)
ALL_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
$(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \
$(OUTDIR)/basicEventHeap.o $(OUTDIR)/basicFunctionality.o \
$(OUTDIR)/basicLogCollection.o $(OUTDIR)/basicLoggingService.o \
$(OUTDIR)/basicMutex.o $(OUTDIR)/basicObject.o \
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicRing.o \
$(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTimeStamp.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/database_class.o \
$(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseServerModule.o \
$(OUTDIR)/rgooseUSBRelayModule.o $(OUTDIR)/Transform.o \
$(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o
COMPILE=g++ -c -x c++ "-DDEBUG" "-D__STDC_CONSTANT_MACROS" -g -std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -g -lpthread -lmysqlclient -lcurl -lm -lssl -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --libs` -o "$(OUTFILE)" $(ALL_OBJ)
# Pattern rules
$(OUTDIR)/%.o : ../../lib/data/ponvif/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/components/base/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/App/defender/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/protocol/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/defender-dc-trig/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/json/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/mysql/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/components/object/%.cpp
$(COMPILE)
# Build rules
all: $(OUTFILE)
$(OUTFILE): $(OUTDIR) $(OBJ)
$(LINK)
$(OUTDIR):
$(MKDIR) -p "$(OUTDIR)"
# Rebuild this project
rebuild: cleanall all
# Clean this project
clean:
$(RM) -f $(OUTFILE)
$(RM) -f $(OBJ)
# Clean this project and all dependencies
cleanall: clean
endif
#
# Configuration: Release
#
ifeq "$(CFG)" "Release"
OUTDIR=Release
OUTFILE=$(OUTDIR)/trigd
CFG_INC=
CFG_LIB=
CFG_OBJ=
COMMON_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
$(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \
$(OUTDIR)/basicEventHeap.o $(OUTDIR)/basicFunctionality.o \
$(OUTDIR)/basicLogCollection.o $(OUTDIR)/basicLoggingService.o \
$(OUTDIR)/basicMutex.o $(OUTDIR)/basicObject.o \
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicRing.o \
$(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTimeStamp.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/database_class.o \
$(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseServerModule.o \
$(OUTDIR)/rgooseUSBRelayModule.o $(OUTDIR)/Transform.o \
$(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o
OBJ=$(COMMON_OBJ) $(CFG_OBJ)
ALL_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \
$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
$(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \
$(OUTDIR)/basicEventHeap.o $(OUTDIR)/basicFunctionality.o \
$(OUTDIR)/basicLogCollection.o $(OUTDIR)/basicLoggingService.o \
$(OUTDIR)/basicMutex.o $(OUTDIR)/basicObject.o \
$(OUTDIR)/basicPosition.o $(OUTDIR)/basicRing.o \
$(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTimeStamp.o \
$(OUTDIR)/basicTypes.o $(OUTDIR)/database_class.o \
$(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \
$(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/md5.o \
$(OUTDIR)/objectConsoleLoggingService.o \
$(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \
$(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \
$(OUTDIR)/RGoose_Kernel.o $(OUTDIR)/rgooseServerModule.o \
$(OUTDIR)/rgooseUSBRelayModule.o $(OUTDIR)/Transform.o \
$(OUTDIR)/utm.o $(OUTDIR)/xmlParser.o
COMPILE=g++ -c -x c++ "-DDEBUG" "-D__STDC_CONSTANT_MACROS" -std=c++11 -Wno-write-strings -I../../lib/include `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -lpthread -lmysqlclient -lcurl -lm -lssl -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale --libs` -o "$(OUTFILE)" $(ALL_OBJ)
# Pattern rules
$(OUTDIR)/%.o : ../../lib/data/ponvif/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/components/base/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/App/defender/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/protocol/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/defender-dc-trig/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/json/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/data/mysql/%.cpp
$(COMPILE)
$(OUTDIR)/%.o : ../../lib/components/object/%.cpp
$(COMPILE)
# Build rules
all: $(OUTFILE)
$(OUTFILE): $(OUTDIR) $(OBJ)
$(LINK)
$(OUTDIR):
$(MKDIR) -p "$(OUTDIR)"
# Rebuild this project
rebuild: cleanall all
# Clean this project
clean:
$(RM) -f $(OUTFILE)
$(RM) -f $(OBJ)
# Clean this project and all dependencies
cleanall: clean
endif

12
lib/App/argus/RGoose_Kernel.cpp

@ -239,12 +239,12 @@ bool ARGUS_Kernel::create( void ){
#ifdef DEBUG
LOG( "Kernel Thread Created" );
#endif
m_pWebRTC = new servletWebRTC();
if( m_pWebRTC != NULL ) {
LOG("WebRTC Created");
if(m_pWebRTC->create(8080)){
LOG("WebRTC Started");
//if( ! m_pWebRTC->attachChannel("rtsp://gagua:4GetMyID@192.168.0.109:554/Streaming/Channels/101?transportmode=unicast&profile=Profile_1", false ) ){
m_pServletWS = new servletWS();
if( m_pServletWS != NULL ) {
LOG("ServletWS Created");
if(m_pServletWS->create(8080)){
LOG("ServletWS Started");
//if( ! m_pServletWS->attachChannel("rtsp://gagua:4GetMyID@192.168.0.109:554/Streaming/Channels/101?transportmode=unicast&profile=Profile_1", false ) ){
// LOG("Error Adding Channel!");
//} else {
// LOG("Channel Attached");

4
lib/App/argus/RGoose_Kernel.h

@ -68,7 +68,7 @@ struct serial_struct {
#include "../../rgoose/rgooseIPCamera.h"
#include "../../rgoose/rgooseNodeFactory.h"
#include "../../data/net/netServer.h"
#include "../../data/modWebRTC/servletWebRTC.h"
#include "../../data/servletWS/servletWS.h"
#define SLEEP_KERNEL_INTERVAL 10
#define ONVIF_DISCOVERY_INTERVAL 300 // 5 min
@ -101,7 +101,7 @@ class ARGUS_Kernel: public basicThread {
vectorCamRecords m_vCamRecords;
vectorEventRecords m_vEvtRecords;
argusNodeFactory * m_pNodeFactory;
servletWebRTC * m_pWebRTC;
servletWS * m_pServletWS;
int isCameraListed( CSTR uid );
void validateCameras( void );
void validateEvents( int &lastTSS, int &lastTMS );

246
lib/App/defender/ArgusBackend.cpp

@ -0,0 +1,246 @@
#include "ArgusBackend.h"
// Global Variables
CSTR gsCFG_ADDRESS;
uint16_t guCFG_PORT = DEFAULT_SERVER_PORT;
CSTR gsCFG_LICENSE;
CSTR gsCFG_DB_SERVER;
CSTR gsCFG_DB_NAME;
CSTR gsCFG_DB_USER;
CSTR gsCFG_DB_PASSWORD;
CSTR gsCFG_PID_FILE = (CSTR) DEFAULT_SERVER_PID_FILE;
SOFTWARE_INFO gsSOFT_INFO;
bool gbCFG_MASTER_ROLE = true;
bool gModule_GeoFence_Enabled = true;
bool gModule_SMS_Enabled = false;
bool gModule_Email_Enabled = false;
bool gSignal_Handler_Enabled = true;
#define LOG( X ) m_pLog->Log( "main", 0, X )
#define LOG_ERROR( X ) m_pLog->Log( "main", 0, _LOG_ERROR, X )
ARGUS_Kernel * Kernel = NULL;
//LRF_HardwareManager * HWManager = NULL;
basicLogCollection * m_pLog = NULL;
networkServer * NetworkManager = NULL;
void (*old_update_handler_2)(int); //SIGINT
void (*old_kill_handler_3)(int); //SIGQUIT
void (*old_kill_handler_9)(int); //SIGKILL
void (*old_alarm_handler_14)(int); //SIGALRM
void (*old_kill_handler_15)(int); //SIGTERM
void signal_SIGKILL_handler( int SIG ){
if( Kernel!= NULL ){
if( gSignal_Handler_Enabled ){
m_pLog->Log("SIG", 0, _LOG_DEBUG, "Shutdown Service by Signal" );
Kernel->setStatus( TH_ENDED ); // Closing all Connections;
} else {
m_pLog->Log("SIG", 0, _LOG_DEBUG, "Shutdown Signal Handler Disabled" );
};
};
};
int main (int argc, char *argv[]){
MySQL_Connector * DBC = NULL;
basicSettingsProvider * SETTINGS = NULL;
bool WBG; // Working Background
bool SSE; // Server Statistics Engine
bool NDC; // No Default Configuration
CSTR FLE_NAME;
CSTR DCF_NAME;
CSTR SSP_NAME;
objectFileLoggingService * FLE = NULL;
objectConsoleLoggingService * CLE = NULL;
// default init
WBG = true;
FLE_NAME = (CSTR) DEFAULT_SERVER_LOG_FILE;
SSE = true;
NDC = true;
DCF_NAME = (CSTR) DEFAULT_SERVER_CONFIG_PATH;
SSP_NAME = (CSTR) DEFAULT_SERVER_SOCKET_PATH;
gsSOFT_INFO.SW_BUILD_DATE = UNIX_TIMESTAMP;
gsSOFT_INFO.DATA_VALID = false;
m_pLog = basicLogCollection::getInstance();
gsSOFT_INFO.SW_MODE_FLAGS = 0
#ifdef SKIP_TARGET_LOG
| SW_INFO_NO_TARGET_LOG
#endif
#ifdef HIBERNATE_ENABLE
| SW_INFO_HIBERNATE_ENA
#endif
#ifdef TGD
| SW_INFO_TGD_MOTORS
#ifdef TGD_VERSION_2
| SW_INFO_TGD_VER_2
#endif
#endif
#ifdef ENCODER_8192
| SW_INFO_EU_PROJECT
#endif
#ifdef NO_BLACK_TARGETS
| SW_INFO_NO_BLACK_TARGETS
#endif
#ifndef NO_MOTORS
| SW_INFO_MOTOR_CTRL_ENA
#endif
#ifdef THREADED_FLIP
| SW_INFO_THREAD_FLIP
#endif
#ifndef PRU_SLAVE
| SW_INFO_FLAG_MASTER
#endif
#ifdef DEBUG
| SW_INFO_DEBUG_MODE
#endif
;
// Reading Config
if( argc > 1 ){
for( int i = 0; i < argc; i++ ){
switch( argv[i][0] ){
case '-':
case '\\':
case '/':{
switch( argv[i][1] ){
case 'h': case 'H': case 'v': case 'V': case '?':{
printf( "Dr Frucht Systems R-Goose Server\n");
printf( "Software version <%s>\n", VERSION_NUMBER );
printf( " -h -H This Message\n" );
printf( " -i -I Interactive Mode\n" );
return 0;
break;
};
case 'i': case 'I':{
WBG = false;
CLE = new objectConsoleLoggingService();
if( CLE != NULL ) {
m_pLog->addHandler( CLE );
};
break;
};
case 'c': case 'C':{
DCF_NAME = (CSTR) malloc( MAX_PATH_LEN );
if( DCF_NAME != NULL ) {
sprintf( DCF_NAME, "%s", argv[i+1] );
} else {
printf("ERROR!\n\n");
return -1;
};
break;
};
};
break;
};
};
};
};
FLE = new objectFileLoggingService( FLE_NAME );
if( FLE != NULL ) {
m_pLog->addHandler( FLE );
};
LOG("Starting Log Engne!");
if ( fileExist( DCF_NAME ) ){
SETTINGS = basicSettingsProvider::getInstance(DCF_NAME);
} else {
SETTINGS = basicSettingsProvider::getInstance();
};
// Demonizing or not
if( WBG ){
printf( "Dr Frucht Systems LRF Server ver. %s\n", VERSION_NUMBER );
printf( "Configuration Applied:\n");
printf( " Service Established %s at %d\n", gsCFG_ADDRESS, guCFG_PORT );
printf( " PID File: %s\n", gsCFG_PID_FILE );
printf( " Log File: %s\n", FLE_NAME );
printf( " License: %s\n", gsCFG_LICENSE );
printf( " Database Server: %s Database: %s\n", gsCFG_DB_SERVER, gsCFG_DB_NAME );
if( NDC ){
printf( " No configuration file (%s) supplied.\n", DCF_NAME);
} else {
printf( " Configuration read from: %s\n", DCF_NAME );
};
//Demonizing
pid_t pid, sid;
sync();
close( STDIN_FILENO );
close( STDOUT_FILENO );
close( STDERR_FILENO );
pid = fork();
if( pid < 0 ){
return pid;
};
if( pid > 0 ){
return 0;
};
//umask(0);
sid = setsid();
if (sid < 0) {
return sid;
};
pid = fork();
if( pid < 0 ){
return pid;
};
if( pid > 0 ){
FILE *pPIDF = fopen( gsCFG_PID_FILE, "w+" );
if( pPIDF ){
fprintf( pPIDF, "%d\n", pid );
fclose( pPIDF );
}
return 0;
};
};
uint8_t m_bKernelExitCode = 0;
do{
Kernel = new ARGUS_Kernel();
if( Kernel == NULL ) {
// Aborting Work
LOG_ERROR( "++++ Kernel failed to born ++++" );
unlink( gsCFG_PID_FILE );
LOG( "PID File Deleted" );
delete( m_pLog );
return -1;
};
//Loop till some Restart action
if( Kernel != NULL ){
LOG( "++++ Server Started ++++" );
if ( Kernel->create() == false ){
LOG_ERROR("Kernel create failure!");
} else {
//Install Signal Listeners
old_kill_handler_15 = signal( 15, signal_SIGKILL_handler );
old_kill_handler_9 = signal( 9, signal_SIGKILL_handler );
// Waiting for Worker to Shut Down
Kernel->WaitFinish( false );
m_bKernelExitCode = Kernel->getExitCause();
signal( 9, old_kill_handler_9 );
signal( 15, old_kill_handler_15 );
};
delete( Kernel );
LOG( "++++ Server Ended ++++" );
};
} while( m_bKernelExitCode > 0 );
delete( NetworkManager );
//LOG( "++++ CDC DEL ++++" );
unlink( gsCFG_PID_FILE );
LOG( "PID File Deleted" );
if( FLE!= NULL ) delete( FLE );
if( CLE!= NULL ) delete( CLE );
delete( m_pLog );
return(0);
}

50
lib/App/defender/ArgusBackend.h

@ -0,0 +1,50 @@
/*******************************************************************
*
* DESCRIPTION: Argus project main header file
*
* AUTHOR: Gagua
*
* HISTORY:
*
* DATE:5/29/2019
*
*******************************************************************/
#ifndef __ARGUS_BACKEND_MAIN_HEADER__
#define __ARGUS_BACKEND_MAIN_HEADER__
/** include files **/
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include "../../components/base/basicSettings.h"
#include "../../components/base/basicLogCollection.h"
#include "../../components/base/basicMemoryOperation.h"
#include "../../components/object/objectFileLoggingService.h"
#include "../../components/object/objectConsoleLoggingService.h"
#include "../../data/net/netServer.h"
#include "../../data/ponvif/ponvif.h"
#include "../../data/protocol/onvifMediaObserver.h"
#include "../../data/mysql/database_class.h"
#include "RGoose_Kernel.h"
/** local definitions **/
//http://xmsecu.com:8080/ocx/NewActive.exe
/* default settings */
/** external functions **/
/** external data **/
/** internal functions **/
/** public data **/
/** private data **/
/** public functions **/
/** private functions **/
#endif

217
lib/App/defender/RGoose_Kernel.cpp

@ -0,0 +1,217 @@
/*******************************************************************
*
* DESCRIPTION: ARGUS Kernel source
*
* AUTHOR: gagua
*
* HISTORY:
*
* DATE:5/29/2019
*
*******************************************************************/
#include "RGoose_Kernel.h"
#include <sys/types.h>
#define LOG( X ) m_pLog->Log( "KRNL", this, X )
#define LOG_ERROR( X ) m_pLog->Log( "KRNL", this, _LOG_ERROR, X )
ARGUS_Kernel::ARGUS_Kernel( config_setting_t *Settings ):basicThread(){
m_bExitCause = 0;
m_nSiteID = 0;
m_tTimeTSeconds = time( NULL );
m_pLog = basicLogCollection::getInstance();
m_pEventHeap = basicEventHeap::getInstance();
m_pSettings = basicSettingsProvider::getInstance()->getSubNode( Settings, "KERNEL" );
if( basicSettingsProvider::getInstance()->isCompromised() ) {
basicSettingsProvider::getInstance()->validate();
};
};
ARGUS_Kernel::~ARGUS_Kernel(){
#ifdef DEBUG
LOG("Destructor");
#endif
WaitFinish(true);
#ifdef DEBUG
LOG("Deleting Components");
#endif
#ifdef DEBUG
LOG("Destructor Finished");
#endif
};
bool ARGUS_Kernel::create( void ){
char tBuffer[256];
if( m_pSettings != NULL ) {
config_setting_t * pSetting;
int tVal;
const char * tBuf;
//Connect( CSTR DBName, CSTR DBHost, CSTR DBUser, CSTR DBPassword, uint16_t Port = 3300 );
LOG("Getting Settings ...");
if( !config_setting_lookup_string( m_pSettings, ARGUS_KERNEL_TAG_SERVER_IDENTITY, &tBuf ) ){
char * tVar;
char * tTS;
tTS = getTStr(NULL);
tVar = MD5String(tTS);
free(tTS);
sprintf( m_sIdentity, tVar );
pSetting = config_setting_add( m_pSettings, ARGUS_KERNEL_TAG_SERVER_IDENTITY, CONFIG_TYPE_STRING );
config_setting_set_string( pSetting, tVar );
free( tVar );
basicSettingsProvider::getInstance()->compromise();
LOG("Server Identity not defined - generating new!");
} else {
sprintf( m_sIdentity, tBuf );
sprintf( tBuffer, "Server Identity Read From Settings: %s", tBuf );
LOG( tBuffer );
};
if( !config_setting_lookup_int( m_pSettings, ARGUS_KERNEL_TAG_SITE_ID, &tVal ) ){
tVal = m_nSiteID = 1;
pSetting = config_setting_add( m_pSettings, ARGUS_KERNEL_TAG_SITE_ID, CONFIG_TYPE_INT );
config_setting_set_int( pSetting, tVal );
basicSettingsProvider::getInstance()->compromise();
LOG("Site ID not defined - using [1] as number!");
} else {
m_nSiteID = tVal;
sprintf( tBuffer, "Site ID Read From Settings: %d", m_nSiteID );
LOG( tBuffer );
};
/*
#ifdef __EU_PROJECT__
if( !config_setting_lookup_bool( m_pSettings, KNL_SETTINGS_SAFE_SHORE, &tVal ) ){
tVal = m_bSafeShoreSupport = true;
pSetting = config_setting_add( m_pSettings, KNL_SETTINGS_SAFE_SHORE, CONFIG_TYPE_BOOL );
config_setting_set_bool( pSetting, tVal );
m_pSettingsProvider->compromise();
LOG("Safe-Shore support not defined");
} else {
m_bSafeShoreSupport = (bool)tVal;
sprintf( tBuffer, "Safe-Shore support Read From Settings: %d", tVal );
LOG( tBuffer );
};
#endif
if( !config_setting_lookup_bool( m_pSettings, KNL_SETTINGS_DEFENDER, &tVal ) ){
tVal = m_bDefenderSupport = true;
pSetting = config_setting_add( m_pSettings, KNL_SETTINGS_DEFENDER, CONFIG_TYPE_BOOL );
config_setting_set_bool( pSetting, tVal );
m_pSettingsProvider->compromise();
LOG("Defender support not defined");
} else {
m_bDefenderSupport = (bool)tVal;
sprintf( tBuffer, "Defender support Read From Settings: %d", tVal );
LOG( tBuffer );
};
if (!config_setting_lookup_int(m_pSettings, KNL_SETTINGS_DETECTOR_WIDTH, &tVal )){
tVal = m_nWidth = 1000;
pSetting = config_setting_add(m_pSettings, KNL_SETTINGS_DETECTOR_WIDTH, CONFIG_TYPE_INT);
config_setting_set_int(pSetting, tVal );
m_pSettingsProvider->compromise();
LOG("No Detector Width");
} else {
m_nWidth = tVal;
sprintf( tBuffer, "Detector Width Read From Settings: %d", tVal );
LOG( tBuffer );
};
if (!config_setting_lookup_int(m_pSettings, KNL_SETTINGS_FILTER_KERNELS, &tVal )){
tVal = m_nKernelFilter = 0x000000ff;
pSetting = config_setting_add(m_pSettings, KNL_SETTINGS_FILTER_KERNELS, CONFIG_TYPE_INT);
config_setting_set_int(pSetting, tVal );
m_pSettingsProvider->compromise();
LOG("No Fltered Kernels Defined - All LRF Will Work");
} else {
m_nKernelFilter = tVal;
sprintf( tBuffer, "Filter Kernels Read From Settings: %d", tVal );
LOG( tBuffer );
};
if (!config_setting_lookup_int(m_pSettings, KNL_SETTINGS_DETECTOR_SST, &tVal )){
tVal = m_nSST = 0;
pSetting = config_setting_add(m_pSettings, KNL_SETTINGS_DETECTOR_SST, CONFIG_TYPE_INT);
config_setting_set_int(pSetting, tVal );
m_pSettingsProvider->compromise();
LOG("No Detector SST");
} else {
m_nSST = tVal;
sprintf( tBuffer, "Detector SST Read From Settings: %d", tVal );
LOG( tBuffer );
};
if( m_pSettingsProvider->isCompromised() ) {
LOG("Save Settings");
m_pSettingsProvider->validate();
};
*/
} else {
LOG_ERROR("Failed Read Config Settings!");
return false;
};
#ifdef DEBUG
LOG( "Settings Read Done" );
#endif
#ifdef DEBUG
LOG( "Kernel Trhead is about to be Created" );
#endif
if( init() == false ){
LOG_ERROR("Error in starting Kernel Thread!");
return false;
};
#ifdef DEBUG
LOG( "Kernel Thread Created" );
#endif
return true;
};
void ARGUS_Kernel::WaitFinish( bool Force ){
if( Force ){
#ifdef DEBUG
LOG( "Thread End Forced" );
#endif
} else {
// 3 seconds sleep to settle down processes
SLEEP(3000);
};
waitThreadEnd( Force );
#ifdef DEBUG
LOG( "Thread is Detached" );
#endif
};
/* Main Kernel Thread Procedure */
void ARGUS_Kernel::m_fThreadProc( void ){
char Buffer[CTEXT];
time_t tTimeTSeconds;
int lastTSS = 0;
int lastTMS = 0;
#ifdef DEBUG
pid_t pid = gettid();
char pidBuf[16];
sprintf(pidBuf,"pid:%d", pid);
LOG(pidBuf);
#endif
m_bThreadStatus = TH_WORKING;
while( m_bThreadStatus < TH_ENDED ){
m_tTimeTSeconds = time( NULL );
if( m_tTimeTSeconds != tTimeTSeconds ){ // Each Second Process
tTimeTSeconds = m_tTimeTSeconds;
};
SLEEP( SLEEP_KERNEL_INTERVAL );
};
};
bool ARGUS_Kernel::setStatus( int A ){
m_bThreadStatus = (thredStatus)A;
};
#undef LOG
#undef LOG_ERROR

58
lib/App/defender/RGoose_Kernel.h

@ -0,0 +1,58 @@
/*******************************************************************
*
* DESCRIPTION: ARGUS Kernel Header File
*
* AUTHOR: gagua
*
* HISTORY:
*
* DATE:5/29/2019
*
*******************************************************************/
#ifndef __ARGUS_KERNEL_HEADER__
#define __ARGUS_KERNEL_HEADER__
#include <linux/videodev2.h>
#include <linux/types.h>
#include "../../alg/generic/md5.h"
#include "../../components/base/basicThread.h"
#include "../../components/base/basicEngine.h"
#include "../../components/base/basicSettingsProvider.h"
#include "../../components/base/basicEventHeap.h"
#define SLEEP_KERNEL_INTERVAL 10
#define ONVIF_DISCOVERY_INTERVAL 300 // 5 min
#define ONVIF_DISCOVERY_RESULT_TIME 5
#define ARGUS_KERNEL_TAG_SITE_ID "SITE_ID"
#define ARGUS_KERNEL_TAG_SERVER_IDENTITY "IDENTITY"
#define ARGUS_NODE_SOCK_TYPE_SERIAL_PORT 1
#define ARGUS_NODE_SOCK_TYPE_VIDEO_GRABBER 2
#define ARGUS_NODE_SOCK_TYPE_NETWORK 3
class ARGUS_Kernel: public basicThread {
private:
uint32_t m_nSiteID;
char m_sIdentity[33];
time_t m_tTimeTSeconds;
basicLogCollection * m_pLog;
basicEventHeap * m_pEventHeap;
config_setting_t * m_pSettings;
uint8_t m_bExitCause;
protected:
void m_fThreadProc( void );
public:
// Constructor
explicit ARGUS_Kernel( config_setting_t *Settings = NULL );
// Destructor
virtual ~ARGUS_Kernel();
bool create( void );
void WaitFinish( bool Force = false );
bool setStatus( int );
uint8_t getExitCause( void ){ return m_bExitCause;};
};
#endif

4
lib/components/base/basicFunctionality.cpp

@ -13,7 +13,9 @@ bool fileExist(const char *strFilename) {
};
return false;
};
#ifndef __linux__
#else
#include <sys/types.h>
#include <unistd.h>
#include <sys/syscall.h>
@ -22,7 +24,7 @@ bool fileExist(const char *strFilename) {
pid_t gettid( void ){
return syscall(SYS_gettid);
};
#endif
CSTR trim( CSTR val ){
int i = 0;

5
lib/components/base/basicFunctionality.h

@ -14,8 +14,9 @@
#include <sys/statvfs.h>
#include "basicBuildTimeStamp.h"
#else
#include <winsock2.h>
#include <ws2tcpip.h>
//#include <winsock2.h>
//#include <ws2tcpip.h>
#define WIN32_LEAN_AND_MEAN
#include <atlbase.h>
#include <windows.h>
#include <VersionHelpers.h>

2
lib/components/base/basicMutex.h

@ -3,7 +3,7 @@
#ifndef __linux__
#ifndef WIN_PTHREAD
#define WIN_PTHREAD
// #define WIN_PTHREAD
#endif
#endif

1
lib/components/base/basicSettingsProvider.h

@ -3,6 +3,7 @@
#include <libconfig.h>
#include "basicLogCollection.h"
//#pragma message("Debug: Test point riched 1!")
#include "basicFunctionality.h"
#define DEFAULT_SETTINGS_FILE_NAME "default.conf"

8
lib/components/base/basicThread.h

@ -3,7 +3,7 @@
#ifndef __linux__
#ifndef WIN_PTHREAD
#define WIN_PTHREAD
//#define WIN_PTHREAD
#endif
#endif
@ -17,11 +17,11 @@
#include <Windows.h>
#endif
#else
#include <WinSock2.h>
#include <Windows.h>
//#include <WinSock2.h>
//#include <Windows.h>
#endif
//#pragma message("Debug: Test point riched 2!")
#include "basicLogCollection.h"
typedef enum thredStatus{

12
lib/data/json/json_reader.cpp

@ -5,10 +5,10 @@
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
#if !defined(JSON_IS_AMALGAMATION)
#include "json_tool.h"
#include <json/assertions.h>
#include <json/reader.h>
#include <json/value.h>
#include "json_tool.h"
#include <json/assertions.h>
#include <json/reader.h>
#include <json/value.h>
#endif // if !defined(JSON_IS_AMALGAMATION)
#include <cassert>
#include <cstring>
@ -51,9 +51,9 @@ static size_t const stackLimit_g =
namespace Json {
#if __cplusplus >= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520)
typedef std::unique_ptr<CharReader> CharReaderPtr;
typedef std::unique_ptr<CharReader> CharReaderPtr;
#else
typedef std::auto_ptr<CharReader> CharReaderPtr;
typedef std::auto_ptr<CharReader> CharReaderPtr;
#endif
// Implementation of class Features

8
lib/data/json/json_value.cpp

@ -4,9 +4,9 @@
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
#if !defined(JSON_IS_AMALGAMATION)
#include <json/assertions.h>
#include <json/value.h>
#include <json/writer.h>
#include <json/assertions.h>
#include <json/value.h>
#include <json/writer.h>
#endif // if !defined(JSON_IS_AMALGAMATION)
#include <cassert>
#include <cmath>
@ -14,7 +14,7 @@
#include <sstream>
#include <utility>
#ifdef JSON_USE_CPPTL
#include <cpptl/conststring.h>
#include <cpptl/conststring.h>
#endif
#include <algorithm> // min()
#include <cstddef> // size_t

4
lib/data/json/json_writer.cpp

@ -4,8 +4,8 @@
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
#if !defined(JSON_IS_AMALGAMATION)
#include "json_tool.h"
#include <json/writer.h>
#include "json_tool.h"
#include <json/writer.h>
#endif // if !defined(JSON_IS_AMALGAMATION)
#include <cassert>
#include <cstring>

220
lib/data/protocol/protocolDefender.cpp

@ -1,13 +1,17 @@
#include "protocolDefender.h"
#include "../../alg/generic/md5.h"
#include "../json/json_tool.h"
#include <json/value.h>
#include <json/writer.h>
#include <json/reader.h>
#define LOG( X ) m_pLog->Log( "Defender", this, X )
#define LOGS( X ) basicLogCollection::getInstance()->Log( "Defender", NULL, X )
#define LOG_ERROR( X ) m_pLog->Log( "Defender", this, _LOG_ERROR, X )
CSTR defenderStatusMode[] = {
"Operational",
"Degraded"
"OPERATIONAL",
"DEGRADED"
};
CSTR defenderFaultCode[] = {
"Critical",
@ -134,18 +138,21 @@ bool correctSHDTime( int diff ){
CSTR protocolDefender::buildURL( CSTR templ, int dim, CSTR devID ){
CSTR RetVal;
char tpl[256];
RetVal = (CSTR) malloc( 256 );
//sprintf( tpl, "http://%s:%d%s", m_pServerIP, m_nServerPort, templ );
//sprintf( RetVal, tpl, dim, devID );
sprintf( RetVal, DFSL_DEFENDER_DEFAULT_URL, m_pServerIP, m_nServerPort );
if (RetVal != NULL) {
if (m_bUseSSL) {
sprintf(RetVal, "https://%s:%d%s", m_pServerIP, m_nServerPort, m_pAccessURL);
} else {
sprintf(RetVal, "http://%s:%d%s", m_pServerIP, m_nServerPort, m_pAccessURL);
};
};
return RetVal;
};
CSTR protocolDefender::buildUniqID( void ){
CSTR RetVal;
RetVal = (CSTR) malloc(64);
sprintf( RetVal, "%s", MD5String( getSHDTimeStamp() ) );
if(RetVal) sprintf( RetVal, "%s", MD5String( getSHDTimeStamp() ) );
return RetVal;
};
@ -154,6 +161,8 @@ protocolDefender::protocolDefender( config_setting_t *Settings ): protocolHTTP(
m_pLog = basicLogCollection::getInstance();
m_bMitigationStatus = false;
m_pSettings = basicSettingsProvider::getInstance()->getSubNode(Settings, "DEFENDER_CONNECTION");
m_pScannerName = (CSTR)malloc(OS_SCANNER_NAME_SIZE);
@ -164,59 +173,89 @@ protocolDefender::protocolDefender( config_setting_t *Settings ): protocolHTTP(
if( m_pServerIP == NULL ) return;
memset( m_pServerIP, 0 , OS_CEP_ADDRESS_SIZE);
m_pAccessURL = (CSTR)malloc(CTEXT);
if (m_pAccessURL == NULL) return;
memset(m_pAccessURL, 0, CTEXT);
m_bCurrentStatus = false;
if( Settings != NULL ) {
double tVal = 0;
config_setting_t * pSetting;
if (!config_setting_lookup_float(Settings, "LOCATION_LON", &tVal )){
tVal = 35.0938962;
pSetting = config_setting_add(Settings, "LOCATION_LON", CONFIG_TYPE_FLOAT);
config_setting_set_float(pSetting, tVal);
basicSettingsProvider::getInstance()->compromise();
};
m_fLon = tVal;
if (!config_setting_lookup_float(Settings, "LOCATION_LAT", &tVal )){
tVal = 32.904208;
pSetting = config_setting_add(Settings, "LOCATION_LAT", CONFIG_TYPE_FLOAT);
config_setting_set_float(pSetting, tVal);
basicSettingsProvider::getInstance()->compromise();
};
m_fLat = tVal;
} else {
m_fLon = 35.0938962;// 35.095278
m_fLat = 32.904208; // 32.904167
}
if( m_pSettings != NULL ){
int intVar;
double floatVar;
config_setting_t *pSetting;
if (!config_setting_lookup_string(m_pSettings, "SCANNER_NAME", (const char**)&m_pScannerName)){
strncpy( m_pScannerName, "LRF_2D_001", 64 );
LOG( m_pScannerName );
pSetting = config_setting_add(m_pSettings, "SCANNER_NAME", CONFIG_TYPE_STRING);
config_setting_set_string(pSetting, m_pScannerName);
basicSettingsProvider::getInstance()->compromise();
};
if (!config_setting_lookup_int(m_pSettings, "SCANNER_DIMENTIONS", &m_nScannerDimentions )){
m_nScannerDimentions = 2;
pSetting = config_setting_add(m_pSettings, "SCANNER_DIMENTIONS", CONFIG_TYPE_INT);
config_setting_set_int(pSetting, m_nScannerDimentions);
basicSettingsProvider::getInstance()->compromise();
};
if (!config_setting_lookup_string(m_pSettings, "CEP_IP_ADDRESS", (const char**)&m_pServerIP)){
strncpy( m_pServerIP, "192.168.200.204", 16 );
LOG( m_pServerIP );
pSetting = config_setting_add(m_pSettings, "CEP_IP_ADDRESS", CONFIG_TYPE_STRING);
config_setting_set_string(pSetting, m_pServerIP);
basicSettingsProvider::getInstance()->compromise();
if (Settings != NULL) {
m_bEnabled = true;
} else {
if (!config_setting_lookup_bool(m_pSettings, "ENABLE", &intVar)) {
intVar = m_bEnabled = false;
LOG("PROTOCOL DISABLED[default]");
pSetting = config_setting_add(m_pSettings, "ENABLE", CONFIG_TYPE_BOOL);
config_setting_set_bool(pSetting, intVar);
basicSettingsProvider::getInstance()->compromise();
} else {
m_bEnabled = (bool)intVar;
};
};
if (!config_setting_lookup_int(m_pSettings, "CEP_IP_PORT", &m_nServerPort)){
m_nServerPort = 80;
pSetting = config_setting_add(m_pSettings, "CEP_IP_PORT", CONFIG_TYPE_INT);
config_setting_set_int(pSetting, m_nServerPort);
basicSettingsProvider::getInstance()->compromise();
if ( m_bEnabled ) {
if (!config_setting_lookup_float(m_pSettings, "LOCATION_LON", &floatVar)) {
m_fLon = floatVar = 35.0938962;
pSetting = config_setting_add(m_pSettings, "LOCATION_LON", CONFIG_TYPE_FLOAT);
config_setting_set_float(pSetting, floatVar);
basicSettingsProvider::getInstance()->compromise();
} else {
m_fLon = floatVar;
};
if (!config_setting_lookup_float(m_pSettings, "LOCATION_LAT", &floatVar)) {
m_fLat = floatVar = 32.904208;
pSetting = config_setting_add(m_pSettings, "LOCATION_LAT", CONFIG_TYPE_FLOAT);
config_setting_set_float(pSetting, floatVar);
basicSettingsProvider::getInstance()->compromise();
} else {
m_fLat = floatVar;
};
if (!config_setting_lookup_bool(m_pSettings, "USE_SSL", &intVar)) {
intVar = m_bUseSSL = false;
LOG("PROTOCOL DISABLED[default]");
pSetting = config_setting_add(m_pSettings, "USE_SSL", CONFIG_TYPE_BOOL);
config_setting_set_bool(pSetting, intVar);
basicSettingsProvider::getInstance()->compromise();
} else {
m_bUseSSL = (bool)intVar;
};
if (!config_setting_lookup_string(m_pSettings, "SCANNER_NAME", (const char**)&m_pScannerName)) {
strncpy(m_pScannerName, "LRF_2D_001", 64);
LOG(m_pScannerName);
pSetting = config_setting_add(m_pSettings, "SCANNER_NAME", CONFIG_TYPE_STRING);
config_setting_set_string(pSetting, m_pScannerName);
basicSettingsProvider::getInstance()->compromise();
};
if (!config_setting_lookup_int(m_pSettings, "SCANNER_DIMENTIONS", &m_nScannerDimentions)) {
m_nScannerDimentions = 2;
pSetting = config_setting_add(m_pSettings, "SCANNER_DIMENTIONS", CONFIG_TYPE_INT);
config_setting_set_int(pSetting, m_nScannerDimentions);
basicSettingsProvider::getInstance()->compromise();
};
if (!config_setting_lookup_string(m_pSettings, "CEP_IP_ADDRESS", (const char**)&m_pServerIP)) {
strncpy(m_pServerIP, "192.168.200.204", 16);
LOG(m_pServerIP);
pSetting = config_setting_add(m_pSettings, "CEP_IP_ADDRESS", CONFIG_TYPE_STRING);
config_setting_set_string(pSetting, m_pServerIP);
basicSettingsProvider::getInstance()->compromise();
};
LOG(m_pServerIP);
if (!config_setting_lookup_int(m_pSettings, "CEP_IP_PORT", &m_nServerPort)) {
m_nServerPort = 80;
pSetting = config_setting_add(m_pSettings, "CEP_IP_PORT", CONFIG_TYPE_INT);
config_setting_set_int(pSetting, m_nServerPort);
basicSettingsProvider::getInstance()->compromise();
};
if (!config_setting_lookup_string(m_pSettings, "ACCESS_URL", (const char**)&m_pAccessURL)) {
strncpy( m_pAccessURL, DFSL_DEFENDER_DEFAULT_URL, CTEXT );
pSetting = config_setting_add(m_pSettings, "ACCESS_URL", CONFIG_TYPE_STRING);
config_setting_set_string(pSetting, m_pAccessURL);
basicSettingsProvider::getInstance()->compromise();
};
LOG(m_pAccessURL);
};
basicSettingsProvider::getInstance()->validate();
};
@ -254,6 +293,7 @@ NVIDIA
protocolDefender::~protocolDefender(){
if(m_pScannerName!=NULL)free(m_pScannerName);
if(m_pServerIP!=NULL)free(m_pServerIP);
if( m_pAccessURL != NULL)free(m_pAccessURL);
};
void protocolDefender::setScannerName( CSTR Name ){
@ -267,7 +307,7 @@ void protocolDefender::setProtocolType( bool DeviceIs3D ){
};
};
CSTR protocolDefender::assembleStatusData( bool StatusOK ){
CSTR RetVal;
CSTR RetVal = NULL;
CSTR TIME_STAMP;
CSTR tSRC;
CSTR tTARGET;
@ -339,7 +379,7 @@ CSTR protocolDefender::assembleFaultData( uint8_t Code, CSTR Desc ){
if( tID != NULL ) {
sprintf( tID, "%s", MD5String( TIME_STAMP ) );
sprintf( tSRC, DFSL_SENSOR_SOURCE_DTO, DFSL_HARDWARE_TYPE, DFRL_PROVIDER_ID, m_pScannerName );
sprintf( tTARGET, DFSL_ERROR_DTO, Code, TIME_STAMP );
sprintf( tTARGET, DFSL_ERROR_DTO, TIME_STAMP, Code, Desc );
sprintf( RetVal,
PACKAGE_SE_STATUS_DATA_ELEMENT,
Desc,
@ -589,9 +629,13 @@ bool protocolDefender::Alarm2D( float Angle, float Range, float Width, int ID ){
int BufferSize = 0;
CSTR URL;
CSTR UID;
if(!m_bEnabled) return false;
UID = buildUniqID();
if( UID!= NULL ){
URL = buildURL( SERVICE_URL_TEMPLATE_EVENT, m_nScannerDimentions, m_pScannerName );
#ifdef DEBUG
LOG(URL);
#endif
RetVal = buildEvent2DPackage( ( unsigned char *) Buffer, BufferSize, UID, ID, Angle, Range, Width );
if( URL != NULL ){
RetVal = issuePost( URL, Buffer, BufferSize );
@ -608,6 +652,7 @@ bool protocolDefender::Alarm3D( float Angle1, float Angle2, float Range, int ID
int BufferSize = 0;
CSTR URL;
CSTR UID;
if(!m_bEnabled) return false;
UID = buildUniqID();
if( UID!= NULL ){
URL = buildURL( SERVICE_URL_TEMPLATE_EVENT, m_nScannerDimentions, m_pScannerName );
@ -629,6 +674,7 @@ bool protocolDefender::VisibilityChanged( bool Worsened ){
char Buffer[1024];
int BufferSize = 0;
CSTR URL;
if(!m_bEnabled) return false;
URL = buildURL( SERVICE_URL_TEMPLATE_STATUS, m_nScannerDimentions, m_pScannerName );
#ifdef DEBUG
LOG(URL);
@ -646,6 +692,7 @@ bool protocolDefender::StatusUpdate( void ){
char Buffer[1024];
int BufferSize = 0;
CSTR URL;
if(!m_bEnabled) return false;
URL = buildURL( SERVICE_URL_TEMPLATE_STATUS, m_nScannerDimentions, m_pScannerName );
#ifdef DEBUG
LOG(URL);
@ -663,6 +710,7 @@ bool protocolDefender::ErrorReporting( int lvl, CSTR Descr ){
char Buffer[1024];
int BufferSize = 0;
CSTR URL;
if(!m_bEnabled) return false;
URL = buildURL( SERVICE_URL_TEMPLATE_FAULT, m_nScannerDimentions, m_pScannerName );
#ifdef DEBUG
LOG(URL);
@ -693,47 +741,37 @@ bool protocolDefender::StartTimeSynch( void ){
bool protocolDefender::packetHandler( protocolPackage *Package ){
//LOG("PACKET HANDLER");
if(!m_bEnabled) return false;
if( Package==NULL )return false;
if( Package->m_nSize == 0 ) return false;
if( Package->m_pData == NULL ) return false;
if( Package->m_nCode != 200 ) return false;
try{
XMLNode node1 = XMLNode::parseString( (const char *)Package->m_pData, "root");
if( node1.isEmpty() ){
char BUBU[128];
sprintf( BUBU, "The package[%d:%d] XML data is not a valid XML data. Cann't find root element. Code[%d]", strlen((CSTR)Package->m_pData), Package->m_nSize, Package->m_nCode );
LOG_ERROR(BUBU);
} else {
LOG( node1.getName() );
if( strstr(node1.getName(),"ClockSync")!=NULL ){
#ifdef __linux__
unsigned long long t0, t1, t2, t3;
#else
unsigned __int64 t0, t1, t2, t3;
Json::Value root;
Json::Reader reader;
if( !reader.parse( (char *)Package->m_pData, root ) ){
LOG_ERROR( "Error parsing the string" );
return false;
};
if (root.size()) {
Json::Value tVal;
tVal = root["mitigation"]["parameters"]["cmd"];
if (tVal != NULL) {
#ifdef DEBUG
LOG("MITIGATION MESSAGE!");
#endif
XMLNode node3 = node1.getChildNode("t0", 0);
XMLNode node4 = node1.getChildNode("t1", 0);
XMLNode node5 = node1.getChildNode("t2", 0);
t3 = getSHTimeValue();
#ifdef __linux__
t0 = atoll(node3.getText(0));
t1 = atoll(node4.getText(0));
t2 = atoll(node5.getText(0));
#else
t0 = _atoi64(node3.getText(0));
t1 = _atoi64(node4.getText(0));
t2 = _atoi64(node5.getText(0));
if (stricmp(tVal.asString().c_str(), "ARM") == 0) {
#ifdef DEBUG
LOG("ARM!");
#endif
int offset = ((t1-t0)+(t2-t3))/2;
int latency = (t3-t0)-(t2-t1);
int jagajaga = offset+latency;
//if( 0 & correctSHTime( jagajaga ) ){
// LOG("Time is Synced");
// g_iTimeDiff = 0;
//} else {
// LOG_ERROR("Time Sync Unucessfull - Will use DIFF!");
g_iTimeDiff = jagajaga;
//};
m_bMitigationStatus = true;
};
if (stricmp(tVal.asString().c_str(), "DISARM") == 0) {
#ifdef DEBUG
LOG("DISARM!");
#endif
m_bMitigationStatus = false;
};
};
};
}catch( exception e ){

7
lib/data/protocol/protocolDefender.h

@ -46,7 +46,7 @@
#define DFSL_DATA_TYPE_STATUS "EventLidarStatus"
#define DFSL_DATA_TYPE_ERROR "EventLidarFault"
//defender-eps.eng.it
#define DFSL_DEFENDER_DEFAULT_URL "http://%s:%d/defender-eps/rest/simple-event/notify"
#define DFSL_DEFENDER_DEFAULT_URL "/defender-eps/rest/simple-event/notify"
typedef enum E_DEFENDER_CATEGORY{
DC_ERROR = 0,
@ -90,6 +90,10 @@ private:
int m_nScannerDimentions;
CSTR m_pScannerName;
CSTR m_pServerIP;
CSTR m_pAccessURL;
bool m_bEnabled;
bool m_bUseSSL;
bool m_bMitigationStatus;
float m_fLon;
float m_fLat;
int m_nServerPort;
@ -133,6 +137,7 @@ public:
void setProtocolType( bool DeviceIs3D );
void setScannerName( CSTR Name );
void setScannerPosition( float Lat, float Lon ){ m_fLon = Lon; m_fLat = Lat; };
bool getMitigationStatus(void) { return m_bMitigationStatus; };
};
#ifdef __linux__

75
lib/data/protocol/protocolSafeShore.cpp

@ -135,36 +135,49 @@ protocolSafeShore::protocolSafeShore( config_setting_t *Settings ): protocolHTTP
m_bCurrentStatus = false;
if( m_pSettings != NULL ){
config_setting_t *pSetting;
if (!config_setting_lookup_string(m_pSettings, "SCANNER_NAME", (const char**)&m_pScannerName)){
strncpy( m_pScannerName, "LRF_2D_001", 64 );
LOG( m_pScannerName );
pSetting = config_setting_add(m_pSettings, "SCANNER_NAME", CONFIG_TYPE_STRING);
config_setting_set_string(pSetting, m_pScannerName);
basicSettingsProvider::getInstance()->compromise();
};
if (!config_setting_lookup_int(m_pSettings, "SCANNER_DIMENTIONS", &m_nScannerDimentions )){
m_nScannerDimentions = 2;
pSetting = config_setting_add(m_pSettings, "SCANNER_DIMENTIONS", CONFIG_TYPE_INT);
config_setting_set_int(pSetting, m_nScannerDimentions);
basicSettingsProvider::getInstance()->compromise();
};
if (!config_setting_lookup_string(m_pSettings, "LCU_IP_ADDRESS", (const char**)&m_pServerIP)){
strncpy( m_pServerIP, "192.168.200.204", 16 );
LOG( m_pServerIP );
pSetting = config_setting_add(m_pSettings, "LCU_IP_ADDRESS", CONFIG_TYPE_STRING);
config_setting_set_string(pSetting, m_pServerIP);
basicSettingsProvider::getInstance()->compromise();
int intVar;
config_setting_t* pSetting;
if (Settings != NULL) {
m_bEnabled = true;
} else {
if (!config_setting_lookup_bool(m_pSettings, "ENABLE", &intVar)) {
intVar = m_bEnabled = false;
LOG("PROTOCOL DISABLED[default]");
pSetting = config_setting_add(m_pSettings, "ENABLE", CONFIG_TYPE_BOOL);
config_setting_set_bool(pSetting, intVar);
basicSettingsProvider::getInstance()->compromise();
} else {
m_bEnabled = (bool)intVar;
};
};
if (!config_setting_lookup_int(m_pSettings, "LCU_IP_PORT", &m_nServerPort)){
m_nServerPort = 80;
pSetting = config_setting_add(m_pSettings, "LCU_IP_PORT", CONFIG_TYPE_INT);
config_setting_set_int(pSetting, m_nServerPort);
basicSettingsProvider::getInstance()->compromise();
if (m_bEnabled) {
if (!config_setting_lookup_string(m_pSettings, "SCANNER_NAME", (const char**)&m_pScannerName)) {
strncpy(m_pScannerName, "LRF_2D_001", 64);
LOG(m_pScannerName);
pSetting = config_setting_add(m_pSettings, "SCANNER_NAME", CONFIG_TYPE_STRING);
config_setting_set_string(pSetting, m_pScannerName);
basicSettingsProvider::getInstance()->compromise();
};
if (!config_setting_lookup_int(m_pSettings, "SCANNER_DIMENTIONS", &m_nScannerDimentions)) {
m_nScannerDimentions = 2;
pSetting = config_setting_add(m_pSettings, "SCANNER_DIMENTIONS", CONFIG_TYPE_INT);
config_setting_set_int(pSetting, m_nScannerDimentions);
basicSettingsProvider::getInstance()->compromise();
};
if (!config_setting_lookup_string(m_pSettings, "LCU_IP_ADDRESS", (const char**)&m_pServerIP)) {
strncpy(m_pServerIP, "192.168.200.204", 16);
LOG(m_pServerIP);
pSetting = config_setting_add(m_pSettings, "LCU_IP_ADDRESS", CONFIG_TYPE_STRING);
config_setting_set_string(pSetting, m_pServerIP);
basicSettingsProvider::getInstance()->compromise();
};
if (!config_setting_lookup_int(m_pSettings, "LCU_IP_PORT", &m_nServerPort)) {
m_nServerPort = 80;
pSetting = config_setting_add(m_pSettings, "LCU_IP_PORT", CONFIG_TYPE_INT);
config_setting_set_int(pSetting, m_nServerPort);
basicSettingsProvider::getInstance()->compromise();
};
};
basicSettingsProvider::getInstance()->validate();
};
@ -338,6 +351,7 @@ bool protocolSafeShore::Alarm2D( int Angle, int Range, int Width, int ID ){
int BufferSize = 0;
CSTR URL;
CSTR UID;
if(!m_bEnabled) return false;
UID = buildUniqID();
if( UID!= NULL ){
URL = buildURL( SERVICE_URL_TEMPLATE_EVENT, m_nScannerDimentions, m_pScannerName );
@ -357,6 +371,7 @@ bool protocolSafeShore::Alarm3D( int Angle1, int Angle2, int Range, int ID ){
int BufferSize = 0;
CSTR URL;
CSTR UID;
if(!m_bEnabled) return false;
UID = buildUniqID();
if( UID!= NULL ){
URL = buildURL( SERVICE_URL_TEMPLATE_EVENT, m_nScannerDimentions, m_pScannerName );
@ -389,6 +404,7 @@ bool protocolSafeShore::StatusUpdate( void ){
char Buffer[1024];
int BufferSize = 0;
CSTR URL;
if(!m_bEnabled) return false;
URL = buildURL( SERVICE_URL_TEMPLATE_STATUS, m_nScannerDimentions, m_pScannerName );
RetVal = buildStatusPackage( ( unsigned char *) Buffer, BufferSize, m_bCurrentStatus );
if( URL != NULL ){
@ -403,6 +419,7 @@ bool protocolSafeShore::ErrorReporting( int lvl, CSTR Descr ){
char Buffer[1024];
int BufferSize = 0;
CSTR URL;
if(!m_bEnabled) return false;
URL = buildURL( SERVICE_URL_TEMPLATE_FAULT, m_nScannerDimentions, m_pScannerName );
RetVal = buildFaultPackage( ( unsigned char *) Buffer, BufferSize, lvl, Descr );
if( URL != NULL ){
@ -417,6 +434,7 @@ bool protocolSafeShore::StartTimeSynch( void ){
char Buffer[1024];
int BufferSize = 0;
CSTR URL = NULL;
if(!m_bEnabled) return false;
URL = buildURL( SERVICE_URL_TEMPLATE_CLOCKSYNC, m_nScannerDimentions, m_pScannerName );
RetVal = buildClockSyncPackage(( unsigned char *) Buffer, BufferSize );
if( URL != NULL ){
@ -429,6 +447,7 @@ bool protocolSafeShore::StartTimeSynch( void ){
bool protocolSafeShore::packetHandler( protocolPackage *Package ){
//LOG("PACKET HANDLER");
if(!m_bEnabled) return false;
if( Package==NULL )return false;
if( Package->m_nSize == 0 ) return false;
if( Package->m_pData == NULL ) return false;

31
lib/data/protocol/protocolSafeShore.h

@ -75,21 +75,22 @@
*/
class protocolSafeShore : public protocolHTTP {
private:
basicLogCollection *m_pLog;
config_setting_t *m_pSettings;
int m_nScannerDimentions;
CSTR m_pScannerName;
CSTR m_pServerIP;
int m_nServerPort;
bool m_bCurrentStatus;
CSTR buildURL( CSTR templ, int dim, CSTR devID );
CSTR buildUniqID( void );
bool buildClockSyncPackage( unsigned char *Buffer, int &BufferSize );
bool buildCallBackPackage( unsigned char *Buffer, int &BufferSize, CSTR CallBackPath );
bool buildStatusPackage( unsigned char *Buffer, int &BufferSize, bool Status );
bool buildFaultPackage( unsigned char *Buffer, int &BufferSize, unsigned char Type, CSTR Description );
bool buildEvent2DPackage( unsigned char *Buffer, int &BufferSize, CSTR msgUID, int targetID, int Angle, int Range, int Width );
bool buildEvent3DPackage( unsigned char *Buffer, int &BufferSize, CSTR msgUID, int targetID, int Angle1, int Angle2, int Range );
basicLogCollection * m_pLog;
config_setting_t * m_pSettings;
bool m_bEnabled;
int m_nScannerDimentions;
CSTR m_pScannerName;
CSTR m_pServerIP;
int m_nServerPort;
bool m_bCurrentStatus;
CSTR buildURL( CSTR templ, int dim, CSTR devID );
CSTR buildUniqID( void );
bool buildClockSyncPackage( unsigned char *Buffer, int &BufferSize );
bool buildCallBackPackage( unsigned char *Buffer, int &BufferSize, CSTR CallBackPath );
bool buildStatusPackage( unsigned char *Buffer, int &BufferSize, bool Status );
bool buildFaultPackage( unsigned char *Buffer, int &BufferSize, unsigned char Type, CSTR Description );
bool buildEvent2DPackage( unsigned char *Buffer, int &BufferSize, CSTR msgUID, int targetID, int Angle, int Range, int Width );
bool buildEvent3DPackage( unsigned char *Buffer, int &BufferSize, CSTR msgUID, int targetID, int Angle1, int Angle2, int Range );
protected:
virtual bool packetHandler( protocolPackage *Package );

97
lib/data/protocol/protocolZLMEDIA.cpp

@ -0,0 +1,97 @@
#include "protocolZLMEDIA.h"
#include "../json/json_tool.h"
#include <json/value.h>
#include <json/writer.h>
#include <json/reader.h>
#define LOG( X ) basicLogCollection::getInstance()->Log( "ZLMEDIA", this, X )
#define LOG_ERROR( X ) basicLogCollection::getInstance()->Log( "ZLMEDIA", this, _LOG_ERROR, X )
protocolZLMEDIA::protocolZLMEDIA( config_setting_t *Settings ): protocolHTTP( basicSettingsProvider::getInstance()->getSubNode(Settings, "ZLMEDIA_CONNECTION") ){
m_pLog = basicLogCollection::getInstance();
m_pSettings = basicSettingsProvider::getInstance()->getSubNode(Settings, "ZLMEDIA_CONNECTION");
/*
if( m_pSettings != NULL ){
config_setting_t *pSetting;
if (!config_setting_lookup_string(m_pSettings, "SCANNER_NAME", (const char**)&m_pScannerName)){
strncpy( m_pScannerName, "LRF_2D_001", 64 );
LOG( m_pScannerName );
pSetting = config_setting_add(m_pSettings, "SCANNER_NAME", CONFIG_TYPE_STRING);
config_setting_set_string(pSetting, m_pScannerName);
basicSettingsProvider::getInstance()->compromise();
};
if (!config_setting_lookup_int(m_pSettings, "SCANNER_DIMENTIONS", &m_nScannerDimentions )){
m_nScannerDimentions = 2;
pSetting = config_setting_add(m_pSettings, "SCANNER_DIMENTIONS", CONFIG_TYPE_INT);
config_setting_set_int(pSetting, m_nScannerDimentions);
basicSettingsProvider::getInstance()->compromise();
};
if (!config_setting_lookup_string(m_pSettings, "LCU_IP_ADDRESS", (const char**)&m_pServerIP)){
strncpy( m_pServerIP, "192.168.200.204", 16 );
LOG( m_pServerIP );
pSetting = config_setting_add(m_pSettings, "LCU_IP_ADDRESS", CONFIG_TYPE_STRING);
config_setting_set_string(pSetting, m_pServerIP);
basicSettingsProvider::getInstance()->compromise();
};
if (!config_setting_lookup_int(m_pSettings, "LCU_IP_PORT", &m_nServerPort)){
m_nServerPort = 80;
pSetting = config_setting_add(m_pSettings, "LCU_IP_PORT", CONFIG_TYPE_INT);
config_setting_set_int(pSetting, m_nServerPort);
basicSettingsProvider::getInstance()->compromise();
};
basicSettingsProvider::getInstance()->validate();
}; //*/
};
protocolZLMEDIA::~protocolZLMEDIA(){
};
bool protocolZLMEDIA::packetHandler( protocolPackage *Package ){
if( Package == NULL )return false;
if( Package->m_nSize == 0 ) return false;
if( Package->m_pData == NULL ) return false;
if( Package->m_nCode != 200 ) return false;
try{
Json::Value root;
Json::Reader reader;
if( !reader.parse( (char *)Package->m_pData, root ) ){
LOG_ERROR( "Error parsing the string" );
return false;
};
for( Json::Value::const_iterator outer = root.begin() ; outer != root.end() ; outer++ ){
for( Json::Value::const_iterator inner = (*outer).begin() ; inner!= (*outer).end() ; inner++ ){
char tBuffer[256];
sprintf( tBuffer,"Data: %s: %s ", inner.key().asString().c_str(), (*inner).asString().c_str() );
LOG( tBuffer );
};
};
} catch (exception e ){
return false;
};
return true;
};
// Issue New Online Check but return current value
bool protocolZLMEDIA::isOnline(){
if( !m_bSessionOnGo ) {
char URL[256];
uint8_t timeout = 100; // 1 sec.
m_bSessionOnGo = true;
if( m_bUseSSL ) {
sprintf(URL,"https://%s:%d/%s?secret=%s", m_pIP, m_nPort, m_pAccessPoint, m_pSecret );
} else {
};
issuePost(CSTR URL, char *Buffer, int &BufferSize )
while( m_bSessionOnGo && timeout-- ) SLEEP(10);
};
return m_bServerIsPresent;
};
#undef LOG
#undef LOG_ERROR

42
lib/data/protocol/protocolZLMEDIA.h

@ -0,0 +1,42 @@
#ifndef __PROTOCOL_ZL_MEDIASERVER_REST_HEADER__
#define __PROTOCOL_ZL_MEDIASERVER_REST_HEADER__
#ifdef __linux__
#include <features.h>
#endif
#include "protocolHTTP.h"
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/timeb.h>
#include <string>
#include "../../components/base/basicFunctionality.h"
#include "../../components/base/basicLogCollection.h"
#include "../../components/base/basicSettingsProvider.h"
class protocolZLMEDIA : public protocolHTTP {
private:
basicLogCollection * m_pLog;
config_setting_t * m_pSettings;
char m_pSecret[256];
char m_pAccessPoint[256];
char m_pIP[16];
bool m_bSessionOnGo;
bool m_bServerIsPresent;
bool m_bUseSSL;
uint16_t m_nPort;
protected:
virtual bool packetHandler( protocolPackage *Package );
public:
explicit protocolZLMEDIA( config_setting_t *Settings = NULL );
~protocolZLMEDIA();
bool isOnline();
};
#endif

174
lib/data/servletWS/servletChannelWS.cpp

@ -0,0 +1,174 @@
#include "servletChannelWS.h"
#include "../../components/base/basicFunctionality.h"
#define LOG( X ) m_pLog->Log( "SWCHAN", this, X )
#define LOG_ERROR( X ) m_pLog->Log( "SWCHAN", this, _LOG_ERROR, X )
static bool _FFD_REGISTER_ALL_FLAG;
bool servletChannelWS::initLibAV(void){
if (!_FFD_REGISTER_ALL_FLAG){
char Buffer[256];
_FFD_REGISTER_ALL_FLAG = true;
LOG("Init LIBAV");
sprintf(Buffer, "LibAV Codec: %d.%d.%d", LIBAVCODEC_VERSION_MAJOR, LIBAVCODEC_VERSION_MINOR, LIBAVCODEC_VERSION_MICRO);
LOG(Buffer);
sprintf(Buffer, "LibAV Device: %d.%d.%d", LIBAVDEVICE_VERSION_MAJOR, LIBAVDEVICE_VERSION_MINOR, LIBAVDEVICE_VERSION_MICRO);
LOG(Buffer);
sprintf(Buffer, "LibAV Format: %d.%d.%d", LIBAVFORMAT_VERSION_MAJOR, LIBAVFORMAT_VERSION_MINOR, LIBAVFORMAT_VERSION_MICRO);
LOG(Buffer);
sprintf(Buffer, "LibAV SWScale: %d.%d.%d", LIBSWSCALE_VERSION_MAJOR, LIBSWSCALE_VERSION_MINOR, LIBSWSCALE_VERSION_MICRO);
LOG(Buffer);
av_register_all();
avcodec_register_all();
avdevice_register_all();
avformat_network_init();
};
return _FFD_REGISTER_ALL_FLAG;
};
servletChannelWS::servletChannelWS():basicThread(){
m_pLog = basicLogCollection::getInstance();
pthread_mutex_init( &new_pkt_mutex, NULL);
pthread_cond_init( &new_pkt_cond, NULL);
pthread_mutex_init( &fill_buff_mutex, NULL);
pthread_cond_init( &fill_buff_cond, NULL);
};
servletChannelWS::~servletChannelWS(){
basicThread::waitThreadEnd(true);
};
//rtsp://gagua:4GetMyID@192.168.0.109:554/Streaming/Channels/101?transportmode=unicast&profile=Profile_1
char white_list_proto[] = "file,udp,tcp,rtp,rtsp";
bool servletChannelWS::create( CSTR MediaURI ){
LOG( MediaURI );
if(!initLibAV()) {
LOG_ERROR("LibAV INIT Error!");
return false;
}
m_pFormatCtx = avformat_alloc_context();
if( m_pFormatCtx == NULL ) return false;
LOG("Format Context Allocated");
m_pFormatCtx->protocol_whitelist = white_list_proto;
LOG("White List is Set");
int ret = avformat_open_input( &m_pFormatCtx, MediaURI , NULL, NULL);
if ( ret != 0){
//char tBuf[CTEXT];
//av_strerror( ret, tBuf, CTEXT );
LOG_ERROR( "Couldn't open file" );
return false;
};
LOG("Media Opened");
// Retrieve stream information
if( avformat_find_stream_info(m_pFormatCtx,NULL) < 0 ){
LOG_ERROR( "Couldn't find stream information" );
return false;
};
LOG("Stream Info Found");
// Find the first video stream
m_iVideoStreamID = -1;
for( unsigned int i = 0; i < m_pFormatCtx->nb_streams; i++ ){
AVCodecContext *cc = m_pFormatCtx->streams[i]->codec;
if( cc->codec_type==AVMEDIA_TYPE_VIDEO ){
// don't care FF_DEBUG_VIS_MV_B_BACK
cc->debug_mv = 0;//FF_DEBUG_VIS_MV_P_FOR | FF_DEBUG_VIS_MV_B_FOR;
m_iVideoStreamID = i;
break;
};
};
if (m_iVideoStreamID == -1){
LOG_ERROR("Didn't find a video stream");
return false;
}
LOG("Video Stream Found");
// Get a pointer to the codec context for the video stream
m_pCodecCtx = m_pFormatCtx->streams[m_iVideoStreamID]->codec;
m_pCodecCtx->refcounted_frames = 1;
m_pCodecCtx->thread_count = 0;//NB_DEC_THREADS;
//pCodecCtx->thread_type=2;
// Find the decoder for the video stream
m_pCodec = avcodec_find_decoder( m_pCodecCtx->codec_id );
if (m_pCodec == NULL){
LOG_ERROR("Codec not found");
return false;
};
LOG("Codec Found");
// Inform the codec that we can handle truncated bitstreams -- i.e.,
// bitstreams where frame boundaries can fall in the middle of packets
if (m_pCodec->capabilities & CODEC_CAP_TRUNCATED) m_pCodecCtx->flags |= CODEC_FLAG_TRUNCATED;
// Open codec
if (avcodec_open2(m_pCodecCtx, m_pCodec, NULL)<0)
return -1; // Could not open codec
LOG("Codec Opened");
m_fFrameRate = 1*m_pCodecCtx->time_base.den/(m_pCodecCtx->time_base.num*m_pCodecCtx->ticks_per_frame);
m_nWidth = m_pCodecCtx->width;
m_nHeight = m_pCodecCtx->height;
LOG("Starting Decoder Thread");
return basicThread::init();
};
void servletChannelWS::m_fThreadProc( void ){
AVPacket *dummy_packet;
pid_t pid = gettid();
char pidBuf[16];
sprintf(pidBuf,"pid:%d", pid);
LOG("Decoder Thread Started");
LOG(pidBuf);
m_bThreadStatus = TH_WORKING;
while( m_bThreadStatus < TH_ENDED ){
AVPacket *packet=(AVPacket*)av_malloc(sizeof(AVPacket));
if( packet != NULL ) {
packet->stream_index = -1;
do{
av_init_packet(packet);
//av_free_packet(&packet);
packet->data = NULL;
int err = av_read_frame( m_pFormatCtx, packet );
if( err < 0 ){
//pthread_exit(NULL);
//return 0 ;
if( b_streaming == false ){
av_seek_frame( m_pFormatCtx, -1, 0, AVSEEK_FLAG_BACKWARD );
packet->stream_index = -1;
};
//fprintf(stderr, "#################### =======> av_seek_frame");
continue;
};
} while( packet->stream_index != m_iVideoStreamID );
pthread_mutex_lock(&fill_buff_mutex);
//if(Pkt_buf.size()<PKT_BUF_LEN)
b_fill_buf = m_qMediaBus.size() < PKT_BUF_LEN;
if( b_streaming == false ){
while( b_fill_buf == 0 ) pthread_cond_wait(&fill_buff_cond, &fill_buff_mutex);
} else {
if( b_fill_buf == 0 ){// if streaming mode is true, the receiving thread is never blocked and some packets can be dropped
dummy_packet = m_qMediaBus.front();
m_qMediaBus.pop();
av_packet_unref( dummy_packet );
};
};
//AVPacket *packet = av_malloc(sizeof(AVPacket));
//av_frame_ref (pFrame_ref,decode_th_data->pFrame);
m_qMediaBus.push( packet );
pthread_mutex_unlock(&fill_buff_mutex);
pthread_mutex_lock(&new_pkt_mutex);
b_new_pkt=true;
pthread_cond_signal( &new_pkt_cond );
pthread_mutex_unlock(&new_pkt_mutex);
};
};
};
#undef LOG
#undef LOG_ERROR

67
lib/data/servletWS/servletChannelWS.h

@ -0,0 +1,67 @@
#ifndef __SERVLET_CHANNEL_WEB_SOCKET_HEADER__
#define __SERVLET_CHANNEL_WEB_SOCKET_HEADER__
#include "../../components/base/basicThread.h"
extern "C" {
#include <libavdevice/avdevice.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avio.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libavutil/file.h>
#include <libavutil/mathematics.h>
#include <libavutil/error.h>
#include <libavutil/imgutils.h>
};
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1)
#define av_frame_alloc avcodec_alloc_frame
#define av_frame_free avcodec_free_frame
#define avcodec_free_context av_free
#define AV_PIX_FMT_BGR24 PIX_FMT_BGR24
#endif
#define CLEAR(x) memset(&(x), 0, sizeof(x))
#include <vector>
#include <queue>
typedef std::queue<AVPacket *> pipeAVPacket;
#define PKT_BUF_LEN 1
class servletChannelWS:basicThread{
private:
basicLogCollection * m_pLog;
bool b_is_waiting_;
bool b_new_pkt;
bool b_fill_buf;
bool b_streaming;
pthread_mutex_t new_pkt_mutex;
pthread_cond_t new_pkt_cond;
pthread_mutex_t fill_buff_mutex;
pthread_cond_t fill_buff_cond;
pipeAVPacket m_qMediaBus;
/* Encoder fields */
AVFormatContext * m_pFormatCtx;
AVCodecContext * m_pCodecCtx;
AVCodec * m_pCodec;
uint32_t m_fFrameRate;
uint32_t m_nWidth;
uint32_t m_nHeight;
int m_iVideoStreamID;
bool initLibAV(void);
protected:
virtual void m_fThreadProc( void );
public:
servletChannelWS();
virtual ~servletChannelWS();
bool create( CSTR MediaURI );
pipeAVPacket * getPipe( void ){ return &m_qMediaBus; };
};
typedef std::vector<servletChannelWS *> vectorChannelsWS;
#endif

lib/data/modWebRTC/servletClientHandlerWebRTC.cpp → lib/data/servletWS/servletClientHandlerWS.cpp

lib/data/modWebRTC/servletClientHandlerWebRTC.h → lib/data/servletWS/servletClientHandlerWS.h

158
lib/data/servletWS/servletWS.cpp

@ -0,0 +1,158 @@
#include "servletWS.h"
#include "../../components/base/basicFunctionality.h"
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <getopt.h>
#include <ifaddrs.h>
#include <netdb.h>
#include <paths.h>
#include <poll.h>
#include <stdio.h>
#include <signal.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
#include <sys/param.h> /* MIN() */
#include <sys/socket.h>
#define LOG( X ) m_pLog->Log( "SWRTC", this, X )
#define LOG_ERROR( X ) m_pLog->Log( "SWRTC", this, _LOG_ERROR, X )
#define ENABLE_SOCKOPT(sd, level, opt) \
do { \
int val = 1; \
if (setsockopt(sd, level, opt, &val, sizeof(val)) < 0) \
warn("Failed enabling %s for web service", #opt); \
} while (0);
servletWS::servletWS( uint16_t ListenPort ):basicDualThread(){
m_pLog = basicLogCollection::getInstance();
m_nListenPort = ListenPort;
m_nSocketDescriptor = -1;
LOG("Construct");
};
servletWS::~servletWS(){
LOG("Destruct");
};
bool servletWS::create( uint16_t ListenPort ){
LOG("Create");
if( m_nListenPort == 0 && ListenPort == 0 ) return false;
m_nListenPort = ListenPort;
struct sockaddr sa;
struct sockaddr_in *sin;
memset(&sa, 0, sizeof(struct sockaddr));
sa.sa_family = AF_INET;
sin = (struct sockaddr_in *)&sa;
sin->sin_addr.s_addr = htonl(INADDR_ANY);
sin->sin_port = htons( m_nListenPort );
m_nSocketDescriptor = socket( sa.sa_family, SOCK_STREAM | SOCK_NONBLOCK, 0);
if( m_nSocketDescriptor == -1 ){
LOG_ERROR("Failed creating web socket");
return false;
};
ENABLE_SOCKOPT( m_nSocketDescriptor, SOL_SOCKET, SO_REUSEADDR);
#ifdef SO_REUSEPORT
ENABLE_SOCKOPT( m_nSocketDescriptor, SOL_SOCKET, SO_REUSEPORT);
#endif
if( bind( m_nSocketDescriptor, &sa, sizeof(sa)) < 0 ){
LOG_ERROR("Failed binding Socket");
close( m_nSocketDescriptor );
return false;
} else {
LOG("Bind Socessfull");
}
if( listen( m_nSocketDescriptor, 10) != 0 ){
LOG_ERROR("Failed setting web listen backlog");
close( m_nSocketDescriptor );
return false;
} else {
LOG("Listen OK");
};
return basicDualThread::init();
};
// Listener
void servletWS::m_fThreadAProc( void ){
struct pollfd pfd[1];
pid_t pid = gettid();
char pidBuf[16];
sprintf(pidBuf,"pid:%d", pid);
LOG(pidBuf);
pfd->fd = m_nSocketDescriptor;
pfd->events = POLLIN | POLLHUP;
m_bThreadAStatus = TH_WORKING;
while( m_bThreadAStatus < TH_ENDED ) {
int RetVal = 0;//, timeout;
RetVal = poll( pfd, 1, 1000 );
if( RetVal < 0 ){
if (EINTR == errno) continue;
LOG_ERROR("Unrecoverable error");
m_bThreadAStatus = TH_ENDED;
continue;
};
// Handle Connections
if( RetVal != 0 ){
if ( pfd[0].revents & POLLIN ) {
servletClientHandlerWS * pClient;
LOG("Handle New Client");
pClient = new servletClientHandlerWS( this, pfd[0].fd );
if( pClient != NULL ) {
m_vWebClients.push_back( pClient );
};
};
};
// Handle Dead Clients
if( m_vWebClients.size() ) {
for( vectorClientHandlerWS::iterator index = m_vWebClients.begin(); index < m_vWebClients.end(); index++ ) {
servletClientHandlerWS * pClient;
pClient = (*index);
if( !( pClient->getStatus()< TH_ENDED ) ) {
// Remove Dead Client
m_vWebClients.erase(index);
LOG("Client Record Erased!");
delete( pClient );
};
};
};
SLEEP(50);
};
};
// Worker
void servletWS::m_fThreadBProc( void ){
pid_t pid = gettid();
char pidBuf[16];
sprintf(pidBuf,"pid:%d", pid);
LOG(pidBuf);
m_bThreadBStatus = TH_WORKING;
while( m_bThreadBStatus < TH_ENDED ) {
SLEEP(50);
};
};
bool servletWS::attachChannel( CSTR MediaURI, bool LocalDevice ){
if( MediaURI == NULL ) return false;
servletChannelWS * tPtr;
tPtr = new servletChannelWS();
if( tPtr == NULL ) return false;
if( tPtr->create(MediaURI) ){
m_vChannels.push_back( tPtr );
} else {
delete( tPtr );
};
return true;
};
#undef LOG
#undef LOG_ERROR

27
lib/data/servletWS/servletWS.h

@ -0,0 +1,27 @@
#ifndef __SERVLET_WEB_SOCKET_HEADER__
#define __SERVLET_WEB_SOCKET_HEADER__
#include "../../components/base/basicDualThread.h"
#include "servletChannelWS.h"
#include "servletClientHandlerWS.h"
class servletWS: public basicDualThread{
private:
basicLogCollection * m_pLog;
int m_nSocketDescriptor;
uint16_t m_nListenPort;
vectorChannelsWS m_vChannels;
vectorClientHandlerWS m_vWebClients;
public:
explicit servletWS( uint16_t ListenPort = 8081 );
virtual ~servletWS();
bool create( uint16_t ListenPort = 8081 );
virtual void m_fThreadAProc( void ); // Listener
virtual void m_fThreadBProc( void ); // Worker
bool attachChannel( CSTR MediaURI, bool LocalDevice );
};
#endif

lib/data/modWebRTC/servletChannelWebRTC.cpp → lib/data/servletWebRTC/servletChannelWebRTC.cpp

lib/data/modWebRTC/servletChannelWebRTC.h → lib/data/servletWebRTC/servletChannelWebRTC.h

451
lib/data/servletWebRTC/servletClientHandlerWebRTC.bakup

@ -0,0 +1,451 @@
#include "servletClientHandlerWebRTC.h"
#include "servletWebRTC.h"
#include "../../components/base/basicFunctionality.h"
#include "../../alg/generic/base64.h"
#include <openssl/sha.h>
#include <websocketpp/http/request.hpp>
#include <websocketpp/http/response.hpp>
#include <websocketpp/config/core.hpp>
#include <websocketpp/processors/hybi13.hpp>
#define LOG( X ) m_pLog->Log( "WRTC", this, X )
#define LOG_ERROR( X ) m_pLog->Log( "WRTC", this, _LOG_ERROR, X )
typedef websocketpp::config::core ws_config;
typedef websocketpp::processor::hybi13<ws_config> ws_parser;
typedef ws_config::request_type ws_request;
typedef ws_config::response_type ws_response;
typedef ws_config::con_msg_manager_type ws_msg_manager;
typedef ws_config::rng_type ws_rng;
enum {
WEBRTC_REQ_SIGNIN = 0,
WEBRTC_REQ_WAIT = 1,
WEBRTC_REQ_SIGNOUT = 2,
WEBRTC_REQ_MESSAGE = 3
};
static const char* kRequestPaths[] = {
"/sign_in",
"/wait",
"/sign_out",
"/message"
};
servletClientHandlerWebRTC::servletClientHandlerWebRTC( servletWebRTC *pPtr, int Socket ):basicThread(){
m_pLog = basicLogCollection::getInstance();
m_pParent = NULL;
if( pPtr == NULL ) return;
m_iSocketFID = accept( Socket, NULL, NULL);
if ( m_iSocketFID < 0) {
char tBuf[CTEXT];
sprintf(tBuf, "accept() error: %s", strerror(errno));
LOG_ERROR(tBuf);
return;
};
m_pDeflatener = NULL;
m_bDeflatePerMessage = false;
m_pParent = pPtr;
basicThread::init();
};
servletClientHandlerWebRTC::~servletClientHandlerWebRTC(){
basicThread::waitThreadEnd( true );
if(m_pDeflatener) {
delete(m_pDeflatener);
};
LOG("Client Handler Deleted!");
};
void servletClientHandlerWebRTC::m_fThreadProc( void ){
char *ws_guid = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
char *head = "HTTP/1.1 200 OK\r\n"
"Content-Type: text/xml\r\n"
"Connection: close\r\n"
"\r\n";
char *ws_head = "HTTP/1.1 101 Switching Protocols\r\n"
//Date: Wed, 25 Oct 2017 10:07:34 GMT
"Connection: Upgrade\r\n"
"Upgrade: websocket\r\n"
"Sec-WebSocket-Accept: %s\r\n"
"\r\n";
char mesg[1024];
size_t RecvSize;
char cWSKey[256];
char cWSRep[256];
char hostname[64];
struct pollfd pfd[1];
bool bWebSocketMode = false;
bool bUpgradeMode = false;
int nWebSocketVersion = 0;
pid_t pid = gettid();
char pidBuf[16];
sprintf(pidBuf,"pid:%d", pid);
LOG(pidBuf);
pfd->fd = m_iSocketFID;
pfd->events = POLLIN;
ws_parser * m_pParser = NULL;
ws_msg_manager M;
std::shared_ptr<ws_msg_manager> tPointer( &M );
ws_rng A;
m_pParser = new ws_parser( false, true, tPointer, A ); //No Secure, Server
if(m_pParser == NULL ) {
m_bThreadStatus = TH_ENDED;
return;
};
m_bThreadStatus = TH_WORKING;
char cGetURI[255];
while( m_bThreadStatus < TH_ENDED ) {
int RetVal, rcvd;
char * reqline[256];
RetVal = poll( pfd, 1, 1000 );
if( RetVal <= 0 ){
if (EINTR == errno) continue;
LOG_ERROR("Unrecoverable error");
m_bThreadStatus = TH_ENDED;
continue;
};
memset(mesg, 0, sizeof(mesg));
rcvd = recv( m_iSocketFID, mesg, sizeof(mesg), 0);
if ( rcvd <= 0 ) {
sprintf( mesg, "web recv() error: %s", strerror(errno));
LOG_ERROR(mesg);
m_bThreadStatus = TH_ENDED;
continue;
};
websocketpp::lib::error_code ec;
ws_request tRequest;
size_t consumed = tRequest.consume( mesg, rcvd );
LOG( "BONG" );
char tBuuuf[256];
sprintf( tBuuuf, "Consumed %d bytes of %d to parse", consumed, rcvd );
LOG( tBuuuf );
if( tRequest.ready() ) {
LOG("Parsed!");
};
#ifdef lksdfljkalsdkfj
if( !bWebSocketMode ) {
uint32_t index = 0;
#ifdef DEBUG
LOG("HTTP request handler!");
#endif
reqline[index] = strtok( mesg, "\n" );
if( strncmp( reqline[index], "GET", 3 ) == 0 ) {
char * pPartURI;
char * pPartPROTO;
pPartURI = strstr( reqline[index], " " );
if( pPartURI != NULL ) {
pPartURI++;
pPartPROTO = strstr( pPartURI, " " );
pPartPROTO++;
int URILen = pPartPROTO - pPartURI;
strncpy( cGetURI, pPartURI, URILen );
cGetURI[URILen] = (char)0;
if(strncmp( pPartPROTO, "HTTP/1.0", 8) != 0 && strncmp( pPartPROTO, "HTTP/1.1", 8) != 0) {
LOG_ERROR("No HTTP version supplied in request!");
if( write( m_iSocketFID, "HTTP/1.1 400 Bad Request\r\n", 26) < 0 ){
sprintf( mesg, "Failed returning status 400 to client: %s", strerror(errno));
LOG_ERROR(mesg);
};
m_bThreadStatus = TH_ENDED;
continue;
};
};
LOG(cGetURI);
};
// parse rest of request
while( ( reqline[++index] = strtok( NULL, "\n" ) )!= NULL ) {
if( strncmp( reqline[index], "Connection:", 11 ) == 0 ) {
char * pPart;
pPart = strcasestr( reqline[index], "Upgrade" );
if( pPart != NULL ) {
LOG("Upgrade Mode ON");
bUpgradeMode = true;
};
};
if( strncmp( reqline[index], "Upgrade:", 8 ) == 0 ) {
if( bUpgradeMode ) {
char * pPart;
pPart = strcasestr( reqline[index], "websocket" );
if( pPart != NULL ) {
LOG("WebSocket Mode ON");
bWebSocketMode = true;
};
};
};
if( strncmp( reqline[index], "Sec-WebSocket-Version:", 22 ) == 0 ) {
char * pPart;
pPart = strstr( reqline[index], " " );
if( pPart != NULL ) {
char tBuf[CTEXT];
nWebSocketVersion = atoi(pPart+1);
sprintf( tBuf,"Web Socket Version: %d", nWebSocketVersion );
LOG( tBuf );
};
};
if( strncmp( reqline[index], "Sec-WebSocket-Key:", 18 ) == 0 ) {
char * pPart;
pPart = strstr( reqline[index], " " );
if( pPart != NULL ) {
char tGenStr[256];
unsigned char * tBase64;
size_t nBase64;
int kLen;
unsigned char hash[SHA_DIGEST_LENGTH]; // == 20
pPart++;
kLen = strstr(pPart,"\r") - pPart;
strncpy(cWSKey,pPart,kLen);
cWSKey[kLen]=(char)0;
LOG( cWSKey );
sprintf( tGenStr, "%s%s", cWSKey, ws_guid );
SHA1( (const unsigned char*)tGenStr, strlen(tGenStr), hash );
tBase64 = base64_encode( hash, SHA_DIGEST_LENGTH, &nBase64 );
strncpy( cWSRep, (const char*)tBase64, nBase64 );
free( tBase64 );
cWSRep[nBase64] = (char)0;
LOG( cWSRep );
};
};
if( strncmp( reqline[index], "Sec-WebSocket-Protocol:", 23 ) == 0 ) {
char * pPart;
pPart = strstr( reqline[index], " " );
if( pPart != NULL ) {
// Check for protos
};
};
if( strncmp( reqline[index], "Sec-WebSocket-Extensions:", 25 ) == 0 ) {
char * pPart;
pPart = strstr( reqline[index], " " );
if( pPart != NULL ) {
pPart++;
if(strncmp( pPart, "permessage-deflate", 18 ) == 0 ) {
//m_bDeflatePerMessage = true;
LOG("Using Deflate");
};
};
};
};
gethostname( hostname, sizeof(hostname) );
#ifdef DEBUG
LOG("Sending reply ...");
#endif
if( bWebSocketMode ) {
LOG( "WebSocket Switcher" );
sprintf( mesg, ws_head, cWSRep );
send(m_iSocketFID, mesg , strlen(mesg), 0);
uint8_t * buffer = NULL;
size_t size = 0;
SLEEP(20);
if( assembleFrame( 1, 0, 0, 0, WS_OC_TEXT, (uint8_t *)"H264|-|-|", 9, buffer, size ) ){
send( m_iSocketFID, buffer, size, 0 );
free( buffer );
};
} else {
LOG( "HTTP Responce" );
send(m_iSocketFID, head, strlen(head), 0);
if (send(m_iSocketFID, mesg, strlen(mesg), 0) < 0){
sprintf( mesg, "Failed sending file to client: %s", strerror(errno));
LOG_ERROR(mesg);
m_bThreadStatus = TH_ENDED;
};
};
} else {
uint8_t test_buffer[] = {0x81,0x05,0x48,0x65,0x6c,0x6c,0x6f};
uint8_t * buffer = NULL;
size_t size = 0;
if( assembleFrame( 1, 0, 0, 0, WS_OC_TEXT, (uint8_t *)"Hello", 5, buffer, size ) ){
send( m_iSocketFID, buffer, size, 0 );
char tBuf[256];
sprintf( tBuf, "Size of Package: %d", size );
LOG( tBuf );
for(int i = 0; i < size; i++) {
sprintf( tBuf, "Pac[%d]: 0x%02x", i, buffer[i] );
LOG( tBuf );
};
free( buffer );
};
};
#endif
};
LOG("Client Handler Ended!");
shutdown(m_iSocketFID, SHUT_RDWR);
close(m_iSocketFID);
};
bool servletClientHandlerWebRTC::assembleFrame( bool FIN, bool RSV1, bool RSV2, bool RSV3, WS_OPCODE code, uint8_t *in_buffer, size_t in_size, uint8_t *&out_buffer, size_t &out_size, bool bmask, uint32_t mask ){
if( in_buffer == NULL ) return false;
if( out_buffer!= NULL ) {
LOG_ERROR("Output Buffer Must not be allocated!");
return false;
};
if( m_bDeflatePerMessage ) {
if( m_pDeflatener == NULL ) {
m_pDeflatener = new zipDataPackage();
if( m_pDeflatener == NULL ) {
LOG_ERROR("Error Create Deflate!");
return false;
};
};
uint8_t *tDeflatBuffer = NULL;
size_t BufferSize;
if( m_pDeflatener->zip( in_buffer, in_size, tDeflatBuffer, BufferSize ) ){
if( BufferSize < 127 ) {
if( bmask ) {
LOG("MDF<127");
out_size = BufferSize + 6;
} else {
LOG("NDF<127");
out_size = BufferSize + 2;
};
out_buffer = (uint8_t *) malloc( out_size );
if(out_buffer == NULL) {
free( tDeflatBuffer );
return false;
};
WS_FRAME_HEADER * tHeader;
tHeader = (WS_FRAME_HEADER *) out_buffer;
tHeader->word = 0x0000;
tHeader->bits.MASK = bmask;
tHeader->bits.FIN = FIN;
tHeader->bits.RSV1 = RSV1;
tHeader->bits.RSV2 = RSV2;
tHeader->bits.RSV3 = RSV3;
tHeader->bits.OPCODE = code;
tHeader->bits.PLEN0 = BufferSize & 0x7F;
if( bmask ) {
tHeader->PLE_MASK1 = ( mask >> 16 ) & 0xFFFF;
tHeader->PLE_MASK2 = mask & 0xFFFF;
memcpy( out_buffer + 6, tDeflatBuffer, BufferSize );
} else {
memcpy( out_buffer + 2, tDeflatBuffer, BufferSize );
}
free( tDeflatBuffer );
return true;
} else {
if( bmask ) {
LOG("MDF>127");
out_size = BufferSize + 14;
} else {
LOG("MDF>127");
out_size = BufferSize + 10;
};
out_buffer = (uint8_t *) malloc( out_size );
if(out_buffer == NULL) {
free( tDeflatBuffer );
return false;
};
WS_FRAME_HEADER * tHeader;
tHeader = (WS_FRAME_HEADER *) out_buffer;
tHeader->word = 0x0000;
tHeader->bits.MASK = bmask;
tHeader->bits.FIN = FIN;
tHeader->bits.RSV1 = RSV1;
tHeader->bits.RSV2 = RSV2;
tHeader->bits.RSV3 = RSV3;
tHeader->bits.OPCODE = code;
tHeader->bits.PLEN0 = 0x7F;
tHeader->PLE_MASK1 = ( BufferSize >> 48 ) & 0xFFFF;
tHeader->PLE_MASK2 = ( BufferSize >> 32 ) & 0xFFFF;
tHeader->PLE3 = ( BufferSize >> 16 ) & 0xFFFF;
tHeader->PLE4 = BufferSize & 0xFFFF;
if( bmask ) {
tHeader->MASK3 = ( mask >> 16 ) & 0xFFFF;
tHeader->MASK4 = mask & 0xFFFF;
memcpy( out_buffer + 14, tDeflatBuffer, BufferSize );
} else {
memcpy( out_buffer + 10, tDeflatBuffer, BufferSize );
}
free( tDeflatBuffer );
return true;
};
} else {
LOG_ERROR( "Deflat Failure!");
if( tDeflatBuffer!= NULL) {
free (tDeflatBuffer);
};
return false;
};
} else {
if( in_size < 127 ) {
if( bmask ) {
LOG("M00<127");
out_size = in_size + 6;
} else {
LOG("N00<127");
out_size = in_size + 2;
};
out_buffer = (uint8_t *) malloc( out_size );
if(out_buffer == NULL) {
return false;
};
WS_FRAME_HEADER * tHeader;
tHeader = (WS_FRAME_HEADER *) out_buffer;
tHeader->word = 0x0000;
tHeader->bits.MASK = bmask;
tHeader->bits.FIN = FIN;
tHeader->bits.RSV1 = RSV1;
tHeader->bits.RSV2 = RSV2;
tHeader->bits.RSV3 = RSV3;
tHeader->bits.OPCODE = code;
tHeader->bits.PLEN0 = in_size & 0x7F;
if( bmask ) {
tHeader->PLE_MASK1 = ( mask >> 16 ) & 0xFFFF;
tHeader->PLE_MASK2 = mask & 0xFFFF;
memcpy( out_buffer + 6, in_buffer, in_size );
} else {
memcpy( out_buffer + 2, in_buffer, in_size );
};
return true;
} else {
if( bmask ) {
LOG("M00>127");
out_size = in_size + 14;
} else {
LOG("N00>127");
out_size = in_size + 10;
};
out_buffer = (uint8_t *) malloc( out_size );
if(out_buffer == NULL) {
return false;
};
WS_FRAME_HEADER * tHeader;
tHeader = (WS_FRAME_HEADER *) out_buffer;
tHeader->word = 0x0000;
tHeader->bits.MASK = bmask;
tHeader->bits.FIN = FIN;
tHeader->bits.RSV1 = RSV1;
tHeader->bits.RSV2 = RSV2;
tHeader->bits.RSV3 = RSV3;
tHeader->bits.OPCODE = code;
tHeader->bits.PLEN0 = 0x7F;
tHeader->PLE_MASK1 = ( in_size >> 48 ) & 0xFFFF;
tHeader->PLE_MASK2 = ( in_size >> 32 ) & 0xFFFF;
tHeader->PLE3 = ( in_size >> 16 ) & 0xFFFF;
tHeader->PLE4 = in_size & 0xFFFF;
if( bmask ) {
tHeader->MASK3 = ( mask >> 16 ) & 0xFFFF;
tHeader->MASK4 = mask & 0xFFFF;
memcpy( out_buffer + 14, in_buffer, in_size );
} else {
memcpy( out_buffer + 10, in_buffer, in_size );
};
return true;
};
};
};
#undef LOG
#undef LOG_ERROR

192
lib/data/servletWebRTC/servletClientHandlerWebRTC.cpp

@ -0,0 +1,192 @@
#include "servletClientHandlerWebRTC.h"
#include "servletWebRTC.h"
#include "../../components/base/basicFunctionality.h"
#include "../../alg/generic/base64.h"
#include <openssl/sha.h>
#include <websocketpp/http/request.hpp>
#include <websocketpp/http/response.hpp>
#include <websocketpp/config/core.hpp>
#include <websocketpp/processors/hybi13.hpp>
#define LOG( X ) m_pLog->Log( "WRTC", this, X )
#define LOG_ERROR( X ) m_pLog->Log( "WRTC", this, _LOG_ERROR, X )
typedef websocketpp::config::core ws_config;
typedef websocketpp::processor::hybi13<ws_config> ws_parser;
typedef ws_config::request_type ws_request;
typedef ws_config::response_type ws_response;
typedef ws_config::message_type ws_message;
typedef ws_config::con_msg_manager_type ws_msg_manager;
typedef ws_config::rng_type ws_rng;
servletClientHandlerWebRTC::servletClientHandlerWebRTC( servletWebRTC *pPtr, int Socket ):basicThread(){
m_pLog = basicLogCollection::getInstance();
m_pParent = NULL;
if( pPtr == NULL ) return;
m_iSocketFID = accept( Socket, NULL, NULL);
if ( m_iSocketFID < 0) {
char tBuf[CTEXT];
sprintf(tBuf, "accept() error: %s", strerror(errno));
LOG_ERROR(tBuf);
return;
};
m_pParent = pPtr;
basicThread::init();
};
servletClientHandlerWebRTC::~servletClientHandlerWebRTC(){
basicThread::waitThreadEnd( true );
LOG("Client Handler Deleted!");
};
void servletClientHandlerWebRTC::m_fThreadProc( void ){
char *ws_head = "HTTP/1.1 101 Switching Protocols\r\n";
char mesg[1024];
uint8_t buffer[1024];
bool bSwitched = false;
size_t mRecvSize = 0;
size_t nPackShift = 0;
size_t mParserConsumed = 0;
struct pollfd pfd[1];
#ifdef DEBUG
pid_t pid = gettid();
char pidBuf[16];
sprintf(pidBuf,"pid:%d", pid);
LOG(pidBuf);
#endif
pfd->fd = m_iSocketFID;
pfd->events = POLLIN;
ws_parser * pParser = NULL;
ws_request * pRequest = NULL;
ws_response * pResponse = NULL;
websocketpp::lib::error_code mErrorCode;
std::vector< std::string > vSubprotocolList;
ws_msg_manager M;
std::shared_ptr<ws_msg_manager> pManagerPtr( &M );
ws_rng A;
pParser = new ws_parser( false, true, pManagerPtr, A ); //No Secure, Server
if( pParser == NULL ) {
m_bThreadStatus = TH_ENDED;
return;
};
m_bThreadStatus = TH_WORKING;
while( m_bThreadStatus < TH_ENDED ) {
int RetVal = poll( pfd, 1, 1000 );
if( RetVal <= 0 ){
if (EINTR == errno) continue;
LOG_ERROR("Unrecoverable pool error");
m_bThreadStatus = TH_ENDED;
continue;
};
if(!bSwitched) {
if( nPackShift >= sizeof(mesg) ) {
LOG_ERROR("Package is too lond - drop connection!");
m_bThreadStatus = TH_ENDED;
continue;
};
mRecvSize = recv( m_iSocketFID, mesg + nPackShift, sizeof(mesg) - nPackShift, 0 );
if ( mRecvSize <= 0 ) {
sprintf( mesg, "recv() error: %s[%d]", strerror(errno), errno );
LOG_ERROR(mesg);
m_bThreadStatus = TH_ENDED;
continue;
};
if( pRequest == NULL ) {
pRequest = new ws_request();
};
if( pRequest == NULL ) {
LOG_ERROR("Request Constructor error - drop connection!");
m_bThreadStatus = TH_ENDED;
continue;
};
mParserConsumed = pRequest->consume( mesg, mRecvSize );
if( pRequest->ready() ) {
nPackShift = 0;
LOG( "MSG parsed!" );
if( websocketpp::processor::is_websocket_handshake( *pRequest ) ){
int nVersion = 0;
LOG( "MSG is handshake" );
nVersion = websocketpp::processor::get_websocket_version( *pRequest );
mErrorCode = pParser->extract_subprotocols( *pRequest, vSubprotocolList );
if( vSubprotocolList.size() ) {
LOG( "Subprotocols:" );
for(int index = 0; index < vSubprotocolList.size(); index++ ) {
LOG( vSubprotocolList.at(index).c_str() );
};
} else {
LOG("No Subprotocols");
};
if( pResponse == NULL ) pResponse = new ws_response();
if( pResponse == NULL ) {
delete( pRequest );
LOG_ERROR("Response Constructor error - drop connection!");
m_bThreadStatus = TH_ENDED;
continue;
};
pResponse->consume(ws_head, strlen(ws_head));
mErrorCode = pParser->process_handshake( *pRequest, "", *pResponse );
send( m_iSocketFID, pResponse->raw().c_str(), pResponse->raw().size(), 0);
delete( pResponse );
pResponse = NULL;
bSwitched = true;
};
delete( pRequest );
pRequest = NULL;
} else {
nPackShift += mRecvSize;
};
} else {
if( nPackShift >= sizeof(mesg) ) {
LOG_ERROR("Package is too lond - drop connection!");
m_bThreadStatus = TH_ENDED;
continue;
};
mRecvSize = recv( m_iSocketFID, buffer + nPackShift, sizeof(buffer) - nPackShift, 0 );
if ( mRecvSize <= 0 ) {
sprintf( mesg, "recv() error: %s[%d]", strerror(errno), errno );
LOG_ERROR(mesg);
m_bThreadStatus = TH_ENDED;
continue;
};
mParserConsumed = pParser->consume( buffer, mRecvSize, mErrorCode );
if( pParser->ready() ) {
std::shared_ptr<ws_message> msg;
//ws_message * body_out_msg;
LOG("In MESSAGE!");
mErrorCode = pParser->finalize_message();
in_msg = pParser->get_message();
LOG(in_msg->get_payload().c_str());
body_out_msg = new ws_message( pManagerPtr );
if( body_out_msg != NULL ){
LOG("OUT allocated");
{
std::shared_ptr<ws_message> out_msg(body_out_msg);
out_msg->set_payload( "KOKOBABA" );
LOG("SET PAYLOAD");
mErrorCode = pParser->prepare_data_frame( out_msg, out_msg );
send( m_iSocketFID, out_msg->get_header().c_str(), out_msg->get_header().size(), 0);
if(out_msg->get_extension_data().size()) {
send( m_iSocketFID, out_msg->get_extension_data().c_str(), out_msg->get_extension_data().size(), 0);
};
send( m_iSocketFID, out_msg->get_payload().c_str(), out_msg->get_payload().size(), 0);
out_msg->recycle();
}
//delete( body_out_msg );
LOG("OUT deleted!");
};
};
};
};
LOG("Client Handler Ended!");
shutdown(m_iSocketFID, SHUT_RDWR);
close(m_iSocketFID);
};
#undef LOG
#undef LOG_ERROR

29
lib/data/servletWebRTC/servletClientHandlerWebRTC.h

@ -0,0 +1,29 @@
#ifndef __SERVLET_WEB_RTC_CLIENT_HANDLER_HEADER__
#define __SERVLET_WEB_RTC_CLIENT_HANDLER_HEADER__
#include "../../components/base/basicThread.h"
#include "../../alg/generic/libzip.h"
#include <sys/types.h> /* See NOTES */
#include <sys/socket.h>
#include <poll.h>
#include <vector>
class servletWebRTC;
class servletClientHandlerWebRTC: public basicThread{
private:
basicLogCollection * m_pLog;
int m_iSocketFID;
servletWebRTC * m_pParent;
public:
explicit servletClientHandlerWebRTC( servletWebRTC *pPtr, int Socket );
~servletClientHandlerWebRTC();
virtual void m_fThreadProc( void );
};
typedef std::vector<servletClientHandlerWebRTC *> vectorClientHandlerWebRTC;
#endif

lib/data/modWebRTC/servletWebRTC.cpp → lib/data/servletWebRTC/servletWebRTC.cpp

lib/data/modWebRTC/servletWebRTC.h → lib/data/servletWebRTC/servletWebRTC.h

117
lib/data/webrtc/AUTHORS

@ -0,0 +1,117 @@
# Names should be added to this file like so:
# Name or Organization <email address>
Adam Fedor <adam.fedor@gmail.com>
Akshay Shah <meetakshay99@gmail.com>
Alexander Brauckmann <a.brauckmann@gmail.com>
Alexandre Gouaillard <agouaillard@gmail.com>
Andrew MacDonald <andrew@webrtc.org>
Anil Kumar <an1kumar@gmail.com>
Ben Strong <bstrong@gmail.com>
Bob Withers <bwit@pobox.com>
Bridger Maxwell <bridgeyman@gmail.com>
Chris Tserng <tserng@amazon.com>
Christophe Dumez <ch.dumez@samsung.com>
Cody Barnes <conceptgenesis@gmail.com>
Colin Plumb
Cyril Lashkevich <notorca@gmail.com>
David Porter <david@porter.me>
Dax Booysen <dax@younow.com>
Danail Kirov <dkirovbroadsoft@gmail.com>
Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
Dmitry Lizin <sdkdimon@gmail.com>
Eric Rescorla, RTFM Inc. <ekr@rtfm.com>
Frederik Riedel, Frogg GmbH <frederik.riedel@frogg.io>
Giji Gangadharan <giji.g@samsung.com>
Graham Yoakum <gyoakum@skobalt.com>
Gustavo Garcia <gustavogb@gmail.com>
Hugues Ekra <hekra01@gmail.com>
Jake Hilton <jakehilton@gmail.com>
James H. Brown <jbrown@burgoyne.com>
Jan Kalab <pitlicek@gmail.com>
Jens Nielsen <jens.nielsen@berotec.se>
Jiawei Ou <jiawei.ou@gmail.com>
Jie Mao <maojie0924@gmail.com>
Jose Antonio Olivera Ortega <josea.olivera@gmail.com>
Luke Weber <luke.weber@gmail.com>
Maksim Khobat <maksimkhobat@gmail.com>
Mallikarjuna Rao V <vm.arjun@samsung.com>
Manish Jethani <manish.jethani@gmail.com>
Martin Storsjo <martin@martin.st>
Matthias Liebig <matthias.gcode@gmail.com>
Maxim Potapov <vopatop.skam@gmail.com>
Michael Iedema <michael@kapsulate.com>
Mike Gilbert <floppymaster@gmail.com>
Mo Zanaty <mzanaty@cisco.com>
Pali Rohar
Paul Kapustin <pkapustin@gmail.com>
Philipp Hancke <philipp.hancke@googlemail.com>
Peng Yu <yupeng323@gmail.com>
Rafael Lopez Diez <rafalopezdiez@gmail.com>
Ralph Giles <giles@ghostscript.com>
Riku Voipio <riku.voipio@linaro.org>
Robert Bares <robert@bares.me>
Robert Nagy <robert.nagy@gmail.com>
Ryan Yoakum <ryoakum@skobalt.com>
Satender Saroha <ssaroha@yahoo.com>
Sarah Thompson <sarah@telergy.com>
Saul Kravitz <Saul.Kravitz@celera.com>
Silviu Caragea <silviu.cpp@gmail.com>
Stefan Gula <steweg@gmail.com>
Steve Reid <sreid@sea-to-sky.net>
Tarun Chawla <trnkumarchawla@gmail.com>
Uladzislau Susha <landby@gmail.com>
Vladimir Beloborodov <VladimirTechMan@gmail.com>
Vicken Simonian <vsimon@gmail.com>
Victor Costan <costan@gmail.com>
Xiaohong Xu <freemine@yeah.net>
Xiaolei Yu <dreifachstein@gmail.com>
Yura Yaroshevich <yura.yaroshevich@gmail.com>
Yuriy Pavlyshak <yuriy@appear.in>
Hans Knoechel <hans@hans-knoechel.de>
Korniltsev Anatoly <korniltsev.anatoly@gmail.com>
Todd Wong <todd.wong.ndq@gmail.com>
Sergio Garcia Murillo <sergio.garcia.murillo@gmail.com>
Maxim Pavlov <pavllovmax@gmail.com>
Yusuke Suzuki <utatane.tea@gmail.com>
Piasy Xu <xz4215@gmail.com>
Tomas Popela <tomas.popela@gmail.com>
Jan Grulich <grulja@gmail.com>
Eike Rathke <erathke@redhat.com>
Michel Promonet <michel.promonet.1@gmail.com>
Min Wang <mingewang@gmail.com>
Ramprakash Jelari <ennajelari@gmail.com>
CZ Theng <cz.theng@gmail.com>
&yet LLC <*@andyet.com>
Agora IO <*@agora.io>
ARM Holdings <*@arm.com>
BroadSoft Inc. <*@broadsoft.com>
Facebook Inc. <*@fb.com>
Google Inc. <*@google.com>
HyperConnect Inc. <*@hpcnt.com>
Life On Air Inc. <*@lifeonair.com>
Intel Corporation <*@intel.com>
Microsoft Corporation <*@microsoft.com>
MIPS Technologies <*@mips.com>
Mozilla Foundation <*@mozilla.com>
NVIDIA Corporation <*@nvidia.com>
Opera Software ASA <*@opera.com>
Optical Tone Ltd <*@opticaltone.com>
Pengutronix e.K. <*@pengutronix.de>
Sinch AB <*@sinch.com>
struktur AG <*@struktur.de>
Telenor Digital AS <*@telenor.com>
Temasys Communications <*@temasys.io>
The Chromium Authors <*@chromium.org>
The WebRTC Authors <*@webrtc.org>
Videxio AS <*@videxio.com>
Vidyo, Inc. <*@vidyo.com>
Vonage Holdings Corp. <*@vonage.com>
Wire Swiss GmbH <*@wire.com>
Miguel Paris <mparisdiaz@gmail.com>
Vewd Software AS <*@vewd.com>
Highfive, Inc. <*@highfive.com>
CoSMo Software Consulting, Pte Ltd <*@cosmosoftware.io>
Tuple, LLC <*@tuple.app>
Videona Socialmedia <*@videona.com>

712
lib/data/webrtc/BUILD.gn

@ -0,0 +1,712 @@
# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
# This is the root build file for GN. GN will start processing by loading this
# file, and recursively load all dependencies until all dependencies are either
# resolved or known not to exist (which will cause the build to fail). So if
# you add a new build file, there must be some path of dependencies from this
# file to your new one or GN won't know about it.
import("//build/config/linux/pkg_config.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("webrtc.gni")
if (rtc_enable_protobuf) {
import("//third_party/protobuf/proto_library.gni")
}
if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
}
if (!build_with_chromium) {
# This target should (transitively) cause everything to be built; if you run
# 'ninja default' and then 'ninja all', the second build should do no work.
group("default") {
testonly = true
deps = [
":webrtc",
]
if (rtc_build_examples) {
deps += [ "examples" ]
}
if (rtc_build_tools) {
deps += [ "rtc_tools" ]
}
if (rtc_include_tests) {
deps += [
":rtc_unittests",
":slow_tests",
":video_engine_tests",
":webrtc_lib_link_test",
":webrtc_nonparallel_tests",
":webrtc_perf_tests",
"common_audio:common_audio_unittests",
"common_video:common_video_unittests",
"examples:examples_unittests",
"media:rtc_media_unittests",
"modules:modules_tests",
"modules:modules_unittests",
"modules/audio_coding:audio_coding_tests",
"modules/audio_processing:audio_processing_tests",
"modules/remote_bitrate_estimator:rtp_to_text",
"modules/rtp_rtcp:test_packet_masks_metrics",
"modules/video_capture:video_capture_internal_impl",
"pc:peerconnection_unittests",
"pc:rtc_pc_unittests",
"rtc_tools:rtp_generator",
"stats:rtc_stats_unittests",
"system_wrappers:system_wrappers_unittests",
"test",
"video:screenshare_loopback",
"video:sv_loopback",
"video:video_loopback",
]
if (is_android) {
deps += [
":android_junit_tests",
"sdk/android:android_instrumentation_test_apk",
]
} else {
deps += [ "modules/video_capture:video_capture_tests" ]
}
if (rtc_enable_protobuf) {
deps += [
"audio:low_bandwidth_audio_test",
"logging:rtc_event_log_rtp_dump",
]
}
}
}
}
# Abseil Flags by default doesn't register command line flags on mobile
# platforms, WebRTC tests requires them (e.g. on simualtors) so this
# config will be applied to testonly targets globally (see webrtc.gni).
config("absl_flags_configs") {
defines = [ "ABSL_FLAGS_STRIP_NAMES=0" ]
}
config("library_impl_config") {
# Build targets that contain WebRTC implementation need this macro to
# be defined in order to correctly export symbols when is_component_build
# is true.
# For more info see: rtc_base/build/rtc_export.h.
defines = [ "WEBRTC_LIBRARY_IMPL" ]
}
# Contains the defines and includes in common.gypi that are duplicated both as
# target_defaults and direct_dependent_settings.
config("common_inherited_config") {
defines = []
cflags = []
ldflags = []
if (rtc_enable_symbol_export) {
defines = [ "WEBRTC_ENABLE_SYMBOL_EXPORT" ]
}
if (build_with_mozilla) {
defines += [ "WEBRTC_MOZILLA_BUILD" ]
}
if (!rtc_builtin_ssl_root_certificates) {
defines += [ "WEBRTC_EXCLUDE_BUILT_IN_SSL_ROOT_CERTS" ]
}
# Some tests need to declare their own trace event handlers. If this define is
# not set, the first time TRACE_EVENT_* is called it will store the return
# value for the current handler in an static variable, so that subsequent
# changes to the handler for that TRACE_EVENT_* will be ignored.
# So when tests are included, we set this define, making it possible to use
# different event handlers in different tests.
if (rtc_include_tests) {
defines += [ "WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=1" ]
} else {
defines += [ "WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0" ]
}
if (build_with_chromium) {
defines += [ "WEBRTC_CHROMIUM_BUILD" ]
include_dirs = [
# The overrides must be included first as that is the mechanism for
# selecting the override headers in Chromium.
"../webrtc_overrides",
# Allow includes to be prefixed with webrtc/ in case it is not an
# immediate subdirectory of the top-level.
".",
# Just like the root WebRTC directory is added to include path, the
# corresponding directory tree with generated files needs to be added too.
# Note: this path does not change depending on the current target, e.g.
# it is always "//gen/third_party/webrtc" when building with Chromium.
# See also: http://cs.chromium.org/?q=%5C"default_include_dirs
# https://gn.googlesource.com/gn/+/master/docs/reference.md#target_gen_dir
target_gen_dir,
]
}
if (is_posix || is_fuchsia) {
defines += [ "WEBRTC_POSIX" ]
}
if (is_ios) {
defines += [
"WEBRTC_MAC",
"WEBRTC_IOS",
]
}
if (is_linux) {
defines += [ "WEBRTC_LINUX" ]
}
if (is_mac) {
defines += [ "WEBRTC_MAC" ]
}
if (is_fuchsia) {
defines += [ "WEBRTC_FUCHSIA" ]
}
if (is_win) {
defines += [ "WEBRTC_WIN" ]
}
if (is_android) {
defines += [
"WEBRTC_LINUX",
"WEBRTC_ANDROID",
]
if (build_with_mozilla) {
defines += [ "WEBRTC_ANDROID_OPENSLES" ]
}
}
if (is_chromeos) {
defines += [ "CHROMEOS" ]
}
if (rtc_sanitize_coverage != "") {
assert(is_clang, "sanitizer coverage requires clang")
cflags += [ "-fsanitize-coverage=${rtc_sanitize_coverage}" ]
ldflags += [ "-fsanitize-coverage=${rtc_sanitize_coverage}" ]
}
if (is_ubsan) {
cflags += [ "-fsanitize=float-cast-overflow" ]
}
}
# TODO(bugs.webrtc.org/9693): Remove the possibility to suppress this warning
# as soon as WebRTC compiles without it.
config("no_exit_time_destructors") {
if (is_clang) {
cflags = [ "-Wno-exit-time-destructors" ]
}
}
# TODO(bugs.webrtc.org/9693): Remove the possibility to suppress this warning
# as soon as WebRTC compiles without it.
config("no_global_constructors") {
if (is_clang) {
cflags = [ "-Wno-global-constructors" ]
}
}
config("rtc_prod_config") {
# Ideally, WebRTC production code (but not test code) should have these flags.
if (is_clang) {
cflags = [
"-Wexit-time-destructors",
"-Wglobal-constructors",
]
}
}
config("common_config") {
cflags = []
cflags_c = []
cflags_cc = []
cflags_objc = []
defines = []
if (rtc_enable_protobuf) {
defines += [ "WEBRTC_ENABLE_PROTOBUF=1" ]
} else {
defines += [ "WEBRTC_ENABLE_PROTOBUF=0" ]
}
if (rtc_include_internal_audio_device) {
defines += [ "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE" ]
}
if (rtc_libvpx_build_vp9) {
defines += [ "RTC_ENABLE_VP9" ]
}
if (rtc_enable_sctp) {
defines += [ "HAVE_SCTP" ]
}
if (rtc_enable_external_auth) {
defines += [ "ENABLE_EXTERNAL_AUTH" ]
}
if (rtc_use_h264) {
defines += [ "WEBRTC_USE_H264" ]
}
if (build_with_chromium) {
defines += [
# NOTICE: Since common_inherited_config is used in public_configs for our
# targets, there's no point including the defines in that config here.
# TODO(kjellander): Cleanup unused ones and move defines closer to the
# source when webrtc:4256 is completed.
"HAVE_WEBRTC_VIDEO",
"LOGGING_INSIDE_WEBRTC",
]
} else {
if (is_posix || is_fuchsia) {
# Enable more warnings: -Wextra is currently disabled in Chromium.
cflags = [
"-Wextra",
# Repeat some flags that get overridden by -Wextra.
"-Wno-unused-parameter",
"-Wno-missing-field-initializers",
]
cflags_c += [
# TODO(bugs.webrtc.org/9029): enable commented compiler flags.
# Some of these flags should also be added to cflags_objc.
# "-Wextra", (used when building C++ but not when building C)
# "-Wmissing-prototypes", (C/Obj-C only)
# "-Wmissing-declarations", (ensure this is always used C/C++, etc..)
"-Wstrict-prototypes",
# "-Wpointer-arith", (ensure this is always used C/C++, etc..)
# "-Wbad-function-cast", (C/Obj-C only)
# "-Wnested-externs", (C/Obj-C only)
]
cflags_objc += [ "-Wstrict-prototypes" ]
cflags_cc = [
"-Wnon-virtual-dtor",
# This is enabled for clang; enable for gcc as well.
"-Woverloaded-virtual",
]
}
if (is_clang) {
cflags += [
"-Wc++11-narrowing",
"-Wimplicit-fallthrough",
"-Wthread-safety",
"-Winconsistent-missing-override",
"-Wundef",
]
# use_xcode_clang only refers to the iOS toolchain, host binaries use
# chromium's clang always.
if (!is_nacl &&
(!use_xcode_clang || current_toolchain == host_toolchain)) {
# Flags NaCl (Clang 3.7) and Xcode 7.3 (Clang clang-703.0.31) do not
# recognize.
cflags += [ "-Wunused-lambda-capture" ]
}
}
if (is_win && !is_clang) {
# MSVC warning suppressions (needed to use Abseil).
# TODO(bugs.webrtc.org/9274): Remove these warnings as soon as MSVC allows
# external headers warning suppression (or fix them upstream).
cflags += [ "/wd4702" ] # unreachable code
}
}
if (current_cpu == "arm64") {
defines += [ "WEBRTC_ARCH_ARM64" ]
defines += [ "WEBRTC_HAS_NEON" ]
}
if (current_cpu == "arm") {
defines += [ "WEBRTC_ARCH_ARM" ]
if (arm_version >= 7) {
defines += [ "WEBRTC_ARCH_ARM_V7" ]
if (arm_use_neon) {
defines += [ "WEBRTC_HAS_NEON" ]
}
}
}
if (current_cpu == "mipsel") {
defines += [ "MIPS32_LE" ]
if (mips_float_abi == "hard") {
defines += [ "MIPS_FPU_LE" ]
}
if (mips_arch_variant == "r2") {
defines += [ "MIPS32_R2_LE" ]
}
if (mips_dsp_rev == 1) {
defines += [ "MIPS_DSP_R1_LE" ]
} else if (mips_dsp_rev == 2) {
defines += [
"MIPS_DSP_R1_LE",
"MIPS_DSP_R2_LE",
]
}
}
if (is_android && !is_clang) {
# The Android NDK doesn"t provide optimized versions of these
# functions. Ensure they are disabled for all compilers.
cflags += [
"-fno-builtin-cos",
"-fno-builtin-sin",
"-fno-builtin-cosf",
"-fno-builtin-sinf",
]
}
if (use_fuzzing_engine && optimize_for_fuzzing) {
# Used in Chromium's overrides to disable logging
defines += [ "WEBRTC_UNSAFE_FUZZER_MODE" ]
}
if (!build_with_chromium && rtc_win_undef_unicode) {
cflags += [
"/UUNICODE",
"/U_UNICODE",
]
}
}
config("common_objc") {
libs = [ "Foundation.framework" ]
if (rtc_use_metal_rendering) {
defines = [ "RTC_SUPPORTS_METAL" ]
}
}
if (!build_with_chromium) {
# Target to build all the WebRTC production code.
rtc_static_library("webrtc") {
# Only the root target and the test should depend on this.
visibility = [
"//:default",
"//:webrtc_lib_link_test",
]
sources = []
complete_static_lib = true
suppressed_configs += [ "//build/config/compiler:thin_archive" ]
defines = []
deps = [
":webrtc_common",
"api:create_peerconnection_factory",
"api:libjingle_peerconnection_api",
"api:rtc_error",
"api:transport_api",
"api/crypto",
"api/rtc_event_log:rtc_event_log_factory",
"api/task_queue",
"api/task_queue:default_task_queue_factory",
"audio",
"call",
"common_audio",
"common_video",
"logging:rtc_event_log_api",
"media",
"modules",
"modules/video_capture:video_capture_internal_impl",
"p2p:rtc_p2p",
"pc:libjingle_peerconnection",
"pc:peerconnection",
"pc:rtc_pc",
"pc:rtc_pc_base",
"rtc_base",
"sdk",
"video",
]
if (rtc_include_builtin_audio_codecs) {
deps += [
"api/audio_codecs:builtin_audio_decoder_factory",
"api/audio_codecs:builtin_audio_encoder_factory",
]
}
if (rtc_include_builtin_video_codecs) {
deps += [
"api/video_codecs:builtin_video_decoder_factory",
"api/video_codecs:builtin_video_encoder_factory",
]
}
if (build_with_mozilla) {
deps += [
"api/video:video_frame",
"api/video:video_rtp_headers",
]
} else {
deps += [
"api",
"logging",
"p2p",
"pc",
"stats",
]
}
if (rtc_enable_protobuf) {
defines += [ "ENABLE_RTC_EVENT_LOG" ]
deps += [ "logging:rtc_event_log_proto" ]
}
}
if (rtc_include_tests) {
rtc_executable("webrtc_lib_link_test") {
testonly = true
sources = [
"webrtc_lib_link_test.cc",
]
deps = [
# NOTE: Don't add deps here. If this test fails to link, it means you
# need to add stuff to the webrtc static lib target above.
":webrtc",
]
}
}
}
rtc_source_set("webrtc_common") {
# Client code SHOULD NOT USE THIS TARGET, but for now it needs to be public
# because there exists client code that uses it.
# TODO(bugs.webrtc.org/9808): Move to private visibility as soon as that
# client code gets updated.
visibility = [ "*" ]
sources = [
"common_types.h",
]
}
if (use_libfuzzer || use_afl) {
# This target is only here for gn to discover fuzzer build targets under
# webrtc/test/fuzzers/.
group("webrtc_fuzzers_dummy") {
testonly = true
deps = [
"test/fuzzers:webrtc_fuzzer_main",
]
}
}
if (rtc_include_tests) {
rtc_test("rtc_unittests") {
testonly = true
deps = [
":webrtc_common",
"api:compile_all_headers",
"api:rtc_api_unittests",
"api/audio/test:audio_api_unittests",
"api/audio_codecs/test:audio_codecs_api_unittests",
"api/video/test:rtc_api_video_unittests",
"api/video_codecs/test:video_codecs_api_unittests",
"call:fake_network_pipe_unittests",
"p2p:libstunprober_unittests",
"p2p:rtc_p2p_unittests",
"rtc_base:rtc_base_approved_unittests",
"rtc_base:rtc_base_unittests",
"rtc_base:rtc_json_unittests",
"rtc_base:rtc_numerics_unittests",
"rtc_base:rtc_task_queue_unittests",
"rtc_base:sigslot_unittest",
"rtc_base:weak_ptr_unittests",
"rtc_base/experiments:experiments_unittests",
"rtc_base/synchronization:sequence_checker_unittests",
"rtc_base/task_utils:to_queued_task_unittests",
"sdk:sdk_tests",
"test:rtp_test_utils",
"test:test_main",
"test/network:network_emulation_unittests",
]
if (rtc_enable_protobuf) {
deps += [ "logging:rtc_event_log_tests" ]
}
if (is_android) {
# Do not use Chromium's launcher. native_unittests defines its own JNI_OnLoad.
use_default_launcher = false
deps += [
"sdk/android:native_unittests",
"sdk/android:native_unittests_java",
"//testing/android/native_test:native_test_support",
]
shard_timeout = 900
}
if (is_ios || is_mac) {
deps += [ "sdk:rtc_unittests_objc" ]
}
}
# This runs tests that must run in real time and therefore can take some
# time to execute. They are in a separate executable to avoid making the
# regular unittest suite too slow to run frequently.
rtc_test("slow_tests") {
testonly = true
deps = [
"rtc_base/task_utils:repeating_task_unittests",
"test:test_main",
]
}
# TODO(pbos): Rename test suite, this is no longer "just" for video targets.
video_engine_tests_resources = [
"resources/foreman_cif_short.yuv",
"resources/voice_engine/audio_long16.pcm",
]
if (is_ios) {
bundle_data("video_engine_tests_bundle_data") {
testonly = true
sources = video_engine_tests_resources
outputs = [
"{{bundle_resources_dir}}/{{source_file_part}}",
]
}
}
rtc_test("video_engine_tests") {
testonly = true
deps = [
"audio:audio_tests",
# TODO(eladalon): call_tests aren't actually video-specific, so we
# should move them to a more appropriate test suite.
"call:call_tests",
"test:test_common",
"test:test_main",
"test:video_test_common",
"video:video_tests",
]
data = video_engine_tests_resources
if (is_android) {
deps += [ "//testing/android/native_test:native_test_native_code" ]
shard_timeout = 900
}
if (is_ios) {
deps += [ ":video_engine_tests_bundle_data" ]
}
}
webrtc_perf_tests_resources = [
"resources/audio_coding/speech_mono_16kHz.pcm",
"resources/audio_coding/speech_mono_32_48kHz.pcm",
"resources/audio_coding/testfile32kHz.pcm",
"resources/ConferenceMotion_1280_720_50.yuv",
"resources/difficult_photo_1850_1110.yuv",
"resources/foreman_cif.yuv",
"resources/paris_qcif.yuv",
"resources/photo_1850_1110.yuv",
"resources/presentation_1850_1110.yuv",
"resources/voice_engine/audio_long16.pcm",
"resources/web_screenshot_1850_1110.yuv",
]
if (is_ios) {
bundle_data("webrtc_perf_tests_bundle_data") {
testonly = true
sources = webrtc_perf_tests_resources
outputs = [
"{{bundle_resources_dir}}/{{source_file_part}}",
]
}
}
rtc_test("webrtc_perf_tests") {
testonly = true
deps = [
"audio:audio_perf_tests",
"call:call_perf_tests",
"modules/audio_coding:audio_coding_perf_tests",
"modules/audio_processing:audio_processing_perf_tests",
"pc:peerconnection_perf_tests",
"test:test_main",
"video:video_full_stack_tests",
"video:video_pc_full_stack_tests",
]
data = webrtc_perf_tests_resources
if (is_android) {
deps += [ "//testing/android/native_test:native_test_native_code" ]
shard_timeout = 4500
}
if (is_ios) {
deps += [ ":webrtc_perf_tests_bundle_data" ]
}
}
rtc_test("webrtc_nonparallel_tests") {
testonly = true
deps = [
"rtc_base:rtc_base_nonparallel_tests",
]
if (is_android) {
deps += [ "//testing/android/native_test:native_test_support" ]
shard_timeout = 900
}
}
if (is_android) {
junit_binary("android_junit_tests") {
java_files = [
"examples/androidjunit/src/org/appspot/apprtc/BluetoothManagerTest.java",
"examples/androidjunit/src/org/appspot/apprtc/DirectRTCClientTest.java",
"examples/androidjunit/src/org/appspot/apprtc/TCPChannelClientTest.java",
"sdk/android/tests/src/org/webrtc/AndroidVideoDecoderTest.java",
"sdk/android/tests/src/org/webrtc/CameraEnumerationTest.java",
"sdk/android/tests/src/org/webrtc/CodecTestHelper.java",
"sdk/android/tests/src/org/webrtc/FakeMediaCodecWrapper.java",
"sdk/android/tests/src/org/webrtc/GlGenericDrawerTest.java",
"sdk/android/tests/src/org/webrtc/HardwareVideoEncoderTest.java",
"sdk/android/tests/src/org/webrtc/ScalingSettingsTest.java",
"sdk/android/tests/src/org/webrtc/CryptoOptionsTest.java",
]
deps = [
"examples:AppRTCMobile_javalib",
"sdk/android:libjingle_peerconnection_java",
"//base:base_java_test_support",
"//third_party/google-truth:google_truth_java",
]
additional_jar_files = [ [
"sdk/android/tests/resources/robolectric.properties",
"robolectric.properties",
] ]
}
}
}
# ---- Poisons ----
#
# Here is one empty dummy target for each poison type (needed because
# "being poisonous with poison type foo" is implemented as "depends on
# //:poison_foo").
#
# The set of poison_* targets needs to be kept in sync with the
# `all_poison_types` list in webrtc.gni.
#
group("poison_audio_codecs") {
}
group("poison_software_video_codecs") {
}
group("poison_default_task_queue") {
}

68
lib/data/webrtc/CODE_OF_CONDUCT.md

@ -0,0 +1,68 @@
# Contributors Code of Conduct
Google and the WebRTC team are committed to preserving and fostering a diverse, welcoming and open
community. The WebRTC project is open to contributors from all walks of life and should be a
harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender
identity and expression, level of experience, nationality, personal appearance, race, religion, or
sexual identity and orientation.
## Scope
This Code of Conduct applies to our repos and organizations, mailing lists, blog content, and any
other WebRTC-supported communication group, as well as any private communication initiated in the
context of these spaces.
## Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit
permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Responsibilities
You are empowered to politely engage when you feel that you or others are disrespected. The person
making you feel uncomfortable may not be aware of what they are doing - politely bringing their
behavior to their attention is encouraged.
If you are uncomfortable speaking up, or feel that your concerns are not being duly considered, you
can email community@webrtc.org to request involvement from a community manager. All concerns shared
with community managers will be kept confidential. While all reports will be taken seriously, the
WebRTC community managers may not act on complaints that they feel are not violations of this code
of conduct.
## Enforcement
Consequences for failing to comply with this policy may include, at the sole discretion of the
WebRTC community managers:
* a request for an apology;
* a private or public warning or reprimand;
* a temporary ban from the mailing list, blog, WebRTC repository or organization, or other
WebRTC-supported communication group, including loss of committer status;
* a permanent ban from any of the above, or from all current and future WebRTC-supported or
Google-supported communities, including loss of committer status.
Participants warned to stop any harassing behavior are expected to comply immediately; failure to do
so will result in an escalation of consequences.
The decisions of the WebRTC community managers may be appealed via community-appeals@webrtc.org.
## Acknowledgements
This Code of Conduct is based on Contributor Covenant, version 1.4,
available [here](http://contributor-covenant.org/version/1/4) and [Chromium](https://chromium.googlesource.com/chromium/src/+/master/CODE_OF_CONDUCT.md)
## License
This Code of Conduct is available for reuse under the Creative Commons Zero (CC0) license.

2290
lib/data/webrtc/DEPS
File diff suppressed because it is too large
View File

11
lib/data/webrtc/ENG_REVIEW_OWNERS

@ -0,0 +1,11 @@
# Current list of eng reviewers mostly for the purpose of reviewing
# dependencies on third-party directories (because //ENG_REVIEW_OWNERS is
# included by //third_party/OWNERS).
# People listed in this file will only have to coordinate with chromium's eng
# review owners to ensure that the added dependency was OK.
danilchap@webrtc.org
kwiberg@webrtc.org
mbonadei@webrtc.org
phoglund@webrtc.org

29
lib/data/webrtc/LICENSE

@ -0,0 +1,29 @@
Copyright (c) 2011, The WebRTC project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Google nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

23
lib/data/webrtc/OWNERS

@ -0,0 +1,23 @@
henrika@webrtc.org
juberti@webrtc.org
kwiberg@webrtc.org
mflodman@webrtc.org
phoglund@webrtc.org
stefan@webrtc.org
tommi@webrtc.org
per-file .gitignore=*
per-file .gn=mbonadei@webrtc.org
per-file *.gn=mbonadei@webrtc.org
per-file *.gni=mbonadei@webrtc.org
per-file AUTHORS=*
per-file DEPS=*
per-file pylintrc=phoglund@webrtc.org
per-file WATCHLISTS=*
per-file abseil-in-webrtc.md=danilchap@webrtc.org
per-file abseil-in-webrtc.md=kwiberg@webrtc.org
per-file abseil-in-webrtc.md=mbonadei@webrtc.org
per-file style-guide.md=danilchap@webrtc.org
per-file style-guide.md=kwiberg@webrtc.org
per-file native-api.md=kwiberg@webrtc.org
# COMPONENT: Internals>WebRTC

24
lib/data/webrtc/PATENTS

@ -0,0 +1,24 @@
Additional IP Rights Grant (Patents)
"This implementation" means the copyrightable works distributed by
Google as part of the WebRTC code package.
Google hereby grants to you a perpetual, worldwide, non-exclusive,
no-charge, irrevocable (except as stated in this section) patent
license to make, have made, use, offer to sell, sell, import,
transfer, and otherwise run, modify and propagate the contents of this
implementation of the WebRTC code package, where such license applies
only to those patent claims, both currently owned by Google and
acquired in the future, licensable by Google that are necessarily
infringed by this implementation of the WebRTC code package. This
grant does not include claims that would be infringed only as a
consequence of further modification of this implementation. If you or
your agent or exclusive licensee institute or order or agree to the
institution of patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that this
implementation of the WebRTC code package or any code incorporated
within this implementation of the WebRTC code package constitutes
direct or contributory patent infringement, or inducement of patent
infringement, then any patent rights granted to you under this License
for this implementation of the WebRTC code package shall terminate as
of the date such litigation is filed.

1212
lib/data/webrtc/PRESUBMIT.py
File diff suppressed because it is too large
View File

13
lib/data/webrtc/README.chromium

@ -0,0 +1,13 @@
Name: WebRTC
URL: http://www.webrtc.org
Version: 90
License: BSD
License File: LICENSE
Description:
WebRTC provides real time voice and video processing
functionality to enable the implementation of
PeerConnection/MediaStream.
Third party code used in this project is described
in the file LICENSE_THIRD_PARTY.

28
lib/data/webrtc/README.md

@ -0,0 +1,28 @@
**WebRTC is a free, open software project** that provides browsers and mobile
applications with Real-Time Communications (RTC) capabilities via simple APIs.
The WebRTC components have been optimized to best serve this purpose.
**Our mission:** To enable rich, high-quality RTC applications to be
developed for the browser, mobile platforms, and IoT devices, and allow them
all to communicate via a common set of protocols.
The WebRTC initiative is a project supported by Google, Mozilla and Opera,
amongst others.
### Development
See http://www.webrtc.org/native-code/development for instructions on how to get
started developing with the native code.
[Authoritative list](native-api.md) of directories that contain the
native API header files.
### More info
* Official web site: http://www.webrtc.org
* Master source code repo: https://webrtc.googlesource.com/src
* Samples and reference apps: https://github.com/webrtc
* Mailing list: http://groups.google.com/group/discuss-webrtc
* Continuous build: http://build.chromium.org/p/client.webrtc
* [Coding style guide](style-guide.md)
* [Code of conduct](CODE_OF_CONDUCT.md)

190
lib/data/webrtc/WATCHLISTS

@ -0,0 +1,190 @@
# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
# Inspired by chromium.org:
# http://dev.chromium.org/developers/contributing-code/watchlists
{
'WATCHLIST_DEFINITIONS': {
'this_file': {
'filepath': '^WATCHLISTS$',
},
'all_webrtc': {
# NOTE: if you like this you might like webrtc-reviews@webrtc.org!
'filepath': '^.*',
},
'root_files': {
# Non-recursive contents of ./
'filepath': '^[^/]*$',
},
'build_files': {
'filepath': '\.gni$|\.gn$',
},
'java_files': {
'filepath': '\.java$|\.xml$',
},
'api': {
'filepath': 'api/.*',
},
'audio': {
'filepath': 'audio/.*',
},
'base': {
'filepath': 'rtc_base/.*',
},
'call': {
'filepath': 'call/.*',
},
'media_engine': {
'filepath': 'media/engine/.*',
},
'video': {
'filepath': 'video/.*',
},
'common_audio': {
'filepath': 'common_audio/.*',
},
'common_video': {
'filepath': 'common_video/.*',
},
'video_capture': {
'filepath': 'modules/video_capture/.*',
},
'audio_device': {
'filepath': 'modules/audio_device/.*',
},
'audio_coding': {
'filepath': 'modules/audio_coding/.*',
},
'neteq': {
'filepath': 'modules/audio_coding/neteq/.*',
},
'audio_mixer': {
'filepath': 'modules/audio_mixer/.*',
},
'audio_processing': {
'filepath': 'modules/audio_processing/.*',
},
'video_coding': {
'filepath': 'modules/video_coding/.*',
},
'video_processing': {
'filepath': 'modules/video_processing/.*',
},
'bitrate_controller': {
'filepath': 'modules/bitrate_controller/.*'
},
'congestion_controller': {
'filepath': 'modules/congestion_controller/.*'
},
'remote_bitrate_estimator': {
'filepath': 'modules/remote_bitrate_estimator/.*'
},
'pacing': {
'filepath': 'modules/pacing/.*'
},
'rtp_rtcp': {
'filepath': 'modules/rtp_rtcp/.*'
},
'system_wrappers': {
'filepath': 'system_wrappers/.*',
},
'pc': {
'filepath': '^pc/.*',
},
},
'WATCHLISTS': {
'this_file': [],
'all_webrtc': [],
'root_files': ['peah@webrtc.org',
'qiang.lu@intel.com',
'yujie.mao@webrtc.org'],
'build_files': ['mbonadei@webrtc.org'],
'common_audio': ['alessiob@webrtc.org',
'aluebs@webrtc.org',
'audio-team@agora.io',
'minyue@webrtc.org',
'peah@webrtc.org',
'saza@webrtc.org'],
'audio': ['peah@webrtc.org'],
'api': ['kwiberg@webrtc.org','peah@webrtc.org'],
'base': ['kwiberg@webrtc.org',
'benwright@webrtc.org'],
'call': ['mflodman@webrtc.org',
'stefan@webrtc.org'],
'video': ['mflodman@webrtc.org',
'stefan@webrtc.org',
'video-team@agora.io',
'yujie.mao@webrtc.org',
'zhengzhonghou@agora.io'],
'video_capture': ['mflodman@webrtc.org',
'perkj@webrtc.org',
'sdk-team@agora.io',
'zhengzhonghou@agora.io'],
'audio_device': ['audio-team@agora.io',
'henrika@webrtc.org',
'peah@webrtc.org',
'saza@webrtc.org',
'sdk-team@agora.io'],
'audio_coding': ['alessiob@webrtc.org',
'audio-team@agora.io',
'henrik.lundin@webrtc.org',
'kwiberg@webrtc.org',
'minyue@webrtc.org',
'peah@webrtc.org',
'saza@webrtc.org'],
'neteq': ['alessiob@webrtc.org',
'audio-team@agora.io',
'henrik.lundin@webrtc.org',
'minyue@webrtc.org',
'saza@webrtc.org'],
'audio_mixer': ['aleloi@webrtc.org',
'henrik.lundin@webrtc.org',
'peah@webrtc.org',
'saza@webrtc.org'],
'audio_processing': ['alessiob@webrtc.org',
'aluebs@webrtc.org',
'audio-team@agora.io',
'fhernqvist@webrtc.org',
'henrik.lundin@webrtc.org',
'kwiberg@webrtc.org',
'minyue@webrtc.org',
'peah@webrtc.org',
'saza@webrtc.org'],
'video_coding': ['mflodman@webrtc.org',
'stefan@webrtc.org',
'video-team@agora.io',
'zhengzhonghou@agora.io'],
'video_processing': ['stefan@webrtc.org',
'video-team@agora.io',
'zhengzhonghou@agora.io'],
'bitrate_controller': ['mflodman@webrtc.org',
'stefan@webrtc.org',
'srte@webrtc.org',
'zhuangzesen@agora.io'],
'congestion_controller': ['srte@webrtc.org'],
'remote_bitrate_estimator': ['mflodman@webrtc.org',
'stefan@webrtc.org',
'zhuangzesen@agora.io'],
'pacing': ['mflodman@webrtc.org',
'srte@webrtc.org',
'stefan@webrtc.org',
'zhuangzesen@agora.io'],
'rtp_rtcp': ['mflodman@webrtc.org',
'stefan@webrtc.org',
'danilchap@webrtc.org',
'zhuangzesen@agora.io'],
'system_wrappers': ['fengyue@agora.io',
'henrika@webrtc.org',
'mflodman@webrtc.org',
'peah@webrtc.org',
'zhengzhonghou@agora.io'],
'pc': ['steveanton+watch@webrtc.org'],
},
}

63
lib/data/webrtc/abseil-in-webrtc.md

@ -0,0 +1,63 @@
# Using Abseil in WebRTC
You may use a subset of the utilities provided by the [Abseil][abseil]
library when writing WebRTC C++ code. Below, we list the explicitly
*allowed* and the explicitly *disallowed* subsets of Abseil; if you
find yourself in need of something that isn&rsquo;t in either subset,
please add it to the *allowed* subset in this doc in the same CL that
adds the first use.
[abseil]: https://abseil.io/about/
## **Allowed**
* `absl::InlinedVector`
* `absl::WrapUnique`
* `absl::optional` and related stuff from `absl/types/optional.h`.
* `absl::string_view`
* The functions in `absl/strings/ascii.h`, `absl/strings/match.h`,
and `absl/strings/str_replace.h`.
* `absl::is_trivially_copy_constructible`,
`absl::is_trivially_copy_assignable`, and
`absl::is_trivially_destructible` from `absl/meta/type_traits.h`.
* `absl::variant` and related stuff from `absl/types/variant.h`.
* The functions in `absl/algorithm/algorithm.h` and
`absl/algorithm/container.h`.
* The macros in `absl/base/attributes.h`, `absl/base/config.h` and
`absl/base/macros.h`.
## **Disallowed**
### `absl::make_unique`
*Use `std::make_unique` instead.*
### `absl::Mutex`
*Use `rtc::CriticalSection` instead.*
Chromium has a ban on new static initializers, and `absl::Mutex` uses
one. To make `absl::Mutex` available, we would need to nicely ask the
Abseil team to remove that initializer (like they already did for a
spinlock initializer). Additionally, `absl::Mutex` handles time in a
way that may not be compaible with the rest of WebRTC.
### `absl::Span`
*Use `rtc::ArrayView` instead.*
`absl::Span` differs from `rtc::ArrayView` on several points, and both
of them differ from the `std::span` that was voted into
C++20&mdash;and `std::span` is likely to undergo further changes
before C++20 is finalized. We should just keep using `rtc::ArrayView`
and avoid `absl::Span` until C++20 is finalized and the Abseil team
has decided if they will change `absl::Span` to match.
[Bug](https://bugs.webrtc.org/9214).
### `absl::StrCat`, `absl::StrAppend`, `absl::StrJoin`, `absl::StrSplit`
*Use `rtc::SimpleStringBuilder` to build strings.*
These are optimized for speed, not binary size. Even `StrCat` calls
with a modest number of arguments can easily add several hundred bytes
to the binary.

lib/data/webRTC/BUILD.gn → lib/data/webrtc/api/BUILD.gn

lib/data/webRTC/DEPS → lib/data/webrtc/api/DEPS

lib/data/webRTC/DESIGN.md → lib/data/webrtc/api/DESIGN.md

lib/data/webRTC/OWNERS → lib/data/webrtc/api/OWNERS

lib/data/webRTC/README.md → lib/data/webrtc/api/README.md

lib/data/webRTC/array_view.h → lib/data/webrtc/api/array_view.h

lib/data/webRTC/array_view_unittest.cc → lib/data/webrtc/api/array_view_unittest.cc

lib/data/webRTC/async_resolver_factory.h → lib/data/webrtc/api/async_resolver_factory.h

lib/data/webRTC/audio/BUILD.gn → lib/data/webrtc/api/audio/BUILD.gn

lib/data/webRTC/audio/OWNERS → lib/data/webrtc/api/audio/OWNERS

lib/data/webRTC/audio/audio_frame.cc → lib/data/webrtc/api/audio/audio_frame.cc

lib/data/webRTC/audio/audio_frame.h → lib/data/webrtc/api/audio/audio_frame.h

lib/data/webRTC/audio/audio_mixer.h → lib/data/webrtc/api/audio/audio_mixer.h

lib/data/webRTC/audio/channel_layout.cc → lib/data/webrtc/api/audio/channel_layout.cc

lib/data/webRTC/audio/channel_layout.h → lib/data/webrtc/api/audio/channel_layout.h

lib/data/webRTC/audio/echo_canceller3_config.cc → lib/data/webrtc/api/audio/echo_canceller3_config.cc

lib/data/webRTC/audio/echo_canceller3_config.h → lib/data/webrtc/api/audio/echo_canceller3_config.h

lib/data/webRTC/audio/echo_canceller3_config_json.cc → lib/data/webrtc/api/audio/echo_canceller3_config_json.cc

lib/data/webRTC/audio/echo_canceller3_config_json.h → lib/data/webrtc/api/audio/echo_canceller3_config_json.h

lib/data/webRTC/audio/echo_canceller3_factory.cc → lib/data/webrtc/api/audio/echo_canceller3_factory.cc

lib/data/webRTC/audio/echo_canceller3_factory.h → lib/data/webrtc/api/audio/echo_canceller3_factory.h

lib/data/webRTC/audio/echo_control.h → lib/data/webrtc/api/audio/echo_control.h

lib/data/webRTC/audio/test/BUILD.gn → lib/data/webrtc/api/audio/test/BUILD.gn

lib/data/webRTC/audio/test/audio_frame_unittest.cc → lib/data/webrtc/api/audio/test/audio_frame_unittest.cc

lib/data/webRTC/audio/test/echo_canceller3_config_json_unittest.cc → lib/data/webrtc/api/audio/test/echo_canceller3_config_json_unittest.cc

lib/data/webRTC/audio/test/echo_canceller3_config_unittest.cc → lib/data/webrtc/api/audio/test/echo_canceller3_config_unittest.cc

lib/data/webRTC/audio_codecs/BUILD.gn → lib/data/webrtc/api/audio_codecs/BUILD.gn

lib/data/webRTC/audio_codecs/L16/BUILD.gn → lib/data/webrtc/api/audio_codecs/L16/BUILD.gn

lib/data/webRTC/audio_codecs/L16/audio_decoder_L16.cc → lib/data/webrtc/api/audio_codecs/L16/audio_decoder_L16.cc

lib/data/webRTC/audio_codecs/L16/audio_decoder_L16.h → lib/data/webrtc/api/audio_codecs/L16/audio_decoder_L16.h

lib/data/webRTC/audio_codecs/L16/audio_encoder_L16.cc → lib/data/webrtc/api/audio_codecs/L16/audio_encoder_L16.cc

lib/data/webRTC/audio_codecs/L16/audio_encoder_L16.h → lib/data/webrtc/api/audio_codecs/L16/audio_encoder_L16.h

lib/data/webRTC/audio_codecs/OWNERS → lib/data/webrtc/api/audio_codecs/OWNERS

lib/data/webRTC/audio_codecs/audio_codec_pair_id.cc → lib/data/webrtc/api/audio_codecs/audio_codec_pair_id.cc

lib/data/webRTC/audio_codecs/audio_codec_pair_id.h → lib/data/webrtc/api/audio_codecs/audio_codec_pair_id.h

lib/data/webRTC/audio_codecs/audio_decoder.cc → lib/data/webrtc/api/audio_codecs/audio_decoder.cc

lib/data/webRTC/audio_codecs/audio_decoder.h → lib/data/webrtc/api/audio_codecs/audio_decoder.h

lib/data/webRTC/audio_codecs/audio_decoder_factory.h → lib/data/webrtc/api/audio_codecs/audio_decoder_factory.h

lib/data/webRTC/audio_codecs/audio_decoder_factory_template.h → lib/data/webrtc/api/audio_codecs/audio_decoder_factory_template.h

lib/data/webRTC/audio_codecs/audio_encoder.cc → lib/data/webrtc/api/audio_codecs/audio_encoder.cc

lib/data/webRTC/audio_codecs/audio_encoder.h → lib/data/webrtc/api/audio_codecs/audio_encoder.h

lib/data/webRTC/audio_codecs/audio_encoder_factory.h → lib/data/webrtc/api/audio_codecs/audio_encoder_factory.h

lib/data/webRTC/audio_codecs/audio_encoder_factory_template.h → lib/data/webrtc/api/audio_codecs/audio_encoder_factory_template.h

lib/data/webRTC/audio_codecs/audio_format.cc → lib/data/webrtc/api/audio_codecs/audio_format.cc

lib/data/webRTC/audio_codecs/audio_format.h → lib/data/webrtc/api/audio_codecs/audio_format.h

lib/data/webRTC/audio_codecs/builtin_audio_decoder_factory.cc → lib/data/webrtc/api/audio_codecs/builtin_audio_decoder_factory.cc

lib/data/webRTC/audio_codecs/builtin_audio_decoder_factory.h → lib/data/webrtc/api/audio_codecs/builtin_audio_decoder_factory.h

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save