From 4787c975ec6e138a75b9d4b2c071bfb3d3402134 Mon Sep 17 00:00:00 2001 From: Rohit Gupta <rohit.gupta@eurecom.fr> Date: Fri, 7 Oct 2016 18:19:43 +0200 Subject: [PATCH] delete files with GPL License + modify build scripts --- cmake_targets/CMakeLists.txt | 3 +- common/utils/T/tracer/packet-mac-lte.h | 14 - openair2/DOCS/TEMPLATES/README/Readme.doxy | 1 - .../foreign/sockets-2.3.9.4/Ajp13Socket.cpp | 414 -- .../src/foreign/sockets-2.3.9.4/Ajp13Socket.h | 81 - .../foreign/sockets-2.3.9.4/AjpBaseSocket.cpp | 268 - .../foreign/sockets-2.3.9.4/AjpBaseSocket.h | 96 - .../src/foreign/sockets-2.3.9.4/Base64.cpp | 314 - .../src/foreign/sockets-2.3.9.4/Base64.h | 85 - .../src/foreign/sockets-2.3.9.4/Changelog | 855 --- .../src/foreign/sockets-2.3.9.4/Debug.cpp | 103 - .../src/foreign/sockets-2.3.9.4/Debug.h | 87 - .../src/foreign/sockets-2.3.9.4/Event.cpp | 93 - .../src/foreign/sockets-2.3.9.4/Event.h | 83 - .../foreign/sockets-2.3.9.4/EventHandler.cpp | 209 - .../foreign/sockets-2.3.9.4/EventHandler.h | 88 - .../src/foreign/sockets-2.3.9.4/EventTime.cpp | 107 - .../src/foreign/sockets-2.3.9.4/EventTime.h | 84 - .../src/foreign/sockets-2.3.9.4/Exception.cpp | 66 - .../src/foreign/sockets-2.3.9.4/Exception.h | 74 - .../src/foreign/sockets-2.3.9.4/File.cpp | 203 - .../src/foreign/sockets-2.3.9.4/File.h | 95 - .../foreign/sockets-2.3.9.4/FileStream.cpp | 60 - .../src/foreign/sockets-2.3.9.4/FileStream.h | 62 - .../foreign/sockets-2.3.9.4/HTTPSocket.cpp | 519 -- .../src/foreign/sockets-2.3.9.4/HTTPSocket.h | 175 - .../sockets-2.3.9.4/HttpBaseSocket.cpp | 215 - .../foreign/sockets-2.3.9.4/HttpBaseSocket.h | 90 - .../sockets-2.3.9.4/HttpClientSocket.cpp | 312 - .../sockets-2.3.9.4/HttpClientSocket.h | 139 - .../sockets-2.3.9.4/HttpDebugSocket.cpp | 144 - .../foreign/sockets-2.3.9.4/HttpDebugSocket.h | 76 - .../foreign/sockets-2.3.9.4/HttpGetSocket.cpp | 114 - .../foreign/sockets-2.3.9.4/HttpGetSocket.h | 71 - .../sockets-2.3.9.4/HttpPostSocket.cpp | 295 - .../foreign/sockets-2.3.9.4/HttpPostSocket.h | 101 - .../foreign/sockets-2.3.9.4/HttpPutSocket.cpp | 125 - .../foreign/sockets-2.3.9.4/HttpPutSocket.h | 88 - .../foreign/sockets-2.3.9.4/HttpRequest.cpp | 428 -- .../src/foreign/sockets-2.3.9.4/HttpRequest.h | 145 - .../foreign/sockets-2.3.9.4/HttpResponse.cpp | 251 - .../foreign/sockets-2.3.9.4/HttpResponse.h | 99 - .../sockets-2.3.9.4/HttpTransaction.cpp | 262 - .../foreign/sockets-2.3.9.4/HttpTransaction.h | 106 - .../foreign/sockets-2.3.9.4/HttpdCookies.cpp | 287 - .../foreign/sockets-2.3.9.4/HttpdCookies.h | 94 - .../src/foreign/sockets-2.3.9.4/HttpdForm.cpp | 717 -- .../src/foreign/sockets-2.3.9.4/HttpdForm.h | 147 - .../foreign/sockets-2.3.9.4/HttpdSocket.cpp | 326 - .../src/foreign/sockets-2.3.9.4/HttpdSocket.h | 117 - .../src/foreign/sockets-2.3.9.4/IBase.h | 45 - .../foreign/sockets-2.3.9.4/IEventHandler.h | 78 - .../foreign/sockets-2.3.9.4/IEventOwner.cpp | 81 - .../src/foreign/sockets-2.3.9.4/IEventOwner.h | 82 - .../src/foreign/sockets-2.3.9.4/IFile.h | 75 - .../src/foreign/sockets-2.3.9.4/IFileUpload.h | 61 - .../src/foreign/sockets-2.3.9.4/IHttpServer.h | 69 - .../src/foreign/sockets-2.3.9.4/IMutex.h | 58 - .../foreign/sockets-2.3.9.4/ISocketHandler.h | 262 - .../src/foreign/sockets-2.3.9.4/IStream.h | 61 - .../foreign/sockets-2.3.9.4/Ipv4Address.cpp | 223 - .../src/foreign/sockets-2.3.9.4/Ipv4Address.h | 111 - .../foreign/sockets-2.3.9.4/Ipv6Address.cpp | 286 - .../src/foreign/sockets-2.3.9.4/Ipv6Address.h | 120 - .../src/foreign/sockets-2.3.9.4/Json.cpp | 572 -- .../src/foreign/sockets-2.3.9.4/Json.h | 102 - .../foreign/sockets-2.3.9.4/ListenSocket.h | 511 -- .../src/foreign/sockets-2.3.9.4/Lock.cpp | 57 - .../src/foreign/sockets-2.3.9.4/Lock.h | 62 - .../src/foreign/sockets-2.3.9.4/Makefile.am | 44 - .../src/foreign/sockets-2.3.9.4/MemFile.cpp | 349 - .../src/foreign/sockets-2.3.9.4/MemFile.h | 118 - .../src/foreign/sockets-2.3.9.4/Mutex.cpp | 83 - .../src/foreign/sockets-2.3.9.4/Mutex.h | 73 - .../src/foreign/sockets-2.3.9.4/OSX.zip | Bin 16669 -> 0 bytes .../src/foreign/sockets-2.3.9.4/Parse.cpp | 323 - .../src/foreign/sockets-2.3.9.4/Parse.h | 108 - .../src/foreign/sockets-2.3.9.4/README | 90 - .../src/foreign/sockets-2.3.9.4/README.macosx | 9 - .../foreign/sockets-2.3.9.4/ResolvServer.cpp | 99 - .../foreign/sockets-2.3.9.4/ResolvServer.h | 78 - .../foreign/sockets-2.3.9.4/ResolvSocket.cpp | 442 -- .../foreign/sockets-2.3.9.4/ResolvSocket.h | 120 - .../sockets-2.3.9.4/SSLInitializer.cpp | 181 - .../foreign/sockets-2.3.9.4/SSLInitializer.h | 97 - .../foreign/sockets-2.3.9.4/SctpSocket.cpp | 506 -- .../src/foreign/sockets-2.3.9.4/SctpSocket.h | 122 - .../src/foreign/sockets-2.3.9.4/Semaphore.cpp | 123 - .../src/foreign/sockets-2.3.9.4/Semaphore.h | 100 - .../foreign/sockets-2.3.9.4/SmtpdSocket.cpp | 244 - .../src/foreign/sockets-2.3.9.4/SmtpdSocket.h | 171 - .../src/foreign/sockets-2.3.9.4/Socket.cpp | 1875 ----- .../src/foreign/sockets-2.3.9.4/Socket.h | 735 -- .../foreign/sockets-2.3.9.4/SocketAddress.h | 106 - .../foreign/sockets-2.3.9.4/SocketHandler.cpp | 1419 ---- .../foreign/sockets-2.3.9.4/SocketHandler.h | 302 - .../sockets-2.3.9.4/SocketHandlerEp.cpp | 216 - .../foreign/sockets-2.3.9.4/SocketHandlerEp.h | 96 - .../sockets-2.3.9.4/SocketHandlerThread.cpp | 81 - .../sockets-2.3.9.4/SocketHandlerThread.h | 68 - .../foreign/sockets-2.3.9.4/SocketStream.cpp | 69 - .../foreign/sockets-2.3.9.4/SocketStream.h | 67 - .../foreign/sockets-2.3.9.4/SocketThread.cpp | 51 - .../foreign/sockets-2.3.9.4/SocketThread.h | 43 - .../foreign/sockets-2.3.9.4/Sockets-config | Bin 10413 -> 0 bytes .../sockets-2.3.9.4/Sockets-config.cpp | 121 - .../src/foreign/sockets-2.3.9.4/StdLog.h | 76 - .../src/foreign/sockets-2.3.9.4/StdoutLog.cpp | 110 - .../src/foreign/sockets-2.3.9.4/StdoutLog.h | 64 - .../foreign/sockets-2.3.9.4/StreamSocket.cpp | 173 - .../foreign/sockets-2.3.9.4/StreamSocket.h | 142 - .../foreign/sockets-2.3.9.4/StreamWriter.cpp | 100 - .../foreign/sockets-2.3.9.4/StreamWriter.h | 70 - .../src/foreign/sockets-2.3.9.4/TcpSocket.cpp | 1851 ----- .../src/foreign/sockets-2.3.9.4/TcpSocket.h | 370 - .../src/foreign/sockets-2.3.9.4/Thread.cpp | 178 - .../src/foreign/sockets-2.3.9.4/Thread.h | 137 - .../src/foreign/sockets-2.3.9.4/UdpSocket.cpp | 922 --- .../src/foreign/sockets-2.3.9.4/UdpSocket.h | 227 - .../src/foreign/sockets-2.3.9.4/Utility.cpp | 1440 ---- .../src/foreign/sockets-2.3.9.4/Utility.h | 276 - .../foreign/sockets-2.3.9.4/XmlDocument.cpp | 102 - .../src/foreign/sockets-2.3.9.4/XmlDocument.h | 85 - .../foreign/sockets-2.3.9.4/XmlException.cpp | 52 - .../foreign/sockets-2.3.9.4/XmlException.h | 69 - .../src/foreign/sockets-2.3.9.4/XmlNode.cpp | 357 - .../src/foreign/sockets-2.3.9.4/XmlNode.h | 160 - .../src/foreign/sockets-2.3.9.4/ajp13.h | 102 - .../src/foreign/sockets-2.3.9.4/gpl.txt | 340 - .../src/foreign/sockets-2.3.9.4/mkdot.sh | 14 - .../sockets-2.3.9.4/pkgconfig/libSockets.pc | 12 - .../pkgconfig/libSockets.pc.IN | 12 - .../sockets-2.3.9.4/pkgconfig/libsockets2.pc | 12 - .../pkgconfig/libsockets2.pc.IN | 12 - .../sockets-2.3.9.4/socket_include.cpp | 93 - .../foreign/sockets-2.3.9.4/socket_include.h | 305 - .../foreign/sockets-2.3.9.4/sockets-config.h | 110 - .../foreign/sockets-2.3.9.4/tests/Makefile | 95 - .../foreign/sockets-2.3.9.4/tests/base64.cpp | 35 - .../foreign/sockets-2.3.9.4/tests/chunked.cpp | 65 - .../foreign/sockets-2.3.9.4/tests/copy.cpp | 264 - .../foreign/sockets-2.3.9.4/tests/crlf.cpp | 139 - .../sockets-2.3.9.4/tests/echoserver.cpp | 238 - .../foreign/sockets-2.3.9.4/tests/events.cpp | 217 - .../foreign/sockets-2.3.9.4/tests/http.cpp | 72 - .../sockets-2.3.9.4/tests/http_post.cpp | 107 - .../foreign/sockets-2.3.9.4/tests/httpd.cpp | 109 - .../sockets-2.3.9.4/tests/httpd_test.cpp | 214 - .../foreign/sockets-2.3.9.4/tests/https.cpp | 113 - .../foreign/sockets-2.3.9.4/tests/json.cpp | 52 - .../sockets-2.3.9.4/tests/listener.cpp | 152 - .../foreign/sockets-2.3.9.4/tests/resolve.cpp | 156 - .../foreign/sockets-2.3.9.4/tests/resume.cpp | 128 - .../foreign/sockets-2.3.9.4/tests/retry.cpp | 67 - .../foreign/sockets-2.3.9.4/tests/scanr.cpp | 52 - .../foreign/sockets-2.3.9.4/tests/semtest.cpp | 96 - .../sockets-2.3.9.4/tests/sloppy_http.cpp | 58 - .../sockets-2.3.9.4/tests/sockets_test.cpp | 356 - .../sockets-2.3.9.4/tests/stressclient.cpp | 631 -- .../sockets-2.3.9.4/tests/threadstress.cpp | 123 - .../src/foreign/sockets-2.3.9.4/tests/x.cpp | 298 - openair2/UTIL/AT_COMMANDS/COPYING | 674 -- openair2/UTIL/AT_COMMANDS/parser.c | 513 -- openair2/UTIL/AT_COMMANDS/parser.h | 220 - openair2/UTIL/OCG/Readme.doxy | 157 - openair2/UTIL/OMG/TraCIConstants.h | 703 +- openair2/UTIL/OPT/packet-mac-lte.c | 6195 ----------------- openair2/UTIL/OPT/packet-mac-lte.h | 14 - openair2/UTIL/OPT/packet-rlc-lte.h | 150 - openair2/UTIL/OPT/probe.c | 30 - openair2/UTIL/OPT/socket_sender.c | 21 - openair3/NAS/TEST/MSC/mscgen | Bin 197742 -> 0 bytes openair3/TEST/test_util.c | 287 - openair3/TEST/test_util.h | 62 - openair3/UDP/COPYING | 674 -- targets/SCRIPTS/PROFILING/gprof2dot.py | 2780 -------- targets/SCRIPTS/PROFILING/profoai.sh | 46 - 177 files changed, 21 insertions(+), 44948 deletions(-) delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ajp13Socket.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ajp13Socket.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/AjpBaseSocket.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/AjpBaseSocket.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Base64.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Base64.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Changelog delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Debug.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Debug.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Event.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Event.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/EventHandler.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/EventHandler.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/EventTime.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/EventTime.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Exception.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Exception.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/File.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/File.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/FileStream.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/FileStream.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HTTPSocket.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HTTPSocket.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpBaseSocket.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpBaseSocket.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpClientSocket.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpClientSocket.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpDebugSocket.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpDebugSocket.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpGetSocket.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpGetSocket.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpPostSocket.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpPostSocket.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpPutSocket.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpPutSocket.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpRequest.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpRequest.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpResponse.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpResponse.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpTransaction.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpTransaction.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdCookies.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdCookies.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdForm.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdForm.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdSocket.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdSocket.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IBase.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IEventHandler.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IEventOwner.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IEventOwner.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IFile.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IFileUpload.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IHttpServer.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IMutex.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ISocketHandler.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IStream.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ipv4Address.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ipv4Address.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ipv6Address.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ipv6Address.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Json.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Json.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ListenSocket.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Lock.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Lock.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Makefile.am delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/MemFile.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/MemFile.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Mutex.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Mutex.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/OSX.zip delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Parse.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Parse.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/README delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/README.macosx delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ResolvServer.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ResolvServer.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ResolvSocket.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ResolvSocket.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SSLInitializer.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SSLInitializer.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SctpSocket.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SctpSocket.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Semaphore.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Semaphore.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SmtpdSocket.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SmtpdSocket.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Socket.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Socket.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketAddress.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandler.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandler.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandlerEp.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandlerEp.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandlerThread.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandlerThread.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketStream.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketStream.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketThread.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketThread.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Sockets-config delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Sockets-config.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StdLog.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StdoutLog.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StdoutLog.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StreamSocket.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StreamSocket.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StreamWriter.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StreamWriter.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/TcpSocket.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/TcpSocket.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Thread.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Thread.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/UdpSocket.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/UdpSocket.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Utility.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Utility.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlDocument.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlDocument.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlException.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlException.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlNode.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlNode.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ajp13.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/gpl.txt delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/mkdot.sh delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/pkgconfig/libSockets.pc delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/pkgconfig/libSockets.pc.IN delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/pkgconfig/libsockets2.pc delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/pkgconfig/libsockets2.pc.IN delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/socket_include.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/socket_include.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/sockets-config.h delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/Makefile delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/base64.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/chunked.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/copy.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/crlf.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/echoserver.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/events.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/http.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/http_post.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/httpd.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/httpd_test.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/https.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/json.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/listener.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/resolve.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/resume.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/retry.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/scanr.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/semtest.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/sloppy_http.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/sockets_test.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/stressclient.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/threadstress.cpp delete mode 100755 openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/x.cpp delete mode 100644 openair2/UTIL/AT_COMMANDS/COPYING delete mode 100644 openair2/UTIL/AT_COMMANDS/parser.c delete mode 100644 openair2/UTIL/AT_COMMANDS/parser.h delete mode 100644 openair2/UTIL/OCG/Readme.doxy delete mode 100644 openair2/UTIL/OPT/packet-mac-lte.c delete mode 100755 openair2/UTIL/OPT/packet-rlc-lte.h delete mode 100644 openair2/UTIL/OPT/socket_sender.c delete mode 100755 openair3/NAS/TEST/MSC/mscgen delete mode 100644 openair3/TEST/test_util.c delete mode 100644 openair3/TEST/test_util.h delete mode 100644 openair3/UDP/COPYING delete mode 100755 targets/SCRIPTS/PROFILING/gprof2dot.py delete mode 100755 targets/SCRIPTS/PROFILING/profoai.sh diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 0242f89601e..9223a1786dd 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -880,6 +880,7 @@ set(UTIL_SRC ${OPENAIR2_DIR}/UTIL/OMG/omg_hashtable.c ${OPENAIR2_DIR}/UTIL/OMG/rwalk.c ${OPENAIR2_DIR}/UTIL/OMG/rwp.c + ${OPENAIR2_DIR}/UTIL/OMG/sumo.c ${OPENAIR2_DIR}/UTIL/OMG/socket_traci_OMG.c ${OPENAIR2_DIR}/UTIL/OMG/static.c ${OPENAIR2_DIR}/UTIL/OMG/steadystaterwp.c @@ -1797,7 +1798,6 @@ add_executable(oaisim_nos1 ${OPENAIR_TARGETS}/SIMU/USER/oaisim.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR2_DIR}/RRC/NAS/rb_config.c - ${OPENAIR2_DIR}/UTIL/OMG/sumo.c ${OPENAIR_TARGETS}/COMMON/create_tasks.c ${HW_SOURCE} ${TRANSPORT_SOURCE} @@ -1882,7 +1882,6 @@ foreach(myExe s1ap aes128_cmac_encrypt secu_knas_encrypt_eia2) add_executable(test_${myExe} - ${OPENAIR3_DIR}/TEST/test_util.c ${OPENAIR3_DIR}/TEST/test_${myExe}.c ) target_link_libraries (test_${myExe} diff --git a/common/utils/T/tracer/packet-mac-lte.h b/common/utils/T/tracer/packet-mac-lte.h index 039b9dc3c4c..e418f3417eb 100644 --- a/common/utils/T/tracer/packet-mac-lte.h +++ b/common/utils/T/tracer/packet-mac-lte.h @@ -6,20 +6,6 @@ * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * This header file may also be distributed under * the terms of the BSD Licence as follows: * diff --git a/openair2/DOCS/TEMPLATES/README/Readme.doxy b/openair2/DOCS/TEMPLATES/README/Readme.doxy index d45893eceaa..099c51cdf47 100644 --- a/openair2/DOCS/TEMPLATES/README/Readme.doxy +++ b/openair2/DOCS/TEMPLATES/README/Readme.doxy @@ -25,7 +25,6 @@ * \date 2009 * \version 0.1 * \company Eurecom -* \note This conde is under GNU GENERAL PUBLIC LICENSE, version 2, June 1991 * \email: navid.nikaein@eurecom.fr * \warning */ diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ajp13Socket.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ajp13Socket.cpp deleted file mode 100755 index 4b3bbc25372..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ajp13Socket.cpp +++ /dev/null @@ -1,414 +0,0 @@ -/** - ** \file Ajp13Socket.cpp - ** \date 2007-10-05 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include "Ajp13Socket.h" -#include "ajp13.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -#ifdef _DEBUG -#define DEB(x) x -#else -#define DEB(x) -#endif - - -// -------------------------------------------------------------------------------------- -Ajp13Socket::Ajp13Socket(ISocketHandler& h) : AjpBaseSocket(h) -, m_body_size_left(0) -{ -} - - -// -------------------------------------------------------------------------------------- -void Ajp13Socket::OnHeader( short id, short len ) -{ - if (id != 0x1234) - { -DEB( fprintf(stderr, "ABORT: bad packet id: %x\n", id);) - SetCloseAndDelete(); - } - else - { - DEB(fprintf(stderr, "Packet size: %d bytes\n", len);) - } -} - - -// -------------------------------------------------------------------------------------- -void Ajp13Socket::ReceiveBody(const char *buf, size_t sz) -{ - if (sz - 2 > m_body_size_left) - { -DEB( fprintf(stderr, "More body data received than expected\n");) - SetCloseAndDelete(); - return; - } - - m_req.Write( buf + 2, sz - 2 ); - m_body_size_left -= sz - 2; - - // request more body data - if (m_body_size_left) - { - int ptr = 4; - char msg[100]; - msg[0] = 'A'; - msg[1] = 'B'; - -// reply codes -// 0x3 Send Body Chunk -// 0x4 Send Headers -// 0x5 End Response -// 0x6 Get Body Chunk <------ -// 0x9 CPong Reply - - put_byte(msg, ptr, 0x06); // GET_BODY_CHUNK; - put_integer(msg, ptr, 1000); // request 1000 bytes - - short len = htons( ptr - 4 ); - memcpy( msg + 2, &len, 2 ); - - SendBuf( msg, ptr ); - return; - } - - // Close - m_req.CloseBody(); - - // no more body data left to read - execute - Execute(); - -} - - -// -------------------------------------------------------------------------------------- -void Ajp13Socket::ReceiveForwardRequest( const char *buf, size_t sz ) -{ - // - int ptr = 0; - - get_byte(buf, ptr); // skip first byte: prefix_code - unsigned char method = get_byte(buf, ptr); - std::string protocol = get_string(buf, ptr); - std::string req_uri = get_string(buf, ptr); - std::string remote_addr = get_string(buf, ptr); - std::string remote_host = get_string(buf, ptr); - std::string server_name = get_string(buf, ptr); - short server_port = get_integer(buf, ptr); - bool is_ssl = get_boolean(buf, ptr); - - std::string method_str = Utility::l2string( method ); - std::map<int, std::string>::const_iterator it = Init.Method.find( method ); - if (it != Init.Method.end()) - { - method_str = it -> second; - } - m_req.SetHttpMethod( method_str ); - m_req.SetHttpVersion( protocol ); - m_req.SetUri( req_uri ); - m_req.SetRemoteAddr( remote_addr ); - m_req.SetRemoteHost( remote_host ); - m_req.SetServerName( server_name ); - m_req.SetServerPort( server_port ); - m_req.SetIsSsl( is_ssl ); - - // Get Headers - short num_headers = get_integer(buf, ptr); - for (int i = 0; i < num_headers; i++) - { - std::string key; - switch ( (unsigned char)buf[ptr]) // 0xa0 - { - case 0xa0: - { - unsigned short x = (unsigned short)get_integer(buf, ptr); - std::map<int, std::string>::const_iterator it; - if ( (it = Init.Header.find(x)) != Init.Header.end()) - { - key = it -> second; - } - else - { -DEB( fprintf(stderr, "Unknown header key value: %x\n", x);) - SetCloseAndDelete(); - } - } - break; - - default: // string - key = get_string(buf, ptr); - } - if (Utility::ToLower(key) == "cookie" || Utility::ToLower(key) == "cookie2") - m_req.AddCookie(get_string(buf, ptr)); - else - m_req.SetHeader(key, get_string(buf, ptr)); - } // for - - // size left to read from web server - m_body_size_left = m_req.ContentLength(); - - // Get Attributes - while ( (unsigned char)buf[ptr] != 0xff) - { - std::string key; - unsigned char code = buf[ptr++]; - switch ( code) - { - case 10: // req_attribute, attribute name follow - key = get_string(buf, ptr); - break; - default: - { - std::map<int, std::string>::const_iterator it = Init.Attribute.find( code ); - if (it != Init.Attribute.end()) - { - key = it -> second; - } - else - { -DEB( fprintf(stderr, "Unknown attribute key: 0x%02x\n", buf[ptr]);) - SetCloseAndDelete(); - } - } - } - m_req.SetAttribute(key, get_string(buf, ptr)); - } // while - - // execute at once if no body data - if (!m_body_size_left) - { - Execute(); - } - else - { - // open temporary file for body data - m_req.InitBody( m_body_size_left ); - } -} - - -// -------------------------------------------------------------------------------------- -void Ajp13Socket::ReceiveShutdown( const char *buf, size_t sz ) -{ -} - - -// -------------------------------------------------------------------------------------- -void Ajp13Socket::ReceivePing( const char *buf, size_t sz ) -{ -} - - -// -------------------------------------------------------------------------------------- -void Ajp13Socket::ReceiveCPing( const char *buf, size_t sz ) -{ -} - - -// -------------------------------------------------------------------------------------- -void Ajp13Socket::Execute() -{ - // parse form data / query_string and cookie header if available - m_req.ParseBody(); - - // prepare page - OnExec( m_req ); - -} - - -// -------------------------------------------------------------------------------------- -void Ajp13Socket::Respond(const HttpResponse& res) -{ - char msg[8192]; - msg[0] = 'A'; - msg[1] = 'B'; - - m_res = res; - -// reply codes -// 0x3 Send Body Chunk -// 0x4 Send Headers -// 0x5 End Response -// 0x6 Get Body Chunk -// 0x9 CPong Reply - - // check content length - if (!m_res.ContentLength() && m_res.GetFile().size()) - { -// m_res.SetContentLength( m_res.GetFile().size() ); - } - - // Send Headers - { - int ptr = 4; - put_byte(msg, ptr, 0x04); // send headers - put_integer(msg, ptr, m_res.HttpStatusCode() ); - put_string(msg, ptr, m_res.HttpStatusMsg() ); - put_integer(msg, ptr, (short)m_res.Headers().size() ); - for (Utility::ncmap<std::string>::const_iterator it = m_res.Headers().begin(); it != m_res.Headers().end(); ++it) - { - Utility::ncmap<int>::const_iterator it2 = Init.ResponseHeader.find( it -> first ); - if (it2 != Init.ResponseHeader.end()) - { - put_integer(msg, ptr, it2 -> second); - } - else - { - put_string(msg, ptr, it -> first); - } - put_string(msg, ptr, it -> second); - } - std::list<std::string> vec = m_res.CookieNames(); - { - for (std::list<std::string>::iterator it = vec.begin(); it != vec.end(); ++it) - { - Utility::ncmap<int>::const_iterator it2 = Init.ResponseHeader.find( "set-cookie" ); - if (it2 != Init.ResponseHeader.end()) - { - put_integer(msg, ptr, it2 -> second); - } - else - { - put_string(msg, ptr, "set-cookie"); - } - put_string(msg, ptr, m_res.Cookie(*it) ); - } - } - - short len = htons( ptr - 4 ); - memcpy( msg + 2, &len, 2 ); - - SendBuf( msg, ptr ); - } - // Send Body Chunk - OnTransferLimit(); -} - - -// -------------------------------------------------------------------------------------- -void Ajp13Socket::OnTransferLimit() -{ - char msg[8192]; - msg[0] = 'A'; - msg[1] = 'B'; - - // Send Body Chunk - size_t n = m_res.GetFile().fread(msg + 7, 1, 8100); - while (n > 0) - { - int ptr = 4; - put_byte(msg, ptr, 0x03); // send body chunk - put_integer(msg, ptr, (short)n); - ptr += (int)n; - - short len = htons( ptr - 4 ); - memcpy( msg + 2, &len, 2 ); - - SendBuf( msg, ptr ); - if (GetOutputLength() > 1) - { - SetTransferLimit( 1 ); - break; - } - - // - n = m_res.GetFile().fread(msg + 7, 1, 8100); - } - if (!GetOutputLength()) // all body data sent and no data in output buffer - send end response - { - // End Response - int ptr = 4; - put_byte(msg, ptr, 0x05); // end response - put_boolean(msg, ptr, false); // reuse - /* - don't reuse - - but with m_req.Reset() and m_res.Reset() it should be possible - - also reset any AjpBaseSocket/Ajp13Socket specific states - */ - - short len = htons( ptr - 4 ); - memcpy( msg + 2, &len, 2 ); - - SendBuf( msg, ptr ); - - SetTransferLimit(0); - m_res.GetFile().fclose(); - OnResponseComplete(); - } -} - - -// -------------------------------------------------------------------------------------- -void Ajp13Socket::OnPacket( const char *buf, size_t sz ) -{ - DEB(fprintf(stderr, "OnPacket: %d bytes, code 0x%02x %02x %02x %02x\n", sz, *buf, buf[1], buf[2], buf[3]);) - - // check body size left to read, if non-zero packet is body data - if (m_body_size_left) // must be a body packet - { - ReceiveBody(buf, sz); - return; - } - switch (*buf) - { - case 0x2: // Forward Request - ReceiveForwardRequest(buf, sz); - break; - case 0x7: // Shutdown - ReceiveShutdown(buf, sz); - break; - case 0x8: // Ping - ReceivePing(buf, sz); - break; - case 0xa: // CPing - ReceiveCPing(buf, sz); - break; - default: -DEB( fprintf(stderr, "Unknown packet type: 0x%02x\n", *buf);) - SetCloseAndDelete(); - } - -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ajp13Socket.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ajp13Socket.h deleted file mode 100755 index 14033b48d91..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ajp13Socket.h +++ /dev/null @@ -1,81 +0,0 @@ -/** - ** \file Ajp13Socket.h - ** \date 2007-10-05 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Ajp13Socket_H -#define _SOCKETS_Ajp13Socket_H - -#include "AjpBaseSocket.h" -#include "HttpRequest.h" -#include "IHttpServer.h" -#include "HttpResponse.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -class HttpResponse; - -class Ajp13Socket : public AjpBaseSocket, public IHttpServer -{ -public: - Ajp13Socket(ISocketHandler& h); - - void OnHeader( short id, short len ); - void OnPacket( const char *buf, size_t sz ); - - // implements IHttpServer::Respond - void Respond(const HttpResponse& res); - - void OnTransferLimit(); - -private: - void ReceiveBody( const char *buf, size_t sz ); - void ReceiveForwardRequest( const char *buf, size_t sz ); - void ReceiveShutdown( const char *buf, size_t sz ); - void ReceivePing( const char *buf, size_t sz ); - void ReceiveCPing( const char *buf, size_t sz ); - void Execute(); - // - size_t m_body_size_left; - HttpRequest m_req; - HttpResponse m_res; -}; - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - -#endif // _SOCKETS_Ajp13Socket_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/AjpBaseSocket.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/AjpBaseSocket.cpp deleted file mode 100755 index 784f5d78faf..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/AjpBaseSocket.cpp +++ /dev/null @@ -1,268 +0,0 @@ -/** - ** \file AjpBaseSocket.cpp - ** \date 2007-10-05 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include "AjpBaseSocket.h" -#include "ajp13.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -#ifdef _DEBUG -#define DEB(x) x -#else -#define DEB(x) -#endif - - -// --------------------------------------------------------------------------- -AjpBaseSocket::Initializer AjpBaseSocket::Init; - - -// --------------------------------------------------------------------------- -AjpBaseSocket::Initializer::Initializer() -{ - - Header[HTTP_REQUEST_ACCEPT] = "accept"; - Header[HTTP_REQUEST_ACCEPT_CHARSET] = "accept-charset"; - Header[HTTP_REQUEST_ACCEPT_ENCODING] = "accept-encoding"; - Header[HTTP_REQUEST_ACCEPT_LANGUAGE] = "accept-language"; - Header[HTTP_REQUEST_AUTHORIZATION] = "authorization"; - Header[HTTP_REQUEST_CONNECTION] = "connection"; - Header[HTTP_REQUEST_CONTENT_TYPE] = "content-type"; - Header[HTTP_REQUEST_CONTENT_LENGTH] = "content-length"; - Header[HTTP_REQUEST_COOKIE] = "cookie"; - Header[HTTP_REQUEST_COOKIE2] = "cookie2"; - Header[HTTP_REQUEST_HOST] = "host"; - Header[HTTP_REQUEST_PRAGMA] = "pragma"; - Header[HTTP_REQUEST_REFERER] = "referer"; - Header[HTTP_REQUEST_USER_AGENT] = "user-agent"; - - Method[HTTP_METHOD_OPTIONS] = "OPTIONS"; - Method[HTTP_METHOD_GET] = "GET"; - Method[HTTP_METHOD_HEAD] = "HEAD"; - Method[HTTP_METHOD_POST] = "POST"; - Method[HTTP_METHOD_PUT] = "PUT"; - Method[HTTP_METHOD_DELETE] = "DELETE"; - Method[HTTP_METHOD_TRACE] = "TRACE"; - Method[HTTP_METHOD_PROPFIND] = "PROPFIND"; - Method[HTTP_METHOD_PROPPATCH] = "PROPPATCH"; - Method[HTTP_METHOD_MKCOL] = "MKCOL"; - Method[HTTP_METHOD_COPY] = "COPY"; - Method[HTTP_METHOD_MOVE] = "MOVE"; - Method[HTTP_METHOD_LOCK] = "LOCK"; - Method[HTTP_METHOD_UNLOCK] = "UNLOCK"; - Method[HTTP_METHOD_ACL] = "ACL"; - Method[HTTP_METHOD_REPORT] = "REPORT"; - Method[HTTP_METHOD_VERSION_CONTROL] = "VERSION_CONTROL"; // with a dash "VERSION-CONTROL" - Method[HTTP_METHOD_CHECKIN] = "CHECKIN"; - Method[HTTP_METHOD_CHECKOUT] = "CHECKOUT"; - Method[HTTP_METHOD_UNCHECKOUT] = "UNCHECKOUT"; - Method[HTTP_METHOD_SEARCH] = "SEARCH"; - Method[HTTP_METHOD_MKWORKSPACE] = "MKWORKSPACE"; - Method[HTTP_METHOD_UPDATE] = "UPDATE"; - Method[HTTP_METHOD_LABEL] = "LABEL"; - Method[HTTP_METHOD_MERGE] = "MERGE"; - Method[HTTP_METHOD_BASELINE_CONTROL] = "BASELINE_CONTROL"; - Method[HTTP_METHOD_MKACTIVITY] = "MKACTIVITY"; - - Attribute[ATTR_CONTEXT] = "context"; - Attribute[ATTR_SERVLET_PATH] = "servlet_path"; - Attribute[ATTR_REMOTE_USER] = "remote_user"; - Attribute[ATTR_AUTH_TYPE] = "auth_type"; - Attribute[ATTR_QUERY_STRING] = "query_string"; - Attribute[ATTR_ROUTE] = "route"; - Attribute[ATTR_SSL_CERT] = "ssl_cert"; - Attribute[ATTR_SSL_CIPHER] = "ssl_cipher"; - Attribute[ATTR_SSL_SESSION] = "ssl_session"; - Attribute[ATTR_SSL_KEY_SIZE] = "ssl_key_size"; - Attribute[ATTR_SECRET] = "secret"; - Attribute[ATTR_STORED_METHOD] = "stored_method"; - - ResponseHeader["content-type"] = 0xa001; - ResponseHeader["content-language"] = 0xa002; - ResponseHeader["content-length"] = 0xa003; - ResponseHeader["date"] = 0xa004; - ResponseHeader["last-modified"] = 0xa005; - ResponseHeader["location"] = 0xa006; - ResponseHeader["set-cookie"] = 0xa007; - ResponseHeader["set-cookie2"] = 0xa008; - ResponseHeader["servlet-engine"] = 0xa009; - ResponseHeader["status"] = 0xa00a; - ResponseHeader["www-authenticate"] = 0xa00b; -} - - -// --------------------------------------------------------------------------- -AjpBaseSocket::AjpBaseSocket(ISocketHandler& h) : TcpSocket(h) -, m_state(0) -, m_length(4) -, m_ptr(0) -{ -} - - -// --------------------------------------------------------------------------- -void AjpBaseSocket::OnRawData(const char *buf, size_t sz) -{ -DEB(fprintf(stderr, "OnRawData: %d bytes\n", sz);) - size_t ptr = 0; - while (true) - { - size_t left = sz - ptr; -DEB(fprintf(stderr, " left: %d bytes\n", left); -fprintf(stderr, " state: %d\n", m_state);) - switch (m_state) - { - case 0: - { - size_t missing = m_length - m_ptr; - short len = (short)(missing < left ? missing : left); - memcpy(m_message + m_ptr, buf + ptr, len); - m_ptr += len; - ptr += len; - if (m_ptr < m_length) - { - return; // read more - } - int p = 0; - short id = get_integer(m_message, p); - short length = get_integer(m_message, p); - OnHeader(id, length); - m_state = 1; - m_length = length; - m_ptr = 0; // bytes in m_message - } - break; - case 1: - { - size_t missing = m_length - m_ptr; - short len = (short)(missing < left ? missing : left); - memcpy(m_message + m_ptr, buf + ptr, len); - m_ptr += len; - ptr += len; - if (m_ptr < m_length) - { - return; // read more - } - OnPacket(m_message, m_ptr); - m_state = 0; - m_length = 4; - m_ptr = 0; - } - break; - } - } -} - - -// --------------------------------------------------------------------------- -unsigned char AjpBaseSocket::get_byte(const char *buf, int& ptr) -{ - return (unsigned char)buf[ptr++]; -} - - -// --------------------------------------------------------------------------- -bool AjpBaseSocket::get_boolean(const char *buf, int& ptr) -{ - return ( (unsigned char)buf[ptr++] & 1) == 1 ? true : false; -} - - -// --------------------------------------------------------------------------- -short AjpBaseSocket::get_integer(const char *buf, int& ptr) -{ - short n; - memcpy(&n, buf + ptr, 2); - ptr += 2; - return ntohs(n); -} - - -// --------------------------------------------------------------------------- -std::string AjpBaseSocket::get_string(const char *buf, int& ptr) -{ - short len = get_integer(buf, ptr); - if (len != -1) - { - std::string tmp = buf + ptr; - ptr += len; - ptr++; // skip trailing 0x0 - tmp.resize(len); - return tmp; - } - return ""; -} - - -// --------------------------------------------------------------------------- -void AjpBaseSocket::put_byte(char *buf, int& ptr, unsigned char zz) -{ - buf[ptr++] = zz; -} - - -// --------------------------------------------------------------------------- -void AjpBaseSocket::put_boolean(char *buf, int& ptr, bool zz) -{ - buf[ptr++] = zz ? 1 : 0; -} - - -// --------------------------------------------------------------------------- -void AjpBaseSocket::put_integer(char *buf, int& ptr, short zz) -{ - short tmp = htons(zz); - memcpy(buf + ptr, &tmp, 2); - ptr += 2; -} - - -// --------------------------------------------------------------------------- -void AjpBaseSocket::put_string(char *buf, int& ptr, const std::string& zz) -{ - put_integer(buf, ptr, (short)zz.size() ); - memcpy(buf + ptr, zz.c_str(), zz.size()); - ptr += (int)zz.size(); - put_byte(buf, ptr, 0); -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/AjpBaseSocket.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/AjpBaseSocket.h deleted file mode 100755 index 74d3939ed25..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/AjpBaseSocket.h +++ /dev/null @@ -1,96 +0,0 @@ -/** - ** \file AjpBaseSocket.h - ** \date 2007-10-05 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_AjpBaseSocket_H -#define _SOCKETS_AjpBaseSocket_H - -#include "TcpSocket.h" -#include <map> -#include "Utility.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -class AjpBaseSocket : public TcpSocket -{ - class Initializer - { - public: - Initializer(); - virtual ~Initializer() {} - - std::map<int, std::string> Method; - std::map<int, std::string> Header; - std::map<int, std::string> Attribute; - - Utility::ncmap<int> ResponseHeader; - - }; - -public: - AjpBaseSocket(ISocketHandler& h); - - void OnRawData(const char *buf, size_t sz); - - virtual void OnHeader( short id, short len ) = 0; - virtual void OnPacket( const char *buf, size_t sz ) = 0; - -protected: - unsigned char get_byte(const char *buf, int& ptr); - bool get_boolean(const char *buf, int& ptr); - short get_integer(const char *buf, int& ptr); - std::string get_string(const char *buf, int& ptr); - - void put_byte(char *buf, int& ptr, unsigned char zz); - void put_boolean(char *buf, int& ptr, bool zz); - void put_integer(char *buf, int& ptr, short zz); - void put_string(char *buf, int& ptr, const std::string& zz); - - static Initializer Init; - -private: - int m_state; - int m_length; - int m_ptr; - char m_message[8192]; -}; - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - -#endif // _SOCKETS_AjpBaseSocket_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Base64.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Base64.cpp deleted file mode 100755 index 1a2286ce2c5..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Base64.cpp +++ /dev/null @@ -1,314 +0,0 @@ -/** \file Base64.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "Base64.h" -#include "IFile.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -const char *Base64::bstr = - "ABCDEFGHIJKLMNOPQ" - "RSTUVWXYZabcdefgh" - "ijklmnopqrstuvwxy" - "z0123456789+/"; - -const char Base64::rstr[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, - 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0}; - - -Base64::Base64() -{ -} - - -void Base64::encode(IFile *fil, std::string& output, bool add_crlf) -{ - size_t remain; - size_t i = 0; - size_t o = 0; - char input[4]; - - output = ""; - remain = fil -> fread(input,1,3); - while (remain > 0) - { - if (add_crlf && o && o % 76 == 0) - output += "\n"; - switch (remain) - { - case 1: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) ]; - output += "=="; - break; - case 2: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) ]; - output += "="; - break; - default: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) + ((input[i + 2] >> 6) & 0x03) ]; - output += bstr[ (input[i + 2] & 0x3f) ]; - } - o += 4; - // - remain = fil -> fread(input,1,3); - } -} - - -void Base64::encode(FILE *fil, std::string& output, bool add_crlf) -{ - size_t remain; - size_t i = 0; - size_t o = 0; - char input[4]; - - output = ""; - remain = fread(input,1,3,fil); - while (remain > 0) - { - if (add_crlf && o && o % 76 == 0) - output += "\n"; - switch (remain) - { - case 1: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) ]; - output += "=="; - break; - case 2: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) ]; - output += "="; - break; - default: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) + ((input[i + 2] >> 6) & 0x03) ]; - output += bstr[ (input[i + 2] & 0x3f) ]; - } - o += 4; - // - remain = fread(input,1,3,fil); - } -} - - -void Base64::encode(const std::string& str_in, std::string& str_out, bool add_crlf) -{ - encode(str_in.c_str(), str_in.size(), str_out, add_crlf); -} - - -void Base64::encode(const char* input,size_t l,std::string& output, bool add_crlf) -{ - size_t i = 0; - size_t o = 0; - - output = ""; - while (i < l) - { - size_t remain = l - i; - if (add_crlf && o && o % 76 == 0) - output += "\n"; - switch (remain) - { - case 1: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) ]; - output += "=="; - break; - case 2: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) ]; - output += "="; - break; - default: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) + ((input[i + 2] >> 6) & 0x03) ]; - output += bstr[ (input[i + 2] & 0x3f) ]; - } - o += 4; - i += 3; - } -} - - -void Base64::encode(const unsigned char* input,size_t l,std::string& output,bool add_crlf) -{ - size_t i = 0; - size_t o = 0; - - output = ""; - while (i < l) - { - size_t remain = l - i; - if (add_crlf && o && o % 76 == 0) - output += "\n"; - switch (remain) - { - case 1: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) ]; - output += "=="; - break; - case 2: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) ]; - output += "="; - break; - default: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) + ((input[i + 2] >> 6) & 0x03) ]; - output += bstr[ (input[i + 2] & 0x3f) ]; - } - o += 4; - i += 3; - } -} - - -void Base64::decode(const std::string& input,std::string& output) -{ - size_t i = 0; - size_t l = input.size(); - - output = ""; - while (i < l) - { - while (i < l && (input[i] == 13 || input[i] == 10)) - i++; - if (i < l) - { - char b1 = (char)((rstr[(int)input[i]] << 2 & 0xfc) + - (rstr[(int)input[i + 1]] >> 4 & 0x03)); - output += b1; - if (input[i + 2] != '=') - { - char b2 = (char)((rstr[(int)input[i + 1]] << 4 & 0xf0) + - (rstr[(int)input[i + 2]] >> 2 & 0x0f)); - output += b2; - } - if (input[i + 3] != '=') - { - char b3 = (char)((rstr[(int)input[i + 2]] << 6 & 0xc0) + - rstr[(int)input[i + 3]]); - output += b3; - } - i += 4; - } - } -} - - -void Base64::decode(const std::string& input, unsigned char *output, size_t& sz) -{ - size_t i = 0; - size_t l = input.size(); - size_t j = 0; - - while (i < l) - { - while (i < l && (input[i] == 13 || input[i] == 10)) - i++; - if (i < l) - { - unsigned char b1 = (unsigned char)((rstr[(int)input[i]] << 2 & 0xfc) + - (rstr[(int)input[i + 1]] >> 4 & 0x03)); - if (output) - { - output[j] = b1; - } - j++; - if (input[i + 2] != '=') - { - unsigned char b2 = (unsigned char)((rstr[(int)input[i + 1]] << 4 & 0xf0) + - (rstr[(int)input[i + 2]] >> 2 & 0x0f)); - if (output) - { - output[j] = b2; - } - j++; - } - if (input[i + 3] != '=') - { - unsigned char b3 = (unsigned char)((rstr[(int)input[i + 2]] << 6 & 0xc0) + - rstr[(int)input[i + 3]]); - if (output) - { - output[j] = b3; - } - j++; - } - i += 4; - } - } - sz = j; -} - - -size_t Base64::decode_length(const std::string& str64) -{ - if (!str64.size() || str64.size() % 4) - return 0; - size_t l = 3 * (str64.size() / 4 - 1) + 1; - if (str64[str64.size() - 2] != '=') - l++; - if (str64[str64.size() - 1] != '=') - l++; - return l; -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Base64.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Base64.h deleted file mode 100755 index b1711f252e7..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Base64.h +++ /dev/null @@ -1,85 +0,0 @@ -/** \file Base64.h - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Base64_H -#define _SOCKETS_Base64_H - -#include "sockets-config.h" -#ifdef _MSC_VER -#pragma warning(disable:4514) -#endif - -#include <stdio.h> -#include <string> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -class IFile; - -/** \defgroup util Utilities */ - -/** Base64 encode/decode. - \ingroup util */ -class Base64 -{ -public: - Base64(); - - void encode(FILE *, std::string& , bool add_crlf = true); - void encode(IFile *, std::string& , bool add_crlf = true); - void encode(const std::string&, std::string& , bool add_crlf = true); - void encode(const char *, size_t, std::string& , bool add_crlf = true); - void encode(const unsigned char *, size_t, std::string& , bool add_crlf = true); - - void decode(const std::string&, std::string& ); - void decode(const std::string&, unsigned char *, size_t&); - - size_t decode_length(const std::string& ); - -private: - Base64(const Base64& ) {} - Base64& operator=(const Base64& ) { - return *this; - } - static const char *bstr; - static const char rstr[128]; -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_Base64_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Changelog b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Changelog deleted file mode 100755 index 044be458ec0..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Changelog +++ /dev/null @@ -1,855 +0,0 @@ -diff for next release always available @ http://www.alhem.net/Sockets/latest_diff.html - -next --------- - - -2.3.9.4 --------- -File can be created using an existing FILE *. Fix bug in File using wrong -file ptr when writing. -Added HttpdForm constructor (FILE *) that detects cgi input using -environment variables. -Added HttpRequest constructor (FILE *) that can parse a cgi request. -Added missing sockets namespace in SocketThread class files. -Added new operator <<(int64_t) in StreamWriter. Might be ambigouos on some -architectures. -Fix expression evaluation in TcpSocket, causing access to null pointer. -Fix disable of both reconnect and detach functions. -Added Utility::bigint2string(int64_t). -Added Json support. - -2.3.9.3 --------- -Added multithread support in sockethandler. New method SetNumberOfThreads() -enables this. -New method in sockethandler: Release(). Make select() release before -specified timeout. Enable function with method EnableRelease(). -EventHandler using new release functionality. -Thread startup controlled with semaphore instead of flag/sleep combo. -Default thread startup behaviour is run at once, optional is wait until -released by posting to semaphore (via method SetRelease(true)). -Adding a socket with closeanddelete flag set now works as expected. -Added platform independent method Utility::Sleep( milliseconds ). -Added missing win32 implementation in new sockethandler. -Added win32 implementation of Semaphore. -Repaired build for cygwin/mingw/devcpp. - -2.3.9.2 --------- -More internal restructuring of SocketHandler. -The Get() method has been removed. Set() has been split into three: -ISocketHandler_Add(), ISocketHandler_Mod(), and ISocketHandler_Del(). -New methods defined in ISocketHandler interface to support different -models of socket io: ISocketHandler_Select(), MaxCount(). -Removed Set() method from Socket class. -Implemented SocketHandlerEp using epoll for linux only. -reinterpret_cast<> added in ListenSocket for ipv6 address struct. -HttpPostSocket member variable holding http headers (m_fields) is now -protected (changed from private). -Repaired Reconnect function in sockethandler. - -2.3.9.1 --------- -Using thread- and memory safe clib/c runtime function when possible. -Restructured sockethandler internals. -Quicker tcp shutdown sequence when sockets lib initiates close. -Renamed Utility::GetCurrentDirectory to Utility::CurrentDirectory, and -added Utility::GetEnv(). -Removed unused triggers code. - -2.3.9 ------- -TcpSocket using std::vector<char> to receive incoming line (OnLine -callback). Configurable max limit for library available in sockets-config.h, -default 8192 bytes (TCP_LINE_SIZE). Override ISocketHandler::MaxTcpLineSize -to change this value without recompiling the library. -Added more operators in Debug class. Removed some leftover debug printouts. -HttpResponse returns non-const output file. -HTTPSocket aborts after receiving more than 200 (MAX_HTTP_HEADER_COUNT) http -headers. Use method HTTPSocket::SetMaxHeaderCount() to modify this value. -Reordered log level enum, added minlevel to StdoutLog. - -2.3.8 ------- -SSL sockets now operate in nonblocking mode. A much better solution to the -"hang" problem mentioned in 2.3.7. -Added Path() method to IFile interface. Returns File path name or MemFile -virtual path name. -Added constructor in MemFile that takes a File as input. Will read the -entire File to memory. Added constructor in MemFile that copies another -memfile. Will use the source memfile when reading. -Added reference count when a MemFile object is source for another memfile. - -Set OnTransferLimit back to 0 after a successful transfer of requested file -(in Ajp13Socket and HttpBaseSocket). Reset IFile auto_ptr to -decrease the reference count asap (by using fclose). - -2.3.7 ------- -Moved some #include's outside the sockets namespace definition. -Fix code to avoid an increment on an stl iterator that has reached end. -Helping compilers deal with it++ when result is not used, changed all it++ -to ++it where appropriate. -Doing an extra select on write readiness on file descriptor before calling -SSL_write. Prevents a hang situation when the remote end drops the -connection. - -2.3.6 ------- -Added improved Valid() method using unique socket instance identifier. Using -this identifier internally for events and resolver. Added optional data -parameter in Event class, used by library to store socket instance -identifier. -No longer using SSL_MODE_AUTO_RETRY for ssl connections. If remote end -disconnects this would cause hangups. -Using SSL_MODE_ENABLE_PARTIAL_WRITE because the library supports this. -Renamed EventHandler() method in IEventOwner to GetEventHandler(). -Added file system path abstraction methods to Utility. -Reset file descriptor after successful close of a ListenSocket. - -2.3.5 ------- -Added method(s) in UdpSocket to set default interface to be used for multicast. -Added flag for position independent code for linux-x86-32 architecture (see -Makefile.Defines.linux-x86-32). -Added missing includes (on some distributions/gcc versions). -SetUri in HttpRequest no longer URLDecodes the entire url. -Fix for static variables in SSLInitializer. -Fix for new version of openssl (const SSLxx_method()). -Fix for getnameinfo. -Modified Utility::Uri parser class so it also splits the url in path / -querystring parts. - -2.3.4 ------- -Some .cpp were missing namespace declarations - fixed. Some includes for -ipv6 was missing - fixed. Operators in StreamWriter class modified to work -on 64-bit as well as 32-bit systems. - -2.3.3 ------- -Fix deadlock in SSLInitializer introduced in 2.3.2. -Added check when select() returns -1 indicating one of the file descriptors -have gone bad. The check rebuilds the fd_set used by select(). -Bugfix in HttpGetSocket, one of the constructors had no support in -HttpClientSocket - added. -Corrected bad #include's in Utility. -Added IStream interface to read/write from socket and IFile (memfile, normal -file). New classes SocketStream, FileStream, StreamWriter. -Added ReadInput method in TcpSocket - read from input buffer. -Added GetLine method in TcpSocket - chars input on current line when using -SetLineProtocol mode. - -2.3.2 ------- -Threadsafe list of ssl initializer, ssl contexts and openssl error text -retrieval. -Added interface for Mutex class, adding the possibility for others to -implement the mutex functionality using other approaches. -Moved FromUtf8 method from XmlNode to Utility. - -2.3.1 ------- -Request: Remove() method in SocketHandler changed from private to protected. -Added Utility::Stack that returns a stack walk (currently linux only). -Request: Added $(DESTDIR) variable in Makefile for more flexible installation. -The timeout value is now reset before OnTimeout() is called, making it -possible to set a new timeout value in the OnTimeout() method. - -2.3 ------- -Small change in ListenSocket<> to improve accepting of incoming -connections. -Added xml parsing classes: XmlDocument, XmlNode, and XmlException. -Added new OnDisconnect(flags, code) callback that provides reason -for the disconnect. -Fix crash bug if an event object gets deleted in its own OnEvent -method. -gcc 4.3 compability fixes. - -2.2.9a ------- -Added assignment operator on HttpRequest class. -HttpdForm sometimes got stuck in an infinite loop - fixed. -Lock using const Mutex, and Mutex modified to work when const. -Added Utility::Uri that can be used for parsing of an url. - -2.2.9 ------ -Fixed memory leak in TcpSocket. -Fixed potentially unsafe code in http form data parser (HttpdForm). -Fix memory and resource leak in HttpRequest. -Ajp13Socket/HttpBaseSocket now creates a copy of the HttpResponse -instance when sending a response, to avoid synchronization problems. -Added "lost" flag which is set when a tcpsocket has lost connection -unexpectedly (on read/write error). Earlier this function was only -present when the connection pool was enabled (ENABLE_POOL). -Removed unnecessary call to shutdown() when destroying a closed -tcp socket. -Added brief 'INSTALL' document. - -2.2.8 ------ -Added http client ability to receive a chunked response. -HTTP headers are now treated in a case insensitive manner. -MacOS leopard fixes. -Added callback "OnDataComplete" to HTTPSocket, which is called -when the full body of the request/response has been received. -New random generator (mersienne twister). - -2.2.7 ------ -Http header names no longer converted to lowercase. -"setsockopt()" wrapper methods returning int values has been fixed. -No longer sets query_string attribute of HttpRequest when there is no -query string present. - -2.2.6 ------ -Modified HttpRequest class to easier add support for pipelining. -Made the following classes work with the copy constructor: HttpRequest, -HttpTransaction, HttpdCookies. -Always adding http header names as lowercase in internal storage -(HTTPSocket). Added method to check if http header is set. -Changed IHttpServer interface to better separate request and response. -Added -mno-cygwin flag in Makefile defines for cygwin. -Added calls to OnDisconnect when socket operation caused socket to close. - -2.2.5 ------ -A basic_string exception thrown while trying to access the first -(non-existing) element in a zero-sized string was fixed in HTTPSocket. -Added separate http_version for HttpResponse. Improved reset of state -information in HTTPSocket and derivates (for keep-alive connections). -MemFile support reads and writes larger than internal blocksize. - -2.2.4 ------ -IFile (File/MemFile) added reset_read and reset_write. -Bugfix MemFile read. -UdpSocket timestamp small fix for win32. -Cookies reworked in Http framework (Transaction/Request/Response -and HttpBaseSocket/Ajp13Socket). -Compile issue when compiling without openssl solved. - -2.2.3 ------ -SSL Handshake was never initiated when using both client and server from the -library - fixed. -UdpSocket read timestamp added (SetTimestamp) as new OnRawData method. Use -when timestamps enabled with call to SetSoTimestamp. Not win32. -MacOSX project added. Big Thanks to Bruce for both of these. - -2.2.2 ------ -Close file descriptor in File destructor. -HttpClientSocket new access method Filename. -Added a few access methods to HttpdSocket. -Check if gethostbyname_r failed. -Async resolver fix. -Fix win32 build problem (uint64_t). - -2.2.1 ------ -Adding (optional) exceptions when Bind() or CreateSocket() fails. -Enable with ENABLE_EXCEPTIONS. -Added GetSock* methods in Socket, to retreive information about local -port and address in a connection. -Added InitializeContext in TcpSocket with separate certificate / key files. -Moved some #include's from .h to .cpp files. -Removed multiple calls to recvfrom() in UdpSocket OnRead. -HTTPSocket corrected. - -2.2 ------ -TcpSocket output buffer error fixed. -HTTPSocket HTTP/1.0 request (or HTTP/1.1 with connection: close) fixed. -IEventHandler now won't crash if the IEventOwner is deleted in OnEvent. -Added Ajp13Socket that understands the ajp/1.3 protocol. Each request received -by the class results in an "OnExec(HttpRequest, HttpResponse)" call. -Added "HttpBaseSocket" that also use the "OnExec" method to process a -http/https request. - -2.1.9 ------ -Added exception class. -Changed platform selection in Unix Makefile. -Cleaner compile on mingw. -HTTPSocket supports keepalive. -OnDisconnect moved out of ENABLE_RECONNECT scope. - -2.1.8 ------ -Added missing (optional) namespace in SmtpdSocket. -TcpSocket: Calling OnDisconnect when reading 0 bytes. -TcpSocket: Added OnTransferLimit() callback, called when output buffer -size drops below limit set by SetTransferLimit(). -Boundary bug (writes over two blocks failed) in MemFile fixed. -Member variables in SSLInitializer no longer static since SSLInitializer -in itself is static in TcpSocket (avoid potential problem with -initialization order of static's). - -2.1.7 ------ -Fatal bug in LineProtocol/Online found, when a crlf happens over a read -buffer boundary. FIXED. -New output buffer logic. OnWriteComplete callback added, which fires after -the output buffer has been transferred. - -2.1.6 ------ -No more random number generator in Socket. Random number generator used in -Utility changed to static. -ISocketHandler is now a pure virtual definition of the SocketHandler. -Added general purpose timeout to Socket class (SetTimeout, OnTimeout), and -used it to implement the connection timeout logic in TcpSocket/SctpSocket. -Also added OnConnectTimeout which is called instead of OnTimeout, if the -socket is in Connecting mode. -New StreamSocket class defines variables used for sock_stream stuff (such -as connecting, the line protocol). - -2.1.5 ------ -Changed socket and ip option calls to directly manipulate the socket. They -should be used in the OnOptions callback, to set up the connection before -it is used. OnOptions is only called on client sockets. It is not called on -incoming connections accepted with accept()). -Removed Set methods from ResolvSocket and replaced them with one -constructor for each of the different resolves it can do. -Added DNS cache in ResolvSocket. -Made CircularBuffer an internal class of TcpSocket. -Moved these classes to a separate download: - ICrypt NullCrypt CTcpSocket MinionSocket MinderSocket MinderHandler Uid -ListenSocket now sets SO_REUSEADDR in its OnOptions method. -Small fixes to SmtpSocket to support the new configuration stuff. -Added socket to socket trigger framework (sockets-config.h: ENABLE_TRIGGERS). -Small bugfix in TcpSocket::Open when trying to connect to an ipv6 host -with numeric ip address. - -2.1.4 ------ -Added traffic monitor function. -EventHandler/IEventOwner bugfix (pure virtual method called on takedown). -Added outstanding events counter to IEventOwner, to avoid calling -ClearEvents in destructor of an IEventOwner with no events to clear. -Modified GetTimeUntilNextEvent to not return a negative time. -Added SmtpdSocket serverside implementation. -Crash bug fix if trying to add a socket that already exists in -sockethandler queue. -Made a few classes internal (PoolSocket, EventSocket, SocketThread). - -2.1.3 ------ -Added optional Ipv6 and Detach functionality to sockets-config.h. - (ENABLE_IPV6, ENABLE_DETACH) -Crash bug fix: if socket that asked a resolve question is destroyed -before answer arrives. -HTTPS (openssl) session support on server side. -Safer ssl read/write - tnx Peters! -All debug output now to stderr. -GetClientRemoteAddress and XXX now returns a copy of the address in -question, to avoid NULLing the source address when using std::auto_ptr. -SSL initialization code separated from TcpSocket and put in a new -SSLInitializer class. - -2.1.2 ------ -Fix for broken http framework. -Http and httpd tests added. -Configurable options moved to new 'sockets-config.h' file. -Restored code for dns resolve when getaddrinfo/getnameinfo isn't available. -(See sockets-config.h symbol NO_GETADDRINFO) - -2.1.1 ------ -Semaphore added. -Utility::GetTime() fixed on win32. - -2.1 ---- - * Added Utility::GetTime. - * Created socket handler base class ISocketHandler. It will now be possible - to write really customized sockethandlers. One effect of this is that - the first parameter of the Socket class constructor changes from - SocketHandler& to ISocketHandler& - this will affect all current - software using the library. - * StdLog constructor first parameter changed from SocketHandler* - to ISocketHandler* - * Modified list handling in Socket/SocketHandler. - * Added possibility to clear tcp socket byte counters by passing - 'true' as input parameter to GetBytesReceived() and GetBytesSent(). - * Improved CircularBuffer performance when used as output buffer by - TcpSocket. - * Removed unused and confusing method ISocketHandler::GetSocket. - * SocketAddress will replace direct use of ipv4/ipv6 addresses in the code. - * Removed virtual supporting method Socket::ReadLine. If anyone was using - that method, it used to be called directly after the OnRead callback, - if SetLineProtocol was enabled. Repairing the functionality means - adding a call of your own in the OnRead callback. - * Optimized code for OnLine and HTTP header parsing. - * Found and fixed a timing bug in thread code that could cause - a segmentation fault. - * 'echoserver.cpp' and 'stressclient.cpp' added, for test. Supports - normal echo operation, http "echo" server and ssl server/client. - -2.0.9 ------ -Added a way to disable input buffering on tcp sockets. -The method TcpSocket::DisableInputBuffer() will prevent all writing -to the input buffer. After that, the only way to receive data is to -implement an OnRawData method. TcpSocket derived classes that -already only use OnRawData as a means of receiving data should -call DisableInputBuffer() to improve performance (and turn off those -annoying warning messages). -OnOptions will now be called by UdpSocket. OnOptions is now a pure -virtual method in the Socket class. Moved default implementation of -OnOptions from Socket to TcpSocket. Added empty implementations of -OnOptions in ListenSocket<>, UdpSocket and PoolSocket. -Made Sockets-config compile on mingw systems. - -2.0.8 ------ -gethostbyname_r only used if the symbol LINUX is defined. -Sctp protocol by default disabled. Enable by defining USE_SCTP. -Fixed warnings about GetSocket/handler in connect and disconnect -situations. - -2.0.7 ------ -Added Resolve(ipaddr_t) and Resolve(const std::string&) in Socket class -for reverse lookup. Added OnResolveFailed() callback to Socket when a -Resolve call failed. -Moved definition of SOCKETS_DYNAMIC_TEMP to socket_include.h to avoid -breaking windows application not using Sockets-config to retrieve -compile time flags. -Added "fd XX" to StdoutLog debug printout whenever a socket instance -generates an event, where XX is the file descriptor of the socket or --1 if the file descriptor isn't valid. -Reset connected flag when read returns 0 - avoids using shutdown on -Close() and the following warning. -SCTP support added - see SctpSocket class. - -2.0.6 ------ -"gethostbyname()" calls are replaced with "gethostbyname_r()", to ensure -threadsafe operation. -If the flag SOCKETS_DYNAMIC_TEMP is defined at compile time of the library, -all application using the library must also define the same flag. In unix/ -linux Makefiles this is easiest done by adding `Sockets-config` to the -CPPFLAGS variable. -Optimized SocketHandler by removing the SocketHandler::GetSocket method -and adding better code in each place where it was used - Thanks Samuel. -CircularBuffer now has a ReadString method. -Added method to remove a specific event to the EventHandler class. -Added methods to the IEventOwner interface to remove all events or -one specific events. - Thanks Thomas - -2.0.5 ------ -Added missing call to OnRawData when using ssl. -Bugfix in HttpPostSocket, where the boundary variable was never set. -Reset connecting flag in TcpSocket when a connection attempt fails. -Define SOCKETS_DYNAMIC_TEMP to use dynamically allocated temporary -buffers in read operations - helps on ECOS. -Compile with -O0 if you are using gcc 2.9.x. - -2.0.4 ------ -Improved Http client classes, now they're all able to receive a response. -Use methods SetFilename() / SetDataPtr() to write response to a file -or to memory respectively. -Small fix for uuid.h include for mac os x. -Removed debug printout in SSLInitializer. - -2.0.3 ------ -Url parsing modified for Http Get/Put/Post classes to enable ssl if the -url protocol is https. -TcpSocket/SSL random file modified, see tutorial page at -http://www.alhem.net/Sockets/tutorial/using6d.html -Removed a lot of old debug printouts. - -2.0.2b ------- -Replaced direct read access to sockets map with a method looping through -the map, to avoid adding null pointers to non-existing file descriptors. - -2.0.2a ------- -The new add control logic broke tcp reconnect, so this is a fix for that. - -2.0.2 ------ -Fixed infinite loop that could lock the main process when a socket attempts -to connect, gets data to send, and then the connection fails. -Added control so the same file descriptor can't be added to the socket -handler twice. -Utility::rfc1738_encode buffer overflow (read only) fixed. -Moved local hostname resolution stuff from SocketHandler to Utility -- see http://www.alhem.net/Sockets/tutorial/using6c.html -Project files for visual studio 6 slightly modified (missing dependency, -FD_SETSIZE define removed). - -2.0.1 ------ -Moved Errno declaration outside sockets namespace when compiling for unix. -This was already done for the win32 implementation. -Made typedef for socket_m in SocketHandler protected, since its use are -already protected. -Fixed problem with reconnect. - -2.0 ---- -Optimizing SocketHandler. -Fixed SSL socket reconnect. -HttpGetSocket url parsing fixed. Really. -Increased char buffer size in HttpdSocket for large query_string's. -Added timer events, implemented in EventHandler. -Using _beginthreadex()/_endthreadex() to create/end thread in _win32. -Using GetTempPathA() explicitly when getting _win32 temporary path. - * Removed (almost) all sprintf's. -Visual studio .net project now build multithreaded library. -Removed redundant classes SSLSocket, HttpsGetSocket, and HttpsSocket -(all SSL functionality now in TcpSocket). -Using dummy ssl types in TcpSocket if HAVE_OPENSSL is not defined. -Moved a few typedef's outside the optional sockets namespace in the file -socket_include.h. -Fixed Thread/SocketThread to avoid using method on deleted pointer. -Added CXX in Makefile. -Bugfix in SocketThread so the correct sockethandler will be used by the -detached socket object. -Added full mutex threadsafe operations. The old _THREADSAFE_SOCKETS -Makefile option is no longer in use. -Improved graceful shutdown of tcp connections when possible. -Moved address resolution methods from class Socket to Utility. The methods -are isip, u2ip, l2ip. -Added fix for unassigned names in httpdform parser. - -1.9.9 ------ -Trying to remove all dynamic_cast's. They are used in ListenSocket to -check that the Create method returns correct type, and in the socket -handler to give extra functionality to tcp sockets. -New callback OnDisconnect is called only when a connected tcp socket -is set for reconnect, and has lost connection. -Memory leak in TcpSocket output buffering fixed. -HttpGetSocket.url_this fixed. -Replaced HttpGetSocket.m_content string with an allocated byte buffer. -Fix bug in Utility::rfc1738_decode. -SocketHandler.Select can be called without parameters, which means it -will not return until an event has been received by a socket. -Automatic purging of tcp sockets that hang around too long with data -still left to send. -Added virtual destructor for ICrypt pure virtual. - -1.9.8 ------ -Nasty bug fixed on macosx that caused OnConnect to be called even if -the connection failed. -SSL client functionality restored. Cached data was not sent on connect -because the connected flag was not set. -Two new callbacks added for TcpSocket, to indicate that ssl negotiation -failed: OnSSLConnectFailed and OnSSLAcceptFailed. -HttpGetSocket: getting a https: address enables ssl.... -Added fatal error if trying to use a ssl server without implementing -the initialization method (InitSSLServer). - -1.9.7 ------ -SocketHandler.OkToAccept now takes a socket class pointer as input -parameter, which can be used to identify which ListenSocket is -calling OkToAccept. -Treating socket exception as connection failed on win32 -(if trying to connect). -Reset "flush before close" flag on write/read error. -Moved sockethandler Add logic once again, this time outside loop -checking for fd_set events.. -Check if fd_set is getting full (trying to add more than FD_SETSIZE -sockets to the socket handler). Incoming connections are immediately -disconnected if the fd_set is full. TcpSocket::Open calls will -fail instantly if there is no more space in the fd_set. -Remember that FD_SETSIZE can be defined in socket_handler.h if there -is a need for larger fd_set's. The default on win32 is 64 slots which -is a bit thin. Linux and probably most unixes has 1024 slots... -On MacOsX the macro FD_COPY is used to copy the fd_set's before select(). -More debug logging on exactly how a connection was established. - -1.9.6 ------ -Bugfix protecting the sockethandler from using deleted sockets. -(Socket class destructor calls SocketHandler.Remove in case the socket -is deleted before it is removed from the sockethandler). -Removed a lot of warnings for visual studio .net / 2005 beta. -Fix for bsd sockets sigpipe disable, using SO_NOSIGPIPE. -Solaris use putenv in HttpdSocket. -Added flag flush before close, telling a (tcp) socket to send all data -before closing even while the SetCloseAndDelete flag is set. -Default value: flush before close = true. - -1.9.5 ------ -Visual studio 6 and .net project files updated. -DevCpp project files updated. -Using openssl win32 installer from www.slproweb.com, -with installation location c:\OpenSSL. -Merged Sockets and SocketsEx projects in all windows projects. -Added winsock error texts. - -ListenSocket.Bind slightly modified - if port 0 random assigned is -needed, 0 has to be specified in the Bind call (before this release -a Bind call with no parameters had the same effect). -Ipv6 support has been improved, with many of the ipv4/ipv6 methods -overall merged into one. Ipv6 support for reconnect and connection retry. -The connection pool now also support ipv6 connections. -Added SocketHandler.ResolverReady that indicates the resolverthread -is ready for queries. -UdpSocket constructor modified to also include an ipv6 boolean -parameter, because the socket file descriptor is created in the -constructor. -Change: UdpSocket.Bind returns 0 on success, -1 on failure, just like -ListenSocket<>.Bind. -Connection pool disabled by default. Use SocketHandler.EnablePool to -turn it back on. -HttpDebugSocket: Added first line of request (method url httpversion) to -page echoing the request. -TcpSocket ssl private key callback function no longer uses a static -member variable to store the password. This enables the use of any number -of private key files, each with a different password. - -1.9.4 ------ -Changed udp sockets to nonblocking. - -1.9.3 ------ -New define while compiling: _THREADSAFE_SOCKETS -This "thread safe" compile mode only protects OnWrite / SendBuf in -TcpSocket, but will probably include more sections of the code later on. -Mutex and Lock classes added. -HttpdCookies now excludes domain from the Set-Cookie http header -(if COOKIE_DOMAIN is defined as a blank string ""). -Incoming connections should now respond quicker even when using a long -Select() timeout. -Documentation: All classes and Socket class members at least briefly described. -Tcp and Udp socket now shares a common virtual description of the Send -and SendBuf methods. -Fixed bug that caused too long connection timeouts. -UDP sockets reads up to 10 messages in one read event. - -1.9.2 ------ -Support for HttpdSocket http/1.1 keep-alive operation added. -Fiddling with the connection / reconnect code. Not perfect by a long shot. -If a connection timeout is set, and the socket is supposed to reconnect, -the socket will wait the defined connection timeout until a connection -retry is made even if the connection fails immediately. -OnConnectFailed() will only be called after all connection retries has -been attempted. -OnConnectRetry() will be called before each connection retry. Return -false from this callback method to abort connection retries and kill the -socket permanently. -Data sent before / between connection is preserved, whatever that's worth. -Added optional namespace for the entire library. - -1.9.1 ------ -Added SetConnected() in ListenSocket.h for TcpSocket's on accept. -If not, all incoming tcp connections refused to send their data. - -1.9 ---- -Added reconnect and connection retry for TcpSocket's. -New callbacks: -OnConnectRetry() can return false to abort connection retries. -OnReconnect() when a connection has resumed. - -1.8.7 ------ -Added methods GetSsl() and GetSslContext() to access openssl structures -SSL resp. SSL_CTX in TcpSocket and SSLSocket. -HttpGetSocket no longer reports an error when initialized with an empty -filename. -SocketHandler::GetCount now returns actual number of active socket plus -number of sockets to be added to active sockets list. - -1.8.6 ------ -Socket::DisableRead - use this when creating a socket only for output -(the file descriptor will not be added to the read fd_set on select). -Added check to make sure no more than FD_SETSIZE sockets are added to -the socket handler. - -1.8.5 ------ -ReadLine fixed. - -1.8.4 ------ -Fixed a buffer problem that lost a byte for each read when doing large -http transfers (HTTPSocket, HttpsSocket, TcpSocket). -Added classes mentioned in v1.8.3... -Thread class implemented for win32 (not tested) - -1.8.3 ------ -(OnWriteComplete - pending) -(IFile - File - MemFile) -(HttpdSocket - HttpdForm - HttpdCookies) -Incoming sockets are no longer blocking -OnWrite no longer disconnect on EAGAIN error code -SSLSocket has been integrated with TcpSocket (still experimental) - -1.8.2 ------ -Removed warning about read after shutdown. -Socket does not try to do shutdown/close if the file descriptor is invalid. - -1.8 ---- -ListenSocketBase functionality moved to ListenSocket template class. -The important addition is the Create() method in Socket - use that to -create a socket instance with an alternative constructor if needed. -TcpSocket::Open bugfix - sometimes returned false (connection failed) -although the connection was perfectly fine. -Socks4 client functionality added for outgoing connections. See new -SetSocks4Host, SetSocks4Port, SetSocks4Userid and SetSocks4TryDirect -methods in SocketHandler. -HttpGetSocket stores retrieved document in a private string member -variable, reducing the need for disk access. -Asynchronous DNS functionality added. Use the new SocketHandler method -EnableResolver() to enable this for resolving of all outgoing connections. - -1.7.6 ------ -Small changes in UdpSocket -New class ListenSocketBase as an alternative to ListenSocket<> template -class -New callback in Socket: Create - used by ListenSocketBase - -1.7.5 ------ -New callback on socket class: OnOptions, called when a new socket has -been created, to set options like SetReuse and SetKeepalive. -New get methods on MinionSocket. -Socket::Close now does a recv() after shutdown(). -New logging level: Info - -1.7.2 ------ -HttpsGetSocket::url_this default port changed to 443 (was 80). -TcpSocket buffer sizes adjusted. -Switch off LineProtocol when reading the http body in HTTPSocket and -HttpsSocket. - - -1.7 ---- -HttpPostSocket added functionality, able to switch between url-encoded -form-data or multipart/form-data. -Connection pooling on TcpSocket's; When SetRetain() is called on a client -socket (that use Open / OnConnect), that sockets connection will be left -open and reused by the next TcpSocket the tries to open a new connection to -the same host / port. -This construction gives HTTPSocket HTTP/1.1 support for keep-alive -connections. -Pooled connections are stored as PoolSocket objects in the SocketHandler -socket list, and supervised like any other socket - if a pooled connection -is closed by the remote end, it's removed by the SocketHandler. - - -1.6.4 ------ -Socket::SetParent / ::GetParent added, as a way to find out which -ListenSocket created the Socket. GetParent returns the pointer to the -ListenSocket object, or NULL if the Socket was created by the -programmer. -Win32: WSA startup code is wrapped in a class, which is created as a -static instance in Socket. This should automatically initialize -winsock when the first Socket is created. - - -1.6.3 ------ -"errno" and "strerror" has been replaced by Errno and StrError, -and is defined for each operating system environment. -New classes for HTTP: HttpPutSocket, HttpPostSocket, HttpDebugSocket. - -1.6.2 ------ -Bugfix in ListenSocket, when opening a random port GetPort() returned -wrong port number - this is now fixed. -Defining methods depending on ipv4 or ipv6 was removed, and all ipv4 methods -renamed to their original names - without the '4'. - - -1.6.1 ------ -Dummy copy constructor / assignment operator added to classes that can't be -copied by default. -Minor improvements to HTTPSocket. -Removed typedef string_v - collision with other projects that use same name -for std::vector<std::string> instead of internal use std::list<std::vector> - - -1.6 ---- -Improvements on win32 compile and linking. Remember to turn on rtti -information (/GR in visual studio), because I tend to use dynamic_cast a lot. - -It is now possible to exclude openssl specific code, by not having -HAVE_OPENSSL defined at compile time. -Define HAVE_OPENSSL in Makefile or project file if openssl is installed -on your machine. - -Bugfix in CircularBuffer. It finally works. - -Renamed CircularBuffer method GetCount to "ByteCounter" - the method returns -the total number of bytes to have ever gone through the buffer. - -Improved logging, and cleaned up old debug printouts. - -Fixed a number of memory leaks that would occur in an application that -creates and recreates a lot of SocketHandler's, and also in the threading -part of the library. - -Some optimizations for speed. - - -1.5.4 ------ -UdpSocket: Broadcast flag, Multicast stuff - - -1.5.3 ------ -SocketHandler no longer resolves local hostname on startup. -On hosts with unresolvable hostname this would cause a delay on startup. - -Changed unix socket i/o from read/write to recv/send with MSG_NOSIGNAL -flag, to avoid sigpipe - - see readsocket/writesocket macros in socket_include.h. - - -1.5 ---- - -New callback: OnConnectFailed - -new / modified methods to support ipv6: - Socket::CreateSocket6 - Socket::u2ip - Socket::l2ip - Socket::GetRemoteIP6 - Socket::IsIpv6 - - - -04-04-12 --------- -void TcpSocket::OnRawData(const char *,size_t) -called when new data is read - -bool SocketHandler::OkToAccept() -called by ListenSocket - default implementation returns true - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Debug.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Debug.cpp deleted file mode 100755 index 4d456fd9026..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Debug.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include "Debug.h" -#include <stdarg.h> -#include <cstring> - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -std::map<unsigned long, int> Debug::m_level; -const char *Debug::colors[] = { - "\x1B[0;0m", // &n */ - "\x1B[0;0m\x1B[31m", // &r */ - "\x1B[0;0m\x1B[32m", // &g */ - "\x1B[0;0m\x1B[33m", // &y */ - "\x1B[0;0m\x1B[34m", // &b */ - "\x1B[0;0m\x1B[35m", // &m */ - "\x1B[0;0m\x1B[36m", // &c */ - "\x1B[0;0m\x1B[37m", // &w */ - "\x1B[1;31m", // &R */ - "\x1B[1;32m", // &G */ - "\x1B[1;33m", // &Y */ - "\x1B[1;34m", // &B */ - "\x1B[1;35m", // &M */ - "\x1B[1;36m", // &C */ - "\x1B[1;37m" }; // &W */ - - -void Debug::Print(const char *format, ...) -{ - char slask[5000]; // temporary for vsprintf / vsnprintf - va_list ap; - - va_start(ap, format); - vsnprintf(slask, sizeof(slask), format, ap); - va_end(ap); - - fprintf(stderr, "%s", colors[Utility::ThreadID() % 14 + 1]); - for (int i = 0; i < m_level[Utility::ThreadID()]; i++) - fprintf(stderr, " "); - if (slask[strlen(slask) - 1] == '\n') - slask[strlen(slask) - 1] = 0; - fprintf(stderr, "%s%s\n", slask, colors[0]); -} - - -Debug& Debug::operator<<(const char * str) -{ - m_line += str; - return *this; -} - - -Debug& Debug::operator<<(const std::string& str) -{ - m_line += str; - return *this; -} - - -Debug& Debug::operator<<(short l) -{ - m_line += Utility::l2string(l); - return *this; -} - - -Debug& Debug::operator<<(int l) -{ - m_line += Utility::l2string(l); - return *this; -} - - -Debug& Debug::operator<<(long l) -{ - m_line += Utility::l2string(l); - return *this; -} - - -Debug& Debug::operator<<(double d) -{ - char slask[100]; - snprintf(slask, sizeof(slask), "%f", d); - m_line += slask; - return *this; -} - - -Debug& Debug::operator<<(endl) -{ - Print("%s", m_line.c_str()); - m_line = ""; - return *this; -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Debug.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Debug.h deleted file mode 100755 index e8f20be8df5..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Debug.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef _SOCKETS_Debug_H -#define _SOCKETS_Debug_H - -#include "sockets-config.h" -#include "Utility.h" -#include <stdio.h> - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -class Debug -{ - static const char *colors[]; -public: - class endl - { - public: - endl() {} - virtual ~endl() {} - }; - -public: - Debug() {} - Debug(const std::string& x) : m_id(0), m_text(x) { - fprintf(stderr, "%s", colors[Utility::ThreadID() % 14 + 1]); - - for (int i = 0; i < m_level[Utility::ThreadID()]; i++) - fprintf(stderr, " "); - - fprintf(stderr, "%s%s\n", x.c_str(), colors[0]); - m_level[Utility::ThreadID()]++; - } - Debug(int id, const std::string& x) : m_id(id), m_text(x) { - fprintf(stderr, "%s", colors[Utility::ThreadID() % 14 + 1]); - - for (int i = 0; i < m_level[Utility::ThreadID()]; i++) - fprintf(stderr, " "); - - fprintf(stderr, "%d> %s%s\n", m_id, x.c_str(), colors[0]); - m_level[Utility::ThreadID()]++; - } - ~Debug() { - if (!m_text.empty()) { - if (m_level[Utility::ThreadID()]) - m_level[Utility::ThreadID()]--; - - fprintf(stderr, "%s", colors[Utility::ThreadID() % 14 + 1]); - - for (int i = 0; i < m_level[Utility::ThreadID()]; i++) - fprintf(stderr, " "); - - if (m_id) - fprintf(stderr, "%d> /%s%s\n", m_id, m_text.c_str(), colors[0]); - else - fprintf(stderr, "/%s%s\n", m_text.c_str(), colors[0]); - - fflush(stderr); - } - } - static void Print(const char *format, ...); - - Debug& operator<<(const char *); - Debug& operator<<(const std::string& ); - Debug& operator<<(short); - Debug& operator<<(int); - Debug& operator<<(long); - Debug& operator<<(double); - Debug& operator<<(endl); - -private: - int m_id; - std::string m_text; - static std::map<unsigned long, int> m_level; - std::string m_line; -}; - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - -#endif // _SOCKETS_Debug_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Event.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Event.cpp deleted file mode 100755 index 7398a06475c..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Event.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/** \file Event.cpp - ** \date 2005-12-07 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2005-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "Event.h" -#ifdef _WIN32 -#else -#include <sys/time.h> -#endif - -//#include "IEventOwner.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -// statics -long Event::m_unique_id = 0; - - -Event::Event(IEventOwner *from,long sec,long usec,unsigned long data) : m_from(from), m_data(data), m_time(sec, usec), m_id(++m_unique_id) -{ -} - - -Event::~Event() -{ -} - - -bool Event::operator<(Event& e) -{ - return m_time < e.m_time; -} - - -long Event::GetID() const -{ - return m_id; -} - - -const EventTime& Event::GetTime() const -{ - return m_time; -} - - -IEventOwner *Event::GetFrom() const -{ - return m_from; -} - - -unsigned long Event::Data() const -{ - return m_data; -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Event.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Event.h deleted file mode 100755 index 62ea1a0478e..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Event.h +++ /dev/null @@ -1,83 +0,0 @@ -/** \file Event.h - ** \date 2005-12-07 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2005-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Event_H -#define _SOCKETS_Event_H - -#include "sockets-config.h" -#ifdef _WIN32 -#else -#include <sys/select.h> -#endif -#include "EventTime.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -class IEventOwner; - -/** Store information about a timer event. - \ingroup timer */ -class Event -{ -public: - Event(IEventOwner *,long sec,long usec,unsigned long data = 0); - ~Event(); - - bool operator<(Event&); - long GetID() const; - const EventTime& GetTime() const; - IEventOwner *GetFrom() const; - unsigned long Data() const; - -private: - Event(const Event& ) {} // copy constructor - Event& operator=(const Event& ) { - return *this; // assignment operator - } - IEventOwner *m_from; - unsigned long m_data; - EventTime m_time; - static long m_unique_id; - long m_id; -}; - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_Event_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/EventHandler.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/EventHandler.cpp deleted file mode 100755 index b5913424bae..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/EventHandler.cpp +++ /dev/null @@ -1,209 +0,0 @@ -/** \file EventHandler.cpp - ** \date 2005-12-07 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2005-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include "EventHandler.h" -#include "IEventOwner.h" -#include "Event.h" -#include "TcpSocket.h" -#include "ListenSocket.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -EventHandler::EventHandler(StdLog *p) : SocketHandler(p), m_quit(false) -{ - EnableRelease(); -} - - -EventHandler::EventHandler(IMutex& m,StdLog *p) : SocketHandler(m, p), m_quit(false) -{ - EnableRelease(); -} - - -EventHandler::~EventHandler() -{ - while (m_events.size()) - { - std::list<Event *>::iterator it = m_events.begin(); - Event *e = *it; - e -> GetFrom() -> SetHandlerInvalid(); - delete e; - m_events.erase(it); - } -} - - -bool EventHandler::GetTimeUntilNextEvent(struct timeval *tv) -{ - if (!m_events.size()) - return false; - std::list<Event *>::iterator it = m_events.begin(); - if (it != m_events.end()) - { - EventTime now; - mytime_t diff = (*it) -> GetTime() - now; - if (diff < 1) - { - diff = 1; - } - tv -> tv_sec = static_cast<long>(diff / 1000000); - tv -> tv_usec = static_cast<long>(diff % 1000000); - return true; - } - return false; -} - - -void EventHandler::CheckEvents() -{ - EventTime now; - std::list<Event *>::iterator it = m_events.begin(); - while (it != m_events.end() && (*it) -> GetTime() < now) - { - Event *e = *it; - Socket *s = dynamic_cast<Socket *>(e -> GetFrom()); - /* - s == NULL This is another object implementing 'IEventOwner' and not a socket. - s != NULL This is a Socket implementing IEventOwner, and we can check that the - object instance still is valid using SocketHandler::Valid. - */ - if (!s || (s && Valid( e -> Data() ))) - { - e -> GetFrom() -> OnEvent(e -> GetID()); - } - for (it = m_events.begin(); it != m_events.end(); ++it) - if (*it == e) - { - delete e; - break; - } - if (it != m_events.end()) - m_events.erase(it); - it = m_events.begin(); - } -} - - -long EventHandler::AddEvent(IEventOwner *from,long sec,long usec) -{ - Socket *s = dynamic_cast<Socket *>(from); - Event *e = new Event(from, sec, usec, s ? s -> UniqueIdentifier() : 0); - std::list<Event *>::iterator it = m_events.begin(); - while (it != m_events.end() && *(*it) < *e) - { - ++it; - } - m_events.insert(it, e); - Release(); - return e -> GetID(); -} - - -void EventHandler::ClearEvents(IEventOwner *from) -{ - bool repeat; - do - { - repeat = false; - for (std::list<Event *>::iterator it = m_events.begin(); it != m_events.end(); ++it) - { - Event *e = *it; - if (e -> GetFrom() == from) - { - delete e; - m_events.erase(it); - repeat = true; - break; - } - } - } while (repeat); -} - - -void EventHandler::EventLoop() -{ - while (!m_quit) - { - struct timeval tv; - if (GetTimeUntilNextEvent(&tv)) - { - Select(&tv); - CheckEvents(); - } - else - { - Select(); - } - } -} - - -void EventHandler::SetQuit(bool x) -{ - m_quit = x; -} - - -void EventHandler::RemoveEvent(IEventOwner *from, long eid) -{ - for (std::list<Event *>::iterator it = m_events.begin(); it != m_events.end(); ++it) - { - Event *e = *it; - if (from == e -> GetFrom() && eid == e -> GetID()) - { - delete e; - m_events.erase(it); - break; - } - } -} - - -void EventHandler::Add(Socket *p) -{ - SocketHandler::Add( p ); -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/EventHandler.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/EventHandler.h deleted file mode 100755 index 1dc0425e0f7..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/EventHandler.h +++ /dev/null @@ -1,88 +0,0 @@ -/** \file EventHandler.h - ** \date 2005-12-07 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2005-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_EventHandler_H -#define _SOCKETS_EventHandler_H - -#include "sockets-config.h" -#include "SocketHandler.h" -#include "IEventHandler.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -class StdLog; -class IEventOwner; -class Event; -class TcpSocket; - -/** SocketHandler implementing the IEventHandler interface. - \ingroup timer */ -class EventHandler : public SocketHandler,public IEventHandler -{ -public: - EventHandler(StdLog * = NULL); - EventHandler(IMutex&,StdLog * = NULL); - ~EventHandler(); - - bool GetTimeUntilNextEvent(struct timeval *tv); - void CheckEvents(); - long AddEvent(IEventOwner *from,long sec,long usec); - void ClearEvents(IEventOwner *from); - void RemoveEvent(IEventOwner *from,long eid); - - /** SocketHandler while() loop implemented with event functionality. */ - void EventLoop(); - /** Stop event loop. */ - void SetQuit(bool = true); - - void Add(Socket *); - -private: - EventHandler(const EventHandler& ) {} // copy constructor - EventHandler& operator=(const EventHandler& ) { - return *this; // assignment operator - } - std::list<Event *> m_events; - bool m_quit; -}; - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_EventHandler_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/EventTime.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/EventTime.cpp deleted file mode 100755 index ffd607cc250..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/EventTime.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/** \file EventTime.cpp - ** \date 2005-12-07 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2005-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef MACOSX -#include <stdint.h> -#include <sys/types.h> -#include <signal.h> -#endif -#include "EventTime.h" -#ifdef _WIN32 -#include <windows.h> -#else -#include <sys/select.h> -#include <sys/time.h> -#endif - - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -EventTime::EventTime() : m_time(Tick()) -{ -} - - -EventTime::EventTime(mytime_t sec,long usec) : m_time(Tick()) -{ - m_time += sec * 1000000 + usec; -} - - -EventTime::~EventTime() -{ -} - - -mytime_t EventTime::Tick() -{ - mytime_t t; -#ifdef _WIN32 - FILETIME ft; - GetSystemTimeAsFileTime(&ft); - t = ft.dwHighDateTime; - t = t << 32; - t += ft.dwLowDateTime; - t /= 10; // us -#else - struct timeval tv; - struct timezone tz; - gettimeofday(&tv, &tz); - t = tv.tv_sec; - t *= 1000000; - t += tv.tv_usec; -#endif - return t; -} - - -EventTime EventTime::operator - (const EventTime& x) const -{ - EventTime t; - t.m_time = m_time - x.m_time; - return t; -} - - -bool EventTime::operator < (const EventTime& x) const -{ - return m_time < x.m_time; -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/EventTime.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/EventTime.h deleted file mode 100755 index 1342622061a..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/EventTime.h +++ /dev/null @@ -1,84 +0,0 @@ -/** \file EventTime.h - ** \date 2005-12-07 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2005-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_EventTime_H -#define _SOCKETS_EventTime_H - -#include "sockets-config.h" -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -#if defined( _WIN32) && !defined(__CYGWIN__) -typedef __int64 mytime_t; -#else -#include <inttypes.h> // int64_t -typedef int64_t mytime_t; -#endif - - -/** \defgroup timer EventTimer event handling */ - -/** EventTime primitive, returns current time as a 64-bit number. - \ingroup timer */ -class EventTime -{ -public: - EventTime(); - EventTime(mytime_t sec,long usec); - ~EventTime(); - - static mytime_t Tick(); - - operator mytime_t () { - return m_time; - } - EventTime operator - (const EventTime& x) const; - bool operator < (const EventTime& x) const; - -private: - EventTime(const EventTime& ) {} // copy constructor - EventTime& operator=(const EventTime& ) { - return *this; // assignment operator - } - mytime_t m_time; -}; - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_EventTime_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Exception.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Exception.cpp deleted file mode 100755 index f3898a0805a..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Exception.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/** - ** \file Exception.cpp - ** \date 2007-09-28 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include "Exception.h" -#include "Utility.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - - -Exception::Exception(const std::string& description) : m_description(description) -, m_stack(Utility::Stack()) -{ -} - - -const std::string Exception::ToString() const -{ - return m_description; -} - - -const std::string Exception::Stack() const -{ - return m_stack; -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Exception.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Exception.h deleted file mode 100755 index 52f96e42623..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Exception.h +++ /dev/null @@ -1,74 +0,0 @@ -/** - ** \file Exception.h - ** \date 2007-09-28 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _Sockets_Exception_H -#define _Sockets_Exception_H - -#include "sockets-config.h" -#include <string> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - - -class Exception -{ -public: - Exception(const std::string& description); - virtual ~Exception() {} - - virtual const std::string ToString() const; - virtual const std::string Stack() const; - - Exception(const Exception& ) {} // copy constructor - - Exception& operator=(const Exception& ) { - return *this; // assignment operator - } - -private: - std::string m_description; - std::string m_stack; - -}; - - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - -#endif // _Sockets_Exception_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/File.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/File.cpp deleted file mode 100755 index fd9069ee91d..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/File.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/** \file File.cpp - ** \date 2005-04-25 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include <stdarg.h> -#include <sys/types.h> -#include <sys/stat.h> - -#include "File.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -File::File() -:m_fil(NULL) -,m_b_close(true) -,m_rptr(0) -,m_wptr(0) -{ -} - - -File::File(FILE *fil) -:m_fil(fil) -,m_b_close(false) -,m_rptr(0) -,m_wptr(0) -{ -} - - -File::File(const std::string& path, const std::string& mode) -:m_fil(NULL) -,m_b_close(true) -,m_rptr(0) -,m_wptr(0) -{ - fopen(path, mode); -} - - -File::~File() -{ - if (m_b_close) - { - fclose(); - } -} - - -bool File::fopen(const std::string& path, const std::string& mode) -{ - m_path = path; - m_mode = mode; -#if defined( _WIN32) && !defined(__CYGWIN__) - if (fopen_s(&m_fil, path.c_str(), mode.c_str())) - m_fil = NULL; -#else - m_fil = ::fopen(path.c_str(), mode.c_str()); -#endif - - return m_fil ? true : false; -} - - -void File::fclose() const -{ - if (m_fil) - { - ::fclose(m_fil); - m_fil = NULL; - } -} - - - -size_t File::fread(char *ptr, size_t size, size_t nmemb) const -{ - size_t r = 0; - if (m_fil) - { - fseek(m_fil, m_rptr, SEEK_SET); - r = ::fread(ptr, size, nmemb, m_fil); - m_rptr = ftell(m_fil); - } - return r; -} - - -size_t File::fwrite(const char *ptr, size_t size, size_t nmemb) -{ - size_t r = 0; - if (m_fil) - { - fseek(m_fil, m_wptr, SEEK_SET); - r = ::fwrite(ptr, size, nmemb, m_fil); - m_wptr = ftell(m_fil); - } - return r; -} - - - -char *File::fgets(char *s, int size) const -{ - char *r = NULL; - if (m_fil) - { - fseek(m_fil, m_rptr, SEEK_SET); - r = ::fgets(s, size, m_fil); - m_rptr = ftell(m_fil); - } - return r; -} - - -void File::fprintf(const char *format, ...) -{ - if (!m_fil) - return; - va_list ap; - va_start(ap, format); - fseek(m_fil, m_wptr, SEEK_SET); - vfprintf(m_fil, format, ap); - m_wptr = ftell(m_fil); - va_end(ap); -} - - -off_t File::size() const -{ - struct stat st; - if (stat(m_path.c_str(), &st) == -1) - { - return 0; - } - return st.st_size; -} - - -bool File::eof() const -{ - if (m_fil) - { - if (feof(m_fil)) - return true; - } - return false; -} - - -void File::reset_read() const -{ - m_rptr = 0; -} - - -void File::reset_write() -{ - m_wptr = 0; -} - - -const std::string& File::Path() const -{ - return m_path; -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/File.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/File.h deleted file mode 100755 index 9abc510124d..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/File.h +++ /dev/null @@ -1,95 +0,0 @@ -/** \file File.h - ** \date 2005-04-25 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_File_H -#define _SOCKETS_File_H - -#include "sockets-config.h" -#include "IFile.h" -#include <stdio.h> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -/** IFile implementation of a disk file. - \ingroup file */ -class File : public IFile -{ -public: - File(); - File(FILE *); - /** convenience: calls fopen() */ - File(const std::string& path, const std::string& mode); - ~File(); - - bool fopen(const std::string& path, const std::string& mode); - void fclose() const; - - size_t fread(char *, size_t, size_t) const; - size_t fwrite(const char *, size_t, size_t); - - char *fgets(char *, int) const; - void fprintf(const char *format, ...); - - off_t size() const; - bool eof() const; - - void reset_read() const; - void reset_write(); - - const std::string& Path() const; - -private: - File(const File& ) {} // copy constructor - File& operator=(const File& ) { - return *this; // assignment operator - } - - std::string m_path; - std::string m_mode; - mutable FILE *m_fil; - bool m_b_close; - mutable long m_rptr; - long m_wptr; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_File_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/FileStream.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/FileStream.cpp deleted file mode 100755 index d61ed983cd1..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/FileStream.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/** - ** \file FileStream.cpp - ** \date 2008-12-20 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2008-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "FileStream.h" -#include "IFile.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -FileStream::FileStream(IFile& file) : m_file(file) -{ -} - - -size_t FileStream::IStreamRead(char *buf, size_t max_sz) -{ - return m_file.fread(buf, 1, max_sz); -} - - -void FileStream::IStreamWrite(const char *buf, size_t sz) -{ - m_file.fwrite(buf, 1, sz); -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/FileStream.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/FileStream.h deleted file mode 100755 index 7e41ee78cb0..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/FileStream.h +++ /dev/null @@ -1,62 +0,0 @@ -/** - ** \file FileStream.h - ** \date 2008-12-20 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2008-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_FileStream_H -#define _SOCKETS_FileStream_H - -#include "IStream.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -class IFile; - -class FileStream : public IStream -{ -public: - FileStream(IFile& file); - - size_t IStreamRead(char *buf, size_t max_sz); - - void IStreamWrite(const char *buf, size_t sz); - -private: - IFile& m_file; -}; - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_FileStream_H diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HTTPSocket.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HTTPSocket.cpp deleted file mode 100755 index a316dd17ec1..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HTTPSocket.cpp +++ /dev/null @@ -1,519 +0,0 @@ -/** \file HTTPSocket.cpp - ** \date 2004-04-06 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include "HTTPSocket.h" -#include "Parse.h" -#include "ISocketHandler.h" -#include <stdarg.h> -#include <stdio.h> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -HTTPSocket::HTTPSocket(ISocketHandler& h) -:TcpSocket(h) -,m_first(true) -,m_header(true) -,m_http_version("HTTP/1.0") -,m_request(false) -,m_response(false) -,m_body_size_left(0) -,m_b_http_1_1(false) -,m_b_keepalive(false) -,m_b_chunked(false) -,m_chunk_size(0) -,m_chunk_state(0) -,m_header_count(0) -,m_max_header_count(MAX_HTTP_HEADER_COUNT) -{ - SetLineProtocol(); - DisableInputBuffer(); -} - - -HTTPSocket::~HTTPSocket() -{ -} - - -void HTTPSocket::OnRawData(const char *buf,size_t len) -{ - if (!m_header) - { - if (m_b_chunked) - { - size_t ptr = 0; - while (ptr < len) - { - switch (m_chunk_state) - { - case 4: - while (ptr < len && (m_chunk_line.size() < 2 || m_chunk_line.substr(m_chunk_line.size() - 2) != "\r\n")) - m_chunk_line += buf[ptr++]; - if (m_chunk_line.size() > 1 && m_chunk_line.substr(m_chunk_line.size() - 2) == "\r\n") - { - OnDataComplete(); - // prepare for next request(or response) - m_b_chunked = false; - SetLineProtocol( true ); - m_first = true; - m_header = true; - m_body_size_left = 0; - if (len - ptr > 0) - { - char tmp[TCP_BUFSIZE_READ]; - memcpy(tmp, buf + ptr, len - ptr); - tmp[len - ptr] = 0; - OnRead( tmp, len - ptr ); - ptr = len; - } - } - break; - case 0: - while (ptr < len && (m_chunk_line.size() < 2 || m_chunk_line.substr(m_chunk_line.size() - 2) != "\r\n")) - m_chunk_line += buf[ptr++]; - if (m_chunk_line.size() > 1 && m_chunk_line.substr(m_chunk_line.size() - 2) == "\r\n") - { - m_chunk_line.resize(m_chunk_line.size() - 2); - Parse pa(m_chunk_line, ";"); - std::string size_str = pa.getword(); - m_chunk_size = Utility::hex2unsigned(size_str); - if (!m_chunk_size) - { - m_chunk_state = 4; - m_chunk_line = ""; - } - else - { - m_chunk_state = 1; - m_chunk_line = ""; - } - } - break; - case 1: - { - size_t left = len - ptr; - size_t sz = m_chunk_size < left ? m_chunk_size : left; - OnData(buf + ptr, sz); - m_chunk_size -= sz; - ptr += sz; - if (!m_chunk_size) - { - m_chunk_state = 2; - } - } - break; - case 2: // skip CR - ptr++; - m_chunk_state = 3; - break; - case 3: // skip LF - ptr++; - m_chunk_state = 0; - break; - } - } - } - else - if (!m_b_http_1_1 || !m_b_keepalive) - { - OnData(buf, len); - /* - request is HTTP/1.0 _or_ HTTP/1.1 and not keep-alive - - This means we destroy the connection after the response has been delivered, - hence no need to reset all internal state variables for a new incoming - request. - */ - m_body_size_left -= len; - if (!m_body_size_left) - { - OnDataComplete(); - } - } - else - { - size_t sz = m_body_size_left < len ? m_body_size_left : len; - OnData(buf, sz); - m_body_size_left -= sz; - if (!m_body_size_left) - { - OnDataComplete(); - // prepare for next request(or response) - SetLineProtocol( true ); - m_first = true; - m_header = true; - m_body_size_left = 0; - if (len - sz > 0) - { - char tmp[TCP_BUFSIZE_READ]; - memcpy(tmp, buf + sz, len - sz); - tmp[len - sz] = 0; - OnRead( tmp, len - sz ); - } - } - } - } -} - - -void HTTPSocket::OnLine(const std::string& line) -{ - if (m_first) - { - Parse pa(line); - std::string str = pa.getword(); - if (str.size() > 4 && Utility::ToLower(str.substr(0,5)) == "http/") // response - { - m_http_version = str; - m_status = pa.getword(); - m_status_text = pa.getrest(); - m_response = true; - } - else // request - { - m_method = str; - m_url = pa.getword(); - size_t spl = m_url.find("?"); - if (spl != std::string::npos) - { - m_uri = m_url.substr(0,spl); - m_query_string = m_url.substr(spl + 1); - } - else - { - m_uri = m_url; - m_query_string = ""; - } - m_http_version = pa.getword(); - m_b_http_1_1 = m_http_version.size() > 4 && m_http_version.substr(4) == "/1.1"; - m_b_keepalive = m_b_http_1_1; - m_request = true; - } - m_first = false; - OnFirst(); - return; - } - if (!line.size()) - { - if (m_body_size_left || !m_b_http_1_1 || !m_b_keepalive || m_b_chunked) - { - SetLineProtocol(false); - m_header = false; - } - OnHeaderComplete(); - if (!m_body_size_left && !m_b_chunked) - { - OnDataComplete(); - } - return; - } - Parse pa(line,":"); - std::string key = pa.getword(); - std::string value = pa.getrest(); - OnHeader(key,value); - if (Utility::ToLower(key) == "content-length") - { - m_body_size_left = atol(value.c_str()); - } - if (m_b_http_1_1 && Utility::ToLower(key) == "connection") - { - m_b_keepalive = Utility::ToLower(value) != "close"; - } - if (Utility::ToLower(key) == "transfer-encoding" && Utility::ToLower(value) == "chunked") - { - m_b_chunked = true; - } - /* If remote end tells us to keep connection alive, and we're operating - in http/1.1 mode (not http/1.0 mode), then we mark the socket to be - retained. */ -#ifdef ENABLE_POOL - if (m_b_http_1_1 && m_b_keepalive) - { - SetRetain(); - } -#endif - if (m_header_count++ > m_max_header_count) - { - SetCloseAndDelete(); - Handler().LogError(this, "OnLine", m_header_count, "http header count exceeds builtin limit of (" + Utility::l2string(m_max_header_count) + ")", LOG_LEVEL_FATAL); - } -} - - -void HTTPSocket::SendResponse() -{ - std::string msg; - msg = m_http_version + " " + m_status + " " + m_status_text + "\r\n"; - for (string_m::iterator it = m_response_header.begin(); it != m_response_header.end(); ++it) - { - std::string key = (*it).first; - std::string val = (*it).second; - msg += key + ": " + val + "\r\n"; - } - for (std::list<std::pair<std::string, std::string> >::iterator it2 = m_response_header_append.begin(); it2 != m_response_header_append.end(); ++it2) - { - msg += it2 -> first + ": " + it2 -> second + "\r\n"; - } - msg += "\r\n"; - Send( msg ); -} - - -void HTTPSocket::AddResponseHeader(const std::string& header, const char *format, ...) -{ - char slask[8192]; // temporary for vsprintf / vsnprintf - va_list ap; - - va_start(ap, format); - vsnprintf(slask, sizeof(slask), format, ap); - va_end(ap); - - m_response_header[header] = slask; -} - - -void HTTPSocket::SendRequest() -{ - std::string msg; - msg = m_method + " " + m_url + " " + m_http_version + "\r\n"; - for (string_m::iterator it = m_response_header.begin(); it != m_response_header.end(); ++it) - { - std::string key = (*it).first; - std::string val = (*it).second; - msg += key + ": " + val + "\r\n"; - } - msg += "\r\n"; - Send( msg ); -} - - -std::string HTTPSocket::MyUseragent() -{ - std::string version = "C++Sockets/"; -#ifdef _VERSION - version += _VERSION; -#endif - return version; -} - - -void HTTPSocket::Reset() -{ - m_first = true; - m_header = true; - m_request = false; - m_response = false; - SetLineProtocol(true); - while (m_response_header.size()) - { - string_m::iterator it = m_response_header.begin(); - m_response_header.erase(it); - } - while (m_response_header_append.size()) - { - std::list<std::pair<std::string, std::string> >::iterator it = m_response_header_append.begin(); - m_response_header_append.erase(it); - } - m_header_count = 0; - -} - - -const std::string& HTTPSocket::GetMethod() -{ - return m_method; -} - - -void HTTPSocket::SetMethod(const std::string& x) -{ - m_method = x; -} - - -const std::string& HTTPSocket::GetUrl() -{ - return m_url; -} - - -void HTTPSocket::SetUrl(const std::string& x) -{ - m_url = x; -} - - -const std::string& HTTPSocket::GetUri() -{ - return m_uri; -} - - -const std::string& HTTPSocket::GetQueryString() -{ - return m_query_string; -} - - -const std::string& HTTPSocket::GetHttpVersion() -{ - return m_http_version; -} - - -const std::string& HTTPSocket::GetStatus() -{ - return m_status; -} - - -const std::string& HTTPSocket::GetStatusText() -{ - return m_status_text; -} - - -bool HTTPSocket::IsRequest() -{ - return m_request; -} - - -bool HTTPSocket::IsResponse() -{ - return m_response; -} - - -void HTTPSocket::SetHttpVersion(const std::string& x) -{ - m_http_version = x; -} - - -void HTTPSocket::SetStatus(const std::string& x) -{ - m_status = x; -} - - -void HTTPSocket::SetStatusText(const std::string& x) -{ - m_status_text = x; -} - - -void HTTPSocket::AddResponseHeader(const std::string& x,const std::string& y) -{ - m_response_header[x] = y; -} - - -void HTTPSocket::AppendResponseHeader(const std::string& x,const std::string& y) -{ - m_response_header_append.push_back(std::pair<std::string, std::string>(x,y)); -} - - -void HTTPSocket::SetUri(const std::string& x) -{ - m_uri = x; -} - - -void HTTPSocket::url_this(const std::string& url_in,std::string& protocol,std::string& host,port_t& port,std::string& url,std::string& file) -{ - Parse pa(url_in,"/"); - protocol = pa.getword(); // http - if (!strcasecmp(protocol.c_str(), "https:")) - { -#ifdef HAVE_OPENSSL - EnableSSL(); -#else - Handler().LogError(this, "url_this", -1, "SSL not available", LOG_LEVEL_WARNING); -#endif - port = 443; - } - else - { - port = 80; - } - host = pa.getword(); - if (strstr(host.c_str(),":")) - { - Parse pa(host,":"); - pa.getword(host); - port = static_cast<port_t>(pa.getvalue()); - } - url = "/" + pa.getrest(); - { - Parse pa(url,"/"); - std::string tmp = pa.getword(); - while (tmp.size()) - { - file = tmp; - tmp = pa.getword(); - } - } -} // url_this - - -bool HTTPSocket::ResponseHeaderIsSet(const std::string& name) -{ - string_m::iterator it = m_response_header.find( name ); - if (it != m_response_header.end()) - { - return true; - } - std::list<std::pair<std::string, std::string> >::iterator it2; - for (it2 = m_response_header_append.begin(); it2 != m_response_header_append.end(); ++it2) - { - std::pair<std::string, std::string>& ref = *it2; - if (!strcasecmp(ref.first.c_str(), name.c_str()) ) - { - return true; - } - } - return false; -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HTTPSocket.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HTTPSocket.h deleted file mode 100755 index 37715618b51..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HTTPSocket.h +++ /dev/null @@ -1,175 +0,0 @@ -/** \file HTTPSocket.h Class HTTPSocket definition. - ** \date 2004-04-06 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_HTTPSocket_H -#define _SOCKETS_HTTPSocket_H - -#include "sockets-config.h" -#include "TcpSocket.h" -#include "Utility.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -/** \defgroup http HTTP Sockets */ -/** HTTP request/response base class. - \ingroup http */ -class HTTPSocket : public TcpSocket -{ - /** map to hold http header values. */ - typedef Utility::ncmap<std::string> string_m; -public: - HTTPSocket(ISocketHandler& ); - ~HTTPSocket(); - - void OnRawData(const char *buf,size_t len); - void OnLine(const std::string& line); - - /** Callback executes when first line has been received. - GetMethod, GetUrl/GetUri, and GetHttpVersion are valid when this callback is executed. */ - virtual void OnFirst() = 0; - /** For each header line this callback is executed. - \param key Http header name - \param value Http header value */ - virtual void OnHeader(const std::string& key,const std::string& value) = 0; - /** Callback fires when all http headers have been received. */ - virtual void OnHeaderComplete() = 0; - /** Chunk of http body data recevied. */ - virtual void OnData(const char *,size_t) = 0; - /** The full request/response body has been received. */ - virtual void OnDataComplete() {} - - /** Get http method from incoming request, ie GET/POST/PUT etc */ - const std::string& GetMethod(); - /** Set http method to be used in request. */ - void SetMethod(const std::string& x); - /** Get url from request. */ - const std::string& GetUrl(); - /** Set url to be used in outgoing request. */ - void SetUrl(const std::string& x); - /** Get part of url before '?' character. */ - const std::string& GetUri(); - /** Now why would I need this when there is a SetUrl method? */ - void SetUri(const std::string& x); - /** Get part of url after '?' character. */ - const std::string& GetQueryString(); - /** Get http version from incoming request/response. */ - const std::string& GetHttpVersion(); - /** Get http status from incoming response. */ - const std::string& GetStatus(); - /** Get http statustext from incoming response. */ - const std::string& GetStatusText(); - /** Incoming header has been identified as a request (method url http_version\r\n). */ - bool IsRequest(); - /** Incoming header has been identified as a response (http_version status status_text\r\n). */ - bool IsResponse(); - /** Set http version to be used in outgoing request/response. */ - void SetHttpVersion(const std::string& x); - /** Set http status for outgoing response. */ - void SetStatus(const std::string& x); - /** Set http statustext for outgoing response. */ - void SetStatusText(const std::string& x); - /** Add (and replace if exists) http header. */ - void AddResponseHeader(const std::string& x,const std::string& y); - /** Add (and replace if exists) http header. */ - void AddResponseHeader(const std::string& x,const char *format, ...); - /** Add http header. */ - void AppendResponseHeader(const std::string& x,const std::string& y); - /** See if http header 'name' has been set. */ - bool ResponseHeaderIsSet(const std::string& name); - /** Send response prepared with calls to methods SetHttpVersion, SetStatus, SetStatusText, - and AddResponseHeader. */ - void SendResponse(); - /** Send request prepared with calls to methods SetMethod, SetUrl, SetHttpVersion, - and AddResponseHeader. */ - void SendRequest(); - - /** Implement this to return your own User-agent string. */ - virtual std::string MyUseragent(); - - /** Parse url. If protocol is https, EnableSSL() will be called. */ - void url_this(const std::string& url_in,std::string& protocol,std::string& host,port_t& port,std::string& url,std::string& file); - - /** Transfer coding 'chunked' */ - bool IsChunked() { - return m_b_chunked; - } - -protected: - HTTPSocket(const HTTPSocket& s) : TcpSocket(s) {} - /** Reset state of socket to sucessfully implement keep-alive. */ - virtual void Reset(); - - void SetMaxHeaderCount(int x) { - m_max_header_count = x; - } - -private: - HTTPSocket& operator=(const HTTPSocket& ) { - return *this; - } - bool m_first; - bool m_header; - std::string m_line; - std::string m_method; - std::string m_url; - std::string m_uri; - std::string m_query_string; - std::string m_http_version; - std::string m_status; - std::string m_status_text; - bool m_request; - bool m_response; - string_m m_response_header; - size_t m_body_size_left; - bool m_b_http_1_1; - bool m_b_keepalive; - std::list<std::pair<std::string, std::string> > m_response_header_append; - bool m_b_chunked; - size_t m_chunk_size; - int m_chunk_state; - std::string m_chunk_line; - int m_header_count; - int m_max_header_count; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_HTTPSocket_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpBaseSocket.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpBaseSocket.cpp deleted file mode 100755 index b4103c63979..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpBaseSocket.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/** - ** \file AjpBaseSocket.cpp - ** \date 2007-10-05 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include "HttpBaseSocket.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -#ifdef _DEBUG -#define DEB(x) x -#else -#define DEB(x) -#endif - - -HttpBaseSocket::HttpBaseSocket(ISocketHandler& h) -:HTTPSocket(h) -,m_b_keepalive(false) -{ -} - - -HttpBaseSocket::~HttpBaseSocket() -{ -} - - -void HttpBaseSocket::OnFirst() -{ -DEB(fprintf(stderr, " %s %s %s\n", GetMethod().c_str(), GetUri().c_str(), GetHttpVersion().c_str());) - m_req.SetHttpMethod( GetMethod() ); - m_req.SetUri( GetUri() ); - m_req.SetHttpVersion( GetHttpVersion() ); - - if (Utility::ToLower(GetMethod()) == "get" && !GetQueryString().empty()) - { - m_req.SetAttribute("query_string", GetQueryString() ); - } - - m_req.SetRemoteAddr( GetRemoteAddress() ); - m_req.SetRemoteHost( "" ); // %! - m_req.SetServerName( GetSockAddress() ); - m_req.SetServerPort( GetSockPort() ); -} - - -void HttpBaseSocket::OnHeader(const std::string& key,const std::string& value) -{ -DEB(fprintf(stderr, " (request)OnHeader %s: %s\n", key.c_str(), value.c_str());) - if (Utility::ToLower(key) == "cookie") - m_req.AddCookie(value); - else - m_req.SetHeader(key, value); -} - - -void HttpBaseSocket::OnHeaderComplete() -{ - m_body_size_left = atol( m_req.Header("content-length").c_str() ); - if (m_body_size_left > 0) - { - m_req.InitBody( m_body_size_left ); - } - else - { - // execute - Execute(); - } -} - - -void HttpBaseSocket::OnData(const char *buf,size_t sz) -{ - m_req.Write( buf, sz ); - m_body_size_left -= sz; - if (!m_body_size_left) - { - m_req.CloseBody(); - - // execute - Execute(); - } -} - - -// -------------------------------------------------------------------------------------- -void HttpBaseSocket::Execute() -{ - // parse form data / query_string and cookie header if available - m_req.ParseBody(); - -DEB(printf(" *** http version: %s\n", m_req.HttpVersion().c_str()); -printf(" *** connection: %s\n", m_req.Header("connection").c_str());) - if ( !(m_req.HttpVersion().size() > 4 && m_req.HttpVersion().substr(m_req.HttpVersion().size() - 4) == "/1.1") || - m_req.Header("connection") == "close") - { - m_b_keepalive = false; -DEB(printf(" *** keepalive: false\n");) - } - else - { - m_b_keepalive = true; -DEB(printf(" *** keepalive: true\n");) - } - - // prepare page - OnExec( m_req ); - - m_req.Reset(); - Reset(); -} - - -// -------------------------------------------------------------------------------------- -void HttpBaseSocket::Respond(const HttpResponse& res) -{ - m_res = res; - - SetHttpVersion( m_res.HttpVersion() ); - SetStatus( Utility::l2string(m_res.HttpStatusCode()) ); - SetStatusText( m_res.HttpStatusMsg() ); - - if (!ResponseHeaderIsSet("content-length")) - { - AddResponseHeader( "content-length", Utility::l2string( m_res.GetFile().size() ) ); - } - for (Utility::ncmap<std::string>::const_iterator it = m_res.Headers().begin(); it != m_res.Headers().end(); ++it) - { - AddResponseHeader( it -> first, it -> second ); - } - std::list<std::string> vec = m_res.CookieNames(); - for (std::list<std::string>::iterator it2 = vec.begin(); it2 != vec.end(); ++it2) - { - AppendResponseHeader( "set-cookie", m_res.Cookie(*it2) ); - } - SendResponse(); - - OnTransferLimit(); -} - - -// -------------------------------------------------------------------------------------- -void HttpBaseSocket::OnTransferLimit() -{ - char msg[32768]; - size_t n = m_res.GetFile().fread(msg, 1, 32768); - while (n > 0) - { - SendBuf( msg, n ); - if (GetOutputLength() > 1) - { - SetTransferLimit( 1 ); - break; - } - n = m_res.GetFile().fread(msg, 1, 32768); - } - if (!GetOutputLength()) - { - SetTransferLimit(0); - m_res.GetFile().fclose(); - OnResponseComplete(); - if (!m_b_keepalive) - { - SetCloseAndDelete(); - } - } -} - - -// -------------------------------------------------------------------------------------- -void HttpBaseSocket::Reset() -{ - HTTPSocket::Reset(); - m_body_size_left = 0; -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpBaseSocket.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpBaseSocket.h deleted file mode 100755 index 393c5fadcb5..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpBaseSocket.h +++ /dev/null @@ -1,90 +0,0 @@ -/** - ** \file HttpBaseSocket.h - ** \date 2007-10-05 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _HttpBaseSocket_H -#define _HttpBaseSocket_H - -#include "HTTPSocket.h" -#include "HttpRequest.h" -#include "IHttpServer.h" -#include "HttpResponse.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -class HttpResponse; - -class HttpBaseSocket : public HTTPSocket, public IHttpServer -{ -public: - HttpBaseSocket(ISocketHandler& h); - ~HttpBaseSocket(); - - void OnFirst(); - void OnHeader(const std::string& key,const std::string& value); - void OnHeaderComplete(); - void OnData(const char *,size_t); - - // implements IHttpServer::Respond - void Respond(const HttpResponse& res); - - void OnTransferLimit(); - -protected: - HttpBaseSocket(const HttpBaseSocket& s) : HTTPSocket(s) {} // copy constructor - // - HttpRequest m_req; - HttpResponse m_res; - void Reset(); - -private: - HttpBaseSocket& operator=(const HttpBaseSocket& ) { - return *this; // assignment operator - } - void Execute(); - // - size_t m_body_size_left; - bool m_b_keepalive; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - -#endif // _HttpBaseSocket_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpClientSocket.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpClientSocket.cpp deleted file mode 100755 index 74d16978a5a..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpClientSocket.cpp +++ /dev/null @@ -1,312 +0,0 @@ -/** - ** \file HttpClientSocket.cpp - ** \date 2006-04-20 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include "HttpClientSocket.h" -#include "StdLog.h" -#include "ISocketHandler.h" -#include "File.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -HttpClientSocket::HttpClientSocket(ISocketHandler& h) -:HTTPSocket(h) -,m_data_ptr(NULL) -,m_data_size(0) -,m_content_length(0) -,m_data_ptr_set(false) -,m_fil(NULL) -,m_content_ptr(0) -,m_b_complete(false) -,m_b_close_when_complete(false) -{ -} - - -HttpClientSocket::HttpClientSocket(ISocketHandler& h,const std::string& url_in) -:HTTPSocket(h) -,m_data_ptr(NULL) -,m_data_size(0) -,m_content_length(0) -,m_data_ptr_set(false) -,m_fil(NULL) -,m_content_ptr(0) -,m_b_complete(false) -,m_b_close_when_complete(false) -{ - std::string url; - url_this(url_in, m_protocol, m_host, m_port, url, m_url_filename); - SetUrl( url ); -} - - -HttpClientSocket::HttpClientSocket(ISocketHandler& h,const std::string& host, port_t port, const std::string& url_in) -:HTTPSocket(h) -,m_data_ptr(NULL) -,m_data_size(0) -,m_content_length(0) -,m_data_ptr_set(false) -,m_fil(NULL) -,m_content_ptr(0) -,m_b_complete(false) -,m_b_close_when_complete(false) -{ - std::string url; - std::string tmp = "http://" + host + ":" + Utility::l2string(port) + url_in; - url_this(tmp, m_protocol, m_host, m_port, url, m_url_filename); - SetUrl( url ); -} - - -HttpClientSocket::~HttpClientSocket() -{ - if (m_data_ptr && !m_data_ptr_set) - { - delete[] m_data_ptr; - } - if (m_fil) - { - m_fil -> fclose(); - } -} - - -void HttpClientSocket::OnFirst() -{ - if (!IsResponse()) - { - Handler().LogError(this, "OnFirst", 0, "Response expected but not received - aborting", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } - m_content = GetHttpVersion() + " " + GetStatus() + " " + GetStatusText() + "\r\n"; -} - - -void HttpClientSocket::OnHeader(const std::string& key,const std::string& value) -{ - m_content += key + ": " + value + "\r\n"; - if (!strcasecmp(key.c_str(), "content-length")) - { - m_content_length = atoi(value.c_str()); - } - else - if (!strcasecmp(key.c_str(), "content-type")) - { - m_content_type = value; - } -} - - -void HttpClientSocket::OnHeaderComplete() -{ - if (m_filename.size()) - { - m_fil = new File; - if (!m_fil -> fopen(m_filename, "wb")) - { - delete m_fil; - m_fil = NULL; - } - } - else - if (!m_data_ptr && m_content_length) - { - m_data_ptr = new unsigned char[m_content_length]; - m_data_size = m_content_length; - } -} - - -void HttpClientSocket::OnData(const char *buf,size_t len) -{ - if (m_fil) - { - m_fil -> fwrite(buf, 1, len); - } - else - if (m_data_ptr) - { - if (m_content_ptr + len > m_data_size) - { - Handler().LogError(this, "OnData", -1, "content buffer overflow", LOG_LEVEL_ERROR); - } - else - { - memcpy(m_data_ptr + m_content_ptr, buf, len); - } - } - m_content_ptr += len; - if (m_content_ptr == m_content_length && m_content_length) - { - if (m_fil) - { - m_fil -> fclose(); - delete m_fil; - m_fil = NULL; - } - m_b_complete = true; - OnContent(); - if (m_b_close_when_complete) - { - SetCloseAndDelete(); - } - } -} - - -void HttpClientSocket::OnDelete() -{ - if (!m_b_complete) - { - if (m_fil) - { - m_fil -> fclose(); - delete m_fil; - m_fil = NULL; - } - m_b_complete = true; - OnContent(); - } -} - - -void HttpClientSocket::SetFilename(const std::string& x) -{ - m_filename = x; -} - - -void HttpClientSocket::SetDataPtr(unsigned char *buf,size_t len) -{ - m_data_ptr = buf; - m_data_size = len; - m_data_ptr_set = true; -} - - -const std::string& HttpClientSocket::GetContent() -{ - return m_content; -} - - -size_t HttpClientSocket::GetContentLength() -{ - return m_content_length; -} - - -size_t HttpClientSocket::GetContentPtr() -{ - return m_content_ptr; -} - - -size_t HttpClientSocket::GetPos() -{ - return m_content_ptr; -} - - -bool HttpClientSocket::Complete() -{ - return m_b_complete; -} - - -const unsigned char *HttpClientSocket::GetDataPtr() const -{ - return m_data_ptr; -} - - -void HttpClientSocket::OnContent() -{ -} - - -void HttpClientSocket::SetCloseOnComplete(bool x) -{ - m_b_close_when_complete = x; -} - - -const std::string& HttpClientSocket::GetUrlProtocol() -{ - return m_protocol; -} - - -const std::string& HttpClientSocket::GetUrlHost() -{ - return m_host; -} - - -port_t HttpClientSocket::GetUrlPort() -{ - return m_port; -} - - -const std::string& HttpClientSocket::GetUrlFilename() -{ - return m_url_filename; -} - - -const std::string& HttpClientSocket::GetContentType() -{ - return m_content_type; -} - - -void HttpClientSocket::Url(const std::string& url_in,std::string& host,port_t& port) -{ - std::string url; - url_this(url_in, m_protocol, m_host, m_port, url, m_url_filename); - SetUrl(url); - host = GetUrlHost(); - port = GetUrlPort(); -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpClientSocket.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpClientSocket.h deleted file mode 100755 index f2e9f83b0ae..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpClientSocket.h +++ /dev/null @@ -1,139 +0,0 @@ -/** - ** \file HttpClientSocket.h - ** \date 2006-04-20 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_HttpClientSocket_H -#define _SOCKETS_HttpClientSocket_H - -#include "sockets-config.h" -#include "HTTPSocket.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -class IFile; - -/** Get http response to file or memory. - \ingroup http */ -class HttpClientSocket : public HTTPSocket -{ -public: - HttpClientSocket(ISocketHandler&); - HttpClientSocket(ISocketHandler&,const std::string& url_in); - HttpClientSocket(ISocketHandler&,const std::string& host, port_t port, const std::string& url_in); - ~HttpClientSocket(); - - /** Parse url to protocol,host,port,url and file. */ - void Url(const std::string& url_in,std::string& host,port_t& port); - - void OnFirst(); - void OnHeader(const std::string&,const std::string&); - void OnHeaderComplete(); - void OnData(const char *,size_t); - void OnDelete(); - - /** New callback method fires when all data is received. */ - virtual void OnContent(); - - /** Write response to this file */ - void SetFilename(const std::string& ); - const std::string& Filename() const { - return m_filename; - } - - /** Store response in this buffer. */ - void SetDataPtr(unsigned char *,size_t); - - /** Get response headers. */ - const std::string& GetContent(); - - /** Get size of response body. */ - size_t GetContentLength(); - - /** Get content type from response header. */ - const std::string& GetContentType(); - - /** Get size of received response body. */ - size_t GetContentPtr(); - /** Get size of received response body. */ - size_t GetPos(); - - /** Complete response has been received. */ - bool Complete(); - - /** Get ptr to response data buffer. */ - const unsigned char *GetDataPtr() const; - - /** Close socket when response received. */ - void SetCloseOnComplete(bool = true); - - /** Get protocol used from url. */ - const std::string& GetUrlProtocol(); - /** Get hostname from url. */ - const std::string& GetUrlHost(); - /** Get port from url. */ - port_t GetUrlPort(); - /** Get filename part of url. */ - const std::string& GetUrlFilename(); - -protected: - HttpClientSocket(const HttpClientSocket& s) : HTTPSocket(s) {} // copy constructor - HttpClientSocket& operator=(const HttpClientSocket& ) { - return *this; // assignment operator - } -private: - std::string m_filename; ///< Filename to write response to - unsigned char *m_data_ptr; ///< Ptr to buffer where to store response - size_t m_data_size; ///< Max size of data buffer - size_t m_content_length; ///< Content-length header received from remote - std::string m_content; ///< Received http headers - bool m_data_ptr_set; ///< Buffer set from outside, do not delete - IFile *m_fil; ///< Output file - size_t m_content_ptr; ///< Number of bytes received from body - bool m_b_complete; ///< The entire content-length number of bytes has been received - bool m_b_close_when_complete; ///< Close when the full response has been received - std::string m_protocol; ///< Protocol part of url_in - std::string m_host; ///< Hostname from url_in - port_t m_port; ///< Port from url_in - std::string m_url_filename; ///< Filename from url_in - std::string m_content_type; ///< Content-type: header from response -}; - - - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif -#endif // _SOCKETS_HttpClientSocket_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpDebugSocket.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpDebugSocket.cpp deleted file mode 100755 index 87cbd749f96..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpDebugSocket.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/** \file HttpDebugSocket.cpp - ** \date 2004-10-08 -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom (grymse@alhem.net) - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include "HttpDebugSocket.h" -#include "ISocketHandler.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -HttpDebugSocket::HttpDebugSocket(ISocketHandler& h) : HTTPSocket(h) -,m_content_length(0) -,m_read_ptr(0) -{ -} - - -HttpDebugSocket::~HttpDebugSocket() -{ -} - - -void HttpDebugSocket::Init() -{ - if (GetParent() -> GetPort() == 443) - { -#ifdef HAVE_OPENSSL - EnableSSL(); -#else - Handler().LogError(this, "url_this", -1, "SSL not available", LOG_LEVEL_WARNING); -#endif - } -} - - -void HttpDebugSocket::OnFirst() -{ - Send( - "HTTP/1.1 200 OK\n" - "Content-type: text/html\n" - "Connection: close\n" - "Server: HttpDebugSocket/1.0\n" - "\n"); - Send( - "<html><head><title>Echo Request</title></head>" - "<body><h3>Request Header</h3>"); - Send( "<form method='post' action='/test_post'>" - "<input type='text' name='text' value='test text'><br>" - "<input type='submit' name='submit' value=' OK '></form>"); - - // enctype 'multipart/form-data' - Sendf("<form action='/test_post' method='post' enctype='multipart/form-data'>"); - Sendf("<input type=file name=the_file><br>"); - Sendf("<input type=text name=the_name><br>"); - Sendf("<input type=submit name=submit value=' test form-data '>"); - Sendf("</form>"); - - Send( "<pre style='background: #e0e0e0'>"); - Send(GetMethod() + " " + GetUrl() + " " + GetHttpVersion() + "\n"); -} - - -void HttpDebugSocket::OnHeader(const std::string& key,const std::string& value) -{ - if (!strcasecmp(key.c_str(),"content-length")) - m_content_length = atoi(value.c_str()); - - Send(key + ": " + value + "\n"); -} - - -void HttpDebugSocket::OnHeaderComplete() -{ - if (m_content_length || IsChunked()) - { - Send("</pre><h3>Request Body</h3><pre style='background: #e0e0e0'>"); - } - else - { - Send("</pre><hr></body></html>"); - SetCloseAndDelete(); - } -} - - -void HttpDebugSocket::OnData(const char *p,size_t l) -{ - SendBuf(p,l); - m_read_ptr += (int)l; - if (m_read_ptr >= m_content_length && m_content_length) - { - Send("</pre><hr></body></html>"); - SetCloseAndDelete(); - } -} - - -void HttpDebugSocket::OnDataComplete() -{ - if (!CloseAndDelete()) - { - Send("</pre><hr></body></html>"); - SetCloseAndDelete(); - } -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpDebugSocket.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpDebugSocket.h deleted file mode 100755 index cd0b82d3ea4..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpDebugSocket.h +++ /dev/null @@ -1,76 +0,0 @@ -/** \file HttpDebugSocket.h - ** \date 2004-09-27 -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom (grymse@alhem.net) - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_HttpDebugSocket_H -#define _SOCKETS_HttpDebugSocket_H - -#include "sockets-config.h" -#include "HTTPSocket.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -class ISocketHandler; - -/** HTTP request "echo" class. This class echoes a http request/body -with a html formatted page. - \ingroup http */ -class HttpDebugSocket : public HTTPSocket -{ -public: - HttpDebugSocket(ISocketHandler&); - ~HttpDebugSocket(); - - void Init(); - - void OnFirst(); - void OnHeader(const std::string& key,const std::string& value); - void OnHeaderComplete(); - void OnData(const char *,size_t); - void OnDataComplete(); - -private: - HttpDebugSocket(const HttpDebugSocket& s) : HTTPSocket(s) {} // copy constructor - HttpDebugSocket& operator=(const HttpDebugSocket& ) { - return *this; // assignment operator - } - int m_content_length; - int m_read_ptr; -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_HttpDebugSocket_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpGetSocket.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpGetSocket.cpp deleted file mode 100755 index f7fd7e84d8c..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpGetSocket.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/** \file HttpGetSocket.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _WIN32 -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#else -#include <errno.h> -#endif -#include "ISocketHandler.h" -#include "HttpGetSocket.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -HttpGetSocket::HttpGetSocket(ISocketHandler& h) : HttpClientSocket(h) -{ -} - - -HttpGetSocket::HttpGetSocket(ISocketHandler& h,const std::string& url_in,const std::string& to_file) : HttpClientSocket(h, url_in) -{ - if (to_file.size()) - { - SetFilename(to_file); - } - if (!Open(GetUrlHost(),GetUrlPort())) - { - if (!Connecting()) - { - Handler().LogError(this, "HttpGetSocket", -1, "connect() failed miserably", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } - } -} - - -HttpGetSocket::HttpGetSocket(ISocketHandler& h,const std::string& host,port_t port,const std::string& url,const std::string& to_file) : HttpClientSocket(h, host, port, url) -{ - SetUrl(url); - if (to_file.size()) - { - SetFilename(to_file); - } - if (!Open(host, port)) - { - if (!Connecting()) - { - Handler().LogError(this, "HttpGetSocket", -1, "connect() failed miserably", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } - } -} - - -HttpGetSocket::~HttpGetSocket() -{ -} - - -void HttpGetSocket::OnConnect() -{ - SetMethod( "GET" ); - AddResponseHeader( "Accept", "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1"); - AddResponseHeader( "Accept-Language", "en-us,en;q=0.5"); - AddResponseHeader( "Accept-Encoding", "gzip,deflate"); - AddResponseHeader( "Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"); - AddResponseHeader( "User-agent", MyUseragent() ); - - if (GetUrlPort() != 80 && GetUrlPort() != 443) - AddResponseHeader( "Host", GetUrlHost() + ":" + Utility::l2string(GetUrlPort()) ); - else - AddResponseHeader( "Host", GetUrlHost() ); - SendRequest(); -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpGetSocket.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpGetSocket.h deleted file mode 100755 index 0fb96a23bd8..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpGetSocket.h +++ /dev/null @@ -1,71 +0,0 @@ -/** \file HttpGetSocket.h - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_HttpGetSocket_H -#define _SOCKETS_HttpGetSocket_H - -#include "sockets-config.h" -#include "HttpClientSocket.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -/** Get http page. - \ingroup http */ -class HttpGetSocket : public HttpClientSocket -{ -public: - HttpGetSocket(ISocketHandler&); - HttpGetSocket(ISocketHandler&,const std::string& url,const std::string& to_file = ""); - HttpGetSocket(ISocketHandler&,const std::string& host,port_t port,const std::string& url,const std::string& to_file = ""); - ~HttpGetSocket(); - - void OnConnect(); - -protected: - HttpGetSocket& operator=(const HttpGetSocket& ) { - return *this; - } - HttpGetSocket(const HttpGetSocket& s) : HttpClientSocket(s) {} -}; - - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_HttpGetSocket_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpPostSocket.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpPostSocket.cpp deleted file mode 100755 index 97a44eb2296..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpPostSocket.cpp +++ /dev/null @@ -1,295 +0,0 @@ -/** \file HttpPostSocket.cpp - ** \date 2004-10-30 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _WIN32 -#ifdef _MSC_VER -#pragma warning(disable:4786) -#pragma warning(disable:4503) -#endif -#else -#include <errno.h> -#include <ctype.h> -#endif -#include "ISocketHandler.h" -#include <sys/types.h> -#include <sys/stat.h> -#include "Lock.h" -#include "File.h" - -#include "HttpPostSocket.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -int HttpPostSocket::m_boundary_count = 0; -Mutex HttpPostSocket::m_boundary_mutex; - - -HttpPostSocket::HttpPostSocket(ISocketHandler& h) : HttpClientSocket(h) -,m_bMultipart(false) -{ -} - - -HttpPostSocket::HttpPostSocket(ISocketHandler& h,const std::string& url_in) : HttpClientSocket(h, url_in) -,m_bMultipart(false) -{ - Lock lock(m_boundary_mutex); - - m_boundary = "----"; - for (int i = 0; i < 12; i++) - { - char c = m_boundary_count++ % 128; - while (!isalnum(c)) - c = m_boundary_count++ % 128; - m_boundary += c; - } - m_boundary += "__" + Utility::l2string(m_boundary_count++); -} - - -HttpPostSocket::~HttpPostSocket() -{ -} - - -void HttpPostSocket::AddField(const std::string& name,const std::string& value) -{ - std::list<std::string> vec; - vec.push_back(value); - AddMultilineField(name, vec); -} - - -void HttpPostSocket::AddMultilineField(const std::string& name,std::list<std::string>& values) -{ - m_fields[name] = values; -} - - -void HttpPostSocket::AddFile(const std::string& name,const std::string& filename,const std::string& type) -{ - struct stat st; - if (!stat(filename.c_str(), &st)) - { - m_files[name] = filename; - m_content_length[filename] = st.st_size; - m_content_type[filename] = type; - m_bMultipart = true; - } - else - { - Handler().LogError(this, "AddFile", Errno, StrError(Errno), LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } -} - - -void HttpPostSocket::Open() -{ - // why do I have to specify TcpSocket:: to get to the Open() method?? - TcpSocket::Open(GetUrlHost(), GetUrlPort()); -} - - -void HttpPostSocket::OnConnect() -{ - if (m_bMultipart) - { - DoMultipartPost(); - } - else - { - std::string body; - - // only fields, no files, add urlencoding - for (std::map<std::string,std::list<std::string> >::iterator it = m_fields.begin(); it != m_fields.end(); ++it) - { - std::string name = (*it).first; - std::list<std::string>& ref = (*it).second; - if (body.size()) - { - body += '&'; - } - body += name + "="; - bool first = true; - for (std::list<std::string>::iterator it = ref.begin(); it != ref.end(); ++it) - { - std::string value = *it; - if (!first) - { - body += "%0d%0a"; // CRLF - } - body += Utility::rfc1738_encode(value); - first = false; - } - } - - // build header, send body - SetMethod("POST"); - SetHttpVersion( "HTTP/1.1" ); - AddResponseHeader( "Host", GetUrlHost() ); // oops - this is actually a request header that we're adding.. - AddResponseHeader( "User-agent", MyUseragent()); - AddResponseHeader( "Accept", "text/html, text/plain, */*;q=0.01" ); - AddResponseHeader( "Connection", "close" ); - AddResponseHeader( "Content-type", "application/x-www-form-urlencoded" ); - AddResponseHeader( "Content-length", Utility::l2string((long)body.size()) ); - SendRequest(); - - // send body - Send( body ); - } -} - - -void HttpPostSocket::DoMultipartPost() -{ - long length = 0; // calculate content_length of our post body - std::string tmp; - - // fields - { - for (std::map<std::string,std::list<std::string> >::iterator it = m_fields.begin(); it != m_fields.end(); ++it) - { - std::string name = (*it).first; - std::list<std::string>& ref = (*it).second; - tmp = "--" + m_boundary + "\r\n" - "content-disposition: form-data; name=\"" + name + "\"\r\n" - "\r\n"; - for (std::list<std::string>::iterator it = ref.begin(); it != ref.end(); ++it) - { - std::string value = *it; - tmp += value + "\r\n"; - } - length += (long)tmp.size(); - } - } - - // files - { - for (std::map<std::string,std::string>::iterator it = m_files.begin(); it != m_files.end(); ++it) - { - std::string name = (*it).first; - std::string filename = (*it).second; - long content_length = m_content_length[filename]; - std::string content_type = m_content_type[filename]; - tmp = "--" + m_boundary + "\r\n" - "content-disposition: form-data; name=\"" + name + "\"; filename=\"" + filename + "\"\r\n" - "content-type: " + content_type + "\r\n" - "\r\n"; - length += (long)tmp.size(); - length += content_length; - length += 2; // crlf after file - } - } - - // end - tmp = "--" + m_boundary + "--\r\n"; - length += (long)tmp.size(); - - // build header, send body - SetMethod("POST"); - SetHttpVersion( "HTTP/1.1" ); - AddResponseHeader( "Host", GetUrlHost() ); // oops - this is actually a request header that we're adding.. - AddResponseHeader( "User-agent", MyUseragent()); - AddResponseHeader( "Accept", "text/html, text/plain, */*;q=0.01" ); - AddResponseHeader( "Connection", "close" ); - AddResponseHeader( "Content-type", "multipart/form-data; boundary=" + m_boundary ); - AddResponseHeader( "Content-length", Utility::l2string(length) ); - - SendRequest(); - - // send fields - { - for (std::map<std::string,std::list<std::string> >::iterator it = m_fields.begin(); it != m_fields.end(); ++it) - { - std::string name = (*it).first; - std::list<std::string>& ref = (*it).second; - tmp = "--" + m_boundary + "\r\n" - "content-disposition: form-data; name=\"" + name + "\"\r\n" - "\r\n"; - for (std::list<std::string>::iterator it = ref.begin(); it != ref.end(); ++it) - { - std::string value = *it; - tmp += value + "\r\n"; - } - Send( tmp ); - } - } - - // send files - { - for (std::map<std::string,std::string>::iterator it = m_files.begin(); it != m_files.end(); ++it) - { - std::string name = (*it).first; - std::string filename = (*it).second; - std::string content_type = m_content_type[filename]; - tmp = "--" + m_boundary + "\r\n" - "content-disposition: form-data; name=\"" + name + "\"; filename=\"" + filename + "\"\r\n" - "content-type: " + content_type + "\r\n" - "\r\n"; - Send( tmp ); - { - std::auto_ptr<IFile> fil = std::auto_ptr<IFile>(new File); - if (fil -> fopen(filename, "rb")) - { - char slask[2000]; // for fread - size_t n; - while ((n = fil -> fread(slask, 1, 2000)) > 0) - { - SendBuf(slask, n); - } - fil -> fclose(); - } - } - Send("\r\n"); - } - } - - // end of send - Send("--" + m_boundary + "--\r\n"); -} - - -void HttpPostSocket::SetMultipart() -{ - m_bMultipart = true; -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpPostSocket.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpPostSocket.h deleted file mode 100755 index 2985d6d6f72..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpPostSocket.h +++ /dev/null @@ -1,101 +0,0 @@ -/** \file HttpPostSocket.h - ** \date 2004-10-30 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_HttpPostSocket_H -#define _SOCKETS_HttpPostSocket_H - -#include "sockets-config.h" -#include "HttpClientSocket.h" -#include "Mutex.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -class ISocketHandler; - -/** Generate a http post request, get response. - \ingroup http */ -class HttpPostSocket : public HttpClientSocket -{ -public: - HttpPostSocket(ISocketHandler&); - /* client constructor, - \param url_in = 'http://host:port/resource' */ - HttpPostSocket(ISocketHandler&,const std::string& url_in); - ~HttpPostSocket(); - - // these must be specified before connecting / adding to handler - /** Add field to post. */ - void AddField(const std::string& name,const std::string& value); - /** Add multiline field to post. */ - void AddMultilineField(const std::string& name,std::list<std::string>& values); - /** Add file to post. */ - void AddFile(const std::string& name,const std::string& filename,const std::string& type); - - /** use this to post with content-type multipart/form-data. - // when adding a file to the post, this is the default and only content-type */ - void SetMultipart(); - - /** connect to host:port derived from url in constructor */ - void Open(); - - /** http put client implemented in OnConnect */ - void OnConnect(); - -protected: - std::map<std::string,std::list<std::string> > m_fields; - -private: - HttpPostSocket(const HttpPostSocket& s) : HttpClientSocket(s) {} // copy constructor - HttpPostSocket& operator=(const HttpPostSocket& ) { - return *this; // assignment operator - } - void DoMultipartPost(); - // - std::map<std::string,std::string> m_files; - std::string m_boundary; - std::map<std::string,long> m_content_length; - std::map<std::string,std::string> m_content_type; - bool m_bMultipart; - static int m_boundary_count; - static Mutex m_boundary_mutex; -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_HttpPostSocket_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpPutSocket.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpPutSocket.cpp deleted file mode 100755 index b9eb64d1dc7..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpPutSocket.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/** \file HttpPutSocket.cpp - ** \date 2004-10-30 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _WIN32 -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#else -#include <errno.h> -#endif -#include "ISocketHandler.h" -#include <sys/types.h> -#include <sys/stat.h> -#include "File.h" - -#include "HttpPutSocket.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -HttpPutSocket::HttpPutSocket(ISocketHandler& h) : HttpClientSocket(h) -{ -} - - -HttpPutSocket::HttpPutSocket(ISocketHandler& h,const std::string& url_in) : HttpClientSocket(h, url_in) -{ -} - - -HttpPutSocket::~HttpPutSocket() -{ -} - - -void HttpPutSocket::SetFile(const std::string& file) -{ - struct stat st; - if (!stat(file.c_str(), &st)) - { - m_filename = file; - m_content_length = st.st_size; - } - else - { - Handler().LogError(this, "SetFile", Errno, StrError(Errno), LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } -} - - -void HttpPutSocket::SetContentType(const std::string& type) -{ - m_content_type = type; -} - - - -void HttpPutSocket::Open() -{ - // why do I have to specify TcpSocket:: to get to the Open() method?? - TcpSocket::Open(GetUrlHost(), GetUrlPort()); -} - - -void HttpPutSocket::OnConnect() -{ - SetMethod( "PUT" ); - SetHttpVersion( "HTTP/1.1" ); - AddResponseHeader( "Host", GetUrlHost() ); - AddResponseHeader( "Content-type", m_content_type ); - AddResponseHeader( "Content-length", Utility::l2string(m_content_length) ); - AddResponseHeader( "User-agent", MyUseragent() ); - SendRequest(); - - std::auto_ptr<IFile> fil = std::auto_ptr<IFile>(new File); - if (fil -> fopen(m_filename, "rb")) - { - size_t n; - char buf[32768]; - while ((n = fil -> fread(buf, 1, 32768)) > 0) - { - SendBuf(buf, n); - } - fil -> fclose(); - } -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpPutSocket.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpPutSocket.h deleted file mode 100755 index 0d1f6c5e310..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpPutSocket.h +++ /dev/null @@ -1,88 +0,0 @@ -/** \file HttpPutSocket.h - ** \date 2004-10-30 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_HttpPutSocket_H -#define _SOCKETS_HttpPutSocket_H - -#include "sockets-config.h" -#include "HttpClientSocket.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -class ISocketHandler; - -/** Put http page. - \ingroup http */ -class HttpPutSocket : public HttpClientSocket -{ -public: - HttpPutSocket(ISocketHandler&); - /** client constructor, - \param url_in = 'http://host:port/resource' */ - HttpPutSocket(ISocketHandler&,const std::string& url_in); - ~HttpPutSocket(); - - // these must be specified before connecting / adding to handler - /** Set filename to send. */ - void SetFile(const std::string& ); - /** Set mimetype of file to send. */ - void SetContentType(const std::string& ); - - /** connect to host:port derived from url in constructor */ - void Open(); - - /** http put client implemented in OnConnect */ - void OnConnect(); - -private: - HttpPutSocket(const HttpPutSocket& s) : HttpClientSocket(s) {} // copy constructor - HttpPutSocket& operator=(const HttpPutSocket& ) { - return *this; // assignment operator - } - // - std::string m_filename; - std::string m_content_type; - long m_content_length; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_HttpPutSocket_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpRequest.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpRequest.cpp deleted file mode 100755 index 5373c74f0be..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpRequest.cpp +++ /dev/null @@ -1,428 +0,0 @@ -/** - ** \file HttpRequest.cpp - ** \date 2007-10-05 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include "HttpRequest.h" -#include "MemFile.h" -#include "HttpdForm.h" -#include "HttpdCookies.h" -#include "Parse.h" -#include "Exception.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -#ifdef _DEBUG -#define DEB(x) x; fflush(stderr); -#else -#define DEB(x) -#endif - - -// -------------------------------------------------------------------------------------- -HttpRequest::HttpRequest() : HttpTransaction() -, m_server_port(0) -, m_is_ssl(false) -, m_body_file(NULL) -, m_form(NULL) -{ -} - - -// -------------------------------------------------------------------------------------- -#ifndef _WIN32 -HttpRequest::HttpRequest(FILE *fil) : HttpTransaction() -, m_server_port(0) -, m_is_ssl(false) -, m_body_file(NULL) -, m_form(NULL) -{ - int i = 0; -DEB( std::cout << "Initialize HttpRequest from cgi...\n";) - while (environ[i] && *environ[i]) - { - Parse pa(environ[i], "="); - std::string key = pa.getword(); - std::string value = pa.getrest(); - if (key == "REQUEST_METHOD") - m_method = value; - else - if (key == "SERVER_PROTOCOL") - m_protocol = value; - else - if (key == "PATH_INFO") - m_req_uri = value; - else - if (key == "REMOTE_ADDR") - m_remote_addr = value; - else - if (key == "REMOTE_HOST") - m_remote_host = value; - else - if (key == "SERVER_NAME") - m_server_name = value; - else - if (key == "SERVER_PORT") - m_server_port = atoi(value.c_str()); - else - if (key.size() > 5 && key.substr(0, 5) == "HTTP_") - { - key = key.substr(5); - for (size_t pos = 0; pos < key.size(); pos++) - { - if (key[pos] == '_') - key[pos] = '-'; - else - if (key[pos] >= 'A' && key[pos] <= 'Z') - key[pos] |= 32; - } -DEB( std::cout << " http header '" << key << "' == '" << value << "\n";) - SetHeader(key, value); - } - ++i; - } -DEB( std::cout << " setup http form\n";) - m_form = std::auto_ptr<HttpdForm>(new HttpdForm(fil)); -} -#endif - - -// -------------------------------------------------------------------------------------- -HttpRequest::HttpRequest(const HttpRequest& src) : HttpTransaction(src) -, m_method(src.m_method) -, m_protocol(src.m_protocol) -, m_req_uri(src.m_req_uri) -, m_remote_addr(src.m_remote_addr) -, m_remote_host(src.m_remote_host) -, m_server_name(src.m_server_name) -, m_server_port(src.m_server_port) -, m_is_ssl(src.m_is_ssl) -, m_attribute(src.m_attribute) -, m_null(src.m_null) -, m_body_file(src.m_body_file) -, m_form(src.m_form) -, m_cookies(src.m_cookies) -, m_cookie(src.m_cookie) -{ -} - - -// -------------------------------------------------------------------------------------- -HttpRequest::~HttpRequest() -{ -} - - -// -------------------------------------------------------------------------------------- -HttpRequest& HttpRequest::operator=(const HttpRequest& src) -{ - m_method = src.m_method; - m_protocol = src.m_protocol; - m_req_uri = src.m_req_uri; - m_remote_addr = src.m_remote_addr; - m_remote_host = src.m_remote_host; - m_server_name = src.m_server_name; - m_server_port = src.m_server_port; - m_is_ssl = src.m_is_ssl; - m_attribute = src.m_attribute; - m_null = src.m_null; - m_body_file = src.m_body_file; - m_form = src.m_form; - m_cookies = src.m_cookies; - m_cookie = src.m_cookie; - - HttpTransaction::operator=(src); - - return *this; -} - - -// -------------------------------------------------------------------------------------- -void HttpRequest::SetHttpMethod(const std::string& value) -{ - m_method = value; -} - - -const std::string& HttpRequest::HttpMethod() const -{ - return m_method; -} - - - -// -------------------------------------------------------------------------------------- -void HttpRequest::SetHttpVersion(const std::string& value) -{ - m_protocol = value; -} - - -const std::string& HttpRequest::HttpVersion() const -{ - return m_protocol; -} - - - -// -------------------------------------------------------------------------------------- -void HttpRequest::SetUri(const std::string& value) -{ - m_req_uri = value; -} - - -const std::string& HttpRequest::Uri() const -{ - return m_req_uri; -} - - - -// -------------------------------------------------------------------------------------- -void HttpRequest::SetRemoteAddr(const std::string& value) -{ - m_remote_addr = value; -} - - -const std::string& HttpRequest::RemoteAddr() const -{ - return m_remote_addr; -} - - - -// -------------------------------------------------------------------------------------- -void HttpRequest::SetRemoteHost(const std::string& value) -{ - m_remote_host = value; -} - - -const std::string& HttpRequest::RemoteHost() const -{ - return m_remote_host; -} - - - -// -------------------------------------------------------------------------------------- -void HttpRequest::SetServerName(const std::string& value) -{ - m_server_name = value; -} - - -const std::string& HttpRequest::ServerName() const -{ - return m_server_name; -} - - - -// -------------------------------------------------------------------------------------- -void HttpRequest::SetServerPort(int value) -{ - m_server_port = value; -} - - -int HttpRequest::ServerPort() const -{ - return m_server_port; -} - - - -// -------------------------------------------------------------------------------------- -void HttpRequest::SetIsSsl(bool value) -{ - m_is_ssl = value; -} - - -bool HttpRequest::IsSsl() const -{ - return m_is_ssl; -} - - - -// -------------------------------------------------------------------------------------- -void HttpRequest::SetAttribute(const std::string& key, const std::string& value) -{ - m_attribute[key] = value; -} - - -void HttpRequest::SetAttribute(const std::string& key, long value) -{ - m_attribute[key] = Utility::l2string(value); -} - - -const std::string& HttpRequest::Attribute(const std::string& key) const -{ - Utility::ncmap<std::string>::const_iterator it; - if ( (it = m_attribute.find(key)) != m_attribute.end()) - return it -> second; - return m_null; -} - - -// -------------------------------------------------------------------------------------- -const Utility::ncmap<std::string>& HttpRequest::Attributes() const -{ - return m_attribute; -} - - -// -------------------------------------------------------------------------------------- -void HttpRequest::AddCookie(const std::string& str) -{ - m_cookies.add( str ); - Parse pa(str, ";"); - std::string lstr = pa.getword(); - while (!lstr.empty()) - { - Parse pa2(lstr, "="); - std::string name = pa2.getword(); - m_cookie[name] = lstr; -DEB(fprintf(stderr, " *** AddCookie '%s' = '%s'\n", name.c_str(), lstr.c_str());) - lstr = pa.getword(); - } -} - - -// -------------------------------------------------------------------------------------- -void HttpRequest::InitBody( size_t sz ) -{ - if (!m_body_file.get()) - m_body_file = std::auto_ptr<IFile>(new MemFile); -DEB( else - fprintf(stderr, "Body data file already opened\n");) -} - - -// -------------------------------------------------------------------------------------- -void HttpRequest::Write( const char *buf, size_t sz ) -{ - if (m_body_file.get()) - m_body_file -> fwrite(buf, 1, sz); -DEB( else - fprintf(stderr, "Write: Body data file not open\n");) -} - - -// -------------------------------------------------------------------------------------- -void HttpRequest::CloseBody() -{ - if (m_body_file.get()) - m_body_file -> fclose(); -DEB( else - fprintf(stderr, "CloseBody: File not open\n");) -} - - -// -------------------------------------------------------------------------------------- -void HttpRequest::ParseBody() -{ - Utility::ncmap<std::string>::const_iterator it; - if ( (it = m_attribute.find("query_string")) != m_attribute.end()) - { - std::string qs = it -> second; - m_form = std::auto_ptr<HttpdForm>(new HttpdForm( qs, qs.size() )); - } - else - if (m_body_file.get()) - { - m_form = std::auto_ptr<HttpdForm>(new HttpdForm( m_body_file.get(), ContentType(), ContentLength() )); - } - else - { - // dummy - m_form = std::auto_ptr<HttpdForm>(new HttpdForm( "", 0 )); - } -} - - -// -------------------------------------------------------------------------------------- -const HttpdForm& HttpRequest::Form() const -{ - if (!m_form.get()) - throw Exception("Form not available"); - return *m_form; -} - - -// -------------------------------------------------------------------------------------- -const HttpdCookies& HttpRequest::Cookies() const -{ - return m_cookies; -} - - -// -------------------------------------------------------------------------------------- -void HttpRequest::Reset() -{ - HttpTransaction::Reset(); - m_method = ""; - m_protocol = ""; - m_req_uri = ""; - m_remote_addr = ""; - m_remote_host = ""; - m_server_name = ""; - m_server_port = 0; - m_is_ssl = false; - while (!m_attribute.empty()) - { - m_attribute.erase(m_attribute.begin()); - } - m_body_file = std::auto_ptr<IFile>(NULL); - m_form = std::auto_ptr<HttpdForm>(NULL); - m_cookies.Reset(); - while (!m_cookie.empty()) - { - m_cookie.erase(m_cookie.begin()); - } -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpRequest.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpRequest.h deleted file mode 100755 index e525bfbf2e2..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpRequest.h +++ /dev/null @@ -1,145 +0,0 @@ -/** - ** \file HttpRequest.h - ** \date 2007-10-05 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_HttpRequest_H -#define _SOCKETS_HttpRequest_H - -#include "HttpTransaction.h" -#include "HttpdCookies.h" -#include "IFile.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -class HttpdForm; -class IFile; - -class HttpRequest : public HttpTransaction -{ -public: - HttpRequest(); - /** Create from plain old cgi request */ -#ifndef _WIN32 - HttpRequest(FILE *); -#endif - HttpRequest(const HttpRequest& src); - ~HttpRequest(); - - HttpRequest& operator=(const HttpRequest& src); - - /** Get, Post */ - void SetHttpMethod(const std::string& value); - const std::string& HttpMethod() const; - - /** HTTP/1.x */ - void SetHttpVersion(const std::string& value); - const std::string& HttpVersion() const; - - void SetUri(const std::string& value); - const std::string& Uri() const; - - void SetRemoteAddr(const std::string& value); - const std::string& RemoteAddr() const; - - void SetRemoteHost(const std::string& value); - const std::string& RemoteHost() const; - - void SetServerName(const std::string& value); - const std::string& ServerName() const; - - void SetServerPort(int value); - int ServerPort() const; - - void SetIsSsl(bool value); - bool IsSsl() const; - - /** Set / Read attribute value */ - void SetAttribute(const std::string& key, const std::string& value); - void SetAttribute(const std::string& key, long value); - const std::string& Attribute(const std::string& key) const; - - const Utility::ncmap<std::string>& Attributes() const; - - /** Cookies */ - void AddCookie(const std::string& ); - const Utility::ncmap<std::string>& CookieMap() const { - return m_cookie; - } - - /** Open file for body data */ - void InitBody( size_t sz ); - - /** Write body data */ - void Write( const char *buf, size_t sz ); - - /** No more writing */ - void CloseBody(); - - void ParseBody(); - - const HttpdForm& Form() const; - const HttpdCookies& Cookies() const; - - const IFile *BodyFile() const { - return m_body_file.get(); - } - - void Reset(); - -private: - std::string m_method; - std::string m_protocol; - std::string m_req_uri; - std::string m_remote_addr; - std::string m_remote_host; - std::string m_server_name; - int m_server_port; - bool m_is_ssl; - Utility::ncmap<std::string> m_attribute; - std::string m_null; - mutable std::auto_ptr<IFile> m_body_file; - mutable std::auto_ptr<HttpdForm> m_form; - HttpdCookies m_cookies; - Utility::ncmap<std::string> m_cookie; - -}; // end of class - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - -#endif // _SOCKETS_HttpRequest_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpResponse.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpResponse.cpp deleted file mode 100755 index 39b1c2792dd..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpResponse.cpp +++ /dev/null @@ -1,251 +0,0 @@ -/** - ** \file HttpResponse.cpp - ** \date 2007-10-05 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include <stdarg.h> -#include <stdio.h> - -#include "HttpResponse.h" -#include "HttpRequest.h" -#include "MemFile.h" -#include "File.h" -#include "Parse.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -#ifdef _DEBUG -#define DEB(x) x; fflush(stderr); -#else -#define DEB(x) -#endif - - -// -------------------------------------------------------------------------------------- -HttpResponse::HttpResponse(const std::string& version) : HttpTransaction() -, m_http_version( version ) -, m_http_status_code(0) -, m_file( new MemFile ) -{ -} - - -// -------------------------------------------------------------------------------------- -HttpResponse::HttpResponse(const HttpResponse& src) : HttpTransaction(src) -, m_http_version( src.m_http_version ) -, m_http_status_code( src.m_http_status_code ) -, m_http_status_msg( src.m_http_status_msg ) -, m_cookie( src.m_cookie ) -, m_file( src.m_file ) -{ -} - - -// -------------------------------------------------------------------------------------- -HttpResponse::~HttpResponse() -{ -} - - -// -------------------------------------------------------------------------------------- -HttpResponse& HttpResponse::operator=(const HttpResponse& src) -{ - m_http_version = src.m_http_version; - m_http_status_code = src.m_http_status_code; - m_http_status_msg = src.m_http_status_msg; - m_cookie = src.m_cookie; - m_file = src.m_file; - - HttpTransaction::operator=(src); - - return *this; -} - - -// -------------------------------------------------------------------------------------- -void HttpResponse::SetHttpVersion(const std::string& value) -{ - m_http_version = value; -} - - -// -------------------------------------------------------------------------------------- -const std::string& HttpResponse::HttpVersion() const -{ - return m_http_version; -} - - - -// -------------------------------------------------------------------------------------- -void HttpResponse::SetHttpStatusCode(int value) -{ - m_http_status_code = value; -} - - -int HttpResponse::HttpStatusCode() const -{ - return m_http_status_code; -} - - - -// -------------------------------------------------------------------------------------- -void HttpResponse::SetHttpStatusMsg(const std::string& value) -{ - m_http_status_msg = value; -} - - -const std::string& HttpResponse::HttpStatusMsg() const -{ - return m_http_status_msg; -} - - -// -------------------------------------------------------------------------------------- -void HttpResponse::SetCookie(const std::string& value) -{ - Parse pa(value, "="); - std::string name = pa.getword(); - m_cookie[name] = value; -DEB(fprintf(stderr, "HttpResponse::Set-Cookie<%s>: %s\n", name.c_str(), value.c_str());) -} - - -const std::string HttpResponse::Cookie(const std::string& name) const -{ - Utility::ncmap<std::string>::const_iterator it = m_cookie.find(name); -DEB(fprintf(stderr, "HttpResponse; get value of Cookie<%s>: ", name.c_str());) - if (it != m_cookie.end()) - { -DEB(fprintf(stderr, "%s\n", it -> second.c_str());) - return it -> second; - } -DEB(fprintf(stderr, "\n");) - return ""; -} - - -std::list<std::string> HttpResponse::CookieNames() const -{ - std::list<std::string> vec; - DEB(fprintf(stderr, "HttpResponse::CookieNames; ");) - for (Utility::ncmap<std::string>::const_iterator it = m_cookie.begin(); it != m_cookie.end(); ++it) - { - DEB(fprintf(stderr, " %s", it -> first.c_str());) - vec.push_back(it -> first); - } - DEB(fprintf(stderr, "\n");) - return vec; -} - - - -// -------------------------------------------------------------------------------------- -void HttpResponse::Write( const std::string& str ) -{ - Write( str.c_str(), str.size() ); -} - - -// -------------------------------------------------------------------------------------- -void HttpResponse::Write( const char *buf, size_t sz ) -{ - m_file -> fwrite( buf, 1, sz ); -} - - -// -------------------------------------------------------------------------------------- -void HttpResponse::Writef( const char *format, ... ) -{ - va_list ap; - va_start(ap, format); - char tmp[10000]; - vsnprintf(tmp, sizeof(tmp), format, ap); - va_end(ap); - m_file -> fwrite( tmp, 1, strlen(tmp) ); -} - - -// -------------------------------------------------------------------------------------- -const IFile& HttpResponse::GetFile() const -{ - return *m_file; -} - - -// -------------------------------------------------------------------------------------- -IFile& HttpResponse::GetFile() -{ - return *m_file; -} - - -// -------------------------------------------------------------------------------------- -void HttpResponse::SetFile( const std::string& path ) -{ - m_file = std::auto_ptr<IFile>(new File); - m_file -> fopen( path, "rb" ); -} - - -// -------------------------------------------------------------------------------------- -void HttpResponse::SetFile( IFile *f ) -{ - m_file = std::auto_ptr<IFile>(f); -} - - -// -------------------------------------------------------------------------------------- -void HttpResponse::Reset() -{ - HttpTransaction::Reset(); - m_http_version = ""; - m_http_status_code = 0; - m_http_status_msg = ""; - while (!m_cookie.empty()) - { - m_cookie.erase(m_cookie.begin()); - } - m_file = std::auto_ptr<IFile>(new MemFile); -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpResponse.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpResponse.h deleted file mode 100755 index 8f64f9dc84b..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpResponse.h +++ /dev/null @@ -1,99 +0,0 @@ -/** - ** \file HttpResponse.h - ** \date 2007-10-05 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_HttpResponse_H -#define _SOCKETS_HttpResponse_H - -#include "HttpTransaction.h" -#include <list> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -class IFile; - -class HttpResponse : public HttpTransaction -{ -public: - HttpResponse(const std::string& version = "HTTP/1.0"); - HttpResponse(const HttpResponse& src); - ~HttpResponse(); - - HttpResponse& operator=(const HttpResponse& src); - - /** HTTP/1.x */ - void SetHttpVersion(const std::string& value); - const std::string& HttpVersion() const; - - void SetHttpStatusCode(int value); - int HttpStatusCode() const; - - void SetHttpStatusMsg(const std::string& value); - const std::string& HttpStatusMsg() const; - - void SetCookie(const std::string& value); - const std::string Cookie(const std::string& name) const; - std::list<std::string> CookieNames() const; - - void Write( const std::string& str ); - void Write( const char *buf, size_t sz ); - void Writef( const char *format, ... ); - - const IFile& GetFile() const; - IFile& GetFile(); - - /** Replace memfile with file on disk, opened for read. */ - void SetFile( const std::string& path ); - /** Replace memfile with another IFile */ - void SetFile( IFile *f ); - - void Reset(); - -private: - std::string m_http_version; - int m_http_status_code; - std::string m_http_status_msg; - Utility::ncmap<std::string> m_cookie; - mutable std::auto_ptr<IFile> m_file; - -}; // end of class - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - -#endif // _SOCKETS_HttpResponse_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpTransaction.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpTransaction.cpp deleted file mode 100755 index 62a21d95fa3..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpTransaction.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/** - ** \file HttpTransaction.cpp - ** \date 2007-10-05 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include "HttpTransaction.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -// -------------------------------------------------------------------------------------- -HttpTransaction::HttpTransaction() -{ -} - - -// -------------------------------------------------------------------------------------- -HttpTransaction::~HttpTransaction() -{ -} - - -// -------------------------------------------------------------------------------------- -void HttpTransaction::SetHeader(const std::string& key, const std::string& value) -{ - m_header[key] = value; -} - - -void HttpTransaction::SetHeader(const std::string& key, long value) -{ - m_header[key] = Utility::l2string(value); -} - - -const std::string& HttpTransaction::Header(const std::string& key) const -{ - Utility::ncmap<std::string>::const_iterator it; - if ((it = m_header.find(key)) != m_header.end()) - return it -> second; - return m_null; -} - - - -// -------------------------------------------------------------------------------------- -void HttpTransaction::SetAccept(const std::string& value) -{ - SetHeader("accept", value); -} - - -const std::string& HttpTransaction::Accept() const -{ - return Header("accept"); -} - - - -// -------------------------------------------------------------------------------------- -void HttpTransaction::SetAcceptCharset(const std::string& value) -{ - SetHeader("accept-charset", value); -} - - -const std::string& HttpTransaction::AcceptCharset() const -{ - return Header("accept-charset"); -} - - - -// -------------------------------------------------------------------------------------- -void HttpTransaction::SetAcceptEncoding(const std::string& value) -{ - SetHeader("accept-encoding", value); -} - - -const std::string& HttpTransaction::AcceptEncoding() const -{ - return Header("accept-encoding"); -} - - - -// -------------------------------------------------------------------------------------- -void HttpTransaction::SetAcceptLanguage(const std::string& value) -{ - SetHeader("accept-language", value); -} - - -const std::string& HttpTransaction::AcceptLanguage() const -{ - return Header("accept-language"); -} - - - -// -------------------------------------------------------------------------------------- -void HttpTransaction::SetConnection(const std::string& value) -{ - SetHeader("connection", value); -} - - -const std::string& HttpTransaction::Connection() const -{ - return Header("connection"); -} - - - -// -------------------------------------------------------------------------------------- -void HttpTransaction::SetContentType(const std::string& value) -{ - SetHeader("content-type", value); -} - - -const std::string& HttpTransaction::ContentType() const -{ - return Header("content-type"); -} - - - -// -------------------------------------------------------------------------------------- -void HttpTransaction::SetContentLength(long value) -{ - SetHeader("content-length", value ); -} - - -long HttpTransaction::ContentLength() const -{ - return atol(Header("content-length").c_str()); -} - - - -// -------------------------------------------------------------------------------------- -void HttpTransaction::SetHost(const std::string& value) -{ - SetHeader("host", value); -} - - -const std::string& HttpTransaction::Host() const -{ - return Header("host"); -} - - -const std::string HttpTransaction::HostOnly() const -{ - std::string host = Header("host"); - size_t pos = host.find(":"); - if (pos != std::string::npos) - return host.substr(0, pos); - return host; -} - - - -// -------------------------------------------------------------------------------------- -void HttpTransaction::SetPragma(const std::string& value) -{ - SetHeader("pragma", value); -} - - -const std::string& HttpTransaction::Pragma() const -{ - return Header("pragma"); -} - - - -// -------------------------------------------------------------------------------------- -void HttpTransaction::SetReferer(const std::string& value) -{ - SetHeader("referer", value); -} - - -const std::string& HttpTransaction::Referer() const -{ - return Header("referer"); -} - - - -// -------------------------------------------------------------------------------------- -void HttpTransaction::SetUserAgent(const std::string& value) -{ - SetHeader("user-agent", value); -} - - -const std::string& HttpTransaction::UserAgent() const -{ - return Header("user-agent"); -} - - -// -------------------------------------------------------------------------------------- -const Utility::ncmap<std::string>& HttpTransaction::Headers() const -{ - return m_header; -} - - -// -------------------------------------------------------------------------------------- -void HttpTransaction::Reset() -{ - while (!m_header.empty()) - { - m_header.erase(m_header.begin()); - } -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpTransaction.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpTransaction.h deleted file mode 100755 index 89d2ba5b2a9..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpTransaction.h +++ /dev/null @@ -1,106 +0,0 @@ -/** - ** \file HttpTransaction.h - ** \date 2007-10-05 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_HttpTransaction_H -#define _SOCKETS_HttpTransaction_H - -#include "Utility.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -class HttpTransaction -{ -public: - HttpTransaction(); - virtual ~HttpTransaction(); - - /** Set / Read http header value */ - void SetHeader(const std::string& key, const std::string& value); - void SetHeader(const std::string& key, long value); - const std::string& Header(const std::string& key) const; - - void SetAccept(const std::string& value); - const std::string& Accept() const; - - void SetAcceptCharset(const std::string& value); - const std::string& AcceptCharset() const; - - void SetAcceptEncoding(const std::string& value); - const std::string& AcceptEncoding() const; - - void SetAcceptLanguage(const std::string& value); - const std::string& AcceptLanguage() const; - - void SetConnection(const std::string& value); - const std::string& Connection() const; - - void SetContentType(const std::string& value); - const std::string& ContentType() const; - - void SetContentLength(long value); - long ContentLength() const; - - void SetHost(const std::string& value); - const std::string& Host() const; - const std::string HostOnly() const; - - void SetPragma(const std::string& value); - const std::string& Pragma() const; - - void SetReferer(const std::string& value); - const std::string& Referer() const; - - void SetUserAgent(const std::string& value); - const std::string& UserAgent() const; - - const Utility::ncmap<std::string>& Headers() const; - - virtual void Reset(); - -private: - Utility::ncmap<std::string> m_header; - std::string m_null; - -}; // end of class - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - -#endif // _SOCKETS_HttpTransaction_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdCookies.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdCookies.cpp deleted file mode 100755 index 1b1c038ae86..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdCookies.cpp +++ /dev/null @@ -1,287 +0,0 @@ -/** \file HttpdCookies.cpp -*/ -/* -Copyright (C) 2003-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include "Parse.h" -#include "HTTPSocket.h" -#include "HttpdCookies.h" -#include <stdio.h> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -#ifdef _DEBUG -#define DEB(x) x; fflush(stderr); -#else -#define DEB(x) -#endif - - -HttpdCookies::HttpdCookies() -{ -} - -HttpdCookies::HttpdCookies(const std::string& s) -{ - Parse *pa = new Parse(s,";"); - - std::string slask = pa -> getword(); - while (slask.size()) - { - Parse *pa2 = new Parse(slask,"="); - std::string name = pa2 -> getword(); - std::string value = pa2 -> getword(); - delete pa2; - m_cookies.push_back(std::pair<std::string, std::string>(name, value)); - // - slask = pa -> getword(); - } - delete pa; -} - -void HttpdCookies::add(const std::string& s) -{ - Parse *pa = new Parse(s,";"); -DEB(fprintf(stderr, "Parse cookie: %s\n", s.c_str());) - std::string slask = pa -> getword(); - while (slask.size()) - { - Parse *pa2 = new Parse(slask,"="); - std::string name = pa2 -> getword(); - std::string value = pa2 -> getword(); - delete pa2; - m_cookies.push_back(std::pair<std::string, std::string>(name, value)); - // - slask = pa -> getword(); - } - delete pa; -} - -HttpdCookies::~HttpdCookies() -{ -} - -bool HttpdCookies::getvalue(const std::string& name,std::string& buffer) const -{ - for (cookie_v::const_iterator it = m_cookies.begin(); it != m_cookies.end(); ++it) - { - const std::pair<std::string, std::string>& ref = *it; - if (!strcasecmp(ref.first.c_str(),name.c_str())) - { - buffer = ref.second; - return true; - } - } - buffer = ""; - return false; -} - -void HttpdCookies::replacevalue(const std::string& name,const std::string& value) -{ - for (cookie_v::iterator it = m_cookies.begin(); it != m_cookies.end(); ++it) - { - std::pair<std::string, std::string>& ref = *it; - if (!strcasecmp(ref.first.c_str(),name.c_str())) - { - ref.second = value; - return; - } - } - m_cookies.push_back(std::pair<std::string, std::string>(name, value)); - -} - -void HttpdCookies::replacevalue(const std::string& name,long l) -{ - replacevalue(name, Utility::l2string(l)); -} - -void HttpdCookies::replacevalue(const std::string& name,int i) -{ - replacevalue(name, Utility::l2string(i)); -} - -size_t HttpdCookies::getlength(const std::string& name) const -{ - for (cookie_v::const_iterator it = m_cookies.begin(); it != m_cookies.end(); ++it) - { - const std::pair<std::string, std::string>& ref = *it; - if (!strcasecmp(ref.first.c_str(),name.c_str())) - { - return ref.second.size(); - } - } - return 0; -} - -void HttpdCookies::setcookie(HTTPSocket *sock, const std::string& domain, const std::string& path, const std::string& name, const std::string& value) -{ - size_t sz = name.size() + value.size() + domain.size() + path.size() + 100; - char *str = new char[sz]; - - // set-cookie response - if (domain.size()) - { - snprintf(str, sz, "%s=%s; domain=%s; path=%s; expires=%s", - name.c_str(), value.c_str(), - domain.c_str(), - path.c_str(), - expiredatetime().c_str()); - } - else - { - snprintf(str, sz, "%s=%s; path=%s; expires=%s", - name.c_str(), value.c_str(), - path.c_str(), - expiredatetime().c_str()); - } - sock -> AddResponseHeader("Set-cookie", str); - delete[] str; - - replacevalue(name, value); -} - -void HttpdCookies::setcookie(HTTPSocket *sock, const std::string& domain, const std::string& path, const std::string& name, long value) -{ - size_t sz = name.size() + domain.size() + path.size() + 100; - char *str = new char[sz]; - char dt[80]; - - // set-cookie response - if (domain.size()) - { - snprintf(str, sz, "%s=%ld; domain=%s; path=%s; expires=%s", - name.c_str(), value, - domain.c_str(), - path.c_str(), - expiredatetime().c_str()); - } - else - { - snprintf(str, sz, "%s=%ld; path=%s; expires=%s", - name.c_str(), value, - path.c_str(), - expiredatetime().c_str()); - } - sock -> AddResponseHeader("Set-cookie", str); - delete[] str; - - snprintf(dt, sizeof(dt), "%ld", value); - replacevalue(name, dt); -} - -void HttpdCookies::setcookie(HTTPSocket *sock, const std::string& domain, const std::string& path, const std::string& name, int value) -{ - size_t sz = name.size() + domain.size() + path.size() + 100; - char *str = new char[sz]; - char dt[80]; - - // set-cookie response - if (domain.size()) - { - snprintf(str, sz, "%s=%d; domain=%s; path=%s; expires=%s", - name.c_str(), value, - domain.c_str(), - path.c_str(), - expiredatetime().c_str()); - } - else - { - snprintf(str, sz, "%s=%d; path=%s; expires=%s", - name.c_str(), value, - path.c_str(), - expiredatetime().c_str()); - } - sock -> AddResponseHeader("Set-cookie", str); - delete[] str; - - snprintf(dt, sizeof(dt), "%d", value); - replacevalue(name, dt); -} - - -const std::string& HttpdCookies::expiredatetime() const -{ - const char *days[7] = {"Sunday", "Monday", - "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; - const char *months[12] = {"Jan", "Feb", "Mar", "Apr", "May", - "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; - char dt[100]; - - time_t t = time(NULL); -#ifdef __CYGWIN__ - struct tm *tp = gmtime(&t); - snprintf(dt, sizeof(dt), "%s, %02d-%s-%04d %02d:%02d:%02d GMT", - days[tp -> tm_wday], - tp -> tm_mday, - months[tp -> tm_mon], - tp -> tm_year + 1910, - tp -> tm_hour, - tp -> tm_min, - tp -> tm_sec); -#else - struct tm tp; -#if defined( _WIN32) && !defined(__CYGWIN__) - gmtime_s(&tp, &t); -#else - gmtime_r(&t, &tp); -#endif - snprintf(dt, sizeof(dt), "%s, %02d-%s-%04d %02d:%02d:%02d GMT", - days[tp.tm_wday], - tp.tm_mday, - months[tp.tm_mon], - tp.tm_year + 1910, - tp.tm_hour, - tp.tm_min, - tp.tm_sec); -#endif - m_date = dt; - return m_date; -} - - -void HttpdCookies::Reset() -{ - while (!m_cookies.empty()) - { - m_cookies.erase(m_cookies.begin()); - } - m_date = ""; -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdCookies.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdCookies.h deleted file mode 100755 index 0cc0d1cbe38..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdCookies.h +++ /dev/null @@ -1,94 +0,0 @@ -/** \file HttpdCookies.h -*/ -/* -Copyright (C) 2003-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifndef _SOCKETS_HttpdCookies_H -#define _SOCKETS_HttpdCookies_H - -#include "sockets-config.h" -#include <list> -#include <string> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -//! Store the cookies name/value pairs. - - - -//! Retrieve and manage cookies during a cgi call. -class HTTPSocket; - -/** HTTP Cookie parse/container class. -\sa HttpdSocket -\sa HttpdForm -\ingroup webserver */ -class HttpdCookies -{ - /** list of key/value structs. */ - typedef std::list<std::pair<std::string, std::string> > cookie_v; - -public: - HttpdCookies(); - HttpdCookies(const std::string& query_string); - ~HttpdCookies(); - - void add(const std::string& s); - - bool getvalue(const std::string&,std::string&) const; - void replacevalue(const std::string& ,const std::string& ); - void replacevalue(const std::string& ,long); - void replacevalue(const std::string& ,int); - size_t getlength(const std::string& ) const; - void setcookie(HTTPSocket *,const std::string& d,const std::string& p,const std::string& c,const std::string& v); - void setcookie(HTTPSocket *,const std::string& d,const std::string& p,const std::string& c,long v); - void setcookie(HTTPSocket *,const std::string& d,const std::string& p,const std::string& c,int v); - const std::string& expiredatetime() const; - - cookie_v& GetHttpdCookies() { - return m_cookies; - } - - void Reset(); - -private: - cookie_v m_cookies; - mutable std::string m_date; -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_HttpdCookies_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdForm.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdForm.cpp deleted file mode 100755 index 765fa3ece7d..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdForm.cpp +++ /dev/null @@ -1,717 +0,0 @@ -/** \file HttpdForm.cpp - read stdin, parse cgi input - ** - ** Written: 1999-Feb-10 grymse@alhem.net - **/ - -/* -Copyright (C) 1999-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include "socket_include.h" -#include "Parse.h" -#include "IFile.h" -#include "HttpdForm.h" -#include "IFileUpload.h" -#include "IStream.h" -#include "File.h" - -#include <memory> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -#define TMPSIZE 32000 -#ifdef _DEBUG -#define DEB(x) x -#else -#define DEB(x) -#endif - - -HttpdForm::HttpdForm(FILE *fil) -{ - const char *r_m = getenv("REQUEST_METHOD"); - const char *q_s = getenv("QUERY_STRING"); - if (r_m && !strcasecmp(r_m, "post")) - { - const char *c_t = getenv("CONTENT_TYPE"); - const char *c_l = getenv("CONTENT_LENGTH"); - if (c_t && c_l) - { - std::auto_ptr<IFile> p = std::auto_ptr<IFile>(new File(fil)); - ParseFormData( p.get(), c_t, atoi(c_l) ); - } - } - if (q_s && strlen(q_s)) - { - ParseQueryString(q_s, strlen(q_s)); - } -} - -HttpdForm::HttpdForm(IFile *infil, const std::string& content_type, size_t content_length) : raw(false) -, m_file_upload(NULL) -, m_upload_stream(NULL) -{ - ParseFormData(infil, content_type, content_length); -} - -// HttpdForm(buffer,l) -- request_method GET - -HttpdForm::HttpdForm(const std::string& buffer,size_t l) : raw(false) -, m_file_upload(NULL) -, m_upload_stream(NULL) -{ - ParseQueryString(buffer, l); -} - -void HttpdForm::ParseFormData(IFile *infil, const std::string& content_type, size_t content_length) -{ - CGI *cgi = NULL; - size_t extra = 2; - int cl = (int)content_length; - - m_current = m_cgi.end(); - - if (content_type.size() >= 19 && content_type.substr(0, 19) == "multipart/form-data") - { - Parse pa(content_type,";="); - char *tempcmp = NULL; - size_t tc = 0; - size_t l = 0; - std::string str = pa.getword(); - m_strBoundary = ""; - while (!str.empty()) - { - if (!strcmp(str.c_str(),"boundary")) - { - m_strBoundary = pa.getword(); - l = m_strBoundary.size(); - tempcmp = new char[l + extra]; - } - // - str = pa.getword(); - } - if (!m_strBoundary.empty()) - { - std::string content_type; - std::string current_name; - std::string current_filename; - char *slask = new char[TMPSIZE]; - infil -> fgets(slask, TMPSIZE); - cl -= (int)strlen(slask); - while (cl >= 0 && !infil -> eof()) - { - while (strlen(slask) && (slask[strlen(slask) - 1] == 13 || slask[strlen(slask) - 1] == 10)) - { - slask[strlen(slask) - 1] = 0; - } - content_type = ""; - current_name = ""; - current_filename = ""; - if ((strstr(slask,m_strBoundary.c_str()) || strstr(m_strBoundary.c_str(),slask)) && strcmp(slask, m_strBoundary.c_str())) - { - m_strBoundary = slask; - l = m_strBoundary.size(); - delete[] tempcmp; - tempcmp = new char[l + extra]; - } - if (!strcmp(slask, m_strBoundary.c_str())) - { - // Get headers until empty line - infil -> fgets(slask, TMPSIZE); - cl -= (int)strlen(slask); - while (strlen(slask) && (slask[strlen(slask) - 1] == 13 || slask[strlen(slask) - 1] == 10)) - { - slask[strlen(slask) - 1] = 0; - } - while (cl >= 0 && !infil -> eof() && *slask) - { - Parse pa(slask,":"); - std::string h = pa.getword(); - std::string h2 = pa.getrest(); - if (!strcasecmp(h.c_str(),"Content-type")) - { - Parse pa(h2, ";"); - content_type = pa.getword(); - } - else - if (!strcasecmp(h.c_str(),"Content-Disposition")) - { - Parse pa(h2, ";"); - h = pa.getword(); - if (!strcmp(h.c_str(),"form-data")) - { - pa.EnableQuote(true); - h = pa.getword(); - while (!h.empty()) - { - Parse pa2(h,"="); - std::string name = pa2.getword(); - h = pa2.getrest(); - if (!strcmp(name.c_str(),"name")) - { - if (!h.empty() && h[0] == '"') - { - current_name = h.substr(1, h.size() - 2); - } - else - { - current_name = h; - } - } - else - if (!strcmp(name.c_str(),"filename")) - { - if (!h.empty() && h[0] == '"') - { - current_filename = h.substr(1, h.size() - 2); - } - else - { - current_filename = h; - } - size_t x = 0; - for (size_t i = 0; i < current_filename.size(); i++) - { - if (current_filename[i] == '/' || current_filename[i] == '\\') - x = i + 1; - } - if (x) - { - current_filename = current_filename.substr(x); - } - } - h = pa.getword(); - } - } - } - // get next header value - infil -> fgets(slask, TMPSIZE); - cl -= (int)strlen(slask); - while (strlen(slask) && (slask[strlen(slask) - 1] == 13 || slask[strlen(slask) - 1] == 10)) - { - slask[strlen(slask) - 1] = 0; - } - } - // Read content, save...? - if (current_filename.empty()) // not a file - { - std::string val; - infil -> fgets(slask, TMPSIZE); - cl -= (int)strlen(slask); - while (cl >= 0 && !infil -> eof() && strncmp(slask,m_strBoundary.c_str(),m_strBoundary.size() )) - { - val += slask; - infil -> fgets(slask, TMPSIZE); - cl -= (int)strlen(slask); - } - // remove trailing cr/linefeed - while (!val.empty() && (val[val.size() - 1] == 13 || val[val.size() - 1] == 10)) - { - val = val.substr(0,val.size() - 1); - } - cgi = new CGI(current_name, val); - m_cgi.push_back(cgi); - if (!cl) - { - break; - } - } - else // current_filename.size() > 0 - { - // read until m_strBoundary... - IFile *fil = NULL; - int out = 0; - char c; - char fn[2000]; // where post'd file will be saved -#ifdef _WIN32 - { - char tmp_path[2000]; - ::GetTempPathA(2000, tmp_path); - if (tmp_path[strlen(tmp_path) - 1] != '\\') - { -#ifdef __CYGWIN__ - strcat(tmp_path, "\\"); -#else - strcat_s(tmp_path, sizeof(tmp_path), "\\"); -#endif - } - snprintf(fn,sizeof(fn),"%s%s",tmp_path,current_filename.c_str()); - } -#else - snprintf(fn,sizeof(fn),"/tmp/%s",current_filename.c_str()); -#endif - if (m_file_upload && !m_upload_stream) - m_upload_stream = &m_file_upload -> IFileUploadBegin(current_name, current_filename, content_type); - else - { - fil = new File; - if (!fil -> fopen(fn, "wb")) - { - delete fil; - fil = NULL; - } - } - if (fil || m_upload_stream) - { - infil -> fread(&c,1,1); - cl -= 1; - while (cl >= 0 && !infil -> eof()) - { - if (out) - { - if (m_upload_stream) - m_upload_stream -> IStreamWrite(&tempcmp[tc], 1); - else - fil -> fwrite(&tempcmp[tc],1,1); - } - tempcmp[tc] = c; - tc++; - if (tc >= l + extra) - { - tc = 0; - out = 1; - } - if (tc) - { - if (!strncmp(tempcmp + tc + extra, m_strBoundary.c_str(), l - tc) && - !strncmp(tempcmp, m_strBoundary.c_str() + l - tc, tc)) - { - break; - } - } - else - { - if (!strncmp(tempcmp + extra, m_strBoundary.c_str(), l)) - { - break; - } - } - infil -> fread(&c,1,1); - cl -= 1; - } - if (m_file_upload && m_upload_stream) - { - m_file_upload -> IFileUploadEnd(); - m_upload_stream = NULL; - } - else - if (fil) - { - fil -> fclose(); - delete fil; - } - - cgi = new CGI(current_name,fn,fn); - m_cgi.push_back(cgi); - -#if defined( _WIN32) && !defined(__CYGWIN__) - strcpy_s(slask, TMPSIZE, m_strBoundary.c_str()); -#else - strcpy(slask, m_strBoundary.c_str()); -#endif - size_t l = strlen(slask); - infil -> fgets(slask + l, TMPSIZE - (int)l); // next line - cl -= (int)strlen(slask + l); - } - else - { - // couldn't open file - break; - } - if (!cl) - { - break; - } - } - } - else - { - // Probably '<m_strBoundary>--' - break; - } - } // while (!infil -> eof()) - delete[] slask; - } // if (m_strBoundary) - if (tempcmp) - { - delete[] tempcmp; - } - } // end of multipart - else - if (strstr(content_type.c_str(), "x-www-form-urlencoded")) - { - bool got_name = false; // tnx to FatherNitwit - int cl = (int)content_length; - char c,chigh,clow; - std::string slask; - m_current = m_cgi.end(); - std::string name; - - infil -> fread(&c,1,1); - cl--; - while (cl >= 0 && !infil -> eof()) - { - switch (c) // built-in url decoder - { - case '=': /* end of name */ - name = slask; - slask.resize(0); - got_name = true; - break; - case '&': /* end of value */ - if (got_name) - { - cgi = new CGI(name,slask); - got_name = false; - } - else - { - cgi = new CGI(slask, ""); - } - slask.resize(0); - m_cgi.push_back(cgi); - break; - case '+': /* space */ - slask += " "; - break; - case '%': /* hex value */ - infil -> fread(&chigh,1,1); - cl--; - chigh -= 48 + (chigh > '9' ? 7 : 0) + (chigh >= 'a' ? 32 : 0); - infil -> fread(&clow,1,1); - cl--; - clow -= 48 + (clow > '9' ? 7 : 0) + (clow >= 'a' ? 32 : 0); - slask += (char)(chigh * 16 + clow); - break; - default: /* just another char */ - slask += c; - break; - } - // - if (cl > 0) - { - infil -> fread(&c,1,1); - } - cl--; - } - if (got_name) - { - cgi = new CGI(name,slask); - } - else - { - cgi = new CGI(slask, ""); - } - m_cgi.push_back(cgi); - } - else // read other content up to a limit - if (content_length > 0 && content_length < 500000) - { - int ptr = 0; - int cl = (int)content_length; - m_content.resize(cl); - while (ptr < cl) - { - int remaining = cl - ptr; - int n = fread(&m_content[ptr], 1, remaining, stdin); - if (n > 0) - ptr += n; - } - } -} - - -void HttpdForm::ParseQueryString(const std::string& buffer,size_t l) -{ - CGI *cgi = NULL; - std::string slask; - std::string name; - char c,chigh,clow; - size_t ptr = 0; - bool got_name = false; - - m_current = m_cgi.end(); - - ptr = 0; - while (ptr < l) - { - c = buffer[ptr++]; - switch (c) - { - case '=': /* end of name */ - name = slask; - slask.resize(0); - got_name = true; - break; - case '&': /* end of value */ - if (got_name) - { - cgi = new CGI(name,slask); - got_name = false; - } - else - { - cgi = new CGI(slask, ""); - } - slask.resize(0); - m_cgi.push_back(cgi); - break; - case '+': /* space */ - slask += " "; - break; - case '%': /* hex value */ - chigh = buffer[ptr++]; - chigh -= 48 + (chigh > '9' ? 7 : 0) + (chigh >= 'a' ? 32 : 0); - clow = buffer[ptr++]; - clow -= 48 + (clow > '9' ? 7 : 0) + (clow >= 'a' ? 32 : 0); - slask += (char)(chigh * 16 + clow); - break; - default: /* just another char */ - slask += c; - break; - } - } - if (got_name) - { - cgi = new CGI(name,slask); - } - else - { - cgi = new CGI(slask, ""); - } - m_cgi.push_back(cgi); -} - - -HttpdForm::~HttpdForm() -{ - CGI *cgi = NULL; //,*tmp; - - for (cgi_v::iterator it = m_cgi.begin(); it != m_cgi.end(); ++it) - { - cgi = *it; - delete cgi; - } -} - - -void HttpdForm::EnableRaw(bool b) -{ - raw = b; -} - - -void HttpdForm::strcpyval(std::string& v,const char *value) const -{ - v = ""; - for (size_t i = 0; i < strlen(value); i++) - { - if (value[i] == '<') - { - v += "<"; - } - else - if (value[i] == '>') - { - v += ">"; - } - else - if (value[i] == '&') - { - v += "&"; - } - else - { - v += value[i]; - } - } -} - - -bool HttpdForm::getfirst(std::string& n) const -{ - m_current = m_cgi.begin(); - return getnext(n); -} - - -bool HttpdForm::getnext(std::string& n) const -{ - if (m_current != m_cgi.end() ) - { - CGI *current = *m_current; - n = current -> name; - m_current++; - return true; - } - else - { - n = ""; - } - return false; -} - - -bool HttpdForm::getfirst(std::string& n,std::string& v) const -{ - m_current = m_cgi.begin(); - return getnext(n,v); -} - - -bool HttpdForm::getnext(std::string& n,std::string& v) const -{ - if (m_current != m_cgi.end() ) - { - CGI *current = *m_current; - n = current -> name; - if (raw) - { - v = current -> value; - } - else - { - strcpyval(v,current -> value.c_str()); - } - m_current++; - return true; - } - else - { - n = ""; - } - return false; -} - - -int HttpdForm::getvalue(const std::string& n,std::string& v) const -{ - CGI *cgi = NULL; - int r = 0; - - for (cgi_v::const_iterator it = m_cgi.begin(); it != m_cgi.end(); ++it) - { - cgi = *it; - if (cgi -> name == n) - break; - cgi = NULL; - } - if (cgi) - { - if (raw) - { - v = cgi -> value; - } - else - { - strcpyval(v,cgi -> value.c_str()); - } - r++; - } - else - { - v = ""; - } - - return r; -} - - -std::string HttpdForm::getvalue(const std::string& n) const -{ - for (cgi_v::const_iterator it = m_cgi.begin(); it != m_cgi.end(); ++it) - { - CGI *cgi = *it; - if (cgi -> name == n) - { - return cgi -> value; - } - } - return ""; -} - - -size_t HttpdForm::getlength(const std::string& n) const -{ - CGI *cgi = NULL; - size_t l; - - for (cgi_v::const_iterator it = m_cgi.begin(); it != m_cgi.end(); ++it) - { - cgi = *it; - if (cgi -> name == n) - break; - cgi = NULL; - } - l = cgi ? cgi -> value.size() : 0; - if (cgi && !raw) - { - for (size_t i = 0; i < cgi -> value.size(); i++) - { - switch (cgi -> value[i]) - { - case '<': // < - case '>': // > - l += 4; - break; - case '&': // & - l += 5; - break; - } - } - } - return l; -} - - -HttpdForm::cgi_v& HttpdForm::getbase() -{ - return m_cgi; -} - - -const std::string& HttpdForm::GetBoundary() const -{ - return m_strBoundary; -} - - -void HttpdForm::SetFileUpload(IFileUpload& cb) -{ - m_file_upload = &cb; -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdForm.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdForm.h deleted file mode 100755 index c58de69a0ee..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdForm.h +++ /dev/null @@ -1,147 +0,0 @@ -/** \file HttpdForm.h - read stdin, parse cgi input - ** - ** Written: 1999-Feb-10 grymse@alhem.net - **/ - -/* -Copyright (C) 1999-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifndef _SOCKETS_HttpdForm_H -#define _SOCKETS_HttpdForm_H - -#include "sockets-config.h" -#include <string> -#include <list> -#include <cstdio> -#include <cstring> -#include <vector> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -class IFile; -class IFileUpload; -class IStream; - -/** Parse/store a http query_string/form-data body. - \ingroup webserver */ -class HttpdForm -{ - /** - * Store the name/value pairs from a GET/POST operation. - * "name" does not have to be unique. - \ingroup webserver - */ - struct CGI { - CGI(const std::string& n,const std::string& v) : name(n),value(v) {} - CGI(const std::string& n,const std::string& v,const std::string& p) : name(n),value(v),path(p) {} - std::string name; - std::string value; - std::string path; - }; - /** list of key/value pairs. */ - typedef std::list<CGI *> cgi_v; - -public: - /** - * Default constructor - */ - HttpdForm(FILE *); - /** - * Constructor (used in POST operations). - * Input is read from stdin. Number of characters to read - * can be found in the environment variable CONTENT_LENGTH. - */ - HttpdForm(IFile *, const std::string& content_type, size_t content_length); - /** - * Another constructor (used in GET operations). - * Input is read from the environment variable QUERY_STRING. - * @param query_string The httpd server provided QUERY_STRING - * @param length Query string length. - */ - HttpdForm(const std::string& query_string,size_t length); - ~HttpdForm(); - - void ParseFormData(IFile *, const std::string&, size_t); - void ParseQueryString(const std::string& query_string, size_t length); - - void EnableRaw(bool); - - /** Encode characters '<' '>' '&' as < > & */ - void strcpyval(std::string&,const char *) const; - - /* get names */ - bool getfirst(std::string& n) const; - bool getnext(std::string& n) const; - - /* get names and values */ - bool getfirst(std::string& n,std::string& v) const; - bool getnext(std::string& n,std::string& v) const; - - /* get value */ - int getvalue(const std::string& ,std::string& ) const; - std::string getvalue(const std::string& ) const; - size_t getlength(const std::string& ) const; - cgi_v& getbase(); - - const std::string& GetBoundary() const; - - /** Enable IFileUpload callback */ - void SetFileUpload(IFileUpload& cb); - - bool ContentAvailable() const { - return !m_content.empty(); - } - const std::vector<char>& GetContent() const { - return m_content; - } - -private: - HttpdForm(const HttpdForm& ) {} - HttpdForm& operator=(const HttpdForm& ) { - return *this; - } - cgi_v m_cgi; - mutable cgi_v::const_iterator m_current; - std::string m_strBoundary; - bool raw; - IFileUpload *m_file_upload; - IStream *m_upload_stream; - std::vector<char> m_content; -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_HttpdForm_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdSocket.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdSocket.cpp deleted file mode 100755 index 40e5c339260..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdSocket.cpp +++ /dev/null @@ -1,326 +0,0 @@ -/** \file HttpdSocket.cpp -*/ -/* -Copyright (C) 2001-2010 Anders Hedstrom (grymse@alhem.net) - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include "HttpdCookies.h" -#include "HttpdForm.h" -#include "MemFile.h" -#include "HttpdSocket.h" -#include "Base64.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -#define TMPSIZE 10000 - - -// statics -int HttpdSocket::m_request_count = 0; -std::string HttpdSocket::m_start = ""; - - -HttpdSocket::HttpdSocket(ISocketHandler& h) -:HTTPSocket(h) -,m_content_length(0) -,m_file(NULL) -,m_received(0) -,m_request_id(++m_request_count) -,m_cookies(NULL) -,m_form(NULL) -{ - m_http_date = datetime2httpdate(GetDate()); - if (!m_start.size()) - m_start = m_http_date; -} - - -HttpdSocket::~HttpdSocket() -{ - if (m_file) - { - delete m_file; - } - if (m_cookies) - delete m_cookies; - if (m_form) - delete m_form; -} - - -void HttpdSocket::OnFirst() -{ -} - - -void HttpdSocket::OnHeader(const std::string& key,const std::string& value) -{ - if (!strcasecmp(key.c_str(),"content-length")) - { - m_content_length = atoi(value.c_str()); - m_content_length_str = value; - } - else - if (!strcasecmp(key.c_str(),"cookie")) - { - m_http_cookie = value; - } - else - if (!strcasecmp(key.c_str(),"content-type")) - { - m_content_type = value; - } - else - if (!strcasecmp(key.c_str(),"if-modified-since")) - { - m_if_modified_since = value; - } -} - - -void HttpdSocket::OnHeaderComplete() -{ - m_cookies = new HttpdCookies(m_http_cookie); - - if (GetMethod() == "GET") - { - Utility::SetEnv("QUERY_STRING", GetQueryString()); - } - Utility::SetEnv("REQUEST_METHOD", GetMethod()); - Utility::SetEnv("HTTP_COOKIE", m_http_cookie); - Utility::SetEnv("CONTENT_TYPE", m_content_type); - Utility::SetEnv("CONTENT_LENGTH", m_content_length_str); - if (GetMethod() == "POST") - { - m_file = new MemFile; - } - else - if (GetMethod() == "GET") - { - m_form = new HttpdForm(GetQueryString(), GetQueryString().size() ); - AddResponseHeader("Date", datetime2httpdate(GetDate()) ); - if (GetUri() == "/image") - { - Send64(Utility::Logo, "image/png"); - } - else - { - Exec(); - } - Reset(); // prepare for next request - } - else - { - AddResponseHeader("Date", GetHttpDate()); - AddResponseHeader("Connection", "close"); - SetStatus("405"); - SetStatusText("Method not allowed"); - SendResponse(); - } -} - - -void HttpdSocket::OnData(const char *p,size_t l) -{ - if (m_file) - { - m_file -> fwrite(p,1,l); - } - m_received += l; - if (m_received >= m_content_length && m_content_length) - { - // all done - if (m_file && !m_form) - { - m_form = new HttpdForm(m_file, m_content_type, m_content_length); - AddResponseHeader("Date", datetime2httpdate(GetDate()) ); - if (GetUri() == "/image") - { - Send64(Utility::Logo, "image/png"); - } - else - { - Exec(); - } - Reset(); // prepare for next request - } - } -} - - -void HttpdSocket::Send64(const std::string& str64, const std::string& type) -{ - Base64 bb; - - if (!strcasecmp(m_start.c_str(), m_if_modified_since.c_str())) - { - SetStatus("304"); - SetStatusText("Not Modified"); - SendResponse(); - } - else - { - size_t len = bb.decode_length(str64); - unsigned char *buf = new unsigned char[len]; - - SetStatus("200"); - SetStatusText("OK"); - - AddResponseHeader("Content-length", Utility::l2string( (long)len) ); - AddResponseHeader("Content-type", type ); - AddResponseHeader("Last-modified", m_start); - SendResponse(); - - bb.decode(str64, buf, len); - SendBuf( (char *)buf, len); - delete[] buf; - } -} - - -std::string HttpdSocket::datetime2httpdate(const std::string& dt) -{ - struct tm tp; - time_t t; - const char *days[] = { "Sun","Mon","Tue","Wed","Thu","Fri","Sat" }; - const char *months[] = { "Jan","Feb","Mar","Apr","May","Jun", - "Jul","Aug","Sep","Oct","Nov","Dec" }; - int i; - char s[40]; - -/* 1997-12-16 09:50:40 */ - - if (dt.size() == 19) - { - tp.tm_year = atoi(dt.substr(0,4).c_str()) - 1900; - i = atoi(dt.substr(5,2).c_str()) - 1; - tp.tm_mon = i >= 0 ? i : 0; - tp.tm_mday = atoi(dt.substr(8,2).c_str()); - tp.tm_hour = atoi(dt.substr(11,2).c_str()); - tp.tm_min = atoi(dt.substr(14,2).c_str()); - tp.tm_sec = atoi(dt.substr(17,2).c_str()); - tp.tm_wday = 0; - tp.tm_yday = 0; - tp.tm_isdst = 0; - t = mktime(&tp); - if (t == -1) - { - Handler().LogError(this, "datetime2httpdate", 0, "mktime() failed"); - } - - snprintf(s,sizeof(s),"%s, %02d %s %d %02d:%02d:%02d GMT", - days[tp.tm_wday], - tp.tm_mday, - months[tp.tm_mon], - tp.tm_year + 1900, - tp.tm_hour,tp.tm_min,tp.tm_sec); - } - else - { - *s = 0; - } - return s; -} - - -std::string HttpdSocket::GetDate() -{ - time_t t = time(NULL); - char slask[40]; // yyyy-mm-dd hh:mm:ss -#ifdef __CYGWIN__ - struct tm *tp = localtime(&t); - snprintf(slask,sizeof(slask),"%d-%02d-%02d %02d:%02d:%02d", - tp -> tm_year + 1900, - tp -> tm_mon + 1, - tp -> tm_mday, - tp -> tm_hour,tp -> tm_min,tp -> tm_sec); -#else - struct tm tp; -#if defined( _WIN32) && !defined(__CYGWIN__) - localtime_s(&tp, &t); -#else - localtime_r(&t, &tp); -#endif - snprintf(slask,sizeof(slask),"%d-%02d-%02d %02d:%02d:%02d", - tp.tm_year + 1900, - tp.tm_mon + 1, - tp.tm_mday, - tp.tm_hour,tp.tm_min,tp.tm_sec); -#endif - return slask; -} - - -void HttpdSocket::Reset() -{ - HTTPSocket::Reset(); - m_content_length = 0; - if (m_file) - { - delete m_file; - m_file = NULL; - } - m_received = 0; - m_request_id = ++m_request_count; - if (m_cookies) - delete m_cookies; - m_cookies = NULL; - if (m_form) - delete m_form; - m_form = NULL; -} - - -const std::string& HttpdSocket::GetHttpDate() const -{ - return m_http_date; -} - - -HttpdCookies *HttpdSocket::GetCookies() -{ - return m_cookies; -} - - -const HttpdForm *HttpdSocket::GetForm() const -{ - return m_form; -} - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdSocket.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdSocket.h deleted file mode 100755 index f28cdf5573c..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/HttpdSocket.h +++ /dev/null @@ -1,117 +0,0 @@ -/** \file HttpdSocket.h -*/ -/* -Copyright (C) 2001-2010 Anders Hedstrom (grymse@alhem.net) - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_HttpdSocket_H -#define _SOCKETS_HttpdSocket_H - -#include "sockets-config.h" -#include "HTTPSocket.h" -#include "ISocketHandler.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -class HttpdCookies; -class HttpdForm; -class IFile; - -/** \defgroup webserver Webserver framework */ -/** Web server socket framework. - \ingroup webserver */ -class HttpdSocket : public HTTPSocket -{ -public: - HttpdSocket(ISocketHandler& ); - ~HttpdSocket(); - - void OnFirst(); - void OnHeader(const std::string& key,const std::string& value); - void OnHeaderComplete(); - void OnData(const char *,size_t); - - /** This method needs to be implemented with logic to produce - a response to an incoming request. */ - virtual void Exec() = 0; - /** Get current date in http rfc format. */ - const std::string& GetHttpDate() const; - /** Get pointer to cookie class. */ - HttpdCookies *GetCookies(); - /** Get pointer to query string/form data class. */ - const HttpdForm *GetForm() const; - - size_t ContentLength() const { - return m_content_length; - } - const IFile *Body() const { - return m_file; - } - int RequestId() const { - return m_request_id; - } - -protected: - HttpdSocket(const HttpdSocket& s) : HTTPSocket(s) {} - /** Decode and send a base64-encoded string. - \param str64 Base64-encoded string - \param type Mime type of content (content-type header) */ - void Send64(const std::string& str64, const std::string& type); - std::string datetime2httpdate(const std::string& dt); - std::string GetDate(); - void Reset(); - // headers - std::string m_http_cookie; - std::string m_content_type; - std::string m_content_length_str; - std::string m_if_modified_since; - -private: - HttpdSocket& operator=(const HttpdSocket& s) { - return *this; - } - static int m_request_count; - static std::string m_start; - size_t m_content_length; - IFile *m_file; - size_t m_received; - int m_request_id; - std::string m_http_date; - HttpdCookies *m_cookies; - HttpdForm *m_form; -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_HttpdSocket_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IBase.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IBase.h deleted file mode 100755 index 49449b0434e..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IBase.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - ** \file - ** \date 2007-06-05 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_IBase_H -#define _SOCKETS_IBase_H - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -class IBase -{ -public: - virtual ~IBase() {} - -}; - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - -#endif // _SOCKETS_IBase_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IEventHandler.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IEventHandler.h deleted file mode 100755 index 16ee1c237ca..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IEventHandler.h +++ /dev/null @@ -1,78 +0,0 @@ -/** \file IEventHandler.h - ** \date 2005-12-07 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2005-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_IEventHandler_H -#define _SOCKETS_IEventHandler_H - -#include "sockets-config.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -class IEventOwner; - -/** Timer event handler pure virtual base class. - \ingroup timer */ -class IEventHandler -{ -public: - virtual ~IEventHandler() {} - - /** Return time left until next event. - \param tv Time struct that will be filled by method - \return true if time is set for next event */ - virtual bool GetTimeUntilNextEvent(struct timeval *) = 0; - /** Will fire events whose time has come. */ - virtual void CheckEvents() = 0; - /** Schedule event for an owner. - \param from Event owner - \param sec Seconds until event - \param usec Microseconds until event */ - virtual long AddEvent(IEventOwner *,long sec,long usec) = 0; - /** Clear all events for a specific owner. */ - virtual void ClearEvents(IEventOwner *) = 0; - /** Remove one specific event for an event owner. */ - virtual void RemoveEvent(IEventOwner *,long) = 0; - -}; - - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_IEventHandler_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IEventOwner.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IEventOwner.cpp deleted file mode 100755 index a2ac5b70df7..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IEventOwner.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/** \file IEventOwner.cpp - ** \date 2005-12-07 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2005-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "IEventOwner.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -IEventOwner::IEventOwner(IEventHandler& h) : m_event_handler(h), m_handler_invalid(false) -{ -} - - -IEventOwner::~IEventOwner() -{ - if (!m_handler_invalid) - { - m_event_handler.ClearEvents(this); - } -} - - -IEventHandler& IEventOwner::GetEventHandler() -{ - return m_event_handler; -} - - -long IEventOwner::AddEvent(long sec,long usec) -{ - return m_event_handler.AddEvent(this, sec, usec); -} - - -void IEventOwner::ClearEvents() -{ - m_event_handler.ClearEvents(this); -} - - -void IEventOwner::RemoveEvent(long eid) -{ - m_event_handler.RemoveEvent(this, eid); -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IEventOwner.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IEventOwner.h deleted file mode 100755 index 4c4857b1a18..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IEventOwner.h +++ /dev/null @@ -1,82 +0,0 @@ -/** \file IEventOwner.h - ** \date 2005-12-07 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2005-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_IEventOwner_H -#define _SOCKETS_IEventOwner_H - -#include "sockets-config.h" -#include "IEventHandler.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -/** Any class that wants to use timer events inherits this. - \ingroup timer */ -class IEventOwner -{ -public: - IEventOwner(IEventHandler& h); - virtual ~IEventOwner(); - - /** Schedule event. - \param sec Seconds until event - \param usec Microseconds until event - \return Event ID */ - long AddEvent(long sec,long usec); - /** Clear all events scheduled by this owner. */ - void ClearEvents(); - /** Remove one event scheduled by this owner. - \param eid Event ID to remove */ - void RemoveEvent(long eid); - /** Event callback will fire when time is up. */ - virtual void OnEvent(int) = 0; - - IEventHandler& GetEventHandler(); - void SetHandlerInvalid(bool x = true) { - m_handler_invalid = x; - } - -private: - IEventHandler& m_event_handler; - bool m_handler_invalid; -}; - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_IEventOwner_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IFile.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IFile.h deleted file mode 100755 index 847b2c76109..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IFile.h +++ /dev/null @@ -1,75 +0,0 @@ -/** \file IFile.h - ** \date 2005-04-25 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_IFile_H -#define _SOCKETS_IFile_H - -#include "sockets-config.h" -#include <string> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -/** \defgroup file File handling */ -/** Pure virtual file I/O interface. - \ingroup file */ -class IFile -{ -public: - virtual ~IFile() {} - - virtual bool fopen(const std::string&, const std::string&) = 0; - virtual void fclose() const = 0; - - virtual size_t fread(char *, size_t, size_t) const = 0; - virtual size_t fwrite(const char *, size_t, size_t) = 0; - - virtual char *fgets(char *, int) const = 0; - virtual void fprintf(const char *format, ...) = 0; - - virtual off_t size() const = 0; - virtual bool eof() const = 0; - - virtual void reset_read() const = 0; - virtual void reset_write() = 0; - - virtual const std::string& Path() const = 0; -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_IFile_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IFileUpload.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IFileUpload.h deleted file mode 100755 index a697ee7cf26..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IFileUpload.h +++ /dev/null @@ -1,61 +0,0 @@ -/** \file IFileUpload.h - ** \date 2009-04-22 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_IFileUpload_H -#define _SOCKETS_IFileUpload_H - -#include "sockets-config.h" -#include <string> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -class IStream; - -/** Multipart form file upload callback. - \ingroup webserver */ -class IFileUpload -{ -public: - virtual ~IFileUpload() {} - - virtual IStream& IFileUploadBegin(const std::string& input_name, const std::string& filename, const std::string& content_type) = 0; - - virtual void IFileUploadEnd() = 0; -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_IFileUpload_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IHttpServer.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IHttpServer.h deleted file mode 100755 index 545b5636439..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IHttpServer.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - ** \file IHttpServer.h - ** \date 2007-10-05 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_IHttpServer_H -#define _SOCKETS_IHttpServer_H - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -class HttpRequest; -class HttpResponse; - -class IHttpServer -{ -public: - virtual ~IHttpServer() {} - - /** Complete request has been received and parsed. Send response - using the Respond() method. */ - virtual void OnExec(const HttpRequest& req) = 0; - - /** Send response. */ - virtual void Respond(const HttpResponse& res) = 0; - - /** Called when the body part of the response has been sent. */ - virtual void OnResponseComplete() = 0; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - -#endif // _SOCKETS_IHttpServer_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IMutex.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IMutex.h deleted file mode 100755 index 031fcad38a3..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IMutex.h +++ /dev/null @@ -1,58 +0,0 @@ -/** \file IMutex.h - ** \date 2008-10-25 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_IMutex_H -#define _SOCKETS_IMutex_H - -#include "sockets-config.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -/** IMutex interface. - \ingroup threading */ -class IMutex -{ -public: - virtual ~IMutex() {} - - virtual void Lock() const = 0; - virtual void Unlock() const = 0; -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif -#endif // _SOCKETS_IMutex_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ISocketHandler.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ISocketHandler.h deleted file mode 100755 index 4926489a001..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ISocketHandler.h +++ /dev/null @@ -1,262 +0,0 @@ -/** \file ISocketHandler.h - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_ISocketHandler_H -#define _SOCKETS_ISocketHandler_H -#include "sockets-config.h" - -#include <list> -#include <map> - -#include "socket_include.h" -#include "Socket.h" -#include "StdLog.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -class SocketAddress; -class IMutex; - - -/** Socket container class, event generator. - \ingroup basic */ -class ISocketHandler -{ - friend class Socket; - -public: - /** Connection pool class for internal use by the ISocketHandler. - \ingroup internal */ -#ifdef ENABLE_POOL - class PoolSocket : public Socket - { - public: - PoolSocket(ISocketHandler& h,Socket *src) : Socket(h) { - CopyConnection( src ); - SetIsClient(); - } - - void OnRead() { - Handler().LogError(this, "OnRead", 0, "data on hibernating socket", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } - void OnOptions(int,int,int,SOCKET) {} - - }; -#endif - -public: - virtual ~ISocketHandler() {} - - /** Return another instance */ - virtual ISocketHandler *Create(StdLog * = NULL) = 0; - - /** Return another instance */ - virtual ISocketHandler *Create(IMutex&, ISocketHandler&, StdLog * = NULL) = 0; - - /** Handler created with parent */ - virtual bool ParentHandlerIsValid() = 0; - - /** Get parent sockethandler */ - virtual ISocketHandler& ParentHandler() = 0; - - /** Get thread handler with least connections */ - virtual ISocketHandler& GetRandomHandler() = 0; - - /** Return parent handler if valid, otherwise return normal handler */ - virtual ISocketHandler& GetEffectiveHandler() = 0; - - /** Enable threading */ - virtual void SetNumberOfThreads(size_t n) = 0; - - /** Threading is enabled */ - virtual bool IsThreaded() = 0; - - /** Enable select release */ - virtual void EnableRelease() = 0; - - /** Make select release */ - virtual void Release() = 0; - - /** Get mutex reference for threadsafe operations. */ - virtual IMutex& GetMutex() const = 0; - - /** Register StdLog object for error callback. - \param log Pointer to log class */ - virtual void RegStdLog(StdLog *log) = 0; - - /** Log error to log class for print out / storage. */ - virtual void LogError(Socket *p,const std::string& user_text,int err,const std::string& sys_err,loglevel_t t = LOG_LEVEL_WARNING) = 0; - - // ------------------------------------------------------------------------- - // Socket stuff - // ------------------------------------------------------------------------- - /** Add socket instance to socket map. Removal is always automatic. */ - virtual void Add(Socket *) = 0; - -protected: - /** Remove socket from socket map, used by Socket class. */ - virtual void Remove(Socket *) = 0; - - /** Actual call to select() */ - virtual int ISocketHandler_Select(struct timeval *) = 0; - -public: - /** Set read/write/exception file descriptor sets (fd_set). */ - virtual void ISocketHandler_Add(Socket *,bool bRead,bool bWrite) = 0; - virtual void ISocketHandler_Mod(Socket *,bool bRead,bool bWrite) = 0; - virtual void ISocketHandler_Del(Socket *) = 0; - - /** Wait for events, generate callbacks. */ - virtual int Select(long sec,long usec) = 0; - /** This method will not return until an event has been detected. */ - virtual int Select() = 0; - /** Wait for events, generate callbacks. */ - virtual int Select(struct timeval *tsel) = 0; - - /** Check that a socket really is handled by this socket handler. */ - virtual bool Valid(Socket *) = 0; - /** Preferred method - Check that a socket still is handled by this socket handler. */ - virtual bool Valid(socketuid_t) = 0; - - /** Return number of sockets handled by this handler. */ - virtual size_t GetCount() = 0; - - /** Return maximum number of sockets allowed. */ - virtual size_t MaxCount() = 0; - - /** Override and return false to deny all incoming connections. - \param p ListenSocket class pointer (use GetPort to identify which one) */ - virtual bool OkToAccept(Socket *p) = 0; - - /** Use with care, always lock with h.GetMutex() if multithreaded */ - virtual const std::map<SOCKET, Socket *>& AllSockets() = 0; - - /** Override to accept longer lines than TCP_LINE_SIZE */ - virtual size_t MaxTcpLineSize() = 0; - - virtual void SetCallOnConnect(bool = true) = 0; - virtual void SetDetach(bool = true) = 0; - virtual void SetTimeout(bool = true) = 0; - virtual void SetRetry(bool = true) = 0; - virtual void SetClose(bool = true) = 0; - - - // ------------------------------------------------------------------------- - // Connection pool - // ------------------------------------------------------------------------- -#ifdef ENABLE_POOL - /** Find available open connection (used by connection pool). */ - virtual ISocketHandler::PoolSocket *FindConnection(int type,const std::string& protocol,SocketAddress&) = 0; - /** Enable connection pool (by default disabled). */ - virtual void EnablePool(bool = true) = 0; - /** Check pool status. - \return true if connection pool is enabled */ - virtual bool PoolEnabled() = 0; -#endif // ENABLE_POOL - - // ------------------------------------------------------------------------- - // Socks4 - // ------------------------------------------------------------------------- -#ifdef ENABLE_SOCKS4 - /** Set socks4 server ip that all new tcp sockets should use. */ - virtual void SetSocks4Host(ipaddr_t) = 0; - /** Set socks4 server hostname that all new tcp sockets should use. */ - virtual void SetSocks4Host(const std::string& ) = 0; - /** Set socks4 server port number that all new tcp sockets should use. */ - virtual void SetSocks4Port(port_t) = 0; - /** Set optional socks4 userid. */ - virtual void SetSocks4Userid(const std::string& ) = 0; - /** If connection to socks4 server fails, immediately try direct connection to final host. */ - virtual void SetSocks4TryDirect(bool = true) = 0; - /** Get socks4 server ip. - \return socks4 server ip */ - virtual ipaddr_t GetSocks4Host() = 0; - /** Get socks4 port number. - \return socks4 port number */ - virtual port_t GetSocks4Port() = 0; - /** Get socks4 userid (optional). - \return socks4 userid */ - virtual const std::string& GetSocks4Userid() = 0; - /** Check status of socks4 try direct flag. - \return true if direct connection should be tried if connection to socks4 server fails */ - virtual bool Socks4TryDirect() = 0; -#endif // ENABLE_SOCKS4 - - // ------------------------------------------------------------------------- - // DNS resolve server - // ------------------------------------------------------------------------- -#ifdef ENABLE_RESOLVER - /** Enable asynchronous DNS. - \param port Listen port of asynchronous dns server */ - virtual void EnableResolver(port_t = 16667) = 0; - /** Check resolver status. - \return true if resolver is enabled */ - virtual bool ResolverEnabled() = 0; - /** Queue a dns request. - \param host Hostname to be resolved - \param port Port number will be echoed in Socket::OnResolved callback */ - virtual int Resolve(Socket *,const std::string& host,port_t port) = 0; -#ifdef ENABLE_IPV6 - virtual int Resolve6(Socket *,const std::string& host,port_t port) = 0; -#endif - /** Do a reverse dns lookup. */ - virtual int Resolve(Socket *,ipaddr_t a) = 0; -#ifdef ENABLE_IPV6 - virtual int Resolve(Socket *,in6_addr& a) = 0; -#endif - /** Get listen port of asynchronous dns server. */ - virtual port_t GetResolverPort() = 0; - /** Resolver thread ready for queries. */ - virtual bool ResolverReady() = 0; - /** Returns true if socket waiting for a resolve event. */ - virtual bool Resolving(Socket *) = 0; -#endif // ENABLE_RESOLVER - -#ifdef ENABLE_DETACH - /** Indicates that the handler runs under SocketThread. */ - virtual void SetSlave(bool x = true) = 0; - /** Indicates that the handler runs under SocketThread. */ - virtual bool IsSlave() = 0; -#endif // ENABLE_DETACH - -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_ISocketHandler_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IStream.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IStream.h deleted file mode 100755 index 0ac47408adf..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/IStream.h +++ /dev/null @@ -1,61 +0,0 @@ -/** \file IStream.h - ** \date 2008-11-15 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2008-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_IStream_H -#define _SOCKETS_IStream_H - -#include "sockets-config.h" -#include <string> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -class IStream -{ -public: - virtual ~IStream() {} - - /** Try to read 'buf_sz' number of bytes from source. - \return Number of bytes actually read. */ - virtual size_t IStreamRead(char *buf, size_t buf_sz) = 0; - - /** Write 'sz' bytes to destination. */ - virtual void IStreamWrite(const char *buf, size_t sz) = 0; - -}; - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_IStream_H diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ipv4Address.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ipv4Address.cpp deleted file mode 100755 index 0c0ab82a084..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ipv4Address.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/** - ** \file Ipv4Address.cpp - ** \date 2006-09-21 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "Ipv4Address.h" -#include "Utility.h" -#ifndef _WIN32 -#include <netdb.h> -#endif - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - - -Ipv4Address::Ipv4Address(port_t port) : m_valid(true) -{ - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin_family = AF_INET; - m_addr.sin_port = htons( port ); -} - - -Ipv4Address::Ipv4Address(ipaddr_t a,port_t port) : m_valid(true) -{ - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin_family = AF_INET; - m_addr.sin_port = htons( port ); - memcpy(&m_addr.sin_addr, &a, sizeof(struct in_addr)); -} - - -Ipv4Address::Ipv4Address(struct in_addr& a,port_t port) : m_valid(true) -{ - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin_family = AF_INET; - m_addr.sin_port = htons( port ); - m_addr.sin_addr = a; -} - - -Ipv4Address::Ipv4Address(const std::string& host,port_t port) : m_valid(false) -{ - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin_family = AF_INET; - m_addr.sin_port = htons( port ); - { - ipaddr_t a; - if (Utility::u2ip(host, a)) - { - memcpy(&m_addr.sin_addr, &a, sizeof(struct in_addr)); - m_valid = true; - } - } -} - - -Ipv4Address::Ipv4Address(struct sockaddr_in& sa) -{ - m_addr = sa; - m_valid = sa.sin_family == AF_INET; -} - - -Ipv4Address::~Ipv4Address() -{ -} - - -Ipv4Address::operator struct sockaddr *() -{ - return (struct sockaddr *)&m_addr; -} - - -Ipv4Address::operator socklen_t() -{ - return sizeof(struct sockaddr_in); -} - - -void Ipv4Address::SetPort(port_t port) -{ - m_addr.sin_port = htons( port ); -} - - -port_t Ipv4Address::GetPort() -{ - return ntohs( m_addr.sin_port ); -} - - -bool Ipv4Address::Resolve(const std::string& hostname,struct in_addr& a) -{ - struct sockaddr_in sa; - memset(&a, 0, sizeof(a)); - if (Utility::isipv4(hostname)) - { - if (!Utility::u2ip(hostname, sa, AI_NUMERICHOST)) - return false; - a = sa.sin_addr; - return true; - } - if (!Utility::u2ip(hostname, sa)) - return false; - a = sa.sin_addr; - return true; -} - - -bool Ipv4Address::Reverse(struct in_addr& a,std::string& name) -{ - struct sockaddr_in sa; - memset(&sa, 0, sizeof(sa)); - sa.sin_family = AF_INET; - sa.sin_addr = a; - return Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name); -} - - -std::string Ipv4Address::Convert(bool include_port) -{ - if (include_port) - return Convert(m_addr.sin_addr) + ":" + Utility::l2string(GetPort()); - return Convert(m_addr.sin_addr); -} - - -std::string Ipv4Address::Convert(struct in_addr& a) -{ - struct sockaddr_in sa; - memset(&sa, 0, sizeof(sa)); - sa.sin_family = AF_INET; - sa.sin_addr = a; - std::string name; - Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name, NI_NUMERICHOST); - return name; -} - - -void Ipv4Address::SetAddress(struct sockaddr *sa) -{ - memcpy(&m_addr, sa, sizeof(struct sockaddr_in)); -} - - -int Ipv4Address::GetFamily() -{ - return m_addr.sin_family; -} - - -bool Ipv4Address::IsValid() -{ - return m_valid; -} - - -bool Ipv4Address::operator==(SocketAddress& a) -{ - if (a.GetFamily() != GetFamily()) - return false; - if ((socklen_t)a != sizeof(m_addr)) - return false; - struct sockaddr *sa = a; - struct sockaddr_in *p = (struct sockaddr_in *)sa; - if (p -> sin_port != m_addr.sin_port) - return false; - if (memcmp(&p -> sin_addr, &m_addr.sin_addr, 4)) - return false; - return true; -} - - -std::auto_ptr<SocketAddress> Ipv4Address::GetCopy() -{ - return std::auto_ptr<SocketAddress>(new Ipv4Address(m_addr)); -} - - -std::string Ipv4Address::Reverse() -{ - std::string tmp; - Reverse(m_addr.sin_addr, tmp); - return tmp; -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ipv4Address.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ipv4Address.h deleted file mode 100755 index 8b47a3501b7..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ipv4Address.h +++ /dev/null @@ -1,111 +0,0 @@ -/** - ** \file Ipv4Address.h - ** \date 2006-09-21 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Ipv4Address_H -#define _SOCKETS_Ipv4Address_H - -#include "sockets-config.h" -#include "SocketAddress.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -/* Ipv4 address implementation. - \ingroup basic */ -class Ipv4Address : public SocketAddress -{ -public: - /** Create empty Ipv4 address structure. - \param port Port number */ - Ipv4Address(port_t port = 0); - /** Create Ipv4 address structure. - \param a Socket address in network byte order (as returned by Utility::u2ip) - \param port Port number in host byte order */ - Ipv4Address(ipaddr_t a,port_t port); - /** Create Ipv4 address structure. - \param a Socket address in network byte order - \param port Port number in host byte order */ - Ipv4Address(struct in_addr& a,port_t port); - /** Create Ipv4 address structure. - \param host Hostname to be resolved - \param port Port number in host byte order */ - Ipv4Address(const std::string& host,port_t port); - Ipv4Address(struct sockaddr_in&); - ~Ipv4Address(); - - // SocketAddress implementation - - operator struct sockaddr *(); - operator socklen_t(); - bool operator==(SocketAddress&); - - void SetPort(port_t port); - port_t GetPort(); - - void SetAddress(struct sockaddr *sa); - int GetFamily(); - - bool IsValid(); - std::auto_ptr<SocketAddress> GetCopy(); - - /** Convert address struct to text. */ - std::string Convert(bool include_port = false); - std::string Reverse(); - - /** Resolve hostname. */ - static bool Resolve(const std::string& hostname,struct in_addr& a); - /** Reverse resolve (IP to hostname). */ - static bool Reverse(struct in_addr& a,std::string& name); - /** Convert address struct to text. */ - static std::string Convert(struct in_addr& a); - -private: - Ipv4Address(const Ipv4Address& ) {} // copy constructor - Ipv4Address& operator=(const Ipv4Address& ) { - return *this; // assignment operator - } - struct sockaddr_in m_addr; - bool m_valid; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif -#endif // _SOCKETS_Ipv4Address_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ipv6Address.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ipv6Address.cpp deleted file mode 100755 index d9addf641a5..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ipv6Address.cpp +++ /dev/null @@ -1,286 +0,0 @@ -/** - ** \file Ipv6Address.cpp - ** \date 2006-09-21 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include <stdio.h> -#include "Ipv6Address.h" -#ifdef ENABLE_IPV6 - -#include "Utility.h" -#ifndef _WIN32 -#include <netdb.h> -#endif -#ifdef IPPROTO_IPV6 - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -Ipv6Address::Ipv6Address(port_t port) : m_valid(true) -{ - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin6_family = AF_INET6; - m_addr.sin6_port = htons( port ); -} - - -Ipv6Address::Ipv6Address(struct in6_addr& a,port_t port) : m_valid(true) -{ - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin6_family = AF_INET6; - m_addr.sin6_port = htons( port ); - m_addr.sin6_addr = a; -} - - -Ipv6Address::Ipv6Address(const std::string& host,port_t port) : m_valid(false) -{ - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin6_family = AF_INET6; - m_addr.sin6_port = htons( port ); - { - struct in6_addr a; - if (Utility::u2ip(host, a)) - { - m_addr.sin6_addr = a; - m_valid = true; - } - } -} - - -Ipv6Address::Ipv6Address(struct sockaddr_in6& sa) -{ - m_addr = sa; - m_valid = sa.sin6_family == AF_INET6; -} - - -Ipv6Address::~Ipv6Address() -{ -} - - -Ipv6Address::operator struct sockaddr *() -{ - return (struct sockaddr *)&m_addr; -} - - -Ipv6Address::operator socklen_t() -{ - return sizeof(struct sockaddr_in6); -} - - -void Ipv6Address::SetPort(port_t port) -{ - m_addr.sin6_port = htons( port ); -} - - -port_t Ipv6Address::GetPort() -{ - return ntohs( m_addr.sin6_port ); -} - - -bool Ipv6Address::Resolve(const std::string& hostname,struct in6_addr& a) -{ - struct sockaddr_in6 sa; - memset(&a, 0, sizeof(a)); - if (Utility::isipv6(hostname)) - { - if (!Utility::u2ip(hostname, sa, AI_NUMERICHOST)) - return false; - a = sa.sin6_addr; - return true; - } - if (!Utility::u2ip(hostname, sa)) - return false; - a = sa.sin6_addr; - return true; -} - - -bool Ipv6Address::Reverse(struct in6_addr& a,std::string& name) -{ - struct sockaddr_in6 sa; - memset(&sa, 0, sizeof(sa)); - sa.sin6_family = AF_INET6; - sa.sin6_addr = a; - return Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name); -} - - -std::string Ipv6Address::Convert(bool include_port) -{ - if (include_port) - return Convert(m_addr.sin6_addr) + ":" + Utility::l2string(GetPort()); - return Convert(m_addr.sin6_addr); -} - - -std::string Ipv6Address::Convert(struct in6_addr& a,bool mixed) -{ - char slask[100]; // l2ip temporary - *slask = 0; - unsigned int prev = 0; - bool skipped = false; - bool ok_to_skip = true; - if (mixed) - { - unsigned short x; - unsigned short addr16[8]; - memcpy(addr16, &a, sizeof(addr16)); - for (size_t i = 0; i < 6; i++) - { - x = ntohs(addr16[i]); - if (*slask && (x || !ok_to_skip || prev)) - { -#if defined( _WIN32) && !defined(__CYGWIN__) - strcat_s(slask,sizeof(slask),":"); -#else - strcat(slask,":"); -#endif - } - if (x || !ok_to_skip) - { - snprintf(slask + strlen(slask), sizeof(slask) - strlen(slask),"%x", x); - if (x && skipped) - ok_to_skip = false; - } - else - { - skipped = true; - } - prev = x; - } - x = ntohs(addr16[6]); - snprintf(slask + strlen(slask), sizeof(slask) - strlen(slask),":%u.%u",x / 256,x & 255); - x = ntohs(addr16[7]); - snprintf(slask + strlen(slask), sizeof(slask) - strlen(slask),".%u.%u",x / 256,x & 255); - } - else - { - struct sockaddr_in6 sa; - memset(&sa, 0, sizeof(sa)); - sa.sin6_family = AF_INET6; - sa.sin6_addr = a; - std::string name; - Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name, NI_NUMERICHOST); - return name; - } - return slask; -} - - -void Ipv6Address::SetAddress(struct sockaddr *sa) -{ - memcpy(&m_addr, sa, sizeof(struct sockaddr_in6)); -} - - -int Ipv6Address::GetFamily() -{ - return m_addr.sin6_family; -} - - -void Ipv6Address::SetFlowinfo(uint32_t x) -{ - m_addr.sin6_flowinfo = x; -} - - -uint32_t Ipv6Address::GetFlowinfo() -{ - return m_addr.sin6_flowinfo; -} - - -#ifndef _WIN32 -void Ipv6Address::SetScopeId(uint32_t x) -{ - m_addr.sin6_scope_id = x; -} - - -uint32_t Ipv6Address::GetScopeId() -{ - return m_addr.sin6_scope_id; -} -#endif - - -bool Ipv6Address::IsValid() -{ - return m_valid; -} - - -bool Ipv6Address::operator==(SocketAddress& a) -{ - if (a.GetFamily() != GetFamily()) - return false; - if ((socklen_t)a != sizeof(m_addr)) - return false; - struct sockaddr *sa = a; - struct sockaddr_in6 *p = (struct sockaddr_in6 *)sa; - if (p -> sin6_port != m_addr.sin6_port) - return false; - if (memcmp(&p -> sin6_addr, &m_addr.sin6_addr, sizeof(struct in6_addr))) - return false; - return true; -} - - -std::auto_ptr<SocketAddress> Ipv6Address::GetCopy() -{ - return std::auto_ptr<SocketAddress>(new Ipv6Address(m_addr)); -} - - -std::string Ipv6Address::Reverse() -{ - std::string tmp; - Reverse(m_addr.sin6_addr, tmp); - return tmp; -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif -#endif // IPPROTO_IPV6 -#endif // ENABLE_IPV6 - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ipv6Address.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ipv6Address.h deleted file mode 100755 index 86957d360cb..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Ipv6Address.h +++ /dev/null @@ -1,120 +0,0 @@ -/** - ** \file Ipv6Address.h - ** \date 2006-09-21 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Ipv6Address_H -#define _SOCKETS_Ipv6Address_H -#include "sockets-config.h" -#ifdef ENABLE_IPV6 - -#include "SocketAddress.h" -#ifdef IPPROTO_IPV6 -#if defined( _WIN32) && !defined(__CYGWIN__) -typedef unsigned __int32 uint32_t; -#endif - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -/** Ipv6 address implementation. - \ingroup basic */ -class Ipv6Address : public SocketAddress -{ -public: - /** Create empty Ipv6 address structure. - \param port Port number */ - Ipv6Address(port_t port = 0); - /** Create Ipv6 address structure. - \param a Socket address in network byte order - \param port Port number in host byte order */ - Ipv6Address(struct in6_addr& a,port_t port); - /** Create Ipv6 address structure. - \param host Hostname to be resolved - \param port Port number in host byte order */ - Ipv6Address(const std::string& host,port_t port); - Ipv6Address(struct sockaddr_in6&); - ~Ipv6Address(); - - // SocketAddress implementation - - operator struct sockaddr *(); - operator socklen_t(); - bool operator==(SocketAddress&); - - void SetPort(port_t port); - port_t GetPort(); - - void SetAddress(struct sockaddr *sa); - int GetFamily(); - - bool IsValid(); - std::auto_ptr<SocketAddress> GetCopy(); - - /** Convert address struct to text. */ - std::string Convert(bool include_port = false); - std::string Reverse(); - - /** Resolve hostname. */ - static bool Resolve(const std::string& hostname,struct in6_addr& a); - /** Reverse resolve (IP to hostname). */ - static bool Reverse(struct in6_addr& a,std::string& name); - /** Convert address struct to text. */ - static std::string Convert(struct in6_addr& a,bool mixed = false); - - void SetFlowinfo(uint32_t); - uint32_t GetFlowinfo(); -#ifndef _WIN32 - void SetScopeId(uint32_t); - uint32_t GetScopeId(); -#endif - -private: - Ipv6Address(const Ipv6Address& ) {} // copy constructor - Ipv6Address& operator=(const Ipv6Address& ) { - return *this; // assignment operator - } - struct sockaddr_in6 m_addr; - bool m_valid; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif -#endif // IPPROTO_IPV6 -#endif // ENABLE_IPV6 -#endif // _SOCKETS_Ipv6Address_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Json.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Json.cpp deleted file mode 100755 index 93791295b30..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Json.cpp +++ /dev/null @@ -1,572 +0,0 @@ -#include "Json.h" -#include <stdio.h> -#include <sstream> -#include "Utility.h" - -#define C buffer[index] - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -// -------------------------------------------------------------------------------- -Json::Json() : m_type(TYPE_UNKNOWN) -{ -} - - -// -------------------------------------------------------------------------------- -Json::Json(char value) : m_type(TYPE_INTEGER), m_i_value(value) -{ -} - - -// -------------------------------------------------------------------------------- -Json::Json(short value) : m_type(TYPE_INTEGER), m_i_value(value) -{ -} - - -// -------------------------------------------------------------------------------- -Json::Json(long value) : m_type(TYPE_INTEGER), m_i_value(value) -{ -} - - -// -------------------------------------------------------------------------------- -//Json::Json(int64_t value) : m_type(TYPE_INTEGER), m_i_value(value) -Json::Json(long long value) : m_type(TYPE_INTEGER), m_i_value(value) -{ -} - - -// -------------------------------------------------------------------------------- -Json::Json(double value) : m_type(TYPE_REAL), m_d_value(value) -{ -} - - -// -------------------------------------------------------------------------------- -Json::Json(const char *value) : m_type(TYPE_STRING), m_str_value(value) -{ -} - - -// -------------------------------------------------------------------------------- -Json::Json(const std::string& value) : m_type(TYPE_STRING), m_str_value(value) -{ -} - - -// -------------------------------------------------------------------------------- -Json::Json(bool value) : m_type(TYPE_BOOLEAN), m_b_value(value) -{ -} - - -// -------------------------------------------------------------------------------- -Json::Json(json_type_t t) : m_type(t) -{ - if (t != TYPE_ARRAY && t != TYPE_OBJECT) - throw Exception("Must be type: Array or type: Object"); -} - - -// -------------------------------------------------------------------------------- -Json::~Json() -{ -} - - -// -------------------------------------------------------------------------------- -Json::json_type_t Json::Type() const { return m_type; } - - -// -------------------------------------------------------------------------------- -bool Json::HasValue(const std::string& name) const -{ - if (m_type != TYPE_OBJECT) - return false; - return m_object.find(name) != m_object.end(); -} - - -// -------------------------------------------------------------------------------- -Json::operator char() const -{ - return (char)m_i_value; -} - - -// -------------------------------------------------------------------------------- -Json::operator short() const -{ - return (short)m_i_value; -} - - -// -------------------------------------------------------------------------------- -Json::operator long() const -{ - return m_i_value; -} - - -// -------------------------------------------------------------------------------- -Json::operator int64_t() const -{ - return m_i_value; -} - - -// -------------------------------------------------------------------------------- -Json::operator double() const -{ - return m_d_value; -} - - -// -------------------------------------------------------------------------------- -Json::operator std::string() const -{ - return m_str_value; -} - - -// -------------------------------------------------------------------------------- -Json::operator bool() const -{ - return m_b_value; -} - - -// -------------------------------------------------------------------------------- -const Json& Json::operator[](const char *name) const -{ - if (m_type != TYPE_OBJECT) - throw Exception("Must be type: Object"); - json_map_t::const_iterator it = m_object.find(name); - if (it != m_object.end()) - return it -> second; - throw Exception("Key not found: " + std::string(name)); -} - -// -------------------------------------------------------------------------------- -Json& Json::operator[](const char *name) -{ - if (m_type == TYPE_UNKNOWN) - m_type = TYPE_OBJECT; - if (m_type != TYPE_OBJECT) - throw Exception("Must be type: Object"); - return m_object[name]; -} - - -// -------------------------------------------------------------------------------- -const Json& Json::operator[](const std::string& name) const -{ - if (m_type != TYPE_OBJECT) - throw Exception("Must be type: Object"); - json_map_t::const_iterator it = m_object.find(name); - if (it != m_object.end()) - return it -> second; - throw Exception("Key not found: " + name); -} - -// -------------------------------------------------------------------------------- -Json& Json::operator[](const std::string& name) -{ - if (m_type == TYPE_UNKNOWN) - m_type = TYPE_OBJECT; - if (m_type != TYPE_OBJECT) - throw Exception("Must be type: Object"); - return m_object[name]; -} - - -// -------------------------------------------------------------------------------- -void Json::Add(Json data) -{ - if (m_type == TYPE_UNKNOWN) - m_type = TYPE_ARRAY; - if (m_type != TYPE_ARRAY) - throw Exception("trying to add array data in non-array"); - m_array.push_back(data); -} - - -// -------------------------------------------------------------------------------- -const std::string& Json::GetString() const -{ - return m_str_value; -} - - -// -------------------------------------------------------------------------------- -Json::json_list_t& Json::GetArray() -{ - if (m_type == TYPE_UNKNOWN) - m_type = TYPE_ARRAY; - if (m_type != TYPE_ARRAY) - throw Exception("Json instance not of type: Array"); - return m_array; -} - - -// -------------------------------------------------------------------------------- -Json::json_map_t& Json::GetObject() -{ - if (m_type == TYPE_UNKNOWN) - m_type = TYPE_OBJECT; - if (m_type != TYPE_OBJECT) - throw Exception("Json instance not of type: Array"); - return m_object; -} - - -// -------------------------------------------------------------------------------- -const Json::json_list_t& Json::GetArray() const -{ - if (m_type != TYPE_ARRAY) - throw Exception("Json instance not of type: Array"); - return m_array; -} - - -// -------------------------------------------------------------------------------- -const Json::json_map_t& Json::GetObject() const -{ - if (m_type != TYPE_OBJECT) - throw Exception("Json instance not of type: Array"); - return m_object; -} - - -// -------------------------------------------------------------------------------- -Json Json::Parse(const std::string& data) -{ - size_t i = 0; - Json obj; - obj.Parse(data.c_str(), i); - return obj; -} - - -// -------------------------------------------------------------------------------- -char Json::Parse(const char *buffer, size_t& index) -{ - while (C == ' ' || C == 9 || C == 13 || C == 10) - ++index; - size_t x = index; // origin - std::string ord; - if (C == '-' || isdigit(C)) // Number - { - bool dot = false; - if (C == '-') - { - ++index; - } - while (isdigit(C) || C == '.') - { - if (C == '.') - dot = true; - ++index; - } - size_t sz = index - x; - ord.resize(sz); - memcpy(&ord[0], &buffer[x], sz); - if (dot) - { - m_type = TYPE_REAL; - m_d_value = atof(ord.c_str()); - } - else - { - m_type = TYPE_INTEGER; - m_i_value = atoi(ord.c_str()); - } - } - else - if (C == 34) // " - String - { - bool ign = false; - x = ++index; - while (C && (ign || C != 34)) - { - if (ign) - { - ign = false; - } - else - if (C == '\\') - { - ign = true; - } - ++index; - } - size_t sz = index - x; - ord.resize(sz); - memcpy(&ord[0], &buffer[x], sz); - decode(ord); - ++index; - m_type = TYPE_STRING; - m_str_value = ord; - } - else - if (!strncmp(&buffer[index], "null", 4)) // null value - { - m_type = TYPE_UNKNOWN; - index += 4; - } - else - if (!strncmp(&buffer[index], "true", 4)) // Boolean: true - { - m_type = TYPE_BOOLEAN; - m_b_value = true; - index += 4; - } - else - if (!strncmp(&buffer[index], "false", 5)) // Boolean: false - { - m_type = TYPE_BOOLEAN; - m_b_value = false; - index += 5; - } - else - if (C == '[') // Array - { - ++index; - m_type = TYPE_ARRAY; - while (true) - { - char res; - Json o; - if ((res = o.Parse(buffer, index)) == 0) - { - m_array.push_back(o); - } - else - if (res == ']') - { - break; - } - else - if (res == ',') // another element follows - { - } - else - { - throw Exception(std::string("Unexpected end of Array: ") + res); - } - } - } - else - if (C == ']') // end of Array - { - ++index; - return ']'; - } - else - if (C == '{') // Object - { - ++index; - m_type = TYPE_OBJECT; - int state = 0; - std::string element_name; - bool quit = false; - while (!quit) - { - Json o; - char res = o.Parse(buffer, index); - switch (state) - { - case 0: - if (res == ',') // another object follow - break; - if (res == '}') // end of Object - { - quit = true; - break; - } - if (res || o.Type() != TYPE_STRING) - throw Exception("Object element name missing"); - element_name = o.GetString(); - state = 1; - break; - case 1: - if (res != ':') - throw Exception("Object element separator missing"); - state = 2; - break; - case 2: - if (res) - throw Exception(std::string("Unexpected character when parsing anytype: ") + res); - m_object[element_name] = o; - state = 0; - break; - } - } - } - else - if (C == '}') // end of Object - { - ++index; - return '}'; - } - else - if (C == ',') - { - ++index; - return ','; - } - else - if (C == ':') - { - ++index; - return ':'; - } - else - { - throw Exception("Can't parse Json representation: " + std::string(&buffer[index])); - } - return 0; -} - - -// -------------------------------------------------------------------------------- -std::string Json::ToString(bool quote) const -{ - switch (m_type) - { - case TYPE_UNKNOWN: - break; - case TYPE_INTEGER: - return Utility::l2string(m_i_value); - case TYPE_REAL: - { - char slask[100]; - sprintf(slask, "%f", m_d_value); - return slask; - } - case TYPE_STRING: - { - std::ostringstream tmp; - tmp << "\"" << encode(m_str_value) << "\""; - return tmp.str(); - } - case TYPE_BOOLEAN: - return m_b_value ? "true" : "false"; - case TYPE_ARRAY: - { - std::ostringstream tmp; - bool first = true; - tmp << "["; - for (json_list_t::const_iterator it = m_array.begin(); it != m_array.end(); it++) - { - const Json& ref = *it; - if (!first) - tmp << ","; - tmp << ref.ToString(quote); - first = false; - } - tmp << "]"; - return tmp.str(); - } - case TYPE_OBJECT: - { - std::ostringstream tmp; - bool first = true; - tmp << "{"; - for (json_map_t::const_iterator it = m_object.begin(); it != m_object.end(); it++) - { - const std::pair<std::string, Json>& ref = *it; - if (!first) - tmp << ","; - if (quote) - tmp << "\"" << encode(ref.first) << "\":" << ref.second.ToString(quote); - else - tmp << ref.first << ":" << ref.second.ToString(quote); - first = false; - } - tmp << "}"; - return tmp.str(); - } - } - return "null"; -} - - -// -------------------------------------------------------------------------------- -void Json::encode(std::string& src) const -{ - size_t pos = src.find("\\"); - while (pos != std::string::npos) - { - src.replace(pos, 1, "\\\\"); - pos = src.find("\\", pos + 2); - } - pos = src.find("\r"); - while (pos != std::string::npos) - { - src.replace(pos, 1, "\\r"); - pos = src.find("\r", pos + 2); - } - pos = src.find("\n"); - while (pos != std::string::npos) - { - src.replace(pos, 1, "\\n"); - pos = src.find("\n", pos + 2); - } - pos = src.find("\""); - while (pos != std::string::npos) - { - src.replace(pos, 1, "\\\""); - pos = src.find("\"", pos + 2); - } -} - - -// -------------------------------------------------------------------------------- -void Json::decode(std::string& src) const -{ - size_t pos = src.find("\\\""); - while (pos != std::string::npos) - { - src.replace(pos, 2, "\""); - pos = src.find("\\\"", pos + 1); - } - pos = src.find("\\r"); - while (pos != std::string::npos) - { - src.replace(pos, 2, "\r"); - pos = src.find("\\r", pos + 1); - } - pos = src.find("\\n"); - while (pos != std::string::npos) - { - src.replace(pos, 2, "\n"); - pos = src.find("\\n", pos + 1); - } - pos = src.find("\\\\"); - while (pos != std::string::npos) - { - src.replace(pos, 2, "\\"); - pos = src.find("\\\\", pos + 1); - } -} - - -// -------------------------------------------------------------------------------- -std::string Json::encode(const std::string& src) const -{ - std::string tmp(src); - encode(tmp); - return tmp; -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Json.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Json.h deleted file mode 100755 index 66792dba8c4..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Json.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef _SOCKETS_Json_H -#define _SOCKETS_Json_H - -#include "Exception.h" -#include <list> -#include <map> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -class Json -{ -public: - typedef std::list<Json> json_list_t; - typedef std::map<std::string, Json> json_map_t; - - typedef enum { - TYPE_UNKNOWN = 0, - TYPE_INTEGER, - TYPE_REAL, - TYPE_STRING, - TYPE_BOOLEAN, - TYPE_ARRAY, - TYPE_OBJECT - } json_type_t; - -public: - /** Default constructor */ - Json(); //m_type(TYPE_UNKNOWN); - - /** Basic type constructors */ - Json(char value); - Json(short value); - Json(long value); //m_type(TYPE_INTEGER), m_i_value(value); - Json(long long value); - // LG Json(int64_t value); - Json(double value); //m_type(TYPE_REAL), m_d_value(value); - Json(const char *value); //m_type(TYPE_STRING), m_str_value(value); - Json(const std::string& value); //m_type(TYPE_STRING), m_str_value(value); - Json(bool value); //m_type(TYPE_BOOLEAN), m_b_value(value); - - /** Complex type constructor (array, object) */ - Json(json_type_t t); //m_type(t); - - virtual ~Json(); - - char Parse(const char *buffer, size_t& index); - - json_type_t Type() const; - - bool HasValue(const std::string& name) const; - - operator char() const; - operator short() const; - operator long() const; - //operator int64_t() const; - operator long long() const; - operator double() const; - operator std::string() const; - operator bool() const; - - const Json& operator[](const char *name) const; - Json& operator[](const char *name); - - const Json& operator[](const std::string& name) const; - Json& operator[](const std::string& name); - - void Add(Json data); - - const std::string& GetString() const; - - const json_list_t& GetArray() const; - json_list_t& GetArray(); - - const json_map_t& GetObject() const; - json_map_t& GetObject(); - - std::string ToString(bool quote = true) const; - - static Json Parse(const std::string& data); - - void encode(std::string& src) const; - void decode(std::string& src) const; - std::string encode(const std::string&) const; - -private: - json_type_t m_type; - long m_i_value; - double m_d_value; - std::string m_str_value; - bool m_b_value; - json_list_t m_array; - json_map_t m_object; -}; - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - -#endif // _SOCKETS_Json_H diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ListenSocket.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ListenSocket.h deleted file mode 100755 index f1299617b44..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ListenSocket.h +++ /dev/null @@ -1,511 +0,0 @@ -/** \file ListenSocket.h - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_ListenSocket_H -#define _SOCKETS_ListenSocket_H -#include "sockets-config.h" - -#ifdef _WIN32 -#include <stdlib.h> -#else -#include <errno.h> -#endif - -#include "ISocketHandler.h" -#include "Socket.h" -#include "Utility.h" -#include "SctpSocket.h" -#include "Ipv4Address.h" -#include "Ipv6Address.h" -#ifdef ENABLE_EXCEPTIONS -#include "Exception.h" -#endif -#include "Lock.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -/** Binds incoming port number to new Socket class X. - \ingroup basic */ -template <class X> -class ListenSocket : public Socket -{ -public: - /** Constructor. - \param h ISocketHandler reference - \param use_creator Optional use of creator (default true) */ - ListenSocket(ISocketHandler& h,bool use_creator = true) : Socket(h), m_depth(0), m_creator(NULL) - ,m_bHasCreate(false) { - if (use_creator) { - m_creator = new X(h); - Socket *tmp = m_creator -> Create(); - - if (tmp && dynamic_cast<X *>(tmp)) { - m_bHasCreate = true; - } - - if (tmp) { - delete tmp; - } - } - } - ~ListenSocket() { - if (m_creator) { - delete m_creator; - } - } - - /** Close file descriptor. */ - int Close() { - if (GetSocket() != INVALID_SOCKET) { - if (closesocket(GetSocket()) == -1) { - } else { - Attach(INVALID_SOCKET); - } - } - - return 0; - } - - /** Bind and listen to any interface. - \param port Port (0 is random) - \param depth Listen queue depth */ - int Bind(port_t port,int depth = 20) { -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - - if (IsIpv6()) { - Ipv6Address ad(port); - return Bind(ad, depth); - } else -#endif -#endif - { - Ipv4Address ad(port); - return Bind(ad, depth); - } - } - - int Bind(SocketAddress& ad,int depth) { -#ifdef USE_SCTP - - if (dynamic_cast<SctpSocket *>(m_creator)) { - return Bind(ad, "sctp", depth); - } - -#endif - return Bind(ad, "tcp", depth); - } - - /** Bind and listen to any interface, with optional protocol. - \param port Port (0 is random) - \param protocol Network protocol - \param depth Listen queue depth */ - int Bind(port_t port,const std::string& protocol,int depth = 20) { -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - - if (IsIpv6()) { - Ipv6Address ad(port); - return Bind(ad, protocol, depth); - } else -#endif -#endif - { - Ipv4Address ad(port); - return Bind(ad, protocol, depth); - } - } - - /** Bind and listen to specific interface. - \param intf Interface hostname - \param port Port (0 is random) - \param depth Listen queue depth */ - int Bind(const std::string& intf,port_t port,int depth = 20) { -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - - if (IsIpv6()) { - Ipv6Address ad(intf, port); - - if (ad.IsValid()) { - return Bind(ad, depth); - } - - Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); - return -1; - } else -#endif -#endif - { - Ipv4Address ad(intf, port); - - if (ad.IsValid()) { - return Bind(ad, depth); - } - - Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); - return -1; - } - } - - /** Bind and listen to specific interface. - \param intf Interface hostname - \param port Port (0 is random) - \param protocol Network protocol - \param depth Listen queue depth */ - int Bind(const std::string& intf,port_t port,const std::string& protocol,int depth = 20) { -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - - if (IsIpv6()) { - Ipv6Address ad(intf, port); - - if (ad.IsValid()) { - return Bind(ad, protocol, depth); - } - - Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); - return -1; - } else -#endif -#endif - { - Ipv4Address ad(intf, port); - - if (ad.IsValid()) { - return Bind(ad, protocol, depth); - } - - Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); - return -1; - } - } - - /** Bind and listen to ipv4 interface. - \param a Ipv4 interface address - \param port Port (0 is random) - \param depth Listen queue depth */ - int Bind(ipaddr_t a,port_t port,int depth = 20) { - Ipv4Address ad(a, port); -#ifdef USE_SCTP - - if (dynamic_cast<SctpSocket *>(m_creator)) { - return Bind(ad, "sctp", depth); - } - -#endif - return Bind(ad, "tcp", depth); - } - /** Bind and listen to ipv4 interface. - \param a Ipv4 interface address - \param port Port (0 is random) - \param protocol Network protocol - \param depth Listen queue depth */ - int Bind(ipaddr_t a,port_t port,const std::string& protocol,int depth) { - Ipv4Address ad(a, port); - return Bind(ad, protocol, depth); - } - -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - /** Bind and listen to ipv6 interface. - \param a Ipv6 interface address - \param port Port (0 is random) - \param depth Listen queue depth */ - int Bind(in6_addr a,port_t port,int depth = 20) { - Ipv6Address ad(a, port); -#ifdef USE_SCTP - - if (dynamic_cast<SctpSocket *>(m_creator)) { - return Bind(ad, "sctp", depth); - } - -#endif - return Bind(ad, "tcp", depth); - } - /** Bind and listen to ipv6 interface. - \param a Ipv6 interface address - \param port Port (0 is random) - \param protocol Network protocol - \param depth Listen queue depth */ - int Bind(in6_addr a,port_t port,const std::string& protocol,int depth) { - Ipv6Address ad(a, port); - return Bind(ad, protocol, depth); - } -#endif -#endif - - /** Bind and listen to network interface. - \param ad Interface address - \param protocol Network protocol - \param depth Listen queue depth */ - int Bind(SocketAddress& ad,const std::string& protocol,int depth) { - SOCKET s; - - if ( (s = CreateSocket(ad.GetFamily(), SOCK_STREAM, protocol)) == INVALID_SOCKET) { - return -1; - } - - // socket must be nonblocking for async connect - if (!SetNonblocking(true, s)) { - closesocket(s); - return -1; - } - - if (bind(s, ad, ad) == -1) { - Handler().LogError(this, "bind", Errno, StrError(Errno), LOG_LEVEL_FATAL); - closesocket(s); -#ifdef ENABLE_EXCEPTIONS - throw Exception("bind() failed for port " + Utility::l2string(ad.GetPort()) + ": " + StrError(Errno)); -#endif - return -1; - } - - if (listen(s, depth) == -1) { - Handler().LogError(this, "listen", Errno, StrError(Errno), LOG_LEVEL_FATAL); - closesocket(s); -#ifdef ENABLE_EXCEPTIONS - throw Exception("listen() failed for port " + Utility::l2string(ad.GetPort()) + ": " + StrError(Errno)); -#endif - return -1; - } - - m_depth = depth; - Attach(s); - return 0; - } - - /** Return assigned port number. */ - port_t GetPort() { - return GetSockPort(); - } - - /** Return listen queue depth. */ - int GetDepth() { - return m_depth; - } - - /** OnRead on a ListenSocket receives an incoming connection. */ - void OnRead() { - struct sockaddr sa; - int max = 10; // process max 10 incoming connection in one call - - while (max--) { - socklen_t sa_len = sizeof(struct sockaddr); - SOCKET a_s = accept(GetSocket(), &sa, &sa_len); - - if (a_s == INVALID_SOCKET) { - // EAGAIN or EWOULDBLOCK -#ifdef _WIN32 - if (Errno != WSAEWOULDBLOCK) -#else - if (Errno != EWOULDBLOCK) -#endif - { - Handler().LogError(this, "accept", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - - return; - } - - if (!Handler().OkToAccept(this)) { - Handler().LogError(this, "accept", -1, "Not OK to accept", LOG_LEVEL_WARNING); - closesocket(a_s); - return; - } - - if (Handler().GetCount() >= Handler().MaxCount()) { - Handler().LogError(this, "accept", (int)Handler().GetCount(), "ISocketHandler socket limit reached", LOG_LEVEL_FATAL); - closesocket(a_s); - return; - } - - // - Socket *tmp = NULL; - - if (Handler().IsThreaded()) { - ISocketHandler& h = Handler().GetRandomHandler(); - tmp = new X(h); // %! no support for Create -#ifdef ENABLE_IPV6 - tmp -> SetIpv6( IsIpv6() ); -#endif - tmp -> SetParent(this); - tmp -> Attach(a_s); - tmp -> SetNonblocking(true); -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - - if (sa_len == sizeof(struct sockaddr_in6)) { - if (reinterpret_cast<struct sockaddr_in6&>(sa).sin6_family == AF_INET6) { - Ipv6Address ad(reinterpret_cast<struct sockaddr_in6&>(sa).sin6_addr, - ntohs(reinterpret_cast<struct sockaddr_in6&>(sa).sin6_port)); - ad.SetFlowinfo(reinterpret_cast<struct sockaddr_in6&>(sa).sin6_flowinfo); -#ifndef _WIN32 - ad.SetScopeId(reinterpret_cast<struct sockaddr_in6&>(sa).sin6_scope_id); -#endif - tmp -> SetRemoteAddress(ad); - } - } - -#endif -#endif - - if (sa_len == sizeof(struct sockaddr_in)) { - struct sockaddr_in *p = (struct sockaddr_in *)&sa; - - if (p -> sin_family == AF_INET) { - Ipv4Address ad(p -> sin_addr,ntohs(p -> sin_port)); - tmp -> SetRemoteAddress(ad); - } - } - - tmp -> SetConnected(true); - tmp -> Init(); - tmp -> SetDeleteByHandler(true); - { - Lock lock(h.GetMutex()); - h.Add(tmp); -#ifdef HAVE_OPENSSL - - if (tmp -> IsSSL()) { // SSL Enabled socket - // %! OnSSLAccept calls SSLNegotiate that can finish in this one call. - // %! If that happens and negotiation fails, the 'tmp' instance is - // %! still added to the list of active sockets in the sockethandler. - // %! See bugfix for this in SocketHandler::Select - don't Set rwx - // %! flags if CloseAndDelete() flag is true. - // %! An even better fugbix (see TcpSocket::OnSSLAccept) now avoids - // %! the Add problem altogether, so ignore the above. - // %! (OnSSLAccept does no longer call SSLNegotiate().) - tmp -> OnSSLAccept(); - } else -#endif - { - tmp -> OnAccept(); - } - } - h.Release(); - } else { - tmp = m_bHasCreate ? m_creator -> Create() : new X(Handler()); -#ifdef ENABLE_IPV6 - tmp -> SetIpv6( IsIpv6() ); -#endif - tmp -> SetParent(this); - tmp -> Attach(a_s); - tmp -> SetNonblocking(true); -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - - if (sa_len == sizeof(struct sockaddr_in6)) { - if (reinterpret_cast<struct sockaddr_in6&>(sa).sin6_family == AF_INET6) { - Ipv6Address ad(reinterpret_cast<struct sockaddr_in6&>(sa).sin6_addr, - ntohs(reinterpret_cast<struct sockaddr_in6&>(sa).sin6_port)); - ad.SetFlowinfo(reinterpret_cast<struct sockaddr_in6&>(sa).sin6_flowinfo); -#ifndef _WIN32 - ad.SetScopeId(reinterpret_cast<struct sockaddr_in6&>(sa).sin6_scope_id); -#endif - tmp -> SetRemoteAddress(ad); - } - } - -#endif -#endif - - if (sa_len == sizeof(struct sockaddr_in)) { - struct sockaddr_in *p = (struct sockaddr_in *)&sa; - - if (p -> sin_family == AF_INET) { - Ipv4Address ad(p -> sin_addr,ntohs(p -> sin_port)); - tmp -> SetRemoteAddress(ad); - } - } - - tmp -> SetConnected(true); - tmp -> Init(); - tmp -> SetDeleteByHandler(true); - Handler().Add(tmp); -#ifdef HAVE_OPENSSL - - if (tmp -> IsSSL()) { // SSL Enabled socket - // %! OnSSLAccept calls SSLNegotiate that can finish in this one call. - // %! If that happens and negotiation fails, the 'tmp' instance is - // %! still added to the list of active sockets in the sockethandler. - // %! See bugfix for this in SocketHandler::Select - don't Set rwx - // %! flags if CloseAndDelete() flag is true. - // %! An even better fugbix (see TcpSocket::OnSSLAccept) now avoids - // %! the Add problem altogether, so ignore the above. - // %! (OnSSLAccept does no longer call SSLNegotiate().) - tmp -> OnSSLAccept(); - } else -#endif - { - tmp -> OnAccept(); - } - } - } // while (true) - } - - /** Please don't use this method. - "accept()" is handled automatically in the OnRead() method. */ - virtual SOCKET Accept(SOCKET socket, struct sockaddr *saptr, socklen_t *lenptr) { - return accept(socket, saptr, lenptr); - } - - bool HasCreator() { - return m_bHasCreate; - } - - void OnOptions(int,int,int,SOCKET) { - SetSoReuseaddr(true); - } - -protected: - ListenSocket(const ListenSocket& s) : Socket(s) {} -private: - ListenSocket& operator=(const ListenSocket& ) { - return *this; - } - int m_depth; - X *m_creator; - bool m_bHasCreate; -}; - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_ListenSocket_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Lock.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Lock.cpp deleted file mode 100755 index 01172e1b603..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Lock.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/** \file Lock.cpp - ** \date 2005-08-22 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2005-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "IMutex.h" -#include "Lock.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -Lock::Lock(const IMutex& m) : m_mutex(m) -{ - m_mutex.Lock(); -} - - -Lock::~Lock() -{ - m_mutex.Unlock(); -} - - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Lock.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Lock.h deleted file mode 100755 index 8a5a329f864..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Lock.h +++ /dev/null @@ -1,62 +0,0 @@ -/** \file Lock.h - ** \date 2005-08-22 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2005-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Lock_H -#define _SOCKETS_Lock_H - -#include "sockets-config.h" -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -class IMutex; - -/** IMutex encapsulation class. - \ingroup threading */ -class Lock -{ -public: - Lock(const IMutex&); - ~Lock(); - -private: - const IMutex& m_mutex; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} -#endif -#endif // _SOCKETS_Lock_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Makefile.am b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Makefile.am deleted file mode 100755 index 8e4fe2424e2..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Makefile.am +++ /dev/null @@ -1,44 +0,0 @@ -noinst_LIBRARIES = libsockets.a - -libsockets_a_SOURCES = Ajp13Socket.cpp HttpRequest.cpp SocketHandlerEp.cpp \ - AjpBaseSocket.cpp HttpResponse.cpp SocketHandlerThread.cpp \ - Base64.cpp HTTPSocket.cpp socket_include.cpp \ - Debug.cpp HttpTransaction.cpp \ - Event.cpp IEventOwner.cpp SocketStream.cpp \ - EventHandler.cpp Ipv4Address.cpp SocketThread.cpp \ - EventTime.cpp Ipv6Address.cpp SSLInitializer.cpp \ - Exception.cpp Json.cpp StdoutLog.cpp \ - File.cpp Lock.cpp StreamSocket.cpp \ - FileStream.cpp MemFile.cpp StreamWriter.cpp \ - HttpBaseSocket.cpp Mutex.cpp TcpSocket.cpp \ - HttpClientSocket.cpp Parse.cpp Thread.cpp \ - HttpdCookies.cpp ResolvServer.cpp UdpSocket.cpp \ - HttpDebugSocket.cpp ResolvSocket.cpp Utility.cpp \ - HttpdForm.cpp SctpSocket.cpp XmlDocument.cpp \ - HttpdSocket.cpp Semaphore.cpp XmlException.cpp \ - HttpGetSocket.cpp SmtpdSocket.cpp XmlNode.cpp \ - HttpPostSocket.cpp Socket.cpp \ - HttpPutSocket.cpp SocketHandler.cpp \ - ajp13.h HttpTransaction.h SocketAddress.h \ - Ajp13Socket.h IBase.h Socket.h \ - AjpBaseSocket.h IEventHandler.h SocketHandlerEp.h \ - Base64.h IEventOwner.h SocketHandler.h \ - Debug.h IFile.h SocketHandlerThread.h \ - Event.h IFileUpload.h socket_include.h \ - EventHandler.h IHttpServer.h sockets-config.h \ - EventTime.h IMutex.h SocketStream.h \ - Exception.h Ipv4Address.h SocketThread.h \ - File.h Ipv6Address.h SSLInitializer.h \ - FileStream.h ISocketHandler.h StdLog.h \ - HttpBaseSocket.h IStream.h StdoutLog.h \ - HttpClientSocket.h Json.h StreamSocket.h \ - HttpdCookies.h ListenSocket.h StreamWriter.h \ - HttpDebugSocket.h Lock.h TcpSocket.h \ - HttpdForm.h MemFile.h Thread.h \ - HttpdSocket.h Mutex.h UdpSocket.h \ - HttpGetSocket.h Parse.h Utility.h \ - HttpPostSocket.h ResolvServer.h XmlDocument.h \ - HttpPutSocket.h ResolvSocket.h XmlException.h \ - HttpRequest.h SctpSocket.h XmlNode.h \ - HttpResponse.h Semaphore.h \ - HTTPSocket.h SmtpdSocket.h diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/MemFile.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/MemFile.cpp deleted file mode 100755 index 6ed6a623c10..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/MemFile.cpp +++ /dev/null @@ -1,349 +0,0 @@ -/** \file MemFile.cpp - ** \date 2005-04-25 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include <stdio.h> -#include <stdarg.h> -#include <cstring> -#include <iostream> - -#include "MemFile.h" -#include "Exception.h" -#include "Lock.h" -#include "Utility.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -MemFile::MemFile() -:m_src(m_src) -,m_src_valid(false) -,m_base(new block_t) -,m_current_read(m_base) -,m_current_write(m_base) -,m_current_write_nr(0) -,m_read_ptr(0) -,m_write_ptr(0) -,m_b_read_caused_eof(false) -,m_ref_count(0) -,m_ref_decreased(false) -{ -} - - -MemFile::MemFile(MemFile& s) -:m_src(s) -,m_src_valid(true) -,m_base(s.m_base) -,m_current_read(m_base) -,m_current_write(s.m_current_write) -,m_current_write_nr(s.m_current_write_nr) -,m_read_ptr(0) -,m_write_ptr(s.m_write_ptr) -,m_b_read_caused_eof(false) -,m_ref_count(0) -,m_ref_decreased(false) -,m_path(s.m_path) -{ - m_src.Increase(); -} - - -MemFile::MemFile(File& f) -:m_src(m_src) -,m_src_valid(false) -,m_base(new block_t) -,m_current_read(NULL) -,m_current_write(NULL) -,m_current_write_nr(0) -,m_read_ptr(0) -,m_write_ptr(0) -,m_b_read_caused_eof(false) -,m_ref_count(0) -,m_ref_decreased(false) -,m_path(f.Path()) -{ - m_current_read = m_base; - m_current_write = m_base; - char slask[32768]; - size_t n; - while ((n = f.fread(slask, 1, 32768)) > 0) - { - fwrite(slask, 1, n); - } -} - - -MemFile::~MemFile() -{ - if (m_ref_count) - std::cerr << "MemFile destructor with a ref count of " + Utility::l2string(m_ref_count) << std::endl; - while (m_base && !m_src_valid) - { - block_t *p = m_base; - m_base = p -> next; - delete p; - } - if (m_src_valid && !m_ref_decreased) - { - m_src.Decrease(); - m_ref_decreased = true; - } -} - - -bool MemFile::fopen(const std::string& path, const std::string& mode) -{ - return true; -} - - -void MemFile::fclose() const -{ - if (m_src_valid && !m_ref_decreased) - { - m_src.Decrease(); - m_ref_decreased = true; - } -} - - -size_t MemFile::fread(char *ptr, size_t size, size_t nmemb) const -{ - size_t p = m_read_ptr % BLOCKSIZE; - size_t sz = size * nmemb; - size_t available = m_write_ptr - m_read_ptr; - if (sz > available) // read beyond eof - { - sz = available; - m_b_read_caused_eof = true; - } - if (!sz) - { - return 0; - } - if (p + sz < BLOCKSIZE) - { - memcpy(ptr, m_current_read -> data + p, sz); - m_read_ptr += sz; - } - else - { - size_t sz1 = BLOCKSIZE - p; - size_t sz2 = sz - sz1; - memcpy(ptr, m_current_read -> data + p, sz1); - m_read_ptr += sz1; - while (sz2 > BLOCKSIZE) - { - if (m_current_read -> next) - { - m_current_read = m_current_read -> next; - memcpy(ptr + sz1, m_current_read -> data, BLOCKSIZE); - m_read_ptr += BLOCKSIZE; - sz1 += BLOCKSIZE; - sz2 -= BLOCKSIZE; - } - else - { - return sz1; - } - } - if (m_current_read -> next) - { - m_current_read = m_current_read -> next; - memcpy(ptr + sz1, m_current_read -> data, sz2); - m_read_ptr += sz2; - } - else - { - return sz1; - } - } - return sz; -} - - -size_t MemFile::fwrite(const char *ptr, size_t size, size_t nmemb) -{ - size_t p = m_write_ptr % BLOCKSIZE; - int nr = (int)m_write_ptr / BLOCKSIZE; - size_t sz = size * nmemb; - if (m_current_write_nr < nr) - { - block_t *next = new block_t; - m_current_write -> next = next; - m_current_write = next; - m_current_write_nr++; - } - if (p + sz <= BLOCKSIZE) - { - memcpy(m_current_write -> data + p, ptr, sz); - m_write_ptr += sz; - } - else - { - size_t sz1 = BLOCKSIZE - p; // size left - size_t sz2 = sz - sz1; - memcpy(m_current_write -> data + p, ptr, sz1); - m_write_ptr += sz1; - while (sz2 > BLOCKSIZE) - { - if (m_current_write -> next) - { - m_current_write = m_current_write -> next; - m_current_write_nr++; - } - else - { - block_t *next = new block_t; - m_current_write -> next = next; - m_current_write = next; - m_current_write_nr++; - } - memcpy(m_current_write -> data, ptr + sz1, BLOCKSIZE); - m_write_ptr += BLOCKSIZE; - sz1 += BLOCKSIZE; - sz2 -= BLOCKSIZE; - } - if (m_current_write -> next) - { - m_current_write = m_current_write -> next; - m_current_write_nr++; - } - else - { - block_t *next = new block_t; - m_current_write -> next = next; - m_current_write = next; - m_current_write_nr++; - } - memcpy(m_current_write -> data, ptr + sz1, sz2); - m_write_ptr += sz2; - } - return sz; -} - - - -char *MemFile::fgets(char *s, int size) const -{ - int n = 0; - while (n < size - 1 && !eof()) - { - char c; - size_t sz = fread(&c, 1, 1); - if (sz) - { - if (c == 10) - { - s[n] = 0; - return s; - } - s[n++] = c; - } - } - s[n] = 0; - return s; -} - - -void MemFile::fprintf(const char *format, ...) -{ - va_list ap; - char tmp[BLOCKSIZE]; - va_start(ap, format); - vsnprintf(tmp, sizeof(tmp), format, ap); - va_end(ap); - fwrite(tmp, 1, strlen(tmp)); -} - - -off_t MemFile::size() const -{ - return (off_t)m_write_ptr; -} - - -bool MemFile::eof() const -{ - return m_b_read_caused_eof; //(m_read_ptr < m_write_ptr) ? false : true; -} - - -void MemFile::reset_read() const -{ - m_read_ptr = 0; - m_current_read = m_base; -} - - -void MemFile::reset_write() -{ - m_write_ptr = 0; - m_current_write = m_base; - m_current_write_nr = 0; -} - - -int MemFile::RefCount() const -{ - return m_ref_count; -} - - -void MemFile::Increase() -{ - ++m_ref_count; -} - - -void MemFile::Decrease() -{ - --m_ref_count; -} - - -const std::string& MemFile::Path() const -{ - return m_path; -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/MemFile.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/MemFile.h deleted file mode 100755 index d66f571436d..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/MemFile.h +++ /dev/null @@ -1,118 +0,0 @@ -/** \file MemFile.h - ** \date 2005-04-25 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_MemFile_H -#define _SOCKETS_MemFile_H - -#include "sockets-config.h" -#include <map> -#include "File.h" -#include "Mutex.h" - -#define BLOCKSIZE 32768 - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -/** Implements a memory file. - \ingroup file */ -class MemFile : public IFile -{ -public: - /** File block structure. - \ingroup file */ - struct block_t { - block_t() : next(NULL) {} - struct block_t *next; - char data[BLOCKSIZE]; - }; -public: - /** Create temporary memory buffer, will be freed when object destructs */ - MemFile(); - /** Copy buffer from source, reset read ptr */ - MemFile(MemFile& ); - /** Read file and write to this, create non-temporary memory buffer from f.Path() */ - MemFile(File& f); - ~MemFile(); - - bool fopen(const std::string& path, const std::string& mode); - void fclose() const; - - size_t fread(char *ptr, size_t size, size_t nmemb) const; - size_t fwrite(const char *ptr, size_t size, size_t nmemb); - - char *fgets(char *s, int size) const; - void fprintf(const char *format, ...); - - off_t size() const; - bool eof() const; - - void reset_read() const; - void reset_write(); - - /** Reference count when copy constructor is used */ - int RefCount() const; - void Increase(); - void Decrease(); - - const std::string& Path() const; - -private: - MemFile& operator=(const MemFile& ) { - return *this; // assignment operator - } - - MemFile& m_src; - bool m_src_valid; - block_t *m_base; - mutable block_t *m_current_read; - block_t *m_current_write; - int m_current_write_nr; - mutable size_t m_read_ptr; - size_t m_write_ptr; - mutable bool m_b_read_caused_eof; - int m_ref_count; - mutable bool m_ref_decreased; - std::string m_path; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_MemFile_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Mutex.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Mutex.cpp deleted file mode 100755 index 80d9562c41f..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Mutex.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/** \file Mutex.cpp - ** \date 2004-10-30 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "Mutex.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -Mutex::Mutex() -{ -#ifdef _WIN32 - m_mutex = ::CreateMutex(NULL, FALSE, NULL); -#else - pthread_mutex_init(&m_mutex, NULL); -#endif -} - - -Mutex::~Mutex() -{ -#ifdef _WIN32 - ::CloseHandle(m_mutex); -#else - pthread_mutex_destroy(&m_mutex); -#endif -} - - -void Mutex::Lock() const -{ -#ifdef _WIN32 - DWORD d = WaitForSingleObject(m_mutex, INFINITE); - /// \todo check 'd' for result -#else - pthread_mutex_lock(&m_mutex); -#endif -} - - -void Mutex::Unlock() const -{ -#ifdef _WIN32 - ::ReleaseMutex(m_mutex); -#else - pthread_mutex_unlock(&m_mutex); -#endif -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Mutex.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Mutex.h deleted file mode 100755 index 720209c1e9e..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Mutex.h +++ /dev/null @@ -1,73 +0,0 @@ -/** \file Mutex.h - ** \date 2004-10-30 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Mutex_H -#define _SOCKETS_Mutex_H - -#include "sockets-config.h" -#ifndef _WIN32 -#include <pthread.h> -#else -#include "socket_include.h" -#include <windows.h> -#endif -#include "IMutex.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -/** Mutex container class, used by Lock. - \ingroup threading */ -class Mutex : public IMutex -{ -public: - Mutex(); - ~Mutex(); - - virtual void Lock() const; - virtual void Unlock() const; - -private: -#ifdef _WIN32 - HANDLE m_mutex; -#else - mutable pthread_mutex_t m_mutex; -#endif -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif -#endif // _SOCKETS_Mutex_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/OSX.zip b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/OSX.zip deleted file mode 100755 index e4046a4a5c5a000d31ccca342dbb8489033a1e2f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16669 zcmb`u1z2257A=gsySux4aCg_>?(Xic3GNVFgFC?`KybGN3+`?&Oy<rdnR{pE|KIDT zo9^%HTD7fq?Netjc`0BJD1ev8vHLdLKR*2P4F&)KK;FUD!r0J>Kt|t?UPT=SfcD5k z6tFW!^ac<GK>o)_6aa`HPc)BTN22~Vl1^AjSINoN!T1G2<;QU8e?lCl2tai+Ac#Cq zLxHkuw2brvy9LVcLALo#+XM-sf8!OKW5X{|Mz7So;KR_-Ba>*AU<TFOs#pMq<M%f@ zVCcj9C>o7TXEwny=cwhX&AnNp5DjbDwjGQh2=S4JreuEP9z!q;bTS)03(iTJZJU`3 zf7HIN2pIQWv@>Sr6zHLu95@%*`8X3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m z?GZ*eKLP~diPa!(X)$s&##0awaDi~kB-YcLklBYLR6Y>)U_X)6{mAYng?JG}EumyF z<akTNP$PB12ddo<&hU{fQ}R{WYgFLxMhy=NC%|8%T>z^fdLgzM|9Htu0Ro`{|Lo)V zcb4RjHjkeV{zHM65Ar`dEdI%vg!mU{@+ZolB)8X;K~#W0Q9k%{{f6?2>;~~K{^V<+ z{+(y|C)}fe(vQZyf6>NN)PF*}5XJrz#A}Hj1tMNU{I1|1oU`8*e9aFe_(j3dzk~aQ zdG^=3{yV?$PhAfM#9kT{Upe3pX53FVys!;_m-03B4*M4=L;n)%|Fbh*gFXr*0Kam^ zUrYMG*puuRNtgaJ=zp~8pA5a%%rL@V@U?!lGrgAeZ}@sY9rnW4du`+wYT0YP6V5Nt zkD$Ln{~NLCC+Z8)?03}H3?uSiPy@jK#>#)iociktUWiJsX*XEEOkncTxcn;4e&J*N zNKrpAUua9Og?_<&O?4st1+(VI{kVUv)7Rj?3H`V5FMOHT91oOV;1hl%u-B-6vS)q@ z`@)`iE$j;~<aM9+ufpCy|BCh>SRy~+Usxiq;a{4)U$+(0{32`s!msfEz4iO&EHAC! zuV;B_QGVT!_p29~kp6O(e>E)s#C&O3{)zc_t$eRDkPiBPz<hn<^k+(XX}o(a@XIaO z*EeUGelbhc{|0XNGcx~d^82aCpL6}SB6zRnIurmV`YT0#z4`n1I=tTPX<y-f@R$3q zxc^oBpE>KLba=f@zZU<4zYE7-ivLR?@zX3Xg@n8mDA>#9jsD}g@gsSVaK3!|KSy3T AT>t<8 diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Parse.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Parse.cpp deleted file mode 100755 index 1286ff6db39..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Parse.cpp +++ /dev/null @@ -1,323 +0,0 @@ -/** \file Parse.cpp - parse a string - ** - ** Written: 1999-Feb-10 grymse@alhem.net - **/ - -/* -Copyright (C) 1999-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include <stdlib.h> -#include <cstring> - -#include "Parse.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -/* implementation of class Parse */ - -Parse::Parse() -:pa_the_str("") -,pa_splits("") -,pa_ord("") -,pa_the_ptr(0) -,pa_breakchar(0) -,pa_enable(0) -,pa_disable(0) -,pa_nospace(0) -,pa_quote(false) -{ -} - -Parse::Parse(const std::string&s) -:pa_the_str(s) -,pa_splits("") -,pa_ord("") -,pa_the_ptr(0) -,pa_breakchar(0) -,pa_enable(0) -,pa_disable(0) -,pa_nospace(0) -,pa_quote(false) -{ -} - -Parse::Parse(const std::string&s,const std::string&sp) -:pa_the_str(s) -,pa_splits(sp) -,pa_ord("") -,pa_the_ptr(0) -,pa_breakchar(0) -,pa_enable(0) -,pa_disable(0) -,pa_nospace(0) -,pa_quote(false) -{ -} - -Parse::Parse(const std::string&s,const std::string&sp,short nospace) -:pa_the_str(s) -,pa_splits(sp) -,pa_ord("") -,pa_the_ptr(0) -,pa_breakchar(0) -,pa_enable(0) -,pa_disable(0) -,pa_nospace(1) -,pa_quote(false) -{ -} - - -Parse::~Parse() -{ -} - -#define C ((pa_the_ptr<pa_the_str.size()) ? pa_the_str[pa_the_ptr] : 0) - -short Parse::issplit(const char c) -{ - for (size_t i = 0; i < pa_splits.size(); i++) - if (pa_splits[i] == c) - return 1; - return 0; -} - -void Parse::getsplit() -{ - size_t x; - - if (C == '=') - { - x = pa_the_ptr++; - } else - { - while (C && (issplit(C))) - pa_the_ptr++; - x = pa_the_ptr; - while (C && !issplit(C) && C != '=') - pa_the_ptr++; - } - if (x == pa_the_ptr && C == '=') - pa_the_ptr++; - pa_ord = (x < pa_the_str.size()) ? pa_the_str.substr(x,pa_the_ptr - x) : ""; -} - -std::string Parse::getword() -{ - size_t x; - int disabled = 0; - int quote = 0; - int rem = 0; - - if (pa_nospace) - { - while (C && issplit(C)) - pa_the_ptr++; - x = pa_the_ptr; - while (C && !issplit(C) && (C != pa_breakchar || !pa_breakchar || disabled)) - { - if (pa_breakchar && C == pa_disable) - disabled = 1; - if (pa_breakchar && C == pa_enable) - disabled = 0; - if (pa_quote && C == '"') - quote = 1; - pa_the_ptr++; - while (quote && C && C != '"') - { - pa_the_ptr++; - } - if (pa_quote && C == '"') - { - pa_the_ptr++; - } - quote = 0; - } - } else - { - if (C == pa_breakchar && pa_breakchar) - { - x = pa_the_ptr++; - rem = 1; - } else - { - while (C && (C == ' ' || C == 9 || C == 13 || C == 10 || issplit(C))) - pa_the_ptr++; - x = pa_the_ptr; - while (C && C != ' ' && C != 9 && C != 13 && C != 10 && !issplit(C) && - (C != pa_breakchar || !pa_breakchar || disabled)) - { - if (pa_breakchar && C == pa_disable) - disabled = 1; - if (pa_breakchar && C == pa_enable) - disabled = 0; - if (pa_quote && C == '"') - { - quote = 1; - pa_the_ptr++; - while (quote && C && C != '"') - { - pa_the_ptr++; - } - if (pa_quote && C == '"') - { - pa_the_ptr++; - } - } - else - pa_the_ptr++; - quote = 0; - } - pa_the_ptr++; - rem = 1; - } - if (x == pa_the_ptr && C == pa_breakchar && pa_breakchar) - pa_the_ptr++; - } - if (x < pa_the_str.size()) - { - pa_ord = pa_the_str.substr(x,pa_the_ptr - x - rem); - } - else - { - pa_ord = ""; - } - return pa_ord; -} - -void Parse::getword(std::string&s) -{ - s = Parse::getword(); -} - -void Parse::getsplit(std::string&s) -{ - Parse::getsplit(); - s = pa_ord; -} - -void Parse::getword(std::string&s,std::string&fill,int l) -{ - Parse::getword(); - s = ""; - while (s.size() + pa_ord.size() < (size_t)l) - s += fill; - s += pa_ord; -} - -std::string Parse::getrest() -{ - std::string s; - while (C && (C == ' ' || C == 9 || issplit(C))) - pa_the_ptr++; - s = (pa_the_ptr < pa_the_str.size()) ? pa_the_str.substr(pa_the_ptr) : ""; - return s; -} - -void Parse::getrest(std::string&s) -{ - while (C && (C == ' ' || C == 9 || issplit(C))) - pa_the_ptr++; - s = (pa_the_ptr < pa_the_str.size()) ? pa_the_str.substr(pa_the_ptr) : ""; -} - -long Parse::getvalue() -{ - Parse::getword(); - return atol(pa_ord.c_str()); -} - -void Parse::setbreak(const char c) -{ - pa_breakchar = c; -} - -int Parse::getwordlen() -{ - size_t x,y = pa_the_ptr,len; - - if (C == pa_breakchar && pa_breakchar) - { - x = pa_the_ptr++; - } else - { - while (C && (C == ' ' || C == 9 || C == 13 || C == 10 || issplit(C))) - pa_the_ptr++; - x = pa_the_ptr; - while (C && C != ' ' && C != 9 && C != 13 && C != 10 && !issplit(C) && (C != pa_breakchar || !pa_breakchar)) - pa_the_ptr++; - } - if (x == pa_the_ptr && C == pa_breakchar && pa_breakchar) - pa_the_ptr++; - len = pa_the_ptr - x; - pa_the_ptr = y; - return (int)len; -} - -int Parse::getrestlen() -{ - size_t y = pa_the_ptr; - size_t len; - - while (C && (C == ' ' || C == 9 || issplit(C))) - pa_the_ptr++; - len = strlen(pa_the_str.c_str() + pa_the_ptr); - pa_the_ptr = y; - return (int)len; -} - -void Parse::getline() -{ - size_t x; - - x = pa_the_ptr; - while (C && C != 13 && C != 10) - pa_the_ptr++; - pa_ord = (x < pa_the_str.size()) ? pa_the_str.substr(x,pa_the_ptr - x) : ""; - if (C == 13) - pa_the_ptr++; - if (C == 10) - pa_the_ptr++; -} - -void Parse::getline(std::string&s) -{ - getline(); - s = pa_ord; -} - -/* end of implementation of class Parse */ -/***************************************************/ -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Parse.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Parse.h deleted file mode 100755 index 0b69d46d8bf..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Parse.h +++ /dev/null @@ -1,108 +0,0 @@ -/** \file Parse.h - parse a string - ** - ** Written: 1999-Feb-10 grymse@alhem.net - **/ - -/* -Copyright (C) 1999-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifndef _SOCKETS_Parse_H -#define _SOCKETS_Parse_H - -#include "sockets-config.h" -#ifdef _MSC_VER -#pragma warning(disable:4514) -#endif - -#include <string> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -/***************************************************/ -/* interface of class Parse */ - -/** Splits a string whatever way you want. - \ingroup util */ -class Parse -{ -public: - Parse(); - Parse(const std::string&); - Parse(const std::string&,const std::string&); - Parse(const std::string&,const std::string&,short); - ~Parse(); - short issplit(const char); - void getsplit(); - void getsplit(std::string&); - std::string getword(); - void getword(std::string&); - void getword(std::string&,std::string&,int); - std::string getrest(); - void getrest(std::string&); - long getvalue(); - void setbreak(const char); - int getwordlen(); - int getrestlen(); - void enablebreak(const char c) { - pa_enable = c; - } - void disablebreak(const char c) { - pa_disable = c; - } - void getline(); - void getline(std::string&); - size_t getptr() { - return pa_the_ptr; - } - void EnableQuote(bool b) { - pa_quote = b; - } - -private: - std::string pa_the_str; - std::string pa_splits; - std::string pa_ord; - size_t pa_the_ptr; - char pa_breakchar; - char pa_enable; - char pa_disable; - short pa_nospace; - bool pa_quote; -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_Parse_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/README b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/README deleted file mode 100755 index 6dbef38d34c..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/README +++ /dev/null @@ -1,90 +0,0 @@ -http://www.alhem.net/Sockets/ - -C++ Sockets Library :: installation instructions - - -Unix (and Cygwin/Mingw on windows) -================================== - -1. Change the 'PLATFORM =' line in Makefile - - Possible values are - linux-x86-32 - win32-cygwin - solaris9-sparc-64 - macosx - solaris8 - -2. If you want to use ssl encrypted socket communication, the library - has support for the third-party library openssl. If necessary, add - the following include directory to Makefile: - - INCLUDE = -I<path to openssl>/include - - The openssl include directory contains only one directory named - 'openssl', in which all header files can be found. - - OpenSSL support is enabled by default. - - If you don't need encrypted communications, make sure to comment - out this line in the file 'sockets-config.h': - - #define HAVE_OPENSSL - -3. If you really need thread-safe dns lookups, and your operating has - support for *addrinfo and *nameinfo function calls, make sure this - line in 'sockets-config.h' is commented: - - #define NO_GETADDRINFO - - By default, dns lookups using getaddrinfo/getnameinfo is disabled. - -4. If your operating system supports SCTP, there might be a slight - chance the sctp code in the library works. Uncomment this line in - 'sockets-config.h' to try: - - //#define USE_SCTP - -5. If you need IPv6 support, uncomment this line in - 'sockets-config.h': - - //#define ENABLE_IPV6 - -6. Type 'make' - -7. If all builds ok, you'll find the static library file 'libSockets.a' - in the build directory. - - -When compiling the application, any flags used when compiling the library -also needs to be present when including the library .h files. All flags -can be retrieved using the 'Sockets-config' executable. Add something like -this in your Makefile: - -CFLAGS += `Sockets-config` -CPPFLAGS += `Sockets-config` - -When linking an application using the library, make sure the object and -library files are in correct order on your link command line: - - First: Application object files - 2nd: -lSockets - 3rd: openssl libraries - Finally: Everything else, ending with -lpthread - - -windows -======= - -Project files for various IDE's can be found here: - - Project/ Visual studio 6.0 - Project.net/ Visual studio .NET - DevCpp/ Dev C++ - -Please see steps 2-5 above for some details on configuring the library. - -When linking on cygwin/mingw, add the following libraries: - -lwsock32 - -lws2_32 - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/README.macosx b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/README.macosx deleted file mode 100755 index ffee721a97f..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/README.macosx +++ /dev/null @@ -1,9 +0,0 @@ -MAC notes ---------- - -The file OSX.zip contains xcode project files for an older version of the library. - -Find uuid.h (if missing) here: - http://www.die.net/doc/linux/include/uuid/uuid.h -This used to be a problem, but isn't any more afaik. - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ResolvServer.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ResolvServer.cpp deleted file mode 100755 index 5e5497e8332..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ResolvServer.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/** \file ResolvServer.cpp - ** \date 2005-03-24 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include "ResolvServer.h" -#ifdef ENABLE_RESOLVER -#include "StdoutLog.h" -#include "ListenSocket.h" -#include "ResolvSocket.h" -#include "SocketHandler.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -ResolvServer::ResolvServer(port_t port) -:Thread() -,m_quit(false) -,m_port(port) -,m_ready(false) -{ -} - - -ResolvServer::~ResolvServer() -{ -} - - -void ResolvServer::Run() -{ -// StdoutLog log; - SocketHandler h; - ListenSocket<ResolvSocket> l(h); - - if (l.Bind("127.0.0.1", m_port)) - { - return; - } - h.Add(&l); - - m_ready = true; - while (!m_quit && IsRunning() ) - { - h.Select(0, 500000); - } - SetRunning(false); -} - - -void ResolvServer::Quit() -{ - m_quit = true; -} - - -bool ResolvServer::Ready() -{ - return m_ready; -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // ENABLE_RESOLVER - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ResolvServer.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ResolvServer.h deleted file mode 100755 index 5787d18bb05..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ResolvServer.h +++ /dev/null @@ -1,78 +0,0 @@ -/** \file ResolvServer.h - ** \date 2005-03-24 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_ResolvServer_H -#define _SOCKETS_ResolvServer_H -#include "sockets-config.h" -#ifdef ENABLE_RESOLVER -#include "socket_include.h" -#include "Thread.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -/** \defgroup async Asynchronous DNS */ -/** Async DNS resolver thread. - \ingroup async */ -class ResolvServer : public Thread -{ -public: - ResolvServer(port_t); - ~ResolvServer(); - - void Run(); - void Quit(); - - bool Ready(); - -private: - ResolvServer(const ResolvServer& ) {} // copy constructor - ResolvServer& operator=(const ResolvServer& ) { - return *this; // assignment operator - } - - bool m_quit; - port_t m_port; - bool m_ready; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // ENABLE_RESOLVER -#endif // _SOCKETS_ResolvServer_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ResolvSocket.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ResolvSocket.cpp deleted file mode 100755 index c07e78dce19..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ResolvSocket.cpp +++ /dev/null @@ -1,442 +0,0 @@ -/** \file ResolvSocket.cpp - ** \date 2005-03-24 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _WIN32 -#ifdef _MSC_VER -#pragma warning(disable:4786) -#pragma warning(disable:4503) -#endif -#else -#include <netdb.h> -#endif -#include "ResolvSocket.h" -#ifdef ENABLE_RESOLVER -#include "Utility.h" -#include "Parse.h" -#include "ISocketHandler.h" -#include "Lock.h" -#include "Mutex.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -#ifdef _DEBUG -#define DEB(x) x -#else -#define DEB(x) -#endif - - -// static -ResolvSocket::cache_t ResolvSocket::m_cache; -ResolvSocket::timeout_t ResolvSocket::m_cache_to; -Mutex ResolvSocket::m_cache_mutex; - - -ResolvSocket::ResolvSocket(ISocketHandler& h) -:TcpSocket(h) -,m_bServer(false) -,m_parent(NULL) -,m_parent_uid(0) -#ifdef ENABLE_IPV6 -,m_resolve_ipv6(false) -#endif -,m_cached(false) -{ - SetLineProtocol(); -} - - -ResolvSocket::ResolvSocket(ISocketHandler& h, Socket *parent, const std::string& host, port_t port, bool ipv6) -:TcpSocket(h) -,m_bServer(false) -,m_parent(parent) -,m_parent_uid(parent -> UniqueIdentifier()) -,m_resolv_host(host) -,m_resolv_port(port) -#ifdef ENABLE_IPV6 -,m_resolve_ipv6(ipv6) -#endif -,m_cached(false) -{ - SetLineProtocol(); -} - - -ResolvSocket::ResolvSocket(ISocketHandler& h, Socket *parent, ipaddr_t a) -:TcpSocket(h) -,m_bServer(false) -,m_parent(parent) -,m_parent_uid(parent -> UniqueIdentifier()) -,m_resolv_port(0) -,m_resolv_address(a) -#ifdef ENABLE_IPV6 -,m_resolve_ipv6(false) -#endif -,m_cached(false) -{ - SetLineProtocol(); -} - - -#ifdef ENABLE_IPV6 -ResolvSocket::ResolvSocket(ISocketHandler& h, Socket *parent, in6_addr& a) -:TcpSocket(h) -,m_bServer(false) -,m_parent(parent) -,m_parent_uid(parent -> UniqueIdentifier()) -,m_resolv_port(0) -,m_resolve_ipv6(true) -,m_resolv_address6(a) -,m_cached(false) -{ - SetLineProtocol(); -} -#endif - - -ResolvSocket::~ResolvSocket() -{ -} - - -void ResolvSocket::OnLine(const std::string& line) -{ - Parse pa(line, ":"); - if (m_bServer) - { - m_query = pa.getword(); - m_data = pa.getrest(); -DEB( fprintf(stderr, " *** ResolvSocket server; query=%s, data=%s\n", m_query.c_str(), m_data.c_str());) - // %! check cache - { - Lock lock(m_cache_mutex); - if (m_cache[m_query].find(m_data) != m_cache[m_query].end()) - { - if (time(NULL) - m_cache_to[m_query][m_data] < 3600) // ttl - { - std::string result = m_cache[m_query][m_data]; -DEB(fprintf(stderr, " *** Returning cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), result.c_str());) - Send("Cached\n"); - if (!result.size()) /* failed */ - { - Send("Failed\n\n"); - SetCloseAndDelete(); - return; - } - else - if (m_query == "gethostbyname") - { - Send("A: " + result + "\n\n"); - SetCloseAndDelete(); - return; - } - else -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (m_query == "gethostbyname2") - { - Send("AAAA: " + result + "\n\n"); - SetCloseAndDelete(); - return; - } - else -#endif -#endif - if (m_query == "gethostbyaddr") - { - Send("Name: " + result + "\n\n"); - SetCloseAndDelete(); - return; - } - } - } - } - if (!Detach()) // detach failed? - { - SetCloseAndDelete(); - } - return; - } - std::string key = pa.getword(); - std::string value = pa.getrest(); -DEB( fprintf(stderr, " *** ResolvSocket response; %s: %s\n", key.c_str(), value.c_str());) - - if (key == "Cached") - { - m_cached = true; - } - else - if (key == "Failed" && m_parent) - { -DEB( fprintf(stderr, " ************ Resolve failed\n");) - if (Handler().Resolving(m_parent) || Handler().Valid(m_parent_uid)) - { - m_parent -> OnResolveFailed(m_resolv_id); - } - // update cache - if (!m_cached) - { - Lock lock(m_cache_mutex); -DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) - m_cache[m_query][m_data] = value; - m_cache_to[m_query][m_data] = time(NULL); - } - m_parent = NULL; - } - else - if (key == "Name" && !m_resolv_host.size() && m_parent) - { - if (Handler().Resolving(m_parent) || Handler().Valid(m_parent_uid)) - { - m_parent -> OnReverseResolved(m_resolv_id, value); - } - // update cache - if (!m_cached) - { - Lock lock(m_cache_mutex); -DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) - m_cache[m_query][m_data] = value; - m_cache_to[m_query][m_data] = time(NULL); - } - m_parent = NULL; - } - else - if (key == "A" && m_parent) - { - if (Handler().Resolving(m_parent) || Handler().Valid(m_parent_uid)) - { - ipaddr_t l; - Utility::u2ip(value, l); // ip2ipaddr_t - m_parent -> OnResolved(m_resolv_id, l, m_resolv_port); - } - // update cache - if (!m_cached) - { - Lock lock(m_cache_mutex); -DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) - m_cache[m_query][m_data] = value; - m_cache_to[m_query][m_data] = time(NULL); - } - m_parent = NULL; // always use first ip in case there are several - } -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - else - if (key == "AAAA" && m_parent) - { - if (Handler().Resolving(m_parent) || Handler().Valid(m_parent_uid)) - { - in6_addr a; - Utility::u2ip(value, a); - m_parent -> OnResolved(m_resolv_id, a, m_resolv_port); - } - // update cache - if (!m_cached) - { - Lock lock(m_cache_mutex); -DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) - m_cache[m_query][m_data] = value; - m_cache_to[m_query][m_data] = time(NULL); - } - m_parent = NULL; - } -#endif -#endif -} - - -void ResolvSocket::OnDetached() -{ -DEB( fprintf(stderr, " *** ResolvSocket::OnDetached(); query=%s, data=%s\n", m_query.c_str(), m_data.c_str());) - if (m_query == "gethostbyname") - { - struct sockaddr_in sa; - if (Utility::u2ip(m_data, sa)) - { - std::string ip; - Utility::l2ip(sa.sin_addr, ip); - Send("A: " + ip + "\n"); - } - else - { - Send("Failed\n"); - } - Send("\n"); - } - else -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (m_query == "gethostbyname2") - { - struct sockaddr_in6 sa; - if (Utility::u2ip(m_data, sa)) - { - std::string ip; - Utility::l2ip(sa.sin6_addr, ip); - Send("AAAA: " + ip + "\n"); - } - else - { - Send("Failed\n"); - } - Send("\n"); - } - else -#endif -#endif - if (m_query == "gethostbyaddr") - { - if (Utility::isipv4( m_data )) - { - struct sockaddr_in sa; - if (!Utility::u2ip(m_data, sa, AI_NUMERICHOST)) - { - Send("Failed: convert to sockaddr_in failed\n"); - } - else - { - std::string name; - if (!Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), name)) - { - Send("Failed: ipv4 reverse lookup of " + m_data + "\n"); - } - else - { - Send("Name: " + name + "\n"); - } - } - } - else -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (Utility::isipv6( m_data )) - { - struct sockaddr_in6 sa; - if (!Utility::u2ip(m_data, sa, AI_NUMERICHOST)) - { - Send("Failed: convert to sockaddr_in6 failed\n"); - } - else - { - std::string name; - if (!Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), name)) - { - Send("Failed: ipv6 reverse lookup of " + m_data + "\n"); - } - else - { - Send("Name: " + name + "\n"); - } - } - } - else -#endif -#endif - { - Send("Failed: malformed address\n"); - } - Send("\n"); - } - else - { - std::string msg = "Unknown query type: " + m_query; - Handler().LogError(this, "OnDetached", 0, msg); - Send("Unknown\n\n"); - } - SetCloseAndDelete(); -} - - -void ResolvSocket::OnConnect() -{ - if (m_resolv_host.size()) - { -#ifdef ENABLE_IPV6 - std::string msg = (m_resolve_ipv6 ? "gethostbyname2 " : "gethostbyname ") + m_resolv_host + "\n"; - m_query = m_resolve_ipv6 ? "gethostbyname2" : "gethostbyname"; -#else - std::string msg = "gethostbyname " + m_resolv_host + "\n"; - m_query = "gethostbyname"; -#endif - m_data = m_resolv_host; - Send( msg ); - return; - } -#ifdef ENABLE_IPV6 - if (m_resolve_ipv6) - { - std::string tmp; - Utility::l2ip(m_resolv_address6, tmp); - m_query = "gethostbyaddr"; - m_data = tmp; - std::string msg = "gethostbyaddr " + tmp + "\n"; - Send( msg ); - } -#endif - std::string tmp; - Utility::l2ip(m_resolv_address, tmp); - m_query = "gethostbyaddr"; - m_data = tmp; - std::string msg = "gethostbyaddr " + tmp + "\n"; - Send( msg ); -} - - -void ResolvSocket::OnDelete() -{ - if (m_parent) - { - if (Handler().Resolving(m_parent) || Handler().Valid(m_parent_uid)) - { - m_parent -> OnResolveFailed(m_resolv_id); - } - // update cache - if (!m_cached) - { - Lock lock(m_cache_mutex); - std::string value; -DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) - m_cache[m_query][m_data] = value; - m_cache_to[m_query][m_data] = time(NULL); - } - m_parent = NULL; - } -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // ENABLE_RESOLVER - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ResolvSocket.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ResolvSocket.h deleted file mode 100755 index e080d012556..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ResolvSocket.h +++ /dev/null @@ -1,120 +0,0 @@ -/** \file ResolvSocket.h - ** \date 2005-03-24 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_ResolvSocket_H -#define _SOCKETS_ResolvSocket_H -#include "sockets-config.h" -#ifdef ENABLE_RESOLVER -#include "TcpSocket.h" -#include <map> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -class Mutex; - -/** Async DNS resolver socket. - \ingroup async */ -class ResolvSocket : public TcpSocket -{ - typedef std::map<std::string, /* type */ - std::map<std::string, std::string> > cache_t; /* host, result */ - typedef std::map<std::string, /* type */ - std::map<std::string, time_t> > timeout_t; /* host, time */ - -public: - ResolvSocket(ISocketHandler&); - ResolvSocket(ISocketHandler&, Socket *parent, const std::string& host, port_t port, bool ipv6 = false); - ResolvSocket(ISocketHandler&, Socket *parent, ipaddr_t); -#ifdef ENABLE_IPV6 - ResolvSocket(ISocketHandler&, Socket *parent, in6_addr&); -#endif - ~ResolvSocket(); - - void OnAccept() { - m_bServer = true; - } - void OnLine(const std::string& line); - void OnDetached(); - void OnDelete(); - - void SetId(int x) { - m_resolv_id = x; - } - int GetId() { - return m_resolv_id; - } - - void OnConnect(); - -#ifdef ENABLE_IPV6 - void SetResolveIpv6(bool x = true) { - m_resolve_ipv6 = x; - } -#endif - -private: - ResolvSocket(const ResolvSocket& s) : TcpSocket(s) {} // copy constructor - ResolvSocket& operator=(const ResolvSocket& ) { - return *this; // assignment operator - } - - std::string m_query; - std::string m_data; - bool m_bServer; - Socket *m_parent; - socketuid_t m_parent_uid; - int m_resolv_id; - std::string m_resolv_host; - port_t m_resolv_port; - ipaddr_t m_resolv_address; -#ifdef ENABLE_IPV6 - bool m_resolve_ipv6; - in6_addr m_resolv_address6; -#endif - static cache_t m_cache; - static timeout_t m_cache_to; - static Mutex m_cache_mutex; - bool m_cached; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // ENABLE_RESOLVER -#endif // _SOCKETS_ResolvSocket_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SSLInitializer.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SSLInitializer.cpp deleted file mode 100755 index 29c2b8ac398..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SSLInitializer.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/** - ** \file SSLInitializer.cpp - ** \date 2007-04-30 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _WIN32 -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include <io.h> -#endif -#include "SSLInitializer.h" -#ifdef HAVE_OPENSSL -#include <map> -#include "Utility.h" -#include <openssl/rand.h> -#include "Lock.h" - -#ifdef _DEBUG -#define DEB(x) x -#else -#define DEB(x) -#endif - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -std::map<int, IMutex *> *SSLInitializer::m_mmap = NULL; -Mutex *SSLInitializer::m_mmap_mutex = NULL; - - -SSLInitializer::SSLInitializer() -{ -DEB( fprintf(stderr, "SSLInitializer()\n");) - - bio_err = NULL; - m_rand_size = 1024; - - /* An error write context */ - bio_err = BIO_new_fp(stderr, BIO_NOCLOSE); - - /* Global system initialization*/ - SSL_library_init(); - SSL_load_error_strings(); - OpenSSL_add_all_algorithms(); - CRYPTO_set_locking_callback( SSL_locking_function ); - CRYPTO_set_id_callback( SSL_id_function ); - - std::string randfile = Utility::GetEnv("RANDFILE"); - std::string home = Utility::GetEnv("HOME"); - if (randfile.empty() && home.empty()) - { - std::string homepath = Utility::GetEnv("HOMEPATH"); - if (!homepath.empty()) - { - Utility::SetEnv("HOME", homepath); - } - } - char path[512]; - *path = 0; - RAND_file_name(path, 512); - if (*path) - { - m_rand_file = path; - m_rand_size = 1024; - RAND_write_file(path); - } - else - { -DEB( fprintf(stderr, "SSLInitializer: no random file generated\n");) - } - - /* Load randomness */ - if (!m_rand_file.size() || !RAND_load_file(m_rand_file.c_str(), m_rand_size)) - { -DEB( fprintf(stderr, "SSLInitializer: PRNG not initialized\n");) - } - -} - - -SSLInitializer::~SSLInitializer() -{ -DEB( fprintf(stderr, "~SSLInitializer()\n");) - DeleteRandFile(); - // %! delete mutexes -} - - -void SSLInitializer::DeleteRandFile() -{ - if (m_rand_file.size()) - { -#ifdef _WIN32 - _unlink(m_rand_file.c_str()); -#else - unlink(m_rand_file.c_str()); -#endif - } -} - - -void SSLInitializer::SSL_locking_function(int mode, int n, const char *file, int line) -{ - IMutex *mutex = NULL; - { - Lock lock(MMapMutex()); - if (MMap().find(n) == MMap().end()) - { - MMap()[n] = new Mutex; - } - mutex = MMap()[n]; - } - if (mode & CRYPTO_LOCK) - { - mutex -> Lock(); - } - else - { - mutex -> Unlock(); - } -} - - -unsigned long SSLInitializer::SSL_id_function() -{ - return Utility::ThreadID(); -} - - -std::map<int, IMutex *>& SSLInitializer::MMap() -{ - if (m_mmap == NULL) - m_mmap = new std::map<int, IMutex *>(); - return *m_mmap; -} - - -Mutex& SSLInitializer::MMapMutex() -{ - if (m_mmap_mutex == NULL) - m_mmap_mutex = new Mutex(); - return *m_mmap_mutex; -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif -#endif // HAVE_OPENSSL - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SSLInitializer.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SSLInitializer.h deleted file mode 100755 index 4945458f92e..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SSLInitializer.h +++ /dev/null @@ -1,97 +0,0 @@ -/** - ** \file SSLInitializer.h - ** \date 2007-04-30 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef __SOCKETS_SSLInitializer_H -#define __SOCKETS_SSLInitializer_H -#include "sockets-config.h" -#ifdef HAVE_OPENSSL - -#ifdef _WIN32 -#include <winsock2.h> -#endif -#include <openssl/ssl.h> -#include <string> -#include <map> -#include "Mutex.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -class SSLInitializer -{ -public: - /** - init openssl - bio_err - create random file - */ - SSLInitializer(); - - /** - remove random file - */ - ~SSLInitializer(); - - void DeleteRandFile(); - - /** SSL; mutex locking function callback. */ - static void SSL_locking_function(int mode, int n, const char *file, int line); - - /** Return thread id. */ - static unsigned long SSL_id_function(); - - BIO *bio_err; - -private: - std::string m_rand_file; - long m_rand_size; - static std::map<int, IMutex *> *m_mmap; - static Mutex *m_mmap_mutex; - - static std::map<int, IMutex *>& MMap(); - static Mutex& MMapMutex(); - -}; - - - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif -#endif // HAVE_OPENSSL -#endif // __SOCKETS_SSLInitializer_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SctpSocket.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SctpSocket.cpp deleted file mode 100755 index 767438c6364..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SctpSocket.cpp +++ /dev/null @@ -1,506 +0,0 @@ -/** - ** \file SctpSocket.cpp - ** \date 2006-09-04 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "SctpSocket.h" -#ifdef USE_SCTP -#include "Utility.h" -#include "ISocketHandler.h" -#include <errno.h> -#include "Ipv4Address.h" -#include "Ipv6Address.h" -#ifdef ENABLE_EXCEPTIONS -#include "Exception.h" -#endif - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -SctpSocket::SctpSocket(ISocketHandler& h,int type) : StreamSocket(h) -,m_type(type) -,m_buf(new char[SCTP_BUFSIZE_READ]) -{ - if (type != SOCK_STREAM && type != SOCK_SEQPACKET) - { - } -} - - -SctpSocket::~SctpSocket() -{ - delete[] m_buf; -} - - -int SctpSocket::Bind(const std::string& a,port_t p) -{ -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(a, p); - return Bind(ad); - } -#endif -#endif - Ipv4Address ad(a, p); - return Bind(ad); -} - - -int SctpSocket::Bind(SocketAddress& ad) -{ - if (!ad.IsValid()) - { - Handler().LogError(this, "SctpSocket", -1, "invalid address", LOG_LEVEL_ERROR); - return -1; - } - if (GetSocket() == INVALID_SOCKET) - { - Attach(CreateSocket(ad.GetFamily(), m_type, "sctp")); - } - if (GetSocket() != INVALID_SOCKET) - { - int n = bind(GetSocket(), ad, ad); - if (n == -1) - { - Handler().LogError(this, "SctpSocket", -1, "bind() failed", LOG_LEVEL_ERROR); -#ifdef ENABLE_EXCEPTIONS - throw Exception("bind() failed for SctpSocket, port: " + Utility::l2string(ad.GetPort())); -#endif - } - return n; - } - return -1; -} - - -int SctpSocket::AddAddress(const std::string& a,port_t p) -{ -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(a, p); - return AddAddress(ad); - } -#endif -#endif - Ipv4Address ad(a, p); - return AddAddress(ad); -} - - -int SctpSocket::AddAddress(SocketAddress& ad) -{ - if (!ad.IsValid()) - { - Handler().LogError(this, "SctpSocket", -1, "invalid address", LOG_LEVEL_ERROR); - return -1; - } - if (GetSocket() == INVALID_SOCKET) - { - Handler().LogError(this, "SctpSocket", -1, "AddAddress called with invalid file descriptor", LOG_LEVEL_ERROR); - return -1; - } - int n = sctp_bindx(GetSocket(), ad, ad, SCTP_BINDX_ADD_ADDR); - if (n == -1) - { - Handler().LogError(this, "SctpSocket", -1, "sctp_bindx() failed", LOG_LEVEL_ERROR); - } - return n; -} - - -int SctpSocket::RemoveAddress(const std::string& a,port_t p) -{ -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(a, p); - return RemoveAddress(ad); - } -#endif -#endif - Ipv4Address ad(a, p); - return RemoveAddress(ad); -} - - -int SctpSocket::RemoveAddress(SocketAddress& ad) -{ - if (!ad.IsValid()) - { - Handler().LogError(this, "SctpSocket", -1, "invalid address", LOG_LEVEL_ERROR); - return -1; - } - if (GetSocket() == INVALID_SOCKET) - { - Handler().LogError(this, "SctpSocket", -1, "RemoveAddress called with invalid file descriptor", LOG_LEVEL_ERROR); - return -1; - } - int n = sctp_bindx(GetSocket(), ad, ad, SCTP_BINDX_REM_ADDR); - if (n == -1) - { - Handler().LogError(this, "SctpSocket", -1, "sctp_bindx() failed", LOG_LEVEL_ERROR); - } - return n; -} - - -int SctpSocket::Open(const std::string& a,port_t p) -{ -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(a, p); - return Open(ad); - } -#endif -#endif - Ipv4Address ad(a, p); - return Open(ad); -} - - -int SctpSocket::Open(SocketAddress& ad) -{ - if (!ad.IsValid()) - { - Handler().LogError(this, "SctpSocket", -1, "invalid address", LOG_LEVEL_ERROR); - return -1; - } - if (GetSocket() == INVALID_SOCKET) - { - Attach(CreateSocket(ad.GetFamily(), m_type, "sctp")); - } - if (GetSocket() != INVALID_SOCKET) - { - if (!SetNonblocking(true)) - { - return -1; - } - int n = connect(GetSocket(), ad, ad); - if (n == -1) - { - // check error code that means a connect is in progress -#ifdef _WIN32 - if (Errno == WSAEWOULDBLOCK) -#else - if (Errno == EINPROGRESS) -#endif - { - Handler().LogError(this, "connect: connection pending", Errno, StrError(Errno), LOG_LEVEL_INFO); - SetConnecting( true ); // this flag will control fd_set's - } - else - { - Handler().LogError(this, "SctpSocket", -1, "connect() failed", LOG_LEVEL_ERROR); - } - } - return n; - } - return -1; -} - - -#ifndef SOLARIS -int SctpSocket::AddConnection(const std::string& a,port_t p) -{ -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(a, p); - return AddConnection(ad); - } -#endif -#endif - Ipv4Address ad(a, p); - return AddConnection(ad); -} - - -int SctpSocket::AddConnection(SocketAddress& ad) -{ - if (!ad.IsValid()) - { - Handler().LogError(this, "SctpSocket", -1, "invalid address", LOG_LEVEL_ERROR); - return -1; - } - if (GetSocket() == INVALID_SOCKET) - { - Handler().LogError(this, "SctpSocket", -1, "AddConnection called with invalid file descriptor", LOG_LEVEL_ERROR); - return -1; - } - int n = sctp_connectx(GetSocket(), ad, ad); - if (n == -1) - { - Handler().LogError(this, "SctpSocket", -1, "sctp_connectx() failed", LOG_LEVEL_ERROR); - } - else - { - SetConnecting(); - } - return n; -} -#endif - - -int SctpSocket::getpaddrs(sctp_assoc_t id,std::list<std::string>& vec) -{ - struct sockaddr *p = NULL; - int n = sctp_getpaddrs(GetSocket(), id, &p); - if (!n || n == -1) - { - Handler().LogError(this, "SctpSocket", -1, "sctp_getpaddrs failed", LOG_LEVEL_WARNING); - return n; - } - for (int i = 0; i < n; i++) - { - vec.push_back(Utility::Sa2String(&p[i])); - } - sctp_freepaddrs(p); - return n; -} - - -int SctpSocket::getladdrs(sctp_assoc_t id,std::list<std::string>& vec) -{ - struct sockaddr *p = NULL; - int n = sctp_getladdrs(GetSocket(), id, &p); - if (!n || n == -1) - { - Handler().LogError(this, "SctpSocket", -1, "sctp_getladdrs failed", LOG_LEVEL_WARNING); - return n; - } - for (int i = 0; i < n; i++) - { - vec.push_back(Utility::Sa2String(&p[i])); - } - sctp_freeladdrs(p); - return n; -} - - -int SctpSocket::PeelOff(sctp_assoc_t id) -{ - int n = sctp_peeloff(GetSocket(), id); - if (n == -1) - { - Handler().LogError(this, "SctpSocket", -1, "PeelOff failed", LOG_LEVEL_WARNING); - return -1; - } - Socket *p = Create(); - p -> Attach(n); - p -> SetDeleteByHandler(); - Handler().Add(p); - return n; -} - - -void SctpSocket::OnRead() -{ -/* - int sctp_recvmsg(int sd, void * msg, size_t * len, - struct sockaddr * from, socklen_t * fromlen, - struct sctp_sndrcvinfo * sinfo, int * msg_flags); - - DESCRIPTION - sctp_recvmsg is a wrapper library function that can be used to receive a message from a socket while using the advanced - features of SCTP. sd is the socket descriptor on which the message pointed to by msg of length len is received. - - If from is not NULL, the source address of the message is filled in. The argument fromlen is a value-result parameter. - initialized to the size of the buffer associated with from , and modified on return to indicate the actual size of the - address stored. - - sinfo is a pointer to a sctp_sndrcvinfo structure to be filled upon receipt of the message. msg_flags is a pointer to a - integer that is filled with any message flags like MSG_NOTIFICATION or MSG_EOR. - -*/ - struct sockaddr sa; - socklen_t sa_len = 0; - struct sctp_sndrcvinfo sinfo; - int flags = 0; - int n = sctp_recvmsg(GetSocket(), m_buf, SCTP_BUFSIZE_READ, &sa, &sa_len, &sinfo, &flags); - if (n == -1) - { - Handler().LogError(this, "SctpSocket", Errno, StrError(Errno), LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } - else - { - OnReceiveMessage(m_buf, n, &sa, sa_len, &sinfo, flags); - } -} - - -void SctpSocket::OnReceiveMessage(const char *buf,size_t sz,struct sockaddr *sa,socklen_t sa_len,struct sctp_sndrcvinfo *sinfo,int msg_flags) -{ -} - - -void SctpSocket::OnWrite() -{ - if (Connecting()) - { - int err = SoError(); - - // don't reset connecting flag on error here, we want the OnConnectFailed timeout later on - /// \todo add to read fd_set here - if (!err) // ok - { - Set(!IsDisableRead(), false); - SetConnecting(false); - SetCallOnConnect(); - return; - } - Handler().LogError(this, "sctp: connect failed", err, StrError(err), LOG_LEVEL_FATAL); - Set(false, false); // no more monitoring because connection failed - - // failed -#ifdef ENABLE_SOCKS4 - if (Socks4()) - { - OnSocks4ConnectFailed(); - return; - } -#endif - if (GetConnectionRetry() == -1 || - (GetConnectionRetry() && GetConnectionRetries() < GetConnectionRetry()) ) - { - // even though the connection failed at once, only retry after - // the connection timeout. - // should we even try to connect again, when CheckConnect returns - // false it's because of a connection error - not a timeout... - return; - } - SetConnecting(false); - SetCloseAndDelete( true ); - /// \todo state reason why connect failed - OnConnectFailed(); - return; - } -} - - -void SctpSocket::OnConnectTimeout() -{ - Handler().LogError(this, "connect", -1, "connect timeout", LOG_LEVEL_FATAL); -#ifdef ENABLE_SOCKS4 - if (Socks4()) - { - OnSocks4ConnectFailed(); - // retry direct connection - } - else -#endif - if (GetConnectionRetry() == -1 || - (GetConnectionRetry() && GetConnectionRetries() < GetConnectionRetry()) ) - { - IncreaseConnectionRetries(); - // ask socket via OnConnectRetry callback if we should continue trying - if (OnConnectRetry()) - { - SetRetryClientConnect(); - } - else - { - SetCloseAndDelete( true ); - /// \todo state reason why connect failed - OnConnectFailed(); - } - } - else - { - SetCloseAndDelete(true); - /// \todo state reason why connect failed - OnConnectFailed(); - } - // - SetConnecting(false); -} - - -#ifdef _WIN32 -void SctpSocket::OnException() -{ - if (Connecting()) - { -#ifdef ENABLE_SOCKS4 - if (Socks4()) - OnSocks4ConnectFailed(); - else -#endif - if (GetConnectionRetry() == -1 || - (GetConnectionRetry() && - GetConnectionRetries() < GetConnectionRetry() )) - { - // even though the connection failed at once, only retry after - // the connection timeout - // should we even try to connect again, when CheckConnect returns - // false it's because of a connection error - not a timeout... - } - else - { - SetConnecting(false); // tnx snibbe - SetCloseAndDelete(); - OnConnectFailed(); - } - return; - } - // %! exception doesn't always mean something bad happened, this code should be reworked - // errno valid here? - int err = SoError(); - Handler().LogError(this, "exception on select", err, StrError(err), LOG_LEVEL_FATAL); - SetCloseAndDelete(); -} -#endif // _WIN32 - - -int SctpSocket::Protocol() -{ - return IPPROTO_SCTP; -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE -#endif - - -#endif // USE_SCTP - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SctpSocket.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SctpSocket.h deleted file mode 100755 index 61102ff2f55..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SctpSocket.h +++ /dev/null @@ -1,122 +0,0 @@ -/** - ** \file SctpSocket.h - ** \date 2006-09-04 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2008-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_SctpSocket_H -#define _SOCKETS_SctpSocket_H -#include "sockets-config.h" - -#include "StreamSocket.h" -#ifdef USE_SCTP -#include <netinet/sctp.h> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -#define SCTP_BUFSIZE_READ 16400 - -class SocketAddress; - - -class SctpSocket : public StreamSocket -{ -public: - /** SctpSocket constructor. - \param h Owner - \param type SCTP_STREAM or SCTP_SEQPACKET */ - SctpSocket(ISocketHandler& h,int type); - ~SctpSocket(); - - /** bind() */ - int Bind(const std::string&,port_t); - int Bind(SocketAddress&); - /** sctp_bindx() */ - int AddAddress(const std::string&,port_t); - int AddAddress(SocketAddress&); - /** sctp_bindx() */ - int RemoveAddress(const std::string&,port_t); - int RemoveAddress(SocketAddress&); - - /** connect() */ - int Open(const std::string&,port_t); - int Open(SocketAddress&); - - /** Connect timeout callback. */ - void OnConnectTimeout(); -#ifdef _WIN32 - /** Connection failed reported as exception on win32 */ - void OnException(); -#endif - -#ifndef SOLARIS - /** sctp_connectx() */ - int AddConnection(const std::string&,port_t); - int AddConnection(SocketAddress&); -#endif - - /** Get peer addresses of an association. */ - int getpaddrs(sctp_assoc_t id,std::list<std::string>&); - /** Get all bound addresses of an association. */ - int getladdrs(sctp_assoc_t id,std::list<std::string>&); - - /** sctp_peeloff */ - int PeelOff(sctp_assoc_t id); - - /** recvmsg callback */ - virtual void OnReceiveMessage(const char *buf,size_t sz,struct sockaddr *sa,socklen_t sa_len,struct sctp_sndrcvinfo *sinfo,int msg_flags) = 0; - - void OnOptions(int,int,int,SOCKET) {} - - virtual int Protocol(); - -protected: - SctpSocket(const SctpSocket& s) : StreamSocket(s) {} - void OnRead(); - void OnWrite(); - -private: - SctpSocket& operator=(const SctpSocket& s) { - return *this; - } - int m_type; ///< SCTP_STREAM or SCTP_SEQPACKET - char *m_buf; ///< Temporary receive buffer -}; - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE -#endif - -#endif // USE_SCTP -#endif // _SOCKETS_SctpSocket_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Semaphore.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Semaphore.cpp deleted file mode 100755 index 0fdf2245f24..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Semaphore.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/** - ** \file Semaphore.cpp - ** \date 2007-04-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "Semaphore.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -// --------------------------------------------------------------- -#ifdef _WIN32 - -Semaphore::Semaphore(value_t start_val) -{ - m_handle = ::CreateSemaphore((LPSECURITY_ATTRIBUTES)NULL, start_val, 1, (LPCTSTR)NULL); -} - - -Semaphore::~Semaphore() -{ - ::CloseHandle(m_handle); -} - - -int Semaphore::Post() -{ - return (::ReleaseSemaphore(m_handle, 1, (LPLONG)NULL) != 0) ? 0 : -1; -} - - -int Semaphore::Wait() -{ - return (WaitForSingleObject(m_handle, INFINITE) == WAIT_OBJECT_0) ? 0 : -1; -} - - -int Semaphore::TryWait() -{ - return -1; // %! not implemented -} - - -int Semaphore::GetValue(int& i) -{ - return 0; // %! not implemented -} - -// --------------------------------------------------------------- -#else - -Semaphore::Semaphore(value_t start_val) -{ - sem_init(&m_sem, 0, start_val); -} - - -Semaphore::~Semaphore() -{ - sem_destroy(&m_sem); -} - - -int Semaphore::Post() -{ - return sem_post(&m_sem); -} - - -int Semaphore::Wait() -{ - return sem_wait(&m_sem); -} - - -int Semaphore::TryWait() -{ - return sem_trywait(&m_sem); -} - - -int Semaphore::GetValue(int& i) -{ - return sem_getvalue(&m_sem, &i); -} - -#endif - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Semaphore.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Semaphore.h deleted file mode 100755 index 02010093e21..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Semaphore.h +++ /dev/null @@ -1,100 +0,0 @@ -/** - ** \file Semaphore.h - ** \date 2007-04-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Semaphore_H -#define _SOCKETS_Semaphore_H - -#include "sockets-config.h" -#ifdef _WIN32 -#include "socket_include.h" -#include <windows.h> -#else -#include <pthread.h> -#ifdef MACOSX -#include <sys/semaphore.h> -#else -#include <semaphore.h> -#endif -#endif - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -#ifdef _WIN32 -typedef LONG value_t; -#else -typedef unsigned int value_t; -#endif - -/** pthread semaphore wrapper. - \ingroup threading */ -class Semaphore -{ -public: - Semaphore(value_t start_val = 0); - ~Semaphore(); - - /** \return 0 if successful */ - int Post(); - /** Wait for Post - \return 0 if successful */ - int Wait(); - - /** Not implemented for win32 */ - int TryWait(); - - /** Not implemented for win32 */ - int GetValue(int&); - -private: - Semaphore(const Semaphore& ) {} // copy constructor - Semaphore& operator=(const Semaphore& ) { - return *this; // assignment operator - } -#ifdef _WIN32 - HANDLE m_handle; -#else - sem_t m_sem; -#endif -}; - - - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif -#endif // _SOCKETS_Semaphore_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SmtpdSocket.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SmtpdSocket.cpp deleted file mode 100755 index 17e831bbf64..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SmtpdSocket.cpp +++ /dev/null @@ -1,244 +0,0 @@ -/** - ** \file SmtpdSocket.cpp - ** \date 2007-05-10 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "SmtpdSocket.h" -#include "Parse.h" -#include "Utility.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -SmtpdSocket::SmtpdSocket(ISocketHandler& h) -:TcpSocket(h) -,m_hello(false) -,m_data(false) -,m_header(false) -{ - SetLineProtocol(); -} - - -void SmtpdSocket::OnAccept() -{ - Send("220 ESMTP; \r\n"); -} - - -void SmtpdSocket::OnLine(const std::string& line) -{ - if (m_data) - { - if (m_header) - { - if (!line.size()) - { - if (m_header_line.size()) - { - Parse pa(m_header_line, ":"); - std::string key = pa.getword(); - OnHeader(key, pa.getrest()); - } - m_header = false; - OnHeaderComplete(); - } - else - if (line[0] == ' ' || line[0] == '\t') - { - m_header_line += line; - } - else - { - if (m_header_line.size()) - { - Parse pa(m_header_line, ":"); - std::string key = pa.getword(); - OnHeader(key, pa.getrest()); - } - m_header_line = line; - } - } - else - if (line == ".") - { - m_data = false; - if (OnDataComplete()) - Send("250 OK\r\n"); - else - Send("550 Failed\r\n"); - } - else - if (line.size() && line[0] == '.') - { - OnData(line.substr(1)); - } - else - { - OnData(line); - } - return; - } - Parse pa(line); - std::string cmd = Utility::ToUpper(pa.getword()); - - if (cmd == "EHLO") - { - if (!OnHello(pa.getrest())) - { - Send("550 Failed\r\n"); - } - else - { - m_hello = true; - Send("250 mail.alhem.net\r\n"); - } - } - else - if (cmd == "HELO") - { - if (!OnHello(pa.getrest())) - { - Send("550 Failed\r\n"); - } - else - { - m_hello = true; - Send("250 mail.alhem.net\r\n"); - } - } - else - if (!m_hello) - { - OnAbort(SMTP_NO_HELLO); - SetCloseAndDelete(); - } - else - if (cmd == "MAIL") // mail from: - { - Parse pa(line, ":"); - pa.getword(); // 'mail' - pa.getword(); // 'from' - std::string email = Utility::ToLower(pa.getrest()); - - EmailAddress addr( email ); - if (addr.GetName().size() > 64) - { - OnAbort(SMTP_NAME_TOO_LONG); - Send("500 Name too long.\r\n"); - return; - } - if (addr.GetDomain().size() > 64) - { - OnAbort(SMTP_DOMAIN_TOO_LONG); - Send("500 Domain too long.\r\n"); - return; - } - - if (!OnMailFrom( addr )) - { - Send("550 Failed\r\n"); - } - else - { - Send("250 OK\r\n"); - } - } - else - if (cmd == "RCPT") // rcpt to: - { - Parse pa(line, ":"); - pa.getword(); // 'rcpt' - pa.getword(); // 'to' - std::string email = Utility::ToLower(pa.getrest()); - // %! reject based on user / domain? - EmailAddress addr( email ); - - if (addr.GetName().size() > 64) - { - OnAbort(SMTP_NAME_TOO_LONG); - Send("500 Name too long.\r\n"); - return; - } - if (addr.GetDomain().size() > 64) - { - OnAbort(SMTP_DOMAIN_TOO_LONG); - Send("500 Domain too long.\r\n"); - return; - } - - if (!OnRcptTo( addr )) - { - Send("553 Failed\r\n"); - } - else - { - Send("250 OK\r\n"); - } - } - else - if (cmd == "DATA") - { - Send("354 Enter mail, end with \".\" on a line by itself\r\n"); - m_data = true; - m_header = false; - } - else - if (cmd == "RSET") - { - m_data = false; - m_header = false; - OnRset(); - Send("250 OK\r\n"); // %! ??? - } - else - if (cmd == "QUIT") - { - OnAbort(SMTP_QUIT); - Send("221 Bye Bye\r\n"); - SetCloseAndDelete(); - } - else - if (cmd == "NOOP") - { - Send("250 OK\r\n"); - } - else - { - OnNotSupported(cmd, pa.getrest()); - } -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SmtpdSocket.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SmtpdSocket.h deleted file mode 100755 index 7b42988bd74..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SmtpdSocket.h +++ /dev/null @@ -1,171 +0,0 @@ -/** - ** \file SmtpdSocket.h - ** \date 2007-05-10 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_SmtpdSocket_H -#define _SOCKETS_SmtpdSocket_H - -#include "sockets-config.h" -#include <string> -#include "TcpSocket.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -/** Smtp server base class. */ -class SmtpdSocket : public TcpSocket -{ -protected: - typedef enum { - SMTP_NO_HELLO, - SMTP_NAME_TOO_LONG, - SMTP_DOMAIN_TOO_LONG, - SMTP_QUIT - } reason_t; - -public: - class EmailAddress - { - public: - EmailAddress(const std::string& str_in) { - std::string str = str_in; - size_t i = str.find("<"); - - if (i != std::string::npos) - str = str.substr(i + 1); - - i = str.find("@"); - - if (i != std::string::npos) { - m_name = str.substr(0, i); - str = str.substr(i + 1); - i = str.find(">"); - - if (i != std::string::npos) - str = str.substr(0, i); - - m_domain = str; - } - - while (m_name.size() && m_name[m_name.size() - 1] == ' ') - m_name.resize(m_name.size() - 1); - - while (m_domain.size() && m_domain[m_domain.size() - 1] == ' ') - m_domain.resize(m_domain.size() - 1); - - while (m_name.size() && m_name[0] == ' ') - m_name = m_name.substr(1); - - while (m_domain.size() && m_domain[0] == ' ') - m_domain = m_domain.substr(1); - - m_top = m_domain; - { - for (size_t i = 0; i < m_domain.size(); i++) { - if (m_domain[i] == '.') { - m_sub = m_top; - m_top = m_domain.substr(i + 1); - } - } - } - } - - const std::string& GetName() const { - return m_name; - } - const std::string& GetDomain() const { - return m_domain; - } - const std::string& GetTopDomain() const { - return m_top; - } - const std::string& GetSubDomain() const { - return m_sub; - } - - std::string ToString() const { - return m_name + "@" + m_domain; - } - - private: - std::string m_name; - std::string m_domain; - std::string m_top; - std::string m_sub; - }; - -public: - SmtpdSocket(ISocketHandler&); - - void OnAccept(); - void OnLine(const std::string&); - - /** \return 'false' to abort */ - virtual bool OnHello(const std::string& domain) = 0; - - /** \return 'false' to abort */ - virtual bool OnMailFrom(const EmailAddress& addr) = 0; - - /** \return 'false' to abort */ - virtual bool OnRcptTo(const EmailAddress& addr) = 0; - - virtual void OnHeader(const std::string& key, const std::string& value) = 0; - - virtual void OnHeaderComplete() = 0; - - virtual void OnData(const std::string& line) = 0; - - /** \return 'false' if message write failed (message will probably be resent) */ - virtual bool OnDataComplete() = 0; - - virtual void OnRset() = 0; - - virtual void OnAbort(reason_t) = 0; - - virtual void OnNotSupported(const std::string& cmd, const std::string& arg) = 0; - -private: - bool m_hello; // we need HELO or EHLO first of all - bool m_data; - bool m_header; - std::string m_header_line; -}; - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - -#endif // _SOCKETS_SmtpdSocket_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Socket.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Socket.cpp deleted file mode 100755 index 4adb6b3d603..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Socket.cpp +++ /dev/null @@ -1,1875 +0,0 @@ -/** \file Socket.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "Socket.h" -#ifdef _WIN32 -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include <stdlib.h> -#else -#include <errno.h> -#include <netdb.h> -#endif -#include <ctype.h> -#include <fcntl.h> - -#include "Utility.h" - -#include "SocketAddress.h" -#include "SocketHandler.h" -#ifdef ENABLE_EXCEPTIONS -#include "Exception.h" -#endif -#include "Ipv4Address.h" -//#ifdef ENABLE_IPV6 -#include "Ipv6Address.h" -//#endif -#include "SocketThread.h" - -#ifdef _DEBUG -#define DEB(x) x; fflush(stderr); -#else -#define DEB(x) -#endif - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -// statics -#ifdef _WIN32 -WSAInitializer Socket::m_winsock_init; -#endif -socketuid_t Socket::m_next_uid = 0; - - -Socket::Socket(ISocketHandler& h) -//:m_flags(0) -:m_handler(h) -,m_socket( INVALID_SOCKET ) -,m_bDel(false) -,m_bClose(false) -,m_tCreate(time(NULL)) -,m_parent(NULL) -,m_b_disable_read(false) -,m_connected(false) -,m_b_erased_by_handler(false) -,m_tClose(0) -,m_client_remote_address(NULL) -,m_remote_address(NULL) -,m_traffic_monitor(NULL) -,m_timeout_start(0) -,m_timeout_limit(0) -,m_bLost(false) -,m_uid(++Socket::m_next_uid) -,m_call_on_connect(false) -,m_b_retry_connect(false) -#ifdef HAVE_OPENSSL -,m_b_enable_ssl(false) -,m_b_ssl(false) -,m_b_ssl_server(false) -#endif -//#ifdef ENABLE_IPV6 -,m_ipv6(false) -//#endif -#ifdef ENABLE_POOL -,m_socket_type(0) -,m_bClient(false) -,m_bRetain(false) -#endif -#ifdef ENABLE_SOCKS4 -,m_bSocks4(false) -,m_socks4_host(h.GetSocks4Host()) -,m_socks4_port(h.GetSocks4Port()) -,m_socks4_userid(h.GetSocks4Userid()) -#endif -#ifdef ENABLE_DETACH -,m_detach(false) -,m_detached(false) -,m_pThread(NULL) -,m_slave_handler(NULL) -#endif -{ -} - - -Socket::~Socket() -{ - Handler().Remove(this); - if (m_socket != INVALID_SOCKET -#ifdef ENABLE_POOL - && !m_bRetain -#endif - ) - { - Close(); - } -} - - -void Socket::Init() -{ -} - - -void Socket::OnRead() -{ -} - - -void Socket::OnWrite() -{ -} - - -void Socket::OnException() -{ - // %! exception doesn't always mean something bad happened, this code should be reworked - // errno valid here? - int err = SoError(); - Handler().LogError(this, "exception on select", err, StrError(err), LOG_LEVEL_FATAL); - SetCloseAndDelete(); -} - - -void Socket::OnDelete() -{ -} - - -void Socket::OnConnect() -{ -} - - -void Socket::OnAccept() -{ -} - - -int Socket::Close() -{ - if (m_socket == INVALID_SOCKET) // this could happen - { - Handler().LogError(this, "Socket::Close", 0, "file descriptor invalid", LOG_LEVEL_WARNING); - return 0; - } - int n; - Handler().ISocketHandler_Del(this); // remove from fd_set's - if ((n = closesocket(m_socket)) == -1) - { - // failed... - Handler().LogError(this, "close", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - m_socket = INVALID_SOCKET; - return n; -} - - -SOCKET Socket::CreateSocket(int af,int type, const std::string& protocol) -{ - struct protoent *p = NULL; - SOCKET s; - -#ifdef ENABLE_POOL - m_socket_type = type; - m_socket_protocol = protocol; -#endif - if (protocol.size()) - { - p = getprotobyname( protocol.c_str() ); - if (!p) - { - Handler().LogError(this, "getprotobyname", Errno, StrError(Errno), LOG_LEVEL_FATAL); - SetCloseAndDelete(); -#ifdef ENABLE_EXCEPTIONS - throw Exception(std::string("getprotobyname() failed: ") + StrError(Errno)); -#endif - return INVALID_SOCKET; - } - } - int protno = p ? p -> p_proto : 0; - - s = socket(af, type, protno); - if (s == INVALID_SOCKET) - { - Handler().LogError(this, "socket", Errno, StrError(Errno), LOG_LEVEL_FATAL); - SetCloseAndDelete(); -#ifdef ENABLE_EXCEPTIONS - throw Exception(std::string("socket() failed: ") + StrError(Errno)); -#endif - return INVALID_SOCKET; - } - Attach(s); - OnOptions(af, type, protno, s); - Attach(INVALID_SOCKET); - return s; -} - - -void Socket::Attach(SOCKET s) -{ - m_socket = s; -} - - -SOCKET Socket::GetSocket() -{ - return m_socket; -} - - -void Socket::SetDeleteByHandler(bool x) -{ - m_bDel = x; -} - - -bool Socket::DeleteByHandler() -{ - return m_bDel; -} - - -void Socket::SetCloseAndDelete(bool x) -{ - if (x != m_bClose) - { - m_bClose = x; - if (x) - { - m_tClose = time(NULL); - Handler().SetClose(); - } - } -} - - -bool Socket::CloseAndDelete() -{ - return m_bClose; -} - - -void Socket::SetRemoteAddress(SocketAddress& ad) //struct sockaddr* sa, socklen_t l) -{ - m_remote_address = ad.GetCopy(); -} - - -std::auto_ptr<SocketAddress> Socket::GetRemoteSocketAddress() -{ - return m_remote_address -> GetCopy(); -} - - -ISocketHandler& Socket::Handler() const -{ -#ifdef ENABLE_DETACH - if (IsDetached()) - return *m_slave_handler; -#endif - return m_handler; -} - - -ISocketHandler& Socket::MasterHandler() const -{ - return m_handler; -} - - -ipaddr_t Socket::GetRemoteIP4() -{ - ipaddr_t l = 0; -//#ifdef ENABLE_IPV6 - if (m_ipv6) - { - Handler().LogError(this, "GetRemoteIP4", 0, "get ipv4 address for ipv6 socket", LOG_LEVEL_WARNING); - } -//#endif - if (m_remote_address.get() != NULL) - { - struct sockaddr *p = *m_remote_address; - struct sockaddr_in *sa = (struct sockaddr_in *)p; - memcpy(&l, &sa -> sin_addr, sizeof(struct in_addr)); - } - return l; -} - - -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 -struct in6_addr Socket::GetRemoteIP6() -{ - if (!m_ipv6) - { - Handler().LogError(this, "GetRemoteIP6", 0, "get ipv6 address for ipv4 socket", LOG_LEVEL_WARNING); - } - struct sockaddr_in6 fail; - if (m_remote_address.get() != NULL) - { - struct sockaddr *p = *m_remote_address; - memcpy(&fail, p, sizeof(struct sockaddr_in6)); - } - else - { - memset(&fail, 0, sizeof(struct sockaddr_in6)); - } - return fail.sin6_addr; -} -//#endif -//#endif - - -port_t Socket::GetRemotePort() -{ - if (!m_remote_address.get()) - { - return 0; - } - return m_remote_address -> GetPort(); -} - - -std::string Socket::GetRemoteAddress() -{ - if (!m_remote_address.get()) - { - return ""; - } - return m_remote_address -> Convert(false); -} - - -std::string Socket::GetRemoteHostname() -{ - if (!m_remote_address.get()) - { - return ""; - } - return m_remote_address -> Reverse(); -} - - -bool Socket::SetNonblocking(bool bNb) -{ -#ifdef _WIN32 - unsigned long l = bNb ? 1 : 0; - int n = ioctlsocket(m_socket, FIONBIO, &l); - if (n != 0) - { - Handler().LogError(this, "ioctlsocket(FIONBIO)", Errno, ""); - return false; - } - return true; -#else - if (bNb) - { - if (fcntl(m_socket, F_SETFL, O_NONBLOCK) == -1) - { - Handler().LogError(this, "fcntl(F_SETFL, O_NONBLOCK)", Errno, StrError(Errno), LOG_LEVEL_ERROR); - return false; - } - } - else - { - if (fcntl(m_socket, F_SETFL, 0) == -1) - { - Handler().LogError(this, "fcntl(F_SETFL, 0)", Errno, StrError(Errno), LOG_LEVEL_ERROR); - return false; - } - } - return true; -#endif -} - - -bool Socket::SetNonblocking(bool bNb, SOCKET s) -{ -#ifdef _WIN32 - unsigned long l = bNb ? 1 : 0; - int n = ioctlsocket(s, FIONBIO, &l); - if (n != 0) - { - Handler().LogError(this, "ioctlsocket(FIONBIO)", Errno, ""); - return false; - } - return true; -#else - if (bNb) - { - if (fcntl(s, F_SETFL, O_NONBLOCK) == -1) - { - Handler().LogError(this, "fcntl(F_SETFL, O_NONBLOCK)", Errno, StrError(Errno), LOG_LEVEL_ERROR); - return false; - } - } - else - { - if (fcntl(s, F_SETFL, 0) == -1) - { - Handler().LogError(this, "fcntl(F_SETFL, 0)", Errno, StrError(Errno), LOG_LEVEL_ERROR); - return false; - } - } - return true; -#endif -} - - -bool Socket::Ready() -{ - if (m_socket != INVALID_SOCKET && !CloseAndDelete()) - return true; - return false; -} - - -void Socket::OnLine(const std::string& ) -{ -} - - -void Socket::OnConnectFailed() -{ -} - - -Socket *Socket::GetParent() -{ - return m_parent; -} - - -void Socket::SetParent(Socket *x) -{ - m_parent = x; -} - - -port_t Socket::GetPort() -{ - Handler().LogError(this, "GetPort", 0, "GetPort only implemented for ListenSocket", LOG_LEVEL_WARNING); - return 0; -} - - -bool Socket::OnConnectRetry() -{ - return true; -} - - -#ifdef ENABLE_RECONNECT -void Socket::OnReconnect() -{ -} -#endif - - -time_t Socket::Uptime() -{ - return time(NULL) - m_tCreate; -} - - -//#ifdef ENABLE_IPV6 -void Socket::SetIpv6(bool x) -{ - m_ipv6 = x; -} - - -bool Socket::IsIpv6() -{ - return m_ipv6; -} -//#endif - - -void Socket::DisableRead(bool x) -{ - m_b_disable_read = x; -} - - -bool Socket::IsDisableRead() -{ - return m_b_disable_read; -} - - -void Socket::SendBuf(const char *,size_t,int) -{ -} - - -void Socket::Send(const std::string&,int) -{ -} - - -void Socket::SetConnected(bool x) -{ - m_connected = x; -} - - -bool Socket::IsConnected() -{ - return m_connected; -} - - -void Socket::OnDisconnect() -{ -} - - -void Socket::OnDisconnect(short, int) -{ -} - - -void Socket::SetLost() -{ - m_bLost = true; -} - - -bool Socket::Lost() -{ - return m_bLost; -} - - -void Socket::SetErasedByHandler(bool x) -{ - m_b_erased_by_handler = x; -} - - -bool Socket::ErasedByHandler() -{ - return m_b_erased_by_handler; -} - - -time_t Socket::TimeSinceClose() -{ - return time(NULL) - m_tClose; -} - - -void Socket::SetClientRemoteAddress(SocketAddress& ad) -{ - if (!ad.IsValid()) - { - Handler().LogError(this, "SetClientRemoteAddress", 0, "remote address not valid", LOG_LEVEL_ERROR); - } - m_client_remote_address = ad.GetCopy(); -} - - -std::auto_ptr<SocketAddress> Socket::GetClientRemoteAddress() -{ - if (!m_client_remote_address.get()) - { - Handler().LogError(this, "GetClientRemoteAddress", 0, "remote address not yet set", LOG_LEVEL_ERROR); - } - return m_client_remote_address -> GetCopy(); -} - - -uint64_t Socket::GetBytesSent(bool) -{ - return 0; -} - - -uint64_t Socket::GetBytesReceived(bool) -{ - return 0; -} - - -void Socket::SetCallOnConnect(bool x) -{ - m_call_on_connect = x; - if (x) - Handler().SetCallOnConnect(); -} - - -bool Socket::CallOnConnect() -{ - return m_call_on_connect; -} - - -void Socket::SetRetryClientConnect(bool x) -{ - m_b_retry_connect = x; - if (x) - Handler().SetRetry(); -} - - -bool Socket::RetryClientConnect() -{ - return m_b_retry_connect; -} - - -#ifdef HAVE_OPENSSL -void Socket::OnSSLConnect() -{ -} - - -void Socket::OnSSLAccept() -{ -} - - -bool Socket::SSLNegotiate() -{ - return false; -} - - -bool Socket::IsSSL() -{ - return m_b_enable_ssl; -} - - -void Socket::EnableSSL(bool x) -{ - m_b_enable_ssl = x; -} - - -bool Socket::IsSSLNegotiate() -{ - return m_b_ssl; -} - - -void Socket::SetSSLNegotiate(bool x) -{ - m_b_ssl = x; -} - - -bool Socket::IsSSLServer() -{ - return m_b_ssl_server; -} - - -void Socket::SetSSLServer(bool x) -{ - m_b_ssl_server = x; -} - - -void Socket::OnSSLConnectFailed() -{ -} - - -void Socket::OnSSLAcceptFailed() -{ -} -#endif // HAVE_OPENSSL - - -#ifdef ENABLE_POOL -void Socket::CopyConnection(Socket *sock) -{ - Attach( sock -> GetSocket() ); -//#ifdef ENABLE_IPV6 - SetIpv6( sock -> IsIpv6() ); -//#endif - SetSocketType( sock -> GetSocketType() ); - SetSocketProtocol( sock -> GetSocketProtocol() ); - - SetClientRemoteAddress( *sock -> GetClientRemoteAddress() ); - SetRemoteAddress( *sock -> GetRemoteSocketAddress() ); -} - - -void Socket::SetIsClient() -{ - m_bClient = true; -} - - -void Socket::SetSocketType(int x) -{ - m_socket_type = x; -} - - -int Socket::GetSocketType() -{ - return m_socket_type; -} - - -void Socket::SetSocketProtocol(const std::string& x) -{ - m_socket_protocol = x; -} - - -const std::string& Socket::GetSocketProtocol() -{ - return m_socket_protocol; -} - - -void Socket::SetRetain() -{ - if (m_bClient) - m_bRetain = true; -} - - -bool Socket::Retain() -{ - return m_bRetain; -} - - -#endif // ENABLE_POOL - - -#ifdef ENABLE_SOCKS4 -void Socket::OnSocks4Connect() -{ - Handler().LogError(this, "OnSocks4Connect", 0, "Use with TcpSocket only"); -} - - -void Socket::OnSocks4ConnectFailed() -{ - Handler().LogError(this, "OnSocks4ConnectFailed", 0, "Use with TcpSocket only"); -} - - -bool Socket::OnSocks4Read() -{ - Handler().LogError(this, "OnSocks4Read", 0, "Use with TcpSocket only"); - return true; -} - - -void Socket::SetSocks4Host(const std::string& host) -{ - Utility::u2ip(host, m_socks4_host); -} - - -bool Socket::Socks4() -{ - return m_bSocks4; -} - - -void Socket::SetSocks4(bool x) -{ - m_bSocks4 = x; -} - - -void Socket::SetSocks4Host(ipaddr_t a) -{ - m_socks4_host = a; -} - - -void Socket::SetSocks4Port(port_t p) -{ - m_socks4_port = p; -} - - -void Socket::SetSocks4Userid(const std::string& x) -{ - m_socks4_userid = x; -} - - -ipaddr_t Socket::GetSocks4Host() -{ - return m_socks4_host; -} - - -port_t Socket::GetSocks4Port() -{ - return m_socks4_port; -} - - -const std::string& Socket::GetSocks4Userid() -{ - return m_socks4_userid; -} -#endif // ENABLE_SOCKS4 - - -#ifdef ENABLE_DETACH -bool Socket::Detach() -{ - if (!DeleteByHandler()) - return false; - if (m_pThread) - return false; - if (m_detached) - return false; - SetDetach(); - return true; -} - - -void Socket::DetachSocket() -{ - SetDetached(); - m_pThread = new SocketThread(this); - m_pThread -> SetRelease(true); -} - - -void Socket::OnDetached() -{ -} - - -void Socket::SetDetach(bool x) -{ - m_detach = x; - if (x) - Handler().SetDetach(); -} - - -bool Socket::IsDetach() -{ - return m_detach; -} - - -void Socket::SetDetached(bool x) -{ - m_detached = x; -} - - -const bool Socket::IsDetached() const -{ - return m_detached; -} - - -void Socket::SetSlaveHandler(ISocketHandler *p) -{ - m_slave_handler = p; -} - - -#endif // ENABLE_DETACH - - -#ifdef ENABLE_RESOLVER -int Socket::Resolve(const std::string& host,port_t port) -{ - return Handler().Resolve(this, host, port); -} - - -//#ifdef ENABLE_IPV6 -int Socket::Resolve6(const std::string& host,port_t port) -{ - return Handler().Resolve6(this, host, port); -} -//#endif - - -int Socket::Resolve(ipaddr_t a) -{ - return Handler().Resolve(this, a); -} - - -//#ifdef ENABLE_IPV6 -int Socket::Resolve(in6_addr& a) -{ - return Handler().Resolve(this, a); -} -//#endif - - -void Socket::OnResolved(int,ipaddr_t,port_t) -{ -} - - -//#ifdef ENABLE_IPV6 -void Socket::OnResolved(int,in6_addr&,port_t) -{ -} -//#endif - - -void Socket::OnReverseResolved(int,const std::string&) -{ -} - - -void Socket::OnResolveFailed(int) -{ -} -#endif // ENABLE_RESOLVER - - -/* IP options */ - - -bool Socket::SetIpOptions(const void *p, socklen_t len) -{ -#ifdef IP_OPTIONS - if (setsockopt(GetSocket(), IPPROTO_IP, IP_OPTIONS, (char *)p, len) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_OPTIONS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_OPTIONS", LOG_LEVEL_INFO); - return false; -#endif -} - - -#ifdef IP_PKTINFO -bool Socket::SetIpPktinfo(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_PKTINFO, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_PKTINFO)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef IP_RECVTOS -bool Socket::SetIpRecvTOS(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVTOS, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVTOS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef IP_RECVTTL -bool Socket::SetIpRecvTTL(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVTTL, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVTTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef IP_RECVOPTS -bool Socket::SetIpRecvopts(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVOPTS, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVOPTS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef IP_RETOPTS -bool Socket::SetIpRetopts(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_RETOPTS, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RETOPTS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -bool Socket::SetIpTOS(unsigned char tos) -{ -#ifdef IP_TOS - if (setsockopt(GetSocket(), IPPROTO_IP, IP_TOS, (char *)&tos, sizeof(tos)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_TOS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_TOS", LOG_LEVEL_INFO); - return false; -#endif -} - - -unsigned char Socket::IpTOS() -{ - unsigned char tos = 0; -#ifdef IP_TOS - socklen_t len = sizeof(tos); - if (getsockopt(GetSocket(), IPPROTO_IP, IP_TOS, (char *)&tos, &len) == -1) - { - Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_TOS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } -#else - Handler().LogError(this, "ip option not available", 0, "IP_TOS", LOG_LEVEL_INFO); -#endif - return tos; -} - - -bool Socket::SetIpTTL(int ttl) -{ -#ifdef IP_TTL - if (setsockopt(GetSocket(), IPPROTO_IP, IP_TTL, (char *)&ttl, sizeof(ttl)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_TTL", LOG_LEVEL_INFO); - return false; -#endif -} - - -int Socket::IpTTL() -{ - int ttl = 0; -#ifdef IP_TTL - socklen_t len = sizeof(ttl); - if (getsockopt(GetSocket(), IPPROTO_IP, IP_TTL, (char *)&ttl, &len) == -1) - { - Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } -#else - Handler().LogError(this, "ip option not available", 0, "IP_TTL", LOG_LEVEL_INFO); -#endif - return ttl; -} - - -bool Socket::SetIpHdrincl(bool x) -{ -#ifdef IP_HDRINCL - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_HDRINCL, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_HDRINCL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_HDRINCL", LOG_LEVEL_INFO); - return false; -#endif -} - - -#ifdef IP_RECVERR -bool Socket::SetIpRecverr(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVERR, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVERR)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef IP_MTU_DISCOVER -bool Socket::SetIpMtudiscover(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_MTU_DISCOVER, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_MTU_DISCOVER)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef IP_MTU -int Socket::IpMtu() -{ - int mtu = 0; - socklen_t len = sizeof(mtu); - if (getsockopt(GetSocket(), IPPROTO_IP, IP_MTU, (char *)&mtu, &len) == -1) - { - Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_MTU)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } - return mtu; -} -#endif - - -#ifdef IP_ROUTER_ALERT -bool Socket::SetIpRouterAlert(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_ROUTER_ALERT, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_ROUTER_ALERT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -bool Socket::SetIpMulticastTTL(int ttl) -{ -#ifdef IP_MULTICAST_TTL - if (setsockopt(GetSocket(), IPPROTO_IP, IP_MULTICAST_TTL, (char *)&ttl, sizeof(ttl)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_MULTICAST_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_MULTICAST_TTL", LOG_LEVEL_INFO); - return false; -#endif -} - - -int Socket::IpMulticastTTL() -{ - int ttl = 0; -#ifdef IP_MULTICAST_TTL - socklen_t len = sizeof(ttl); - if (getsockopt(GetSocket(), IPPROTO_IP, IP_MULTICAST_TTL, (char *)&ttl, &len) == -1) - { - Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_MULTICAST_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } -#else - Handler().LogError(this, "ip option not available", 0, "IP_MULTICAST_TTL", LOG_LEVEL_INFO); -#endif - return ttl; -} - - -bool Socket::SetMulticastLoop(bool x) -{ -#ifdef IP_MULTICAST_LOOP - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_MULTICAST_LOOP, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_MULTICAST_LOOP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_MULTICAST_LOOP", LOG_LEVEL_INFO); - return false; -#endif -} - - -#ifdef LINUX -bool Socket::IpAddMembership(struct ip_mreqn& ref) -{ -#ifdef IP_ADD_MEMBERSHIP - if (setsockopt(GetSocket(), IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreqn)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_ADD_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_ADD_MEMBERSHIP", LOG_LEVEL_INFO); - return false; -#endif -} -#endif - - -bool Socket::IpAddMembership(struct ip_mreq& ref) -{ -#ifdef IP_ADD_MEMBERSHIP - if (setsockopt(GetSocket(), IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreq)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_ADD_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_ADD_MEMBERSHIP", LOG_LEVEL_INFO); - return false; -#endif -} - - -#ifdef LINUX -bool Socket::IpDropMembership(struct ip_mreqn& ref) -{ -#ifdef IP_DROP_MEMBERSHIP - if (setsockopt(GetSocket(), IPPROTO_IP, IP_DROP_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreqn)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_DROP_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_DROP_MEMBERSHIP", LOG_LEVEL_INFO); - return false; -#endif -} -#endif - - -bool Socket::IpDropMembership(struct ip_mreq& ref) -{ -#ifdef IP_DROP_MEMBERSHIP - if (setsockopt(GetSocket(), IPPROTO_IP, IP_DROP_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreq)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_DROP_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "ip option not available", 0, "IP_DROP_MEMBERSHIP", LOG_LEVEL_INFO); - return false; -#endif -} - - -/* SOCKET options */ - - -bool Socket::SetSoReuseaddr(bool x) -{ -#ifdef SO_REUSEADDR - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_REUSEADDR, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_REUSEADDR)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_REUSEADDR", LOG_LEVEL_INFO); - return false; -#endif -} - - -bool Socket::SetSoKeepalive(bool x) -{ -#ifdef SO_KEEPALIVE - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_KEEPALIVE, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_KEEPALIVE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_KEEPALIVE", LOG_LEVEL_INFO); - return false; -#endif -} - - -#ifdef SO_NOSIGPIPE -bool Socket::SetSoNosigpipe(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_NOSIGPIPE, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_NOSIGPIPE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -bool Socket::SoAcceptconn() -{ - int value = 0; -#ifdef SO_ACCEPTCONN - socklen_t len = sizeof(value); - if (getsockopt(GetSocket(), SOL_SOCKET, SO_ACCEPTCONN, (char *)&value, &len) == -1) - { - Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_ACCEPTCONN)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } -#else - Handler().LogError(this, "socket option not available", 0, "SO_ACCEPTCONN", LOG_LEVEL_INFO); -#endif - return value ? true : false; -} - - -#ifdef SO_BSDCOMPAT -bool Socket::SetSoBsdcompat(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_BSDCOMPAT, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_BSDCOMPAT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef SO_BINDTODEVICE -bool Socket::SetSoBindtodevice(const std::string& intf) -{ - if (setsockopt(GetSocket(), SOL_SOCKET, SO_BINDTODEVICE, (char *)intf.c_str(), intf.size()) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_BINDTODEVICE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -bool Socket::SetSoBroadcast(bool x) -{ -#ifdef SO_BROADCAST - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_BROADCAST)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_BROADCAST", LOG_LEVEL_INFO); - return false; -#endif -} - - -bool Socket::SetSoDebug(bool x) -{ -#ifdef SO_DEBUG - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_DEBUG, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_DEBUG)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_DEBUG", LOG_LEVEL_INFO); - return false; -#endif -} - - -int Socket::SoError() -{ - int value = 0; -#ifdef SO_ERROR - socklen_t len = sizeof(value); - if (getsockopt(GetSocket(), SOL_SOCKET, SO_ERROR, (char *)&value, &len) == -1) - { - Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_ERROR)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } -#else - Handler().LogError(this, "socket option not available", 0, "SO_ERROR", LOG_LEVEL_INFO); -#endif - return value; -} - - -bool Socket::SetSoDontroute(bool x) -{ -#ifdef SO_DONTROUTE - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_DONTROUTE, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_DONTROUTE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_DONTROUTE", LOG_LEVEL_INFO); - return false; -#endif -} - - -bool Socket::SetSoLinger(int onoff, int linger) -{ -#ifdef SO_LINGER - struct linger stl; - stl.l_onoff = onoff; - stl.l_linger = linger; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_LINGER, (char *)&stl, sizeof(stl)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_LINGER)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_LINGER", LOG_LEVEL_INFO); - return false; -#endif -} - - -bool Socket::SetSoOobinline(bool x) -{ -#ifdef SO_OOBINLINE - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_OOBINLINE, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_OOBINLINE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_OOBINLINE", LOG_LEVEL_INFO); - return false; -#endif -} - - -#ifdef SO_PASSCRED -bool Socket::SetSoPasscred(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_PASSCRED, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_PASSCRED)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef SO_PEERCRED -bool Socket::SoPeercred(struct ucred& ucr) -{ - if (setsockopt(GetSocket(), SOL_SOCKET, SO_PEERCRED, (char *)&ucr, sizeof(ucr)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_PEERCRED)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef SO_PRIORITY -bool Socket::SetSoPriority(int x) -{ - if (setsockopt(GetSocket(), SOL_SOCKET, SO_PRIORITY, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_PRIORITY)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -bool Socket::SetSoRcvlowat(int x) -{ -#ifdef SO_RCVLOWAT - if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVLOWAT, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVLOWAT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_RCVLOWAT", LOG_LEVEL_INFO); - return false; -#endif -} - - -bool Socket::SetSoSndlowat(int x) -{ -#ifdef SO_SNDLOWAT - if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDLOWAT, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDLOWAT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_SNDLOWAT", LOG_LEVEL_INFO); - return false; -#endif -} - - -bool Socket::SetSoRcvtimeo(struct timeval& tv) -{ -#ifdef SO_RCVTIMEO - if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVTIMEO)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_RCVTIMEO", LOG_LEVEL_INFO); - return false; -#endif -} - - -bool Socket::SetSoSndtimeo(struct timeval& tv) -{ -#ifdef SO_SNDTIMEO - if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(tv)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDTIMEO)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_SNDTIMEO", LOG_LEVEL_INFO); - return false; -#endif -} - - -bool Socket::SetSoRcvbuf(int x) -{ -#ifdef SO_RCVBUF - if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVBUF, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_RCVBUF", LOG_LEVEL_INFO); - return false; -#endif -} - - -int Socket::SoRcvbuf() -{ - int value = 0; -#ifdef SO_RCVBUF - socklen_t len = sizeof(value); - if (getsockopt(GetSocket(), SOL_SOCKET, SO_RCVBUF, (char *)&value, &len) == -1) - { - Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_RCVBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } -#else - Handler().LogError(this, "socket option not available", 0, "SO_RCVBUF", LOG_LEVEL_INFO); -#endif - return value; -} - - -#ifdef SO_RCVBUFFORCE -bool Socket::SetSoRcvbufforce(int x) -{ - if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVBUFFORCE, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVBUFFORCE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -bool Socket::SetSoSndbuf(int x) -{ -#ifdef SO_SNDBUF - if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDBUF, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "SO_SNDBUF", LOG_LEVEL_INFO); - return false; -#endif -} - - -int Socket::SoSndbuf() -{ - int value = 0; -#ifdef SO_SNDBUF - socklen_t len = sizeof(value); - if (getsockopt(GetSocket(), SOL_SOCKET, SO_SNDBUF, (char *)&value, &len) == -1) - { - Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_SNDBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } -#else - Handler().LogError(this, "socket option not available", 0, "SO_SNDBUF", LOG_LEVEL_INFO); -#endif - return value; -} - - -#ifdef SO_SNDBUFFORCE -bool Socket::SetSoSndbufforce(int x) -{ - if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDBUFFORCE, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDBUFFORCE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -#ifdef SO_TIMESTAMP -bool Socket::SetSoTimestamp(bool x) -{ - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_TIMESTAMP, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_TIMESTAMP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -} -#endif - - -int Socket::SoType() -{ - int value = 0; -#ifdef SO_TYPE - socklen_t len = sizeof(value); - if (getsockopt(GetSocket(), SOL_SOCKET, SO_TYPE, (char *)&value, &len) == -1) - { - Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_TYPE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } -#else - Handler().LogError(this, "socket option not available", 0, "SO_TYPE", LOG_LEVEL_INFO); -#endif - return value; -} - - -void Socket::SetTimeout(time_t secs) -{ - if (!secs) - { - m_timeout_start = 0; - m_timeout_limit = 0; - return; - } - m_timeout_start = time(NULL); - m_timeout_limit = secs; - Handler().SetTimeout(); -} - - -bool Socket::CheckTimeout() -{ - return m_timeout_start > 0 && m_timeout_limit > 0; -} - - -void Socket::OnTimeout() -{ -} - - -void Socket::OnConnectTimeout() -{ -} - - -bool Socket::Timeout(time_t tnow) -{ - if (m_timeout_start > 0 && tnow - m_timeout_start > m_timeout_limit) - return true; - return false; -} - - -/** Returns local port number for bound socket file descriptor. */ -port_t Socket::GetSockPort() -{ -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - struct sockaddr_in6 sa; - socklen_t sockaddr_length = sizeof(struct sockaddr_in6); - if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) - memset(&sa, 0, sizeof(sa)); - return ntohs(sa.sin6_port); - } -//#endif -//#endif - struct sockaddr_in sa; - socklen_t sockaddr_length = sizeof(struct sockaddr_in); - if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) - memset(&sa, 0, sizeof(sa)); - return ntohs(sa.sin_port); -} - - -/** Returns local ipv4 address for bound socket file descriptor. */ -ipaddr_t Socket::GetSockIP4() -{ -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - return 0; - } -//#endif -//#endif - struct sockaddr_in sa; - socklen_t sockaddr_length = sizeof(struct sockaddr_in); - if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) - memset(&sa, 0, sizeof(sa)); - ipaddr_t a; - memcpy(&a, &sa.sin_addr, 4); - return a; -} - - -/** Returns local ipv4 address as text for bound socket file descriptor. */ -std::string Socket::GetSockAddress() -{ -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - return ""; - } -//#endif -//#endif - struct sockaddr_in sa; - socklen_t sockaddr_length = sizeof(struct sockaddr_in); - if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) - memset(&sa, 0, sizeof(sa)); - Ipv4Address addr( sa ); - return addr.Convert(); -} - - -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 -/** Returns local ipv6 address for bound socket file descriptor. */ -struct in6_addr Socket::GetSockIP6() -{ - if (IsIpv6()) - { - struct sockaddr_in6 sa; - socklen_t sockaddr_length = sizeof(struct sockaddr_in6); - if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) - memset(&sa, 0, sizeof(sa)); - return sa.sin6_addr; - } - struct in6_addr a; - memset(&a, 0, sizeof(a)); - return a; -} - - -/** Returns local ipv6 address as text for bound socket file descriptor. */ -std::string Socket::GetSockAddress6() -{ - if (IsIpv6()) - { - struct sockaddr_in6 sa; - socklen_t sockaddr_length = sizeof(struct sockaddr_in6); - if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) - memset(&sa, 0, sizeof(sa)); - Ipv6Address addr( sa ); - return addr.Convert(); - } - return ""; -} -//#endif -//#endif - - -#ifdef SOCKETS_NAMESPACE -} -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Socket.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Socket.h deleted file mode 100755 index cfdc0ec7af0..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Socket.h +++ /dev/null @@ -1,735 +0,0 @@ -/** \file Socket.h - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Socket_H -#define _SOCKETS_Socket_H -#include "sockets-config.h" - -#include <string> -#include <vector> -#include <list> -#ifdef HAVE_OPENSSL -#include <openssl/ssl.h> -#endif - -#include "socket_include.h" -#include <time.h> -#include "SocketAddress.h" -#include "Thread.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -class ISocketHandler; -class SocketAddress; -class IFile; -class SocketThread; - - -/** \defgroup basic Basic sockets */ -/** Socket base class. - \ingroup basic */ -class Socket -{ - /** Socket mode flags. */ - /* - enum { - // Socket - SOCK_DEL = 0x01, ///< Delete by handler flag - SOCK_CLOSE = 0x02, ///< Close and delete flag - SOCK_DISABLE_READ = 0x04, ///< Disable checking for read events - SOCK_CONNECTED = 0x08, ///< Socket is connected (tcp/udp) - - SOCK_ERASED_BY_HANDLER = 0x10, ///< Set by handler before delete - // HAVE_OPENSSL - SOCK_ENABLE_SSL = 0x20, ///< Enable SSL for this TcpSocket - SOCK_SSL = 0x40, ///< ssl negotiation mode (TcpSocket) - SOCK_SSL_SERVER = 0x80, ///< True if this is an incoming ssl TcpSocket connection - - // ENABLE_IPV6 - SOCK_IPV6 = 0x0100, ///< This is an ipv6 socket if this one is true - // ENABLE_POOL - SOCK_CLIENT = 0x0200, ///< only client connections are pooled - SOCK_RETAIN = 0x0400, ///< keep connection on close - SOCK_LOST = 0x0800, ///< connection lost - - // ENABLE_SOCKS4 - SOCK_SOCKS4 = 0x1000, ///< socks4 negotiation mode (TcpSocket) - // ENABLE_DETACH - SOCK_DETACH = 0x2000, ///< Socket ordered to detach flag - SOCK_DETACHED = 0x4000, ///< Socket has been detached - // StreamSocket - STREAMSOCK_CONNECTING = 0x8000, ///< Flag indicating connection in progress - - STREAMSOCK_FLUSH_BEFORE_CLOSE = 0x010000L, ///< Send all data before closing (default true) - STREAMSOCK_CALL_ON_CONNECT = 0x020000L, ///< OnConnect will be called next ISocketHandler cycle if true - STREAMSOCK_RETRY_CONNECT = 0x040000L, ///< Try another connection attempt next ISocketHandler cycle - STREAMSOCK_LINE_PROTOCOL = 0x080000L, ///< Line protocol mode flag - - }; - */ - -public: - /** "Default" constructor */ - Socket(ISocketHandler&); - - virtual ~Socket(); - - /** Socket class instantiation method. Used when a "non-standard" constructor - * needs to be used for the socket class. Note: the socket class still needs - * the "default" constructor with one ISocketHandler& as input parameter. - */ - virtual Socket *Create() { - return NULL; - } - - /** Returns reference to sockethandler that owns the socket. - If the socket is detached, this is a reference to the slave sockethandler. - */ - ISocketHandler& Handler() const; - - /** Returns reference to sockethandler that owns the socket. - This one always returns the reference to the original sockethandler, - even if the socket is detached. - */ - ISocketHandler& MasterHandler() const; - - /** Called by ListenSocket after accept but before socket is added to handler. - * CTcpSocket uses this to create its ICrypt member variable. - * The ICrypt member variable is created by a virtual method, therefore - * it can't be called directly from the CTcpSocket constructor. - * Also used to determine if incoming HTTP connection is normal (port 80) - * or ssl (port 443). - */ - virtual void Init(); - - /** Create a socket file descriptor. - \param af Address family AF_INET / AF_INET6 / ... - \param type SOCK_STREAM / SOCK_DGRAM / ... - \param protocol "tcp" / "udp" / ... */ - SOCKET CreateSocket(int af,int type,const std::string& protocol = ""); - - /** Assign this socket a file descriptor created - by a call to socket() or otherwise. */ - void Attach(SOCKET s); - - /** Return file descriptor assigned to this socket. */ - SOCKET GetSocket(); - - /** Close connection immediately - internal use. - \sa SetCloseAndDelete */ - virtual int Close(); - - /** Returns true when socket file descriptor is valid - and socket is not about to be closed. */ - virtual bool Ready(); - - /** Returns pointer to ListenSocket that created this instance - * on an incoming connection. */ - Socket *GetParent(); - - /** Used by ListenSocket to set parent pointer of newly created - * socket instance. */ - void SetParent(Socket *); - - /** Get listening port from ListenSocket<>. */ - virtual port_t GetPort(); - - /** Set socket non-block operation. */ - bool SetNonblocking(bool); - - /** Set socket non-block operation. */ - bool SetNonblocking(bool, SOCKET); - - /** Total lifetime of instance. */ - time_t Uptime(); - - /** Set address/port of last connect() call. */ - void SetClientRemoteAddress(SocketAddress&); - - /** Get address/port of last connect() call. */ - std::auto_ptr<SocketAddress> GetClientRemoteAddress(); - - /** Common interface for SendBuf used by Tcp and Udp sockets. */ - virtual void SendBuf(const char *,size_t,int = 0); - - /** Common interface for Send used by Tcp and Udp sockets. */ - virtual void Send(const std::string&,int = 0); - - /** Outgoing traffic counter. */ - virtual uint64_t GetBytesSent(bool clear = false); - - /** Incoming traffic counter. */ - virtual uint64_t GetBytesReceived(bool clear = false); - - // LIST_TIMEOUT - - /** Enable timeout control. 0=disable timeout check. */ - void SetTimeout(time_t secs); - - bool CheckTimeout(); - - /** Check timeout. \return true if time limit reached */ - bool Timeout(time_t tnow); - - /** Used by ListenSocket. ipv4 and ipv6 */ - void SetRemoteAddress(SocketAddress&); - - /** \name Event callbacks */ - //@{ - - /** Called when there is something to be read from the file descriptor. */ - virtual void OnRead(); - /** Called when there is room for another write on the file descriptor. */ - virtual void OnWrite(); - /** Called on socket exception. */ - virtual void OnException(); - /** Called before a socket class is deleted by the ISocketHandler. */ - virtual void OnDelete(); - /** Called when a connection has completed. */ - virtual void OnConnect(); - /** Called when an incoming connection has been completed. */ - virtual void OnAccept(); - /** Called when a complete line has been read and the socket is in - * line protocol mode. */ - virtual void OnLine(const std::string& ); - /** Called on connect timeout (5s). */ - virtual void OnConnectFailed(); - /** Called when a client socket is created, to set socket options. - \param family AF_INET, AF_INET6, etc - \param type SOCK_STREAM, SOCK_DGRAM, etc - \param protocol Protocol number (tcp, udp, sctp, etc) - \param s Socket file descriptor - */ - virtual void OnOptions(int family,int type,int protocol,SOCKET s) = 0; - /** Connection retry callback - return false to abort connection attempts */ - virtual bool OnConnectRetry(); -#ifdef ENABLE_RECONNECT - /** a reconnect has been made */ - virtual void OnReconnect(); -#endif - /** TcpSocket: When a disconnect has been detected (recv/SSL_read returns 0 bytes). */ - virtual void OnDisconnect(); - /** TcpSocket: When a disconnect has been detected (recv/SSL_read returns 0 bytes). - \param info bit 0 read(0)/write(1) - bit 1 normal(read or write returned 0)/error(r/w returned -1) - bit 2 ssl - \param code error code from read/write call (errno / ssl error) - */ - virtual void OnDisconnect(short info, int code); - /** Timeout callback. */ - virtual void OnTimeout(); - /** Connection timeout. */ - virtual void OnConnectTimeout(); - //@} - - /** \name Socket mode flags, set/reset */ - //@{ - /** Set delete by handler true when you want the sockethandler to - delete the socket instance after use. */ - void SetDeleteByHandler(bool = true); - /** Check delete by handler flag. - \return true if this instance should be deleted by the sockethandler */ - bool DeleteByHandler(); - - // LIST_CLOSE - conditional event queue - - /** Set close and delete to terminate the connection. */ - void SetCloseAndDelete(bool = true); - /** Check close and delete flag. - \return true if this socket should be closed and the instance removed */ - bool CloseAndDelete(); - - /** Return number of seconds since socket was ordered to close. \sa SetCloseAndDelete */ - time_t TimeSinceClose(); - - /** Ignore read events for an output only socket. */ - void DisableRead(bool x = true); - /** Check ignore read events flag. - \return true if read events should be ignored */ - bool IsDisableRead(); - - /** Set connected status. */ - void SetConnected(bool = true); - /** Check connected status. - \return true if connected */ - bool IsConnected(); - - /** Connection lost - error while reading/writing from a socket - TcpSocket only. */ - void SetLost(); - /** Check connection lost status flag, used by TcpSocket only. - \return true if there was an error while r/w causing the socket to close */ - bool Lost(); - - /** Set flag indicating the socket is being actively deleted by the sockethandler. */ - void SetErasedByHandler(bool x = true); - /** Get value of flag indicating socket is deleted by sockethandler. */ - bool ErasedByHandler(); - - //@} - - /** \name Information about remote connection */ - //@{ - /** Returns address of remote end. */ - std::auto_ptr<SocketAddress> GetRemoteSocketAddress(); - /** Returns address of remote end: ipv4. */ - ipaddr_t GetRemoteIP4(); - //#ifdef ENABLE_IPV6 - /** Returns address of remote end: ipv6. */ - //#ifdef IPPROTO_IPV6 - struct in6_addr GetRemoteIP6(); - //#endif - //#endif - /** Returns remote port number: ipv4 and ipv6. */ - port_t GetRemotePort(); - /** Returns remote ip as string? ipv4 and ipv6. */ - std::string GetRemoteAddress(); - /** ipv4 and ipv6(not implemented) */ - std::string GetRemoteHostname(); - //@} - - /** Returns local port number for bound socket file descriptor. */ - port_t GetSockPort(); - /** Returns local ipv4 address for bound socket file descriptor. */ - ipaddr_t GetSockIP4(); - /** Returns local ipv4 address as text for bound socket file descriptor. */ - std::string GetSockAddress(); - //#ifdef ENABLE_IPV6 - //#ifdef IPPROTO_IPV6 - /** Returns local ipv6 address for bound socket file descriptor. */ - struct in6_addr GetSockIP6(); - /** Returns local ipv6 address as text for bound socket file descriptor. */ - std::string GetSockAddress6(); - //#endif - //#endif - socketuid_t UniqueIdentifier() { - return m_uid; - } - - // -------------------------------------------------------------------------- - /** @name IP options - When an ip or socket option is available on all of the operating systems - I'm testing on (linux 2.4.x, _win32, macosx, solaris9 intel) they are not - checked with an #ifdef below. - This might cause a compile error on other operating systems. */ - // -------------------------------------------------------------------------- - - // IP options - //@{ - - bool SetIpOptions(const void *p, socklen_t len); - bool SetIpTOS(unsigned char tos); - unsigned char IpTOS(); - bool SetIpTTL(int ttl); - int IpTTL(); - bool SetIpHdrincl(bool x = true); - bool SetIpMulticastTTL(int); - int IpMulticastTTL(); - bool SetMulticastLoop(bool x = true); - bool IpAddMembership(struct ip_mreq&); - bool IpDropMembership(struct ip_mreq&); - -#ifdef IP_PKTINFO - bool SetIpPktinfo(bool x = true); -#endif -#ifdef IP_RECVTOS - bool SetIpRecvTOS(bool x = true); -#endif -#ifdef IP_RECVTTL - bool SetIpRecvTTL(bool x = true); -#endif -#ifdef IP_RECVOPTS - bool SetIpRecvopts(bool x = true); -#endif -#ifdef IP_RETOPTS - bool SetIpRetopts(bool x = true); -#endif -#ifdef IP_RECVERR - bool SetIpRecverr(bool x = true); -#endif -#ifdef IP_MTU_DISCOVER - bool SetIpMtudiscover(bool x = true); -#endif -#ifdef IP_MTU - int IpMtu(); -#endif -#ifdef IP_ROUTER_ALERT - bool SetIpRouterAlert(bool x = true); -#endif -#ifdef LINUX - bool IpAddMembership(struct ip_mreqn&); -#endif -#ifdef LINUX - bool IpDropMembership(struct ip_mreqn&); -#endif - //@} - - // SOCKET options - /** @name Socket Options */ - //@{ - - bool SoAcceptconn(); - bool SetSoBroadcast(bool x = true); - bool SetSoDebug(bool x = true); - int SoError(); - bool SetSoDontroute(bool x = true); - bool SetSoLinger(int onoff, int linger); - bool SetSoOobinline(bool x = true); - bool SetSoRcvlowat(int); - bool SetSoSndlowat(int); - bool SetSoRcvtimeo(struct timeval&); - bool SetSoSndtimeo(struct timeval&); - bool SetSoRcvbuf(int); - int SoRcvbuf(); - bool SetSoSndbuf(int); - int SoSndbuf(); - int SoType(); - bool SetSoReuseaddr(bool x = true); - bool SetSoKeepalive(bool x = true); - -#ifdef SO_BSDCOMPAT - bool SetSoBsdcompat(bool x = true); -#endif -#ifdef SO_BINDTODEVICE - bool SetSoBindtodevice(const std::string& intf); -#endif -#ifdef SO_PASSCRED - bool SetSoPasscred(bool x = true); -#endif -#ifdef SO_PEERCRED - bool SoPeercred(struct ucred& ); -#endif -#ifdef SO_PRIORITY - bool SetSoPriority(int); -#endif -#ifdef SO_RCVBUFFORCE - bool SetSoRcvbufforce(int); -#endif -#ifdef SO_SNDBUFFORCE - bool SetSoSndbufforce(int); -#endif -#ifdef SO_TIMESTAMP - bool SetSoTimestamp(bool x = true); -#endif -#ifdef SO_NOSIGPIPE - bool SetSoNosigpipe(bool x = true); -#endif - //@} - - // TCP options in TcpSocket.h/TcpSocket.cpp - - - // LIST_CALLONCONNECT - - /** Instruct socket to call OnConnect callback next sockethandler cycle. */ - void SetCallOnConnect(bool x = true); - - /** Check call on connect flag. - \return true if OnConnect() should be called a.s.a.p */ - bool CallOnConnect(); - - // LIST_RETRY - - /** Set flag to initiate a connection attempt after a connection timeout. */ - void SetRetryClientConnect(bool x = true); - - /** Check if a connection attempt should be made. - \return true when another attempt should be made */ - bool RetryClientConnect(); - -#ifdef HAVE_OPENSSL - /** @name SSL Support */ - //@{ - /** SSL client/server support - internal use. \sa TcpSocket */ - virtual void OnSSLConnect(); - /** SSL client/server support - internal use. \sa TcpSocket */ - virtual void OnSSLAccept(); - /** SSL negotiation failed for client connect. */ - virtual void OnSSLConnectFailed(); - /** SSL negotiation failed for server accept. */ - virtual void OnSSLAcceptFailed(); - /** new SSL support */ - virtual bool SSLNegotiate(); - /** Check if SSL is Enabled for this TcpSocket. - \return true if this is a TcpSocket with SSL enabled */ - bool IsSSL(); - /** Enable SSL operation for a TcpSocket. */ - void EnableSSL(bool x = true); - /** Still negotiating ssl connection. - \return true if ssl negotiating is still in progress */ - bool IsSSLNegotiate(); - /** Set flag indicating ssl handshaking still in progress. */ - void SetSSLNegotiate(bool x = true); - /** OnAccept called with SSL Enabled. - \return true if this is a TcpSocket with an incoming SSL connection */ - bool IsSSLServer(); - /** Set flag indicating that this is a TcpSocket with incoming SSL connection. */ - void SetSSLServer(bool x = true); - /** SSL; Get pointer to ssl context structure. */ - virtual SSL_CTX *GetSslContext() { - return NULL; - } - /** SSL; Get pointer to ssl structure. */ - virtual SSL *GetSsl() { - return NULL; - } - //@} -#endif // HAVE_OPENSSL - - //#ifdef ENABLE_IPV6 - /** Enable ipv6 for this socket. */ - void SetIpv6(bool x = true); - /** Check ipv6 socket. - \return true if this is an ipv6 socket */ - bool IsIpv6(); - //#endif - -#ifdef ENABLE_POOL - /** @name Connection Pool */ - //@{ - /** Client = connecting TcpSocket. */ - void SetIsClient(); - /** Socket type from socket() call. */ - void SetSocketType(int x); - /** Socket type from socket() call. */ - int GetSocketType(); - /** Protocol type from socket() call. */ - void SetSocketProtocol(const std::string& x); - /** Protocol type from socket() call. */ - const std::string& GetSocketProtocol(); - /** Instruct a client socket to stay open in the connection pool after use. - If you have connected to a server using tcp, you can call SetRetain - to leave the connection open after your socket instance has been deleted. - The next connection you make to the same server will reuse the already - opened connection, if it is still available. - */ - void SetRetain(); - /** Check retain flag. - \return true if the socket should be moved to connection pool after use */ - bool Retain(); - /** Copy connection parameters from sock. */ - void CopyConnection(Socket *sock); - //@} -#endif // ENABLE_POOL - -#ifdef ENABLE_SOCKS4 - /** \name Socks4 support */ - //@{ - /** Socks4 client support internal use. \sa TcpSocket */ - virtual void OnSocks4Connect(); - /** Socks4 client support internal use. \sa TcpSocket */ - virtual void OnSocks4ConnectFailed(); - /** Socks4 client support internal use. \sa TcpSocket */ - virtual bool OnSocks4Read(); - /** Called when the last write caused the tcp output buffer to - * become empty. */ - /** socket still in socks4 negotiation mode */ - bool Socks4(); - /** Set flag indicating Socks4 handshaking in progress */ - void SetSocks4(bool x = true); - - /** Set socks4 server host address to use */ - void SetSocks4Host(ipaddr_t a); - /** Set socks4 server hostname to use. */ - void SetSocks4Host(const std::string& ); - /** Socks4 server port to use. */ - void SetSocks4Port(port_t p); - /** Provide a socks4 userid if required by the socks4 server. */ - void SetSocks4Userid(const std::string& x); - /** Get the ip address of socks4 server to use. - \return socks4 server host address */ - ipaddr_t GetSocks4Host(); - /** Get the socks4 server port to use. - \return socks4 server port */ - port_t GetSocks4Port(); - /** Get socks4 userid. - \return Socks4 userid */ - const std::string& GetSocks4Userid(); - //@} -#endif // ENABLE_SOCKS4 - -#ifdef ENABLE_RESOLVER - /** \name Asynchronous Resolver */ - //@{ - /** Request an asynchronous dns resolution. - \param host hostname to be resolved - \param port port number passed along for the ride - \return Resolve ID */ - int Resolve(const std::string& host,port_t port = 0); - //#ifdef ENABLE_IPV6 - int Resolve6(const std::string& host, port_t port = 0); - //#endif - /** Callback returning a resolved address. - \param id Resolve ID from Resolve call - \param a resolved ip address - \param port port number passed to Resolve */ - virtual void OnResolved(int id,ipaddr_t a,port_t port); - //#ifdef ENABLE_IPV6 - virtual void OnResolved(int id,in6_addr& a,port_t port); - //#endif - /** Request asynchronous reverse dns lookup. - \param a in_addr to be translated */ - int Resolve(ipaddr_t a); - //#ifdef ENABLE_IPV6 - int Resolve(in6_addr& a); - //#endif - /** Callback returning reverse resolve results. - \param id Resolve ID - \param name Resolved hostname */ - virtual void OnReverseResolved(int id,const std::string& name); - /** Callback indicating failed dns lookup. - \param id Resolve ID */ - virtual void OnResolveFailed(int id); - //@} -#endif // ENABLE_RESOLVER - -#ifdef ENABLE_DETACH - /** \name Thread Support */ - //@{ - /** Callback fires when a new socket thread has started and this - socket is ready for operation again. - \sa ResolvSocket */ - virtual void OnDetached(); - - // LIST_DETACH - - /** Internal use. */ - void SetDetach(bool x = true); - /** Check detach flag. - \return true if the socket should detach to its own thread */ - bool IsDetach(); - - /** Internal use. */ - void SetDetached(bool x = true); - /** Check detached flag. - \return true if the socket runs in its own thread. */ - const bool IsDetached() const; - /** Order this socket to start its own thread and call OnDetached - when ready for operation. */ - bool Detach(); - /** Store the slave sockethandler pointer. */ - void SetSlaveHandler(ISocketHandler *); - /** Create new thread for this socket to run detached in. */ - void DetachSocket(); - //@} -#endif // ENABLE_DETACH - - /** Write traffic to an IFile. Socket will not delete this object. */ - void SetTrafficMonitor(IFile *p) { - m_traffic_monitor = p; - } - -protected: - /** default constructor not available */ - Socket() : m_handler(m_handler) {} - /** copy constructor not available */ - Socket(const Socket& s) : m_handler(s.m_handler) {} - - /** assignment operator not available. */ - Socket& operator=(const Socket& ) { - return *this; - } - - /** All traffic will be written to this IFile, if set. */ - IFile *GetTrafficMonitor() { - return m_traffic_monitor; - } - - // unsigned long m_flags; ///< boolean flags, replacing old 'bool' members - -private: - ISocketHandler& m_handler; ///< Reference of ISocketHandler in control of this socket - SOCKET m_socket; ///< File descriptor - bool m_bDel; ///< Delete by handler flag - bool m_bClose; ///< Close and delete flag - time_t m_tCreate; ///< Time in seconds when this socket was created - Socket *m_parent; ///< Pointer to ListenSocket class, valid for incoming sockets - bool m_b_disable_read; ///< Disable checking for read events - bool m_connected; ///< Socket is connected (tcp/udp) - bool m_b_erased_by_handler; ///< Set by handler before delete - time_t m_tClose; ///< Time in seconds when ordered to close - std::auto_ptr<SocketAddress> m_client_remote_address; ///< Address of last connect() - std::auto_ptr<SocketAddress> m_remote_address; ///< Remote end address - IFile *m_traffic_monitor; - time_t m_timeout_start; ///< Set by SetTimeout - time_t m_timeout_limit; ///< Defined by SetTimeout - bool m_bLost; ///< connection lost - static socketuid_t m_next_uid; - socketuid_t m_uid; - bool m_call_on_connect; ///< OnConnect will be called next ISocketHandler cycle if true - bool m_b_retry_connect; ///< Try another connection attempt next ISocketHandler cycle - -#ifdef _WIN32 - static WSAInitializer m_winsock_init; ///< Winsock initialization singleton class -#endif - -#ifdef HAVE_OPENSSL - bool m_b_enable_ssl; ///< Enable SSL for this TcpSocket - bool m_b_ssl; ///< ssl negotiation mode (TcpSocket) - bool m_b_ssl_server; ///< True if this is an incoming ssl TcpSocket connection -#endif - - //#ifdef ENABLE_IPV6 - bool m_ipv6; ///< This is an ipv6 socket if this one is true - //#endif - -#ifdef ENABLE_POOL - int m_socket_type; ///< Type of socket, from socket() call - std::string m_socket_protocol; ///< Protocol, from socket() call - bool m_bClient; ///< only client connections are pooled - bool m_bRetain; ///< keep connection on close -#endif - -#ifdef ENABLE_SOCKS4 - bool m_bSocks4; ///< socks4 negotiation mode (TcpSocket) - ipaddr_t m_socks4_host; ///< socks4 server address - port_t m_socks4_port; ///< socks4 server port number - std::string m_socks4_userid; ///< socks4 server usedid -#endif - -#ifdef ENABLE_DETACH - bool m_detach; ///< Socket ordered to detach flag - bool m_detached; ///< Socket has been detached - SocketThread *m_pThread; ///< Detach socket thread class pointer - ISocketHandler *m_slave_handler; ///< Actual sockethandler while detached -#endif -}; - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_Socket_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketAddress.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketAddress.h deleted file mode 100755 index 25d0a5f1d3e..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketAddress.h +++ /dev/null @@ -1,106 +0,0 @@ -/** - ** \file SocketAddress.h - ** \date 2006-09-21 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_SocketAddress_H -#define _SOCKETS_SocketAddress_H - -#include "sockets-config.h" -#include <string> -#include <memory> -#include "socket_include.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -/** - This class and its subclasses is intended to be used as replacement - for the internal data type 'ipaddr_t' and various implementations of - IPv6 addressing found throughout the library. - 'ipaddr_t' is an IPv4 address in network byte order. - 'port_t' is the portnumber in host byte order. - 'struct in6_addr' is an IPv6 address. - 'struct in_addr' is an IPv4 address. - \ingroup basic -*/ -class SocketAddress -{ -public: - virtual ~SocketAddress() {} - - /** Get a pointer to the address struct. */ - virtual operator struct sockaddr *() = 0; - - /** Get length of address struct. */ - virtual operator socklen_t() = 0; - - /** Compare two addresses. */ - virtual bool operator==(SocketAddress&) = 0; - - /** Set port number. - \param port Port number in host byte order */ - virtual void SetPort(port_t port) = 0; - - /** Get port number. - \return Port number in host byte order. */ - virtual port_t GetPort() = 0; - - /** Set socket address. - \param sa Pointer to either 'struct sockaddr_in' or 'struct sockaddr_in6'. */ - virtual void SetAddress(struct sockaddr *sa) = 0; - - /** Convert address to text. */ - virtual std::string Convert(bool include_port) = 0; - - /** Reverse lookup of address. */ - virtual std::string Reverse() = 0; - - /** Get address family. */ - virtual int GetFamily() = 0; - - /** Address structure is valid. */ - virtual bool IsValid() = 0; - - /** Get a copy of this SocketAddress object. */ - virtual std::auto_ptr<SocketAddress> GetCopy() = 0; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif -#endif // _SOCKETS_SocketAddress_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandler.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandler.cpp deleted file mode 100755 index fbc4fe102e0..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandler.cpp +++ /dev/null @@ -1,1419 +0,0 @@ -/** \file SocketHandler.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _WIN32 -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#endif -#include <stdlib.h> -#include <stdio.h> -#include <errno.h> - -#include "SocketHandler.h" -#include "UdpSocket.h" -#include "ResolvSocket.h" -#include "ResolvServer.h" -#include "TcpSocket.h" -#include "IMutex.h" -#include "Utility.h" -#include "SocketAddress.h" -#include "Exception.h" -#include "SocketHandlerThread.h" -#include "Lock.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -#ifdef _DEBUG -#define DEB(x) x; fflush(stderr); -#else -#define DEB(x) -#endif - - -SocketHandler::SocketHandler(StdLog *p) -:m_stdlog(p) -,m_mutex(m_mutex) -,m_b_use_mutex(false) -,m_parent(m_parent) -,m_b_parent_is_valid(false) -,m_release(NULL) -,m_maxsock(0) -,m_tlast(0) -,m_b_check_callonconnect(false) -,m_b_check_detach(false) -,m_b_check_timeout(false) -,m_b_check_retry(false) -,m_b_check_close(false) -#ifdef ENABLE_SOCKS4 -,m_socks4_host(0) -,m_socks4_port(0) -,m_bTryDirect(false) -#endif -#ifdef ENABLE_RESOLVER -,m_resolv_id(0) -,m_resolver(NULL) -#endif -#ifdef ENABLE_POOL -,m_b_enable_pool(false) -#endif -#ifdef ENABLE_DETACH -,m_slave(false) -#endif -{ - FD_ZERO(&m_rfds); - FD_ZERO(&m_wfds); - FD_ZERO(&m_efds); -} - - -SocketHandler::SocketHandler(IMutex& mutex,StdLog *p) -:m_stdlog(p) -,m_mutex(mutex) -,m_b_use_mutex(true) -,m_parent(m_parent) -,m_b_parent_is_valid(false) -,m_release(NULL) -,m_maxsock(0) -,m_tlast(0) -,m_b_check_callonconnect(false) -,m_b_check_detach(false) -,m_b_check_timeout(false) -,m_b_check_retry(false) -,m_b_check_close(false) -#ifdef ENABLE_SOCKS4 -,m_socks4_host(0) -,m_socks4_port(0) -,m_bTryDirect(false) -#endif -#ifdef ENABLE_RESOLVER -,m_resolv_id(0) -,m_resolver(NULL) -#endif -#ifdef ENABLE_POOL -,m_b_enable_pool(false) -#endif -#ifdef ENABLE_DETACH -,m_slave(false) -#endif -{ - m_mutex.Lock(); - FD_ZERO(&m_rfds); - FD_ZERO(&m_wfds); - FD_ZERO(&m_efds); -} - - -SocketHandler::SocketHandler(IMutex& mutex, ISocketHandler& parent, StdLog *p) -:m_stdlog(p) -,m_mutex(mutex) -,m_b_use_mutex(true) -,m_parent(parent) -,m_b_parent_is_valid(true) -,m_release(NULL) -,m_maxsock(0) -,m_tlast(0) -,m_b_check_callonconnect(false) -,m_b_check_detach(false) -,m_b_check_timeout(false) -,m_b_check_retry(false) -,m_b_check_close(false) -#ifdef ENABLE_SOCKS4 -,m_socks4_host(0) -,m_socks4_port(0) -,m_bTryDirect(false) -#endif -#ifdef ENABLE_RESOLVER -,m_resolv_id(0) -,m_resolver(NULL) -#endif -#ifdef ENABLE_POOL -,m_b_enable_pool(false) -#endif -#ifdef ENABLE_DETACH -,m_slave(false) -#endif -{ - m_mutex.Lock(); - FD_ZERO(&m_rfds); - FD_ZERO(&m_wfds); - FD_ZERO(&m_efds); -} - - -SocketHandler::~SocketHandler() -{ - for (std::list<SocketHandlerThread *>::iterator it = m_threads.begin(); it != m_threads.end(); it++) - { - SocketHandlerThread *p = *it; - p -> Stop(); - } -#ifdef ENABLE_RESOLVER - if (m_resolver) - { - m_resolver -> Quit(); - } -#endif - { - while (m_sockets.size()) - { -DEB( fprintf(stderr, "Emptying sockets list in SocketHandler destructor, %d instances\n", (int)m_sockets.size());) - socket_m::iterator it = m_sockets.begin(); - Socket *p = it -> second; - if (p) - { -DEB( fprintf(stderr, " fd %d\n", p -> GetSocket());) - p -> Close(); -DEB( fprintf(stderr, " fd closed %d\n", p -> GetSocket());) -// p -> OnDelete(); // hey, I turn this back on. what's the worst that could happen??!! - // MinionSocket breaks, calling MinderHandler methods in OnDelete - - // MinderHandler is already gone when that happens... - - // only delete socket when controlled - // ie master sockethandler can delete non-detached sockets - // and a slave sockethandler can only delete a detach socket - if (p -> DeleteByHandler() -#ifdef ENABLE_DETACH - && !(m_slave ^ p -> IsDetached()) -#endif - ) - { - p -> SetErasedByHandler(); - delete p; - } - m_sockets.erase(it); - } - else - { - m_sockets.erase(it); - } -DEB( fprintf(stderr, "next\n");) - } -DEB( fprintf(stderr, "/Emptying sockets list in SocketHandler destructor, %d instances\n", (int)m_sockets.size());) - } -#ifdef ENABLE_RESOLVER - if (m_resolver) - { - delete m_resolver; - } -#endif - if (m_b_use_mutex) - { - m_mutex.Unlock(); - } -} - - -ISocketHandler *SocketHandler::Create(StdLog *log) -{ - return new SocketHandler(log); -} - - -ISocketHandler *SocketHandler::Create(IMutex& mutex, ISocketHandler& parent, StdLog *log) -{ - return new SocketHandler(mutex, parent, log); -} - - -bool SocketHandler::ParentHandlerIsValid() -{ - return m_b_parent_is_valid; -} - - -ISocketHandler& SocketHandler::ParentHandler() -{ - if (!m_b_parent_is_valid) - throw Exception("No parent sockethandler available"); - return m_parent; -} - - -ISocketHandler& SocketHandler::GetRandomHandler() -{ - if (m_threads.empty()) - throw Exception("SocketHandler is not multithreaded"); - size_t min_count = 99999; - SocketHandlerThread *match = NULL; - for (std::list<SocketHandlerThread *>::iterator it = m_threads.begin(); it != m_threads.end(); it++) - { - SocketHandlerThread *thr = *it; - ISocketHandler& h = thr -> Handler(); - { - Lock lock(h.GetMutex()); - size_t sz = h.GetCount(); - if (sz < min_count) - { - min_count = sz; - match = thr; - } - } - } - if (match) - return match -> Handler(); - throw Exception("Can't locate free threaded sockethandler"); -} - - -ISocketHandler& SocketHandler::GetEffectiveHandler() -{ - return m_b_parent_is_valid ? m_parent : *this; -} - - -void SocketHandler::SetNumberOfThreads(size_t n) -{ - if (!m_threads.empty()) - { - return; // already set - } - if (n > 1 && n < 256) - { - for (int i = 1; i <= (int)n; i++) - { - SocketHandlerThread *p = new SocketHandlerThread(*this); - m_threads.push_back(p); - p -> SetDeleteOnExit(); - p -> Start(); - p -> Wait(); - } - } -} - - -bool SocketHandler::IsThreaded() -{ - return !m_threads.empty(); -} - - -void SocketHandler::EnableRelease() -{ - if (m_release) - return; - m_release = new UdpSocket(*this); - m_release -> SetDeleteByHandler(); - port_t port = 0; - m_release -> Bind("127.0.0.1", port); - Add(m_release); -} - - -void SocketHandler::Release() -{ - if (!m_release) - return; - m_release -> SendTo("127.0.0.1", m_release -> GetPort(), "\n"); -} - - -IMutex& SocketHandler::GetMutex() const -{ - return m_mutex; -} - - -#ifdef ENABLE_DETACH -void SocketHandler::SetSlave(bool x) -{ - m_slave = x; -} - - -bool SocketHandler::IsSlave() -{ - return m_slave; -} -#endif - - -void SocketHandler::RegStdLog(StdLog *log) -{ - m_stdlog = log; -} - - -void SocketHandler::LogError(Socket *p,const std::string& user_text,int err,const std::string& sys_err,loglevel_t t) -{ - if (m_stdlog) - { - m_stdlog -> error(this, p, user_text, err, sys_err, t); - } -} - - -void SocketHandler::Add(Socket *p) -{ - m_add.push_back(p); // no checks here -} - - -void SocketHandler::ISocketHandler_Add(Socket *p,bool bRead,bool bWrite) -{ - Set(p, bRead, bWrite); -} - - -void SocketHandler::ISocketHandler_Mod(Socket *p,bool bRead,bool bWrite) -{ - Set(p, bRead, bWrite); -} - - -void SocketHandler::ISocketHandler_Del(Socket *p) -{ - Set(p, false, false); -} - - -void SocketHandler::Set(Socket *p,bool bRead,bool bWrite) -{ - SOCKET s = p -> GetSocket(); - if (s >= 0) - { - bool bException = true; - if (bRead) - { - if (!FD_ISSET(s, &m_rfds)) - { - FD_SET(s, &m_rfds); - } - } - else - { - FD_CLR(s, &m_rfds); - } - if (bWrite) - { - if (!FD_ISSET(s, &m_wfds)) - { - FD_SET(s, &m_wfds); - } - } - else - { - FD_CLR(s, &m_wfds); - } - if (bException) - { - if (!FD_ISSET(s, &m_efds)) - { - FD_SET(s, &m_efds); - } - } - else - { - FD_CLR(s, &m_efds); - } - } -} - - -#ifdef ENABLE_RESOLVER -bool SocketHandler::Resolving(Socket *p0) -{ - std::map<socketuid_t, bool>::iterator it = m_resolve_q.find(p0 -> UniqueIdentifier()); - return it != m_resolve_q.end(); -} -#endif - - -bool SocketHandler::Valid(Socket *p0) -{ - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); ++it) - { - Socket *p = it -> second; - if (p0 == p) - return true; - } - return false; -} - - -bool SocketHandler::Valid(socketuid_t uid) -{ - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); ++it) - { - Socket *p = it -> second; - if (p -> UniqueIdentifier() == uid) - return true; - } - return false; -} - - -bool SocketHandler::OkToAccept(Socket *) -{ - return true; -} - - -size_t SocketHandler::GetCount() -{ - return m_sockets.size() + m_add.size() + m_delete.size(); -} - - -#ifdef ENABLE_SOCKS4 -void SocketHandler::SetSocks4Host(ipaddr_t a) -{ - m_socks4_host = a; -} - - -void SocketHandler::SetSocks4Host(const std::string& host) -{ - Utility::u2ip(host, m_socks4_host); -} - - -void SocketHandler::SetSocks4Port(port_t port) -{ - m_socks4_port = port; -} - - -void SocketHandler::SetSocks4Userid(const std::string& id) -{ - m_socks4_userid = id; -} -#endif - - -#ifdef ENABLE_RESOLVER -int SocketHandler::Resolve(Socket *p,const std::string& host,port_t port) -{ - // check cache - ResolvSocket *resolv = new ResolvSocket(*this, p, host, port); - resolv -> SetId(++m_resolv_id); - resolv -> SetDeleteByHandler(); - ipaddr_t local; - Utility::u2ip("127.0.0.1", local); - if (!resolv -> Open(local, m_resolver_port)) - { - LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); - } - Add(resolv); - m_resolve_q[p -> UniqueIdentifier()] = true; -DEB( fprintf(stderr, " *** Resolve '%s:%d' id#%d m_resolve_q size: %d p: %p\n", host.c_str(), port, resolv -> GetId(), m_resolve_q.size(), p);) - return resolv -> GetId(); -} - - -#ifdef ENABLE_IPV6 -int SocketHandler::Resolve6(Socket *p,const std::string& host,port_t port) -{ - // check cache - ResolvSocket *resolv = new ResolvSocket(*this, p, host, port, true); - resolv -> SetId(++m_resolv_id); - resolv -> SetDeleteByHandler(); - ipaddr_t local; - Utility::u2ip("127.0.0.1", local); - if (!resolv -> Open(local, m_resolver_port)) - { - LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); - } - Add(resolv); - m_resolve_q[p -> UniqueIdentifier()] = true; - return resolv -> GetId(); -} -#endif - - -int SocketHandler::Resolve(Socket *p,ipaddr_t a) -{ - // check cache - ResolvSocket *resolv = new ResolvSocket(*this, p, a); - resolv -> SetId(++m_resolv_id); - resolv -> SetDeleteByHandler(); - ipaddr_t local; - Utility::u2ip("127.0.0.1", local); - if (!resolv -> Open(local, m_resolver_port)) - { - LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); - } - Add(resolv); - m_resolve_q[p -> UniqueIdentifier()] = true; - return resolv -> GetId(); -} - - -#ifdef ENABLE_IPV6 -int SocketHandler::Resolve(Socket *p,in6_addr& a) -{ - // check cache - ResolvSocket *resolv = new ResolvSocket(*this, p, a); - resolv -> SetId(++m_resolv_id); - resolv -> SetDeleteByHandler(); - ipaddr_t local; - Utility::u2ip("127.0.0.1", local); - if (!resolv -> Open(local, m_resolver_port)) - { - LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); - } - Add(resolv); - m_resolve_q[p -> UniqueIdentifier()] = true; - return resolv -> GetId(); -} -#endif - - -void SocketHandler::EnableResolver(port_t port) -{ - if (!m_resolver) - { - m_resolver_port = port; - m_resolver = new ResolvServer(port); - } -} - - -bool SocketHandler::ResolverReady() -{ - return m_resolver ? m_resolver -> Ready() : false; -} -#endif // ENABLE_RESOLVER - - -#ifdef ENABLE_SOCKS4 -void SocketHandler::SetSocks4TryDirect(bool x) -{ - m_bTryDirect = x; -} - - -ipaddr_t SocketHandler::GetSocks4Host() -{ - return m_socks4_host; -} - - -port_t SocketHandler::GetSocks4Port() -{ - return m_socks4_port; -} - - -const std::string& SocketHandler::GetSocks4Userid() -{ - return m_socks4_userid; -} - - -bool SocketHandler::Socks4TryDirect() -{ - return m_bTryDirect; -} -#endif - - -#ifdef ENABLE_RESOLVER -bool SocketHandler::ResolverEnabled() -{ - return m_resolver ? true : false; -} - - -port_t SocketHandler::GetResolverPort() -{ - return m_resolver_port; -} -#endif // ENABLE_RESOLVER - - -#ifdef ENABLE_POOL -ISocketHandler::PoolSocket *SocketHandler::FindConnection(int type,const std::string& protocol,SocketAddress& ad) -{ - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end() && m_sockets.size(); ++it) - { - PoolSocket *pools = dynamic_cast<PoolSocket *>(it -> second); - if (pools) - { - if (pools -> GetSocketType() == type && - pools -> GetSocketProtocol() == protocol && -// %! pools -> GetClientRemoteAddress() && - *pools -> GetClientRemoteAddress() == ad) - { - m_sockets.erase(it); - pools -> SetRetain(); // avoid Close in Socket destructor - return pools; // Caller is responsible that this socket is deleted - } - } - } - return NULL; -} - - -void SocketHandler::EnablePool(bool x) -{ - m_b_enable_pool = x; -} - - -bool SocketHandler::PoolEnabled() -{ - return m_b_enable_pool; -} -#endif - - -void SocketHandler::Remove(Socket *p) -{ -#ifdef ENABLE_RESOLVER - std::map<socketuid_t, bool>::iterator it4 = m_resolve_q.find(p -> UniqueIdentifier()); - if (it4 != m_resolve_q.end()) - m_resolve_q.erase(it4); -#endif - if (p -> ErasedByHandler()) - { - return; - } - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); ++it) - { - if (it -> second == p) - { - LogError(p, "Remove", -1, "Socket destructor called while still in use", LOG_LEVEL_WARNING); - m_sockets.erase(it); - return; - } - } - for (std::list<Socket *>::iterator it2 = m_add.begin(); it2 != m_add.end(); ++it2) - { - if (*it2 == p) - { - LogError(p, "Remove", -2, "Socket destructor called while still in use", LOG_LEVEL_WARNING); - m_add.erase(it2); - return; - } - } - for (std::list<Socket *>::iterator it3 = m_delete.begin(); it3 != m_delete.end(); ++it3) - { - if (*it3 == p) - { - LogError(p, "Remove", -3, "Socket destructor called while still in use", LOG_LEVEL_WARNING); - m_delete.erase(it3); - return; - } - } -} - - -void SocketHandler::SetCallOnConnect(bool x) -{ - m_b_check_callonconnect = x; -} - - -void SocketHandler::SetDetach(bool x) -{ - m_b_check_detach = x; -} - - -void SocketHandler::SetTimeout(bool x) -{ - m_b_check_timeout = x; -} - - -void SocketHandler::SetRetry(bool x) -{ - m_b_check_retry = x; -} - - -void SocketHandler::SetClose(bool x) -{ - m_b_check_close = x; -} - - -void SocketHandler::DeleteSocket(Socket *p) -{ - p -> OnDelete(); - if (p -> DeleteByHandler() && !p -> ErasedByHandler()) - { - p -> SetErasedByHandler(); - } - m_fds_erase.push_back(p -> UniqueIdentifier()); -} - - -void SocketHandler::RebuildFdset() -{ - fd_set rfds; - fd_set wfds; - fd_set efds; - // rebuild fd_set's from active sockets list (m_sockets) here - FD_ZERO(&rfds); - FD_ZERO(&wfds); - FD_ZERO(&efds); - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); ++it) - { - SOCKET s = it -> first; - Socket *p = it -> second; - if (s == p -> GetSocket() && s >= 0) - { - fd_set fds; - FD_ZERO(&fds); - FD_SET(s, &fds); - struct timeval tv; - tv.tv_sec = 0; - tv.tv_usec = 0; - int n = select((int)s + 1, &fds, NULL, NULL, &tv); - if (n == -1 && Errno == EBADF) - { - // %! bad fd, remove - LogError(p, "Select", (int)s, "Bad fd in fd_set (2)", LOG_LEVEL_ERROR); - DeleteSocket(p); - } - else - { - if (FD_ISSET(s, &m_rfds)) - FD_SET(s, &rfds); - if (FD_ISSET(s, &m_wfds)) - FD_SET(s, &wfds); - if (FD_ISSET(s, &m_efds)) - FD_SET(s, &efds); - } - } - else - { - // %! mismatch - LogError(p, "Select", (int)s, "Bad fd in fd_set (3)", LOG_LEVEL_ERROR); - DeleteSocket(p); - } - } - m_rfds = rfds; - m_wfds = wfds; - m_efds = efds; -} - - -void SocketHandler::AddIncoming() -{ - while (m_add.size() > 0) - { - if (m_sockets.size() >= MaxCount()) - { - LogError(NULL, "Select", (int)m_sockets.size(), "socket limit reached", LOG_LEVEL_WARNING); - break; - } - std::list<Socket *>::iterator it = m_add.begin(); - Socket *p = *it; - SOCKET s = p -> GetSocket(); -DEB( fprintf(stderr, "Trying to add fd %d, m_add.size() %d\n", (int)s, (int)m_add.size());) - // - if (s == INVALID_SOCKET) - { - LogError(p, "Add", -1, "Invalid socket", LOG_LEVEL_WARNING); - m_delete.push_back(p); - m_add.erase(it); - continue; - } - socket_m::iterator it2; - if ((it2 = m_sockets.find(s)) != m_sockets.end()) - { - Socket *found = it2 -> second; - if (p -> UniqueIdentifier() > found -> UniqueIdentifier()) - { - LogError(p, "Add", (int)p -> GetSocket(), "Replacing socket already in controlled queue (newer uid)", LOG_LEVEL_WARNING); - // replace - DeleteSocket(found); - } - else - if (p -> UniqueIdentifier() == found -> UniqueIdentifier()) - { - LogError(p, "Add", (int)p -> GetSocket(), "Attempt to add socket already in controlled queue (same uid)", LOG_LEVEL_ERROR); - // same - ignore - if (p != found) - m_delete.push_back(p); - m_add.erase(it); - continue; - } - else - { - LogError(p, "Add", (int)p -> GetSocket(), "Attempt to add socket already in controlled queue (older uid)", LOG_LEVEL_FATAL); - // %! it's a dup, don't add to delete queue, just ignore it - m_delete.push_back(p); - m_add.erase(it); - continue; - } - } - if (p -> CloseAndDelete()) - { - LogError(p, "Add", (int)p -> GetSocket(), "Added socket with SetCloseAndDelete() true", LOG_LEVEL_WARNING); - m_sockets[s] = p; - DeleteSocket(p); - p -> Close(); - } - else - { - StreamSocket *scp = dynamic_cast<StreamSocket *>(p); - if (scp && scp -> Connecting()) // 'Open' called before adding socket - { - ISocketHandler_Add(p,false,true); - } - else - { - TcpSocket *tcp = dynamic_cast<TcpSocket *>(p); - bool bWrite = tcp ? tcp -> GetOutputLength() != 0 : false; - if (p -> IsDisableRead()) - { - ISocketHandler_Add(p, false, bWrite); - } - else - { - ISocketHandler_Add(p, true, bWrite); - } - } - m_maxsock = (s > m_maxsock) ? s : m_maxsock; - m_sockets[s] = p; - } - // - m_add.erase(it); - } -} - - -void SocketHandler::CheckErasedSockets() -{ - // check erased sockets - bool check_max_fd = false; - while (m_fds_erase.size()) - { - std::list<socketuid_t>::iterator it = m_fds_erase.begin(); - socketuid_t uid = *it; - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) - { - Socket *p = it -> second; - if (p -> UniqueIdentifier() == uid) - { - /* Sometimes a SocketThread class can finish its run before the master - sockethandler gets here. In that case, the SocketThread has set the - 'ErasedByHandler' flag on the socket which will make us end up with a - double delete on the socket instance. - The fix is to make sure that the master sockethandler only can delete - non-detached sockets, and a slave sockethandler only can delete - detach sockets. */ - if (p -> ErasedByHandler() -#ifdef ENABLE_DETACH - && !(m_slave ^ p -> IsDetached()) -#endif - ) - { - delete p; - } - m_sockets.erase(it); - break; - } - } - m_fds_erase.erase(it); - check_max_fd = true; - } - // calculate max file descriptor for select() call - if (check_max_fd) - { - m_maxsock = 0; - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) - { - SOCKET s = it -> first; - m_maxsock = s > m_maxsock ? s : m_maxsock; - } - } -} - - -void SocketHandler::CheckCallOnConnect() -{ - m_b_check_callonconnect = false; - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) - { - Socket *p = it -> second; - if (p -> CallOnConnect()) - { - TcpSocket *tcp = dynamic_cast<TcpSocket *>(p); - p -> SetConnected(); // moved here from inside if (tcp) check below -#ifdef HAVE_OPENSSL - if (p -> IsSSL()) // SSL Enabled socket - p -> OnSSLConnect(); - else -#endif -#ifdef ENABLE_SOCKS4 - if (p -> Socks4()) - p -> OnSocks4Connect(); - else -#endif - { - if (tcp) - { - if (tcp -> GetOutputLength()) - { - p -> OnWrite(); - } - } -#ifdef ENABLE_RECONNECT - if (tcp && tcp -> IsReconnect()) - p -> OnReconnect(); - else -#endif - { - p -> OnConnect(); - } - } - p -> SetCallOnConnect( false ); - m_b_check_callonconnect = true; - } - } -} - - -#ifdef ENABLE_DETACH -void SocketHandler::CheckDetach() -{ - m_b_check_detach = false; - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) - { - Socket *p = it -> second; - if (p -> IsDetach()) - { - ISocketHandler_Del(p); - // After DetachSocket(), all calls to Handler() will return a reference - // to the new slave SocketHandler running in the new thread. - p -> DetachSocket(); - // Adding the file descriptor to m_fds_erase will now also remove the - // socket from the detach queue - tnx knightmad - m_fds_erase.push_back(p -> UniqueIdentifier()); - m_b_check_detach = true; - } - } -} -#endif - - -void SocketHandler::CheckTimeout(time_t tnow) -{ - m_b_check_timeout = false; - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) - { - Socket *p = it -> second; - if (p -> CheckTimeout()) - { - if (p -> Timeout(tnow)) - { - StreamSocket *scp = dynamic_cast<StreamSocket *>(p); - p -> SetTimeout(0); - if (scp && scp -> Connecting()) - { - p -> OnConnectTimeout(); - // restart timer - p -> SetTimeout( scp -> GetConnectTimeout() ); - } - else - { - p -> OnTimeout(); - } - } - m_b_check_timeout = true; - } - } -} - - -void SocketHandler::CheckRetry() -{ - m_b_check_retry = false; - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) - { - Socket *p = it -> second; - if (p -> RetryClientConnect()) - { - TcpSocket *tcp = dynamic_cast<TcpSocket *>(p); - tcp -> SetRetryClientConnect(false); -DEB( fprintf(stderr, "Close() before retry client connect\n");) - p -> Close(); // removes from m_fds_retry - std::auto_ptr<SocketAddress> ad = p -> GetClientRemoteAddress(); - if (ad.get()) - { - tcp -> Open(*ad); - } - else - { - LogError(p, "RetryClientConnect", 0, "no address", LOG_LEVEL_ERROR); - } - Add(p); - m_fds_erase.push_back(p -> UniqueIdentifier()); - m_b_check_retry = true; - } - } -} - - -void SocketHandler::CheckClose() -{ - m_b_check_close = false; - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) - { - Socket *p = it -> second; - if (p -> CloseAndDelete() ) - { - TcpSocket *tcp = dynamic_cast<TcpSocket *>(p); -#ifdef ENABLE_RECONNECT - if (p -> Lost() && !(tcp && tcp -> Reconnect())) -#else - if (p -> Lost()) -#endif - { - // remove instance when Lost, if not reconnect flag is set - DeleteSocket(p); - } - else - // new graceful tcp - flush and close timeout 5s - if (tcp && p -> IsConnected() && tcp -> GetFlushBeforeClose() && -#ifdef HAVE_OPENSSL - !tcp -> IsSSL() && -#endif - p -> TimeSinceClose() < 5) - { -DEB( fprintf(stderr, " close(1)\n");) - if (tcp -> GetOutputLength()) - { - LogError(p, "Closing", (int)tcp -> GetOutputLength(), "Sending all data before closing", LOG_LEVEL_INFO); - } - else // shutdown write when output buffer is empty - if (!(tcp -> GetShutdown() & SHUT_WR)) - { - SOCKET nn = it -> first; - if (nn != INVALID_SOCKET && shutdown(nn, SHUT_WR) == -1) - { - LogError(p, "graceful shutdown", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - tcp -> SetShutdown(SHUT_WR); - } - else - { - ISocketHandler_Del(p); - tcp -> Close(); - DeleteSocket(p); - } - } - else -#ifdef ENABLE_RECONNECT - if (tcp && p -> IsConnected() && tcp -> Reconnect()) - { - p -> SetCloseAndDelete(false); - tcp -> SetIsReconnect(); - p -> SetConnected(false); -DEB( fprintf(stderr, "Close() before reconnect\n");) - p -> Close(); // dispose of old file descriptor (Open creates a new) - p -> OnDisconnect(); - std::auto_ptr<SocketAddress> ad = p -> GetClientRemoteAddress(); - if (ad.get()) - { - tcp -> Open(*ad); - } - else - { - LogError(p, "Reconnect", 0, "no address", LOG_LEVEL_ERROR); - } - tcp -> ResetConnectionRetries(); - Add(p); - m_fds_erase.push_back(p -> UniqueIdentifier()); - } - else -#endif - { - if (tcp && p -> IsConnected() && tcp -> GetOutputLength()) - { - LogError(p, "Closing", (int)tcp -> GetOutputLength(), "Closing socket while data still left to send", LOG_LEVEL_WARNING); - } -#ifdef ENABLE_POOL - if (p -> Retain() && !p -> Lost()) - { - PoolSocket *p2 = new PoolSocket(*this, p); - p2 -> SetDeleteByHandler(); - Add(p2); - // - p -> SetCloseAndDelete(false); // added - remove from m_fds_close - } - else -#endif // ENABLE_POOL - { - ISocketHandler_Del(p); -DEB( fprintf(stderr, "Close() before OnDelete\n");) - p -> Close(); - } - DeleteSocket(p); - } - m_b_check_close = true; - } - } -} - - -int SocketHandler::ISocketHandler_Select(struct timeval *tsel) -{ -#ifdef MACOSX - fd_set rfds; - fd_set wfds; - fd_set efds; - FD_COPY(&m_rfds, &rfds); - FD_COPY(&m_wfds, &wfds); - FD_COPY(&m_efds, &efds); -#else - fd_set rfds = m_rfds; - fd_set wfds = m_wfds; - fd_set efds = m_efds; -#endif - int n; -DEB( -printf("select( %d, [", m_maxsock + 1); -for (size_t i = 0; i <= m_maxsock; i++) - if (FD_ISSET(i, &rfds)) - printf(" %d", i); -printf("], ["); -for (size_t i = 0; i <= m_maxsock; i++) - if (FD_ISSET(i, &wfds)) - printf(" %d", i); -printf("], ["); -for (size_t i = 0; i <= m_maxsock; i++) - if (FD_ISSET(i, &efds)) - printf(" %d", i); -printf("]\n"); -) - if (m_b_use_mutex) - { - m_mutex.Unlock(); - n = select( (int)(m_maxsock + 1),&rfds,&wfds,&efds,tsel); - m_mutex.Lock(); - } - else - { - n = select( (int)(m_maxsock + 1),&rfds,&wfds,&efds,tsel); - } - if (n == -1) // error on select - { - int err = Errno; - /* - EBADF An invalid file descriptor was given in one of the sets. - EINTR A non blocked signal was caught. - EINVAL n is negative. Or struct timeval contains bad time values (<0). - ENOMEM select was unable to allocate memory for internal tables. - */ -#ifdef _WIN32 - switch (err) - { - case WSAENOTSOCK: - RebuildFdset(); - break; - case WSAEINTR: - case WSAEINPROGRESS: - break; - case WSAEINVAL: - LogError(NULL, "SocketHandler::Select", err, StrError(err), LOG_LEVEL_FATAL); - throw Exception("select(n): n is negative. Or struct timeval contains bad time values (<0)."); - case WSAEFAULT: - LogError(NULL, "SocketHandler::Select", err, StrError(err), LOG_LEVEL_ERROR); - break; - case WSANOTINITIALISED: - throw Exception("WSAStartup not successfully called"); - case WSAENETDOWN: - throw Exception("Network subsystem failure"); - } -#else - switch (err) - { - case EBADF: - RebuildFdset(); - break; - case EINTR: - break; - case EINVAL: - LogError(NULL, "SocketHandler::Select", err, StrError(err), LOG_LEVEL_FATAL); - throw Exception("select(n): n is negative. Or struct timeval contains bad time values (<0)."); - case ENOMEM: - LogError(NULL, "SocketHandler::Select", err, StrError(err), LOG_LEVEL_ERROR); - break; - } -#endif - printf("error on select(): %d %s\n", Errno, StrError(err)); - } - else - if (!n) // timeout - { - } - else - if (n > 0) - { - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) - { - SOCKET i = it -> first; - Socket *p = it -> second; - // --------------------------------------------------------------------------------- - if (FD_ISSET(i, &rfds)) - { -#ifdef HAVE_OPENSSL - if (p -> IsSSLNegotiate()) - { - p -> SSLNegotiate(); - } - else -#endif - { - p -> OnRead(); - } - } - // --------------------------------------------------------------------------------- - if (FD_ISSET(i, &wfds)) - { -#ifdef HAVE_OPENSSL - if (p -> IsSSLNegotiate()) - { - p -> SSLNegotiate(); - } - else -#endif - { - p -> OnWrite(); - } - } - // --------------------------------------------------------------------------------- - if (FD_ISSET(i, &efds)) - { - p -> OnException(); - } - } // m_sockets ... - } // if (n > 0) - return n; -} - - -int SocketHandler::Select(long sec,long usec) -{ - struct timeval tv; - tv.tv_sec = sec; - tv.tv_usec = usec; - return Select(&tv); -} - - -int SocketHandler::Select() -{ - if (m_b_check_callonconnect || - m_b_check_detach || - m_b_check_timeout || - m_b_check_retry || - m_b_check_close) - { - return Select(0, 200000); - } - return Select(NULL); -} - - -int SocketHandler::Select(struct timeval *tsel) -{ - if (!m_add.empty()) - { - AddIncoming(); - } - int n = ISocketHandler_Select(tsel); - // check CallOnConnect - EVENT - if (m_b_check_callonconnect) - { - CheckCallOnConnect(); - } - -#ifdef ENABLE_DETACH - // check detach of socket if master handler - EVENT - if (!m_slave && m_b_check_detach) - { - CheckDetach(); - } -#endif - - // check Connecting - connection timeout - conditional event - if (m_b_check_timeout) - { - time_t tnow = time(NULL); - if (tnow != m_tlast) - { - CheckTimeout(tnow); - m_tlast = tnow; - } // tnow != tlast - } - - // check retry client connect - EVENT - if (m_b_check_retry) - { - CheckRetry(); - } - - // check close and delete - conditional event - if (m_b_check_close) - { - CheckClose(); - } - - if (!m_fds_erase.empty()) - { - CheckErasedSockets(); - } - - // remove Add's that fizzed - while (m_delete.size()) - { - std::list<Socket *>::iterator it = m_delete.begin(); - Socket *p = *it; - p -> OnDelete(); - m_delete.erase(it); - if (p -> DeleteByHandler() -#ifdef ENABLE_DETACH - && !(m_slave ^ p -> IsDetached()) -#endif - ) - { - p -> SetErasedByHandler(); - delete p; - } - } - - return n; -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandler.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandler.h deleted file mode 100755 index 79c28bc6b39..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandler.h +++ /dev/null @@ -1,302 +0,0 @@ -/** \file SocketHandler.h - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_SocketHandler_H -#define _SOCKETS_SocketHandler_H - -#include "sockets-config.h" -#include <map> -#include <list> - -#include "socket_include.h" -#include "ISocketHandler.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -class Socket; -#ifdef ENABLE_RESOLVER -class ResolvServer; -#endif -class IMutex; -class SocketHandlerThread; -class UdpSocket; - -/** Socket container class, event generator. - \ingroup basic */ -class SocketHandler : public ISocketHandler -{ -protected: - /** Map type for holding file descriptors/socket object pointers. */ - typedef std::map<SOCKET,Socket *> socket_m; - -public: - /** SocketHandler constructor. - \param log Optional log class pointer */ - SocketHandler(StdLog *log = NULL); - - /** SocketHandler threadsafe constructor. - \param mutex Externally declared mutex variable - \param log Optional log class pointer */ - SocketHandler(IMutex& mutex,StdLog *log = NULL); - - SocketHandler(IMutex&, ISocketHandler& parent, StdLog * = NULL); - - ~SocketHandler(); - - virtual ISocketHandler *Create(StdLog * = NULL); - virtual ISocketHandler *Create(IMutex&, ISocketHandler&, StdLog * = NULL); - - virtual bool ParentHandlerIsValid(); - - virtual ISocketHandler& ParentHandler(); - - virtual ISocketHandler& GetRandomHandler(); - - virtual ISocketHandler& GetEffectiveHandler(); - - virtual void SetNumberOfThreads(size_t n); - virtual bool IsThreaded(); - - virtual void EnableRelease(); - virtual void Release(); - - /** Get mutex reference for threadsafe operations. */ - IMutex& GetMutex() const; - - /** Register StdLog object for error callback. - \param log Pointer to log class */ - void RegStdLog(StdLog *log); - - /** Log error to log class for print out / storage. */ - void LogError(Socket *p,const std::string& user_text,int err,const std::string& sys_err,loglevel_t t = LOG_LEVEL_WARNING); - - /** Add socket instance to socket map. Removal is always automatic. */ - void Add(Socket *); - - /** Set read/write/exception file descriptor sets (fd_set). */ - void ISocketHandler_Add(Socket *,bool bRead,bool bWrite); - void ISocketHandler_Mod(Socket *,bool bRead,bool bWrite); - void ISocketHandler_Del(Socket *); - - /** Wait for events, generate callbacks. */ - int Select(long sec,long usec); - - /** This method will not return until an event has been detected. */ - int Select(); - - /** Wait for events, generate callbacks. */ - int Select(struct timeval *tsel); - - /** Check that a socket really is handled by this socket handler. */ - bool Valid(Socket *); - bool Valid(socketuid_t); - - /** Return number of sockets handled by this handler. */ - size_t GetCount(); - size_t MaxCount() { - return FD_SETSIZE; - } - - /** Override and return false to deny all incoming connections. - \param p ListenSocket class pointer (use GetPort to identify which one) */ - bool OkToAccept(Socket *p); - - /** Use with care, always lock with h.GetMutex() if multithreaded */ - const std::map<SOCKET, Socket *>& AllSockets() { - return m_sockets; - } - - size_t MaxTcpLineSize() { - return TCP_LINE_SIZE; - } - - void SetCallOnConnect(bool = true); - void SetDetach(bool = true); - void SetTimeout(bool = true); - void SetRetry(bool = true); - void SetClose(bool = true); - -private: - static FILE *m_event_file; - static unsigned long m_event_counter; - -public: - // Connection pool -#ifdef ENABLE_POOL - /** Find available open connection (used by connection pool). */ - ISocketHandler::PoolSocket *FindConnection(int type,const std::string& protocol,SocketAddress&); - /** Enable connection pool (by default disabled). */ - void EnablePool(bool x = true); - /** Check pool status. - \return true if connection pool is enabled */ - bool PoolEnabled(); -#endif // ENABLE_POOL - - // Socks4 -#ifdef ENABLE_SOCKS4 - /** Set socks4 server ip that all new tcp sockets should use. */ - void SetSocks4Host(ipaddr_t); - /** Set socks4 server hostname that all new tcp sockets should use. */ - void SetSocks4Host(const std::string& ); - /** Set socks4 server port number that all new tcp sockets should use. */ - void SetSocks4Port(port_t); - /** Set optional socks4 userid. */ - void SetSocks4Userid(const std::string& ); - /** If connection to socks4 server fails, immediately try direct connection to final host. */ - void SetSocks4TryDirect(bool x = true); - /** Get socks4 server ip. - \return socks4 server ip */ - ipaddr_t GetSocks4Host(); - /** Get socks4 port number. - \return socks4 port number */ - port_t GetSocks4Port(); - /** Get socks4 userid (optional). - \return socks4 userid */ - const std::string& GetSocks4Userid(); - /** Check status of socks4 try direct flag. - \return true if direct connection should be tried if connection to socks4 server fails */ - bool Socks4TryDirect(); -#endif // ENABLE_SOCKS4 - - // DNS resolve server -#ifdef ENABLE_RESOLVER - /** Enable asynchronous DNS. - \param port Listen port of asynchronous dns server */ - void EnableResolver(port_t port = 16667); - /** Check resolver status. - \return true if resolver is enabled */ - bool ResolverEnabled(); - /** Queue a dns request. - \param host Hostname to be resolved - \param port Port number will be echoed in Socket::OnResolved callback */ - int Resolve(Socket *,const std::string& host,port_t port); -#ifdef ENABLE_IPV6 - int Resolve6(Socket *,const std::string& host,port_t port); -#endif - /** Do a reverse dns lookup. */ - int Resolve(Socket *,ipaddr_t a); -#ifdef ENABLE_IPV6 - int Resolve(Socket *,in6_addr& a); -#endif - /** Get listen port of asynchronous dns server. */ - port_t GetResolverPort(); - /** Resolver thread ready for queries. */ - bool ResolverReady(); - /** Returns true if the socket is waiting for a resolve event. */ - bool Resolving(Socket *); -#endif // ENABLE_RESOLVER - -#ifdef ENABLE_DETACH - /** Indicates that the handler runs under SocketThread. */ - void SetSlave(bool x = true); - /** Indicates that the handler runs under SocketThread. */ - bool IsSlave(); -#endif - -protected: - socket_m m_sockets; ///< Active sockets map - std::list<Socket *> m_add; ///< Sockets to be added to sockets map - std::list<Socket *> m_delete; ///< Sockets to be deleted (failed when Add) - -protected: - /** Actual call to select() */ - int ISocketHandler_Select(struct timeval *); - /** Remove socket from socket map, used by Socket class. */ - void Remove(Socket *); - /** Schedule socket for deletion */ - void DeleteSocket(Socket *); - void AddIncoming(); - void CheckErasedSockets(); - void CheckCallOnConnect(); - void CheckDetach(); - void CheckTimeout(time_t); - void CheckRetry(); - void CheckClose(); - // - StdLog *m_stdlog; ///< Registered log class, or NULL - IMutex& m_mutex; ///< Thread safety mutex - bool m_b_use_mutex; ///< Mutex correctly initialized - ISocketHandler& m_parent; - bool m_b_parent_is_valid; - -private: - void RebuildFdset(); - void Set(Socket *,bool,bool); - // - std::list<SocketHandlerThread *> m_threads; - UdpSocket *m_release; - // - SOCKET m_maxsock; ///< Highest file descriptor + 1 in active sockets list - fd_set m_rfds; ///< file descriptor set monitored for read events - fd_set m_wfds; ///< file descriptor set monitored for write events - fd_set m_efds; ///< file descriptor set monitored for exceptions - time_t m_tlast; ///< timeout control - - // state lists - std::list<socketuid_t> m_fds_erase; ///< File descriptors that are to be erased from m_sockets - - bool m_b_check_callonconnect; - bool m_b_check_detach; - bool m_b_check_timeout; - bool m_b_check_retry; - bool m_b_check_close; - -#ifdef ENABLE_SOCKS4 - ipaddr_t m_socks4_host; ///< Socks4 server host ip - port_t m_socks4_port; ///< Socks4 server port number - std::string m_socks4_userid; ///< Socks4 userid - bool m_bTryDirect; ///< Try direct connection if socks4 server fails -#endif -#ifdef ENABLE_RESOLVER - int m_resolv_id; ///< Resolver id counter - ResolvServer *m_resolver; ///< Resolver thread pointer - port_t m_resolver_port; ///< Resolver listen port - std::map<socketuid_t, bool> m_resolve_q; ///< resolve queue -#endif -#ifdef ENABLE_POOL - bool m_b_enable_pool; ///< Connection pool enabled if true -#endif -#ifdef ENABLE_DETACH - bool m_slave; ///< Indicates that this is a ISocketHandler run in SocketThread -#endif -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_SocketHandler_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandlerEp.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandlerEp.cpp deleted file mode 100755 index 566e06f6256..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandlerEp.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/** \file SocketHandler.cpp - ** \date 2010-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "SocketHandlerEp.h" -#include "Exception.h" -#include "IMutex.h" -#include "Utility.h" - -#include <errno.h> - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -SocketHandlerEp::SocketHandlerEp(StdLog *p) -:SocketHandler(p) -,m_epoll(-1) -{ -#ifdef LINUX - m_epoll = epoll_create(FD_SETSIZE); - if (m_epoll == -1) - { - throw Exception(StrError(Errno)); - } -#endif -} - - -SocketHandlerEp::SocketHandlerEp(IMutex& mutex, StdLog *p) -:SocketHandler(mutex, p) -,m_epoll(-1) -{ -#ifdef LINUX - m_epoll = epoll_create(FD_SETSIZE); - if (m_epoll == -1) - { - throw Exception(StrError(Errno)); - } -#endif -} - - -SocketHandlerEp::SocketHandlerEp(IMutex& mutex, ISocketHandler& parent, StdLog *p) -:SocketHandler(mutex, parent, p) -,m_epoll(-1) -{ -#ifdef LINUX - m_epoll = epoll_create(FD_SETSIZE); - if (m_epoll == -1) - { - throw Exception(StrError(Errno)); - } -#endif -} - - -SocketHandlerEp::~SocketHandlerEp() -{ -#ifdef LINUX - if (m_epoll != -1) - { - close(m_epoll); - } -#endif -} - - -ISocketHandler *SocketHandlerEp::Create(StdLog *log) -{ - return new SocketHandlerEp(log); -} - - -ISocketHandler *SocketHandlerEp::Create(IMutex& mutex, ISocketHandler& parent, StdLog *log) -{ - return new SocketHandlerEp(mutex, parent, log); -} - - -#ifdef LINUX -void SocketHandlerEp::ISocketHandler_Add(Socket *p,bool bRead,bool bWrite) -{ - struct epoll_event stat; - SOCKET s = p -> GetSocket(); - stat.data.ptr = p; - stat.events = (bRead ? EPOLLIN : 0) | (bWrite ? EPOLLOUT : 0); - if (epoll_ctl(m_epoll, EPOLL_CTL_ADD, s, &stat) == -1) - { - LogError(NULL, "epoll_ctl: EPOLL_CTL_ADD", Errno, StrError(Errno)); - } -} - - -void SocketHandlerEp::ISocketHandler_Mod(Socket *p,bool r,bool w) -{ - struct epoll_event stat; - SOCKET s = p -> GetSocket(); - stat.data.ptr = p; - stat.events = (r ? EPOLLIN : 0) | (w ? EPOLLOUT : 0); - if (epoll_ctl(m_epoll, EPOLL_CTL_MOD, s, &stat) == -1) - { -// LogError(NULL, "epoll_ctl: EPOLL_CTL_MOD", Errno, StrError(Errno)); - } -} - - -void SocketHandlerEp::ISocketHandler_Del(Socket *p) -{ - struct epoll_event stat; - stat.events = 0; - stat.data.ptr = p; - if (epoll_ctl(m_epoll, EPOLL_CTL_DEL, p -> GetSocket(), &stat) == -1) - { -// LogError(NULL, "epoll_ctl: EPOLL_CTL_DEL", Errno, StrError(Errno)); - } -} - - -int SocketHandlerEp::ISocketHandler_Select(struct timeval *tsel) -{ - int n; - if (m_b_use_mutex) - { - m_mutex.Unlock(); - n = epoll_wait(m_epoll, m_events, MAX_EVENTS_EP_WAIT, tsel ? tsel -> tv_sec * 1000 + tsel -> tv_usec / 1000 : -1); - m_mutex.Lock(); - } - else - { - n = epoll_wait(m_epoll, m_events, MAX_EVENTS_EP_WAIT, tsel ? tsel -> tv_sec * 1000 + tsel -> tv_usec / 1000 : -1); - } - if (n == -1) - { - LogError(NULL, "epoll_wait", Errno, StrError(Errno)); - } - else - if (!n) - { - } - else - if (n > 0) - { - for (int x = 0; x < n; x++) - { - Socket *p = static_cast<Socket *>(m_events[x].data.ptr); - if ((m_events[x].events & EPOLLIN) || (m_events[x].events & EPOLLHUP)) - { -#ifdef HAVE_OPENSSL - if (p -> IsSSLNegotiate()) - { - p -> SSLNegotiate(); - } - else -#endif - { - p -> OnRead(); - } - } - if (m_events[x].events & EPOLLOUT) - { -#ifdef HAVE_OPENSSL - if (p -> IsSSLNegotiate()) - { - p -> SSLNegotiate(); - } - else -#endif - { - p -> OnWrite(); - } - } - if (m_events[x].events & EPOLLERR) - { - p -> OnException(); - } - } - } - return n; -} -#endif - - -#ifdef SOCKETS_NAMESPACE -} -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandlerEp.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandlerEp.h deleted file mode 100755 index fe6c8d5af56..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandlerEp.h +++ /dev/null @@ -1,96 +0,0 @@ -/** \file SocketHandlerEp.h - ** \date 2010-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETHANDLEREP_H -#define _SOCKETHANDLEREP_H - -#include "SocketHandler.h" -#ifdef LINUX -#include <sys/epoll.h> - -#define MAX_EVENTS_EP_WAIT 100 -#endif // LINUX - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -class SocketHandlerEp : public SocketHandler -{ -public: - /** SocketHandler constructor. - \param log Optional log class pointer */ - SocketHandlerEp(StdLog *log = NULL); - - /** SocketHandler threadsafe constructor. - \param mutex Externally declared mutex variable - \param log Optional log class pointer */ - SocketHandlerEp(IMutex& mutex,StdLog *log = NULL); - - SocketHandlerEp(IMutex&, ISocketHandler& parent, StdLog * = NULL); - - ~SocketHandlerEp(); - - ISocketHandler *Create(StdLog * = NULL); - ISocketHandler *Create(IMutex&, ISocketHandler&, StdLog * = NULL); - -#ifdef LINUX - - /** Set read/write/exception file descriptor sets (fd_set). */ - void ISocketHandler_Add(Socket *,bool bRead,bool bWrite); - void ISocketHandler_Mod(Socket *,bool bRead,bool bWrite); - void ISocketHandler_Del(Socket *); - - size_t MaxCount() { - return 10000; // %! - } - -protected: - /** Actual call to select() */ - int ISocketHandler_Select(struct timeval *); -#endif // LINUX - -private: - int m_epoll; ///< epoll file descriptor -#ifdef LINUX - struct epoll_event m_events[MAX_EVENTS_EP_WAIT]; - -#endif // LINUX - -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETHANDLEREP_H diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandlerThread.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandlerThread.cpp deleted file mode 100755 index b097983adb9..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandlerThread.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/** - ** \file SocketHandlerThread.cpp - ** \date 2010-03-21 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "SocketHandlerThread.h" -#include "Mutex.h" -#include "ISocketHandler.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -SocketHandlerThread::SocketHandlerThread(ISocketHandler& parent) : Thread(false) -, m_parent(parent) -, m_handler(NULL) -{ -} - - -SocketHandlerThread::~SocketHandlerThread() -{ -} - - -ISocketHandler& SocketHandlerThread::Handler() -{ - return *m_handler; -} - - -void SocketHandlerThread::Run() -{ - Mutex mutex; - m_handler = m_parent.Create(mutex, m_parent); - m_sem.Post(); - ISocketHandler& h = *m_handler; - h.EnableRelease(); - while (IsRunning()) - { - h.Select(1, 0); - } -} - - -void SocketHandlerThread::Wait() -{ - m_sem.Wait(); -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandlerThread.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandlerThread.h deleted file mode 100755 index 8b026968123..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketHandlerThread.h +++ /dev/null @@ -1,68 +0,0 @@ -/** - ** \file SocketHandlerThread.h - ** \date 2010-03-21 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETHANDLERTHREAD_H -#define _SOCKETHANDLERTHREAD_H - -#include "Thread.h" -#include "Semaphore.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -class ISocketHandler; - -class SocketHandlerThread : public Thread -{ -public: - SocketHandlerThread(ISocketHandler& parent); - ~SocketHandlerThread(); - - virtual void Run(); - - ISocketHandler& Handler(); - - void Wait(); - -private: - ISocketHandler& m_parent; - ISocketHandler *m_handler; - Semaphore m_sem; -}; - - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - -#endif // _SOCKETHANDLERTHREAD_H diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketStream.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketStream.cpp deleted file mode 100755 index a97d261f895..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketStream.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/** - ** \file SocketStream.cpp - ** \date 2008-12-20 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2008-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "SocketStream.h" -#include "ISocketHandler.h" -#include "TcpSocket.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -SocketStream::SocketStream(ISocketHandler& h, TcpSocket *sock) : m_handler(h), m_socket(sock) -, m_socket_uid(sock -> UniqueIdentifier()) -{ -} - - -size_t SocketStream::IStreamRead(char *buf, size_t max_sz) -{ - if (m_handler.Valid(m_socket_uid)) - { - return m_socket -> ReadInput(buf, max_sz); - } - return 0; -} - - -void SocketStream::IStreamWrite(const char *buf, size_t sz) -{ - if (m_handler.Valid(m_socket_uid)) - { - m_socket -> SendBuf(buf, sz); - } -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketStream.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketStream.h deleted file mode 100755 index 76ff52478e3..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketStream.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - ** \file SocketStream.h - ** \date 2008-12-20 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2008-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_SocketStream_H -#define _SOCKETS_SocketStream_H - -#include "IStream.h" - -#include "socket_include.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -class ISocketHandler; -class TcpSocket; - -class SocketStream : public IStream -{ -public: - SocketStream(ISocketHandler& h, TcpSocket *sock); - - size_t IStreamRead(char *buf, size_t max_sz); - - void IStreamWrite(const char *buf, size_t sz); - -private: - ISocketHandler& m_handler; - TcpSocket *m_socket; - socketuid_t m_socket_uid; -}; - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_SocketStream_H diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketThread.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketThread.cpp deleted file mode 100755 index 003f8e5ad77..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketThread.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "SocketThread.h" - -#ifdef ENABLE_DETACH -#include "Utility.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - -SocketThread::SocketThread(Socket *p) -:Thread(false) -,m_socket(p) -{ - // Creator will release -} - - -SocketThread::~SocketThread() -{ - if (IsRunning()) - { - SetRelease(true); - SetRunning(false); - m_h.Release(); - Utility::Sleep(5); - } -} - - -void SocketThread::Run() -{ - m_h.SetSlave(); - m_h.Add(m_socket); - m_socket -> SetSlaveHandler(&m_h); - m_socket -> OnDetached(); - m_h.EnableRelease(); - while (m_h.GetCount() && IsRunning()) - { - m_h.Select(0, 500000); - } - // m_socket now deleted oops - // yeah oops m_socket delete its socket thread, that means this - // so Socket will no longer delete its socket thread, instead we do this: - SetDeleteOnExit(); -} - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - -#endif // ENABLE_DETACH diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketThread.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketThread.h deleted file mode 100755 index 49e50c734f9..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/SocketThread.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef _SOCKETTHREAD_H -#define _SOCKETTHREAD_H - -#include "sockets-config.h" -#ifdef ENABLE_DETACH - -#include "Thread.h" -#include "SocketHandler.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -class Socket; - -/** Detached socket run thread. - \ingroup internal */ -class SocketThread : public Thread -{ -public: - SocketThread(Socket *p); - ~SocketThread(); - - void Run(); - -private: - SocketThread(const SocketThread& s) : m_socket(s.m_socket) {} - SocketThread& operator=(const SocketThread& ) { - return *this; - } - - SocketHandler m_h; - Socket *m_socket; -}; - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - -#endif // ENABLE_DETACH - -#endif // _SOCKETTHREAD_H diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Sockets-config b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Sockets-config deleted file mode 100755 index 18f9a6596c8bc8394eb766f64605f8bce74d9880..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10413 zcmeHNeQ=b=ect!(J?UN~gpdFW5cV0whmAQ&AgJUJ^C1Z=BR(R)mJRXC>F#uQ*6Hqi z_Z|qEHYQgbG>UBOWTtMNNw71Mv@;~76FZXxPf7+iY1+)xZYDEnCeyf0lgI<{P#b&P z3E}!Y`yoyWowomWSk2z<v%hD5yZhUHSMP7%{bX<d4$HEH2|nQ$L~Va!2Ro2nT&g4; zA|xEKMywJmL=}oC>v#$r#1JYl22f@r`VkKRA2?|T85@BaDMPW0NQ6LL#$dG&jI1x} zmHb+r5ZAt72N~C(QX3-MrQC-kI1llQsEarS%t$%gU`&FaMB9u#z>G$=@0VWe1(08O z+72=<fQ-?|KL$DA?**fO0P@QI)uJ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/src/foreign/sockets-2.3.9.4/Sockets-config.cpp deleted file mode 100755 index 7311147c8fc..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Sockets-config.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/** - ** \file Sockets-config.cpp - ** \date 2006-09-04 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007 Anders Hedstrom - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include <stdio.h> -#include <string.h> -#include "sockets-config.h" -#include "socket_include.h" - -int main(int argc,char *argv[]) -{ - if (argc > 1 && !strcmp(argv[1], "-info")) - { -#ifdef HAVE_OPENSSL - printf("SSL support\n"); -#endif -#ifdef IPPROTO_IPV6 - printf("IPv6 support\n"); -#endif -#ifdef USE_SCTP -#ifdef IPPROTO_SCTP - printf("SCTP support\n"); -# ifdef HAVE_SCTP - printf(" HAVE_SCTP: yes\n"); -# else - printf(" HAVE_SCTP: no\n"); -# endif -# ifdef HAVE_KERNEL_SCTP - printf(" HAVE_KERNEL_SCTP: yes\n"); -# else - printf(" HAVE_KERNEL_SCTP: no\n"); -# endif -# ifdef HAVE_SCTP_PRSCTP - printf(" HAVE_SCTP_PRSCTP: yes\n"); -# else - printf(" HAVE_SCTP_PRSCTP: no\n"); -# endif -# ifdef HAVE_SCTP_ADDIP - printf(" HAVE_SCTP_ADDIP: yes\n"); -# else - printf(" HAVE_SCTP_ADDIP: no\n"); -# endif -# ifdef HAVE_SCTP_CANSET_PRIMARY - printf(" HAVE_SCTP_CANSETPRIMARY: yes\n"); -# else - printf(" HAVE_SCTP_CANSETPRIMARY: no\n"); -# endif -# ifdef HAVE_SCTP_SAT_NETWORK_CAPABILITY - printf(" HAVE_SCTP_SAT_NETWORK_CAPABILITY: yes\n"); -# else - printf(" HAVE_SCTP_SAT_NETWORK_CAPABILITY: no\n"); -# endif -# ifdef HAVE_SCTP_MULTIBUF - printf(" HAVE_SCTP_MULTIBUF: yes\n"); -# else - printf(" HAVE_SCTP_MULTIBUF: no\n"); -# endif -# ifdef HAVE_SCTP_NOCONNECT - printf(" HAVE_SCTP_NOCONNECT: yes\n"); -# else - printf(" HAVE_SCTP_NOCONNECT: no\n"); -# endif -# ifdef HAVE_SCTP_EXT_RCVINFO - printf(" HAVE_SCTP_EXT_RCVINFO: yes\n"); -# else - printf(" HAVE_SCTP_EXT_RCVINFO: no\n"); -# endif -#else - printf("No SCTP support\n"); -#endif -#endif - return 0; - } - printf(" -D_VERSION='\"%s\"'", _VERSION); - -#ifdef LINUX - printf(" -DLINUX"); -#endif -#ifdef MACOSX - printf(" -DMACOSX"); -#endif -#ifdef SOLARIS - printf(" -DSOLARIS"); -#endif -#ifdef SOLARIS8 - printf(" -DSOLARIS8"); -#endif -#ifdef _WIN32 - printf(" -D_WIN32"); -#endif -#ifdef __CYGWIN__ - printf(" -D__CYGWIN__"); -#endif -#ifdef SOCKETS_NAMESPACE - printf(" -DSOCKETS_NAMESPACE=%s", SOCKETS_NAMESPACE_STR); -#endif -#ifdef _DEBUG - printf(" -D_DEBUG"); -#endif - -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StdLog.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StdLog.h deleted file mode 100755 index 0ce120ca365..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StdLog.h +++ /dev/null @@ -1,76 +0,0 @@ -/** \file StdLog.h - ** \date 2004-06-01 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_StdLog_H -#define _SOCKETS_StdLog_H - -#include "sockets-config.h" -#include <string> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -/** error level enum. */ -typedef enum { - LOG_LEVEL_INFO = 0, - LOG_LEVEL_WARNING, - LOG_LEVEL_ERROR, - LOG_LEVEL_FATAL -} loglevel_t; - - -class ISocketHandler; -class Socket; - -/** \defgroup logging Log help classes */ -/** Log class interface. - \ingroup logging */ -class StdLog -{ -public: - virtual ~StdLog() {} - - virtual void error(ISocketHandler *,Socket *, - const std::string& user_text, - int err, - const std::string& sys_err, - loglevel_t = LOG_LEVEL_WARNING) = 0; -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_StdLog_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StdoutLog.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StdoutLog.cpp deleted file mode 100755 index 4cd199a991c..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StdoutLog.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/** \file StdoutLog.cpp - ** \date 2004-06-01 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif - -#include <stdio.h> -#include "ISocketHandler.h" -#include "StdoutLog.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - - - -void StdoutLog::error(ISocketHandler *,Socket *sock,const std::string& call,int err,const std::string& sys_err,loglevel_t lvl) -{ - if (lvl < m_min_level) - return; - char dt[40]; - time_t t = time(NULL); -#ifdef __CYGWIN__ - struct tm *tp = localtime(&t); - sprintf(dt, "%d-%02d-%02d %02d:%02d:%02d", - tp -> tm_year + 1900, - tp -> tm_mon + 1, - tp -> tm_mday, - tp -> tm_hour,tp -> tm_min,tp -> tm_sec); -#else - struct tm tp; -#if defined( _WIN32) && !defined(__CYGWIN__) - localtime_s(&tp, &t); -#else - localtime_r(&t, &tp); -#endif - sprintf(dt, "%d-%02d-%02d %02d:%02d:%02d", - tp.tm_year + 1900, - tp.tm_mon + 1, - tp.tm_mday, - tp.tm_hour,tp.tm_min,tp.tm_sec); -#endif - std::string level; - - switch (lvl) - { - case LOG_LEVEL_WARNING: - level = "Warning"; - break; - case LOG_LEVEL_ERROR: - level = "Error"; - break; - case LOG_LEVEL_FATAL: - level = "Fatal"; - break; - case LOG_LEVEL_INFO: - level = "Info"; - break; - } - if (sock) - { - printf("%s :: fd %d :: %s: %d %s (%s)\n", - dt, - sock -> GetSocket(), - call.c_str(),err,sys_err.c_str(),level.c_str()); - } - else - { - printf("%s :: %s: %d %s (%s)\n", - dt, - call.c_str(),err,sys_err.c_str(),level.c_str()); - } -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StdoutLog.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StdoutLog.h deleted file mode 100755 index dc407848645..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StdoutLog.h +++ /dev/null @@ -1,64 +0,0 @@ -/** \file StdoutLog.h - ** \date 2004-06-01 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_StdoutLog_H -#define _SOCKETS_StdoutLog_H - -#include "sockets-config.h" -#include "StdLog.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -/** StdLog implementation, logs to stdout. - \ingroup logging */ -class StdoutLog : public StdLog -{ -public: - StdoutLog(loglevel_t min_level = LOG_LEVEL_INFO) : m_min_level(min_level) {} - void error(ISocketHandler *,Socket *,const std::string& call,int err,const std::string& sys_err,loglevel_t); - -private: - loglevel_t m_min_level; -}; - - - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_StdoutLog_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StreamSocket.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StreamSocket.cpp deleted file mode 100755 index 646b1f88b5a..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StreamSocket.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/** - ** \file StreamSocket.cpp - ** \date 2008-12-20 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2008-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "StreamSocket.h" -#include "ISocketHandler.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -StreamSocket::StreamSocket(ISocketHandler& h) : Socket(h) -,m_bConnecting(false) -,m_connect_timeout(5) -,m_flush_before_close(true) -,m_connection_retry(0) -,m_retries(0) -,m_line_protocol(false) -,m_shutdown(0) -{ -} - - -StreamSocket::~StreamSocket() -{ -} - - -void StreamSocket::SetConnecting(bool x) -{ - if (x != m_bConnecting) - { - m_bConnecting = x; - if (x) - { - SetTimeout( GetConnectTimeout() ); - } - else - { - SetTimeout( 0 ); - } - } -} - - -bool StreamSocket::Connecting() -{ - return m_bConnecting; -} - - -bool StreamSocket::Ready() -{ - if (GetSocket() != INVALID_SOCKET && !Connecting() && !CloseAndDelete()) - return true; - return false; -} - - -void StreamSocket::SetConnectTimeout(int x) -{ - m_connect_timeout = x; -} - - -int StreamSocket::GetConnectTimeout() -{ - return m_connect_timeout; -} - - -void StreamSocket::SetFlushBeforeClose(bool x) -{ - m_flush_before_close = x; -} - - -bool StreamSocket::GetFlushBeforeClose() -{ - return m_flush_before_close; -} - - -int StreamSocket::GetConnectionRetry() -{ - return m_connection_retry; -} - - -void StreamSocket::SetConnectionRetry(int x) -{ - m_connection_retry = x; -} - - -int StreamSocket::GetConnectionRetries() -{ - return m_retries; -} - - -void StreamSocket::IncreaseConnectionRetries() -{ - m_retries++; -} - - -void StreamSocket::ResetConnectionRetries() -{ - m_retries = 0; -} - - -void StreamSocket::SetLineProtocol(bool x) -{ - m_line_protocol = x; -} - - -bool StreamSocket::LineProtocol() -{ - return m_line_protocol; -} - - -void StreamSocket::SetShutdown(int x) -{ - m_shutdown = x; -} - - -int StreamSocket::GetShutdown() -{ - return m_shutdown; -} - - - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StreamSocket.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StreamSocket.h deleted file mode 100755 index 367b1f12839..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StreamSocket.h +++ /dev/null @@ -1,142 +0,0 @@ -/** - ** \file StreamSocket.h - ** \date 2008-12-20 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2008-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _StreamSocket_H -#define _StreamSocket_H - -#include "Socket.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -/** SOCK_STREAM Socket base class. - \ingroup basic */ -class StreamSocket : public Socket -{ -public: - StreamSocket(ISocketHandler& ); - ~StreamSocket(); - - /** Socket should Check Connect on next write event from select(). */ - void SetConnecting(bool = true); - - /** Check connecting flag. - \return true if the socket is still trying to connect */ - bool Connecting(); - - /** Returns true when socket file descriptor is valid, - socket connection is established, and socket is not about to - be closed. */ - bool Ready(); - - /** Set timeout to use for connection attempt. - \param x Timeout in seconds */ - void SetConnectTimeout(int x); - - /** Return number of seconds to wait for a connection. - \return Connection timeout (seconds) */ - int GetConnectTimeout(); - - /** Set flush before close to make a tcp socket completely empty its - output buffer before closing the connection. */ - void SetFlushBeforeClose(bool = true); - - /** Check flush before status. - \return true if the socket should send all data before closing */ - bool GetFlushBeforeClose(); - - /** Define number of connection retries (tcp only). - n = 0 - no retry - n > 0 - number of retries - n = -1 - unlimited retries */ - void SetConnectionRetry(int n); - - /** Get number of maximum connection retries (tcp only). */ - int GetConnectionRetry(); - - /** Increase number of actual connection retries (tcp only). */ - void IncreaseConnectionRetries(); - - /** Get number of actual connection retries (tcp only). */ - int GetConnectionRetries(); - - /** Reset actual connection retries (tcp only). */ - void ResetConnectionRetries(); - - /** Called after OnRead if socket is in line protocol mode. - \sa SetLineProtocol */ - /** Enable the OnLine callback. Do not create your own OnRead - * callback when using this. */ - virtual void SetLineProtocol(bool = true); - - /** Check line protocol mode. - \return true if socket is in line protocol mode */ - bool LineProtocol(); - - /** Set shutdown status. */ - void SetShutdown(int); - - /** Get shutdown status. */ - int GetShutdown(); - - /** Returns IPPROTO_TCP or IPPROTO_SCTP */ - virtual int Protocol() = 0; - -protected: - StreamSocket(const StreamSocket& ) {} // copy constructor - -private: - StreamSocket& operator=(const StreamSocket& ) { - return *this; // assignment operator - } - - bool m_bConnecting; ///< Flag indicating connection in progress - int m_connect_timeout; ///< Connection timeout (seconds) - bool m_flush_before_close; ///< Send all data before closing (default true) - int m_connection_retry; ///< Maximum connection retries (tcp) - int m_retries; ///< Actual number of connection retries (tcp) - bool m_line_protocol; ///< Line protocol mode flag - int m_shutdown; ///< Shutdown status -}; - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - - -#endif // _StreamSocket_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StreamWriter.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StreamWriter.cpp deleted file mode 100755 index 6c1bd385eaa..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StreamWriter.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/** - ** \file StreamWriter.cpp - ** \date 2008-12-20 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2008-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "StreamWriter.h" -#include "IStream.h" -#include "Utility.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -StreamWriter::StreamWriter(IStream& stream) : m_stream(stream) -{ -} - - -StreamWriter& StreamWriter::operator<<(const char *buf) -{ - m_stream.IStreamWrite(buf, strlen(buf)); - return *this; -} - - -StreamWriter& StreamWriter::operator<<(const std::string& str) -{ - m_stream.IStreamWrite(str.c_str(), str.size()); - return *this; -} - - -StreamWriter& StreamWriter::operator<<(short x) -{ - *this << Utility::l2string(x); - return *this; -} - - -StreamWriter& StreamWriter::operator<<(int x) -{ - *this << Utility::l2string(x); - return *this; -} - - -StreamWriter& StreamWriter::operator<<(long x) -{ - *this << Utility::l2string(x); - return *this; -} - - -//StreamWriter& StreamWriter::operator<<(int64_t x) -StreamWriter& StreamWriter::operator<<(long long x) -{ - *this << Utility::bigint2string(x); - return *this; -} - - -StreamWriter& StreamWriter::operator<<(double x) -{ - *this << Utility::ToString(x); - return *this; -} - - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StreamWriter.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StreamWriter.h deleted file mode 100755 index ad24ada9023..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/StreamWriter.h +++ /dev/null @@ -1,70 +0,0 @@ -/** - ** \file StreamWriter.h - ** \date 2008-12-20 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2008-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _STREAMWRITER_H -#define _STREAMWRITER_H - -#include "sockets-config.h" -#include <string> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -class IStream; - -class StreamWriter -{ -public: - StreamWriter(IStream& stream); - virtual ~StreamWriter() {} - - StreamWriter& operator<<(const char *); - StreamWriter& operator<<(const std::string&); - StreamWriter& operator<<(short); - StreamWriter& operator<<(int); - StreamWriter& operator<<(long); - StreamWriter& operator<<(long long); - //StreamWriter& operator<<(int64_t); - StreamWriter& operator<<(double); - -private: - IStream& m_stream; - -}; - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - -#endif // _STREAMWRITER_H diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/TcpSocket.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/TcpSocket.cpp deleted file mode 100755 index c6d221529a4..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/TcpSocket.cpp +++ /dev/null @@ -1,1851 +0,0 @@ -/** \file TcpSocket.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _WIN32 -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include <stdlib.h> -#else -#include <errno.h> -#endif -#include "ISocketHandler.h" -#include <fcntl.h> -#include <assert.h> -#include <stdio.h> -#include <stdarg.h> -#ifdef HAVE_OPENSSL -#include <openssl/rand.h> -#include <openssl/err.h> -#endif -#include <map> - -#include "TcpSocket.h" -#include "Utility.h" -#include "Ipv4Address.h" -#include "Ipv6Address.h" -#include "IFile.h" -#include "Lock.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -#ifdef _DEBUG -#define DEB(x) x -#else -#define DEB(x) -#endif - - -// statics -#ifdef HAVE_OPENSSL -SSLInitializer TcpSocket::m_ssl_init; -Mutex TcpSocket::m_server_ssl_mutex; -std::map<std::string, SSL_CTX *> TcpSocket::m_client_contexts; -std::map<std::string, SSL_CTX *> TcpSocket::m_server_contexts; -#endif - - -// thanks, q -#ifdef _MSC_VER -#pragma warning(disable:4355) -#endif -TcpSocket::TcpSocket(ISocketHandler& h) : StreamSocket(h) -,ibuf(TCP_BUFSIZE_READ) -,m_b_input_buffer_disabled(false) -,m_bytes_sent(0) -,m_bytes_received(0) -,m_skip_c(false) -,m_line(Handler().MaxTcpLineSize()) -,m_line_ptr(0) -#ifdef SOCKETS_DYNAMIC_TEMP -,m_buf(new char[TCP_BUFSIZE_READ + 1]) -#endif -,m_obuf_top(NULL) -,m_transfer_limit(0) -,m_output_length(0) -,m_repeat_length(0) -#ifdef HAVE_OPENSSL -,m_ssl_ctx(NULL) -,m_ssl(NULL) -,m_sbio(NULL) -#endif -#ifdef ENABLE_SOCKS4 -,m_socks4_state(0) -#endif -#ifdef ENABLE_RESOLVER -,m_resolver_id(0) -#endif -#ifdef ENABLE_RECONNECT -,m_b_reconnect(false) -,m_b_is_reconnect(false) -#endif -{ -} -#ifdef _MSC_VER -#pragma warning(default:4355) -#endif - - -#ifdef _MSC_VER -#pragma warning(disable:4355) -#endif -TcpSocket::TcpSocket(ISocketHandler& h,size_t isize,size_t osize) : StreamSocket(h) -,ibuf(isize) -,m_b_input_buffer_disabled(false) -,m_bytes_sent(0) -,m_bytes_received(0) -,m_skip_c(false) -,m_line(Handler().MaxTcpLineSize()) -,m_line_ptr(0) -#ifdef SOCKETS_DYNAMIC_TEMP -,m_buf(new char[TCP_BUFSIZE_READ + 1]) -#endif -,m_obuf_top(NULL) -,m_transfer_limit(0) -,m_output_length(0) -,m_repeat_length(0) -#ifdef HAVE_OPENSSL -,m_ssl_ctx(NULL) -,m_ssl(NULL) -,m_sbio(NULL) -#endif -#ifdef ENABLE_SOCKS4 -,m_socks4_state(0) -#endif -#ifdef ENABLE_RESOLVER -,m_resolver_id(0) -#endif -#ifdef ENABLE_RECONNECT -,m_b_reconnect(false) -,m_b_is_reconnect(false) -#endif -{ -} -#ifdef _MSC_VER -#pragma warning(default:4355) -#endif - - -TcpSocket::~TcpSocket() -{ -#ifdef SOCKETS_DYNAMIC_TEMP - delete[] m_buf; -#endif - // %! empty m_obuf - while (m_obuf.size()) - { - output_l::iterator it = m_obuf.begin(); - OUTPUT *p = *it; - delete p; - m_obuf.erase(it); - } -#ifdef HAVE_OPENSSL - if (m_ssl) - { - SSL_free(m_ssl); - } -#endif -} - - -bool TcpSocket::Open(ipaddr_t ip,port_t port,bool skip_socks) -{ - Ipv4Address ad(ip, port); - Ipv4Address local; - return Open(ad, local, skip_socks); -} - - -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 -bool TcpSocket::Open(in6_addr ip,port_t port,bool skip_socks) -{ - Ipv6Address ad(ip, port); - return Open(ad, skip_socks); -} -#endif -#endif - - -bool TcpSocket::Open(SocketAddress& ad,bool skip_socks) -{ - Ipv4Address bind_ad("0.0.0.0", 0); - return Open(ad, bind_ad, skip_socks); -} - - -bool TcpSocket::Open(SocketAddress& ad,SocketAddress& bind_ad,bool skip_socks) -{ - if (!ad.IsValid()) - { - Handler().LogError(this, "Open", 0, "Invalid SocketAddress", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - return false; - } - if (Handler().GetCount() >= Handler().MaxCount()) - { - Handler().LogError(this, "Open", 0, "no space left for more sockets", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - return false; - } - SetConnecting(false); -#ifdef ENABLE_SOCKS4 - SetSocks4(false); -#endif - // check for pooling -#ifdef ENABLE_POOL - if (Handler().PoolEnabled()) - { - ISocketHandler::PoolSocket *pools = Handler().FindConnection(SOCK_STREAM, "tcp", ad); - if (pools) - { - CopyConnection( pools ); - delete pools; - - SetIsClient(); - SetCallOnConnect(); // ISocketHandler must call OnConnect - Handler().LogError(this, "SetCallOnConnect", 0, "Found pooled connection", LOG_LEVEL_INFO); - return true; - } - } -#endif - // if not, create new connection - SOCKET s = CreateSocket(ad.GetFamily(), SOCK_STREAM, "tcp"); - if (s == INVALID_SOCKET) - { - return false; - } - // socket must be nonblocking for async connect - if (!SetNonblocking(true, s)) - { - SetCloseAndDelete(); - closesocket(s); - return false; - } -#ifdef ENABLE_POOL - SetIsClient(); // client because we connect -#endif - SetClientRemoteAddress(ad); - int n = 0; - if (bind_ad.GetPort() != 0) - { - bind(s, bind_ad, bind_ad); - } -#ifdef ENABLE_SOCKS4 - if (!skip_socks && GetSocks4Host() && GetSocks4Port()) - { - Ipv4Address sa(GetSocks4Host(), GetSocks4Port()); - { - std::string sockshost; - Utility::l2ip(GetSocks4Host(), sockshost); - Handler().LogError(this, "Open", 0, "Connecting to socks4 server @ " + sockshost + ":" + - Utility::l2string(GetSocks4Port()), LOG_LEVEL_INFO); - } - SetSocks4(); - n = connect(s, sa, sa); - SetRemoteAddress(sa); - } - else -#endif - { - n = connect(s, ad, ad); - SetRemoteAddress(ad); - } - if (n == -1) - { - // check error code that means a connect is in progress -#ifdef _WIN32 - if (Errno == WSAEWOULDBLOCK) -#else - if (Errno == EINPROGRESS) -#endif - { - Attach(s); - SetConnecting( true ); // this flag will control fd_set's - } - else -#ifdef ENABLE_SOCKS4 - if (Socks4() && Handler().Socks4TryDirect() ) // retry - { - closesocket(s); - return Open(ad, true); - } - else -#endif -#ifdef ENABLE_RECONNECT - if (Reconnect()) - { - Handler().LogError(this, "connect: failed, reconnect pending", Errno, StrError(Errno), LOG_LEVEL_INFO); - Attach(s); - SetConnecting( true ); // this flag will control fd_set's - } - else -#endif - { - Handler().LogError(this, "connect: failed", Errno, StrError(Errno), LOG_LEVEL_FATAL); - SetCloseAndDelete(); - closesocket(s); - return false; - } - } - else - { - Attach(s); - SetCallOnConnect(); // ISocketHandler must call OnConnect - } - - // 'true' means connected or connecting(not yet connected) - // 'false' means something failed - return true; //!Connecting(); -} - - -bool TcpSocket::Open(const std::string &host,port_t port) -{ -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { -#ifdef ENABLE_RESOLVER - if (!Handler().ResolverEnabled() || Utility::isipv6(host) ) - { -#endif - in6_addr a; - if (!Utility::u2ip(host, a)) - { - SetCloseAndDelete(); - return false; - } - Ipv6Address ad(a, port); - Ipv6Address local; - return Open(ad, local); -#ifdef ENABLE_RESOLVER - } - m_resolver_id = Resolve6(host, port); - return true; -#endif - } -#endif -#endif -#ifdef ENABLE_RESOLVER - if (!Handler().ResolverEnabled() || Utility::isipv4(host) ) - { -#endif - ipaddr_t l; - if (!Utility::u2ip(host,l)) - { - SetCloseAndDelete(); - return false; - } - Ipv4Address ad(l, port); - Ipv4Address local; - return Open(ad, local); -#ifdef ENABLE_RESOLVER - } - // resolve using async resolver thread - m_resolver_id = Resolve(host, port); - return true; -#endif -} - - -#ifdef ENABLE_RESOLVER -void TcpSocket::OnResolved(int id,ipaddr_t a,port_t port) -{ -DEB( fprintf(stderr, "TcpSocket::OnResolved id %d addr %x port %d\n", id, a, port);) - if (id == m_resolver_id) - { - if (a && port) - { - Ipv4Address ad(a, port); - Ipv4Address local; - if (Open(ad, local)) - { - if (!Handler().Valid(this)) - { - Handler().Add(this); - } - } - } - else - { - Handler().LogError(this, "OnResolved", 0, "Resolver failed", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } - } - else - { - Handler().LogError(this, "OnResolved", id, "Resolver returned wrong job id", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } -} - - -#ifdef ENABLE_IPV6 -void TcpSocket::OnResolved(int id,in6_addr& a,port_t port) -{ - if (id == m_resolver_id) - { - Ipv6Address ad(a, port); - if (ad.IsValid()) - { - Ipv6Address local; - if (Open(ad, local)) - { - if (!Handler().Valid(this)) - { - Handler().Add(this); - } - } - } - } - else - { - Handler().LogError(this, "OnResolved", id, "Resolver returned wrong job id", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } -} -#endif -#endif - - -void TcpSocket::OnRead() -{ - int n = 0; -#ifdef SOCKETS_DYNAMIC_TEMP - char *buf = m_buf; -#else - char buf[TCP_BUFSIZE_READ]; -#endif -#ifdef HAVE_OPENSSL - if (IsSSL()) - { - if (!Ready()) - return; - n = SSL_read(m_ssl, buf, TCP_BUFSIZE_READ); - if (n == -1) - { - n = SSL_get_error(m_ssl, n); - switch (n) - { - case SSL_ERROR_NONE: - case SSL_ERROR_WANT_READ: - case SSL_ERROR_WANT_WRITE: - break; - case SSL_ERROR_ZERO_RETURN: -DEB( fprintf(stderr, "SSL_read() returns zero - closing socket\n");) - OnDisconnect(); - OnDisconnect(TCP_DISCONNECT_SSL|TCP_DISCONNECT_ERROR, n); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - break; - default: -DEB( fprintf(stderr, "SSL read problem, errcode = %d\n",n);) - OnDisconnect(); - OnDisconnect(TCP_DISCONNECT_SSL|TCP_DISCONNECT_ERROR, n); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - } - return; - } - else - if (!n) - { -DEB( n = SSL_get_error(m_ssl, n); - fprintf(stderr, "SSL_read returns 0, SSL_get_error: %d\n", n); - if (n == SSL_ERROR_SYSCALL) - { - fprintf(stderr, "ERR_get_error() returns %ld\n", ERR_get_error()); - perror("errno: SSL_read"); - }) - OnDisconnect(); - OnDisconnect(TCP_DISCONNECT_SSL, 0); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - SetShutdown(SHUT_WR); - return; - } - else - if (n > 0 && n <= TCP_BUFSIZE_READ) - { - m_bytes_received += n; - if (GetTrafficMonitor()) - { - GetTrafficMonitor() -> fwrite(buf, 1, n); - } - if (!m_b_input_buffer_disabled && !ibuf.Write(buf,n)) - { - Handler().LogError(this, "OnRead(ssl)", 0, "ibuf overflow", LOG_LEVEL_WARNING); - } - } - else - { - Handler().LogError(this, "OnRead(ssl)", n, "abnormal value from SSL_read", LOG_LEVEL_ERROR); - } - } - else -#endif // HAVE_OPENSSL - { - n = recv(GetSocket(), buf, TCP_BUFSIZE_READ, MSG_NOSIGNAL); - if (n == -1) - { - Handler().LogError(this, "read", Errno, StrError(Errno), LOG_LEVEL_FATAL); - OnDisconnect(); - OnDisconnect(TCP_DISCONNECT_ERROR, Errno); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - return; - } - else - if (!n) - { - OnDisconnect(); - OnDisconnect(0, 0); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - SetShutdown(SHUT_WR); - return; - } - else - if (n > 0 && n <= TCP_BUFSIZE_READ) - { - m_bytes_received += n; - if (GetTrafficMonitor()) - { - GetTrafficMonitor() -> fwrite(buf, 1, n); - } - if (!m_b_input_buffer_disabled && !ibuf.Write(buf,n)) - { - Handler().LogError(this, "OnRead", 0, "ibuf overflow", LOG_LEVEL_WARNING); - } - } - else - { - Handler().LogError(this, "OnRead", n, "abnormal value from recv", LOG_LEVEL_ERROR); - } - } - // - OnRead( buf, n ); -} - - -void TcpSocket::OnRead( char *buf, size_t n ) -{ - // unbuffered - if (n > 0 && n <= TCP_BUFSIZE_READ) - { - if (LineProtocol()) - { - buf[n] = 0; - size_t i = 0; - if (m_skip_c && (buf[i] == 13 || buf[i] == 10) && buf[i] != m_c) - { - m_skip_c = false; - i++; - } - size_t x = i; - for (; i < n && LineProtocol(); i++) - { - while ((buf[i] == 13 || buf[i] == 10) && LineProtocol()) - { - char c = buf[i]; - buf[i] = 0; - if (buf[x]) - { - size_t sz = strlen(&buf[x]); - if (m_line_ptr + sz < Handler().MaxTcpLineSize()) - { - memcpy(&m_line[m_line_ptr], &buf[x], sz); - m_line_ptr += sz; - } - else - { - Handler().LogError(this, "TcpSocket::OnRead", (int)(m_line_ptr + sz), "maximum tcp_line_size exceeded, connection closed", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } - } - if (m_line_ptr > 0) - OnLine( std::string(&m_line[0], m_line_ptr) ); - else - OnLine( "" ); - i++; - m_skip_c = true; - m_c = c; - if (i < n && (buf[i] == 13 || buf[i] == 10) && buf[i] != c) - { - m_skip_c = false; - i++; - } - x = i; - m_line_ptr = 0; - } - if (!LineProtocol()) - { - break; - } - } - if (!LineProtocol()) - { - if (i < n) - { - OnRawData(buf + i, n - i); - } - } - else - if (buf[x]) - { - size_t sz = strlen(&buf[x]); - if (m_line_ptr + sz < Handler().MaxTcpLineSize()) - { - memcpy(&m_line[m_line_ptr], &buf[x], sz); - m_line_ptr += sz; - } - else - { - Handler().LogError(this, "TcpSocket::OnRead", (int)(m_line_ptr + sz), "maximum tcp_line_size exceeded, connection closed", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } - } - } - else - { - OnRawData(buf, n); - } - } - if (m_b_input_buffer_disabled) - { - return; - } - // further processing: socks4 -#ifdef ENABLE_SOCKS4 - if (Socks4()) - { - bool need_more = false; - while (GetInputLength() && !need_more && !CloseAndDelete()) - { - need_more = OnSocks4Read(); - } - } -#endif -} - - -void TcpSocket::OnWriteComplete() -{ -} - - -void TcpSocket::OnWrite() -{ - if (Connecting()) - { - int err = SoError(); - - // don't reset connecting flag on error here, we want the OnConnectFailed timeout later on - if (!err) // ok - { - Handler().ISocketHandler_Mod(this, !IsDisableRead(), false); - SetConnecting(false); - SetCallOnConnect(); - return; - } - Handler().LogError(this, "tcp: connect failed", err, StrError(err), LOG_LEVEL_FATAL); - Handler().ISocketHandler_Mod(this, false, false); // no more monitoring because connection failed - - // failed -#ifdef ENABLE_SOCKS4 - if (Socks4()) - { - // %! leave 'Connecting' flag set? - OnSocks4ConnectFailed(); - return; - } -#endif - if (GetConnectionRetry() == -1 || - (GetConnectionRetry() && GetConnectionRetries() < GetConnectionRetry()) ) - { - // even though the connection failed at once, only retry after - // the connection timeout. - // should we even try to connect again, when CheckConnect returns - // false it's because of a connection error - not a timeout... - return; - } - SetConnecting(false); - SetCloseAndDelete( true ); - /// \todo state reason why connect failed - OnConnectFailed(); - return; - } - - SendFromOutputBuffer(); -} - - -void TcpSocket::SendFromOutputBuffer() -{ - // try send next block in buffer - // if full block is sent, repeat - // if all blocks are sent, reset m_wfds - - bool repeat = false; - size_t sz = m_transfer_limit ? GetOutputLength() : 0; - do - { - if (m_obuf.empty()) - { - Handler().LogError(this, "OnWrite", (int)m_output_length, "Empty output buffer in OnWrite", LOG_LEVEL_ERROR); - break; - } - output_l::iterator it = m_obuf.begin(); - OUTPUT *p = *it; - repeat = false; - int n = TryWrite(p -> Buf(), p -> Len()); - if (n > 0) - { - size_t left = p -> Remove(n); - m_output_length -= n; - if (!left) - { - delete p; - m_obuf.erase(it); - if (!m_obuf.size()) - { - m_obuf_top = NULL; - OnWriteComplete(); - } - else - { - repeat = true; - } - } - } - } while (repeat); - - if (m_transfer_limit && sz > m_transfer_limit && GetOutputLength() < m_transfer_limit) - { - OnTransferLimit(); - } - - // check output buffer set, set/reset m_wfds accordingly - { - bool br = !IsDisableRead(); - if (m_obuf.size()) - Handler().ISocketHandler_Mod(this, br, true); - else - Handler().ISocketHandler_Mod(this, br, false); - } -} - - -int TcpSocket::TryWrite(const char *buf, size_t len) -{ - int n = 0; -#ifdef HAVE_OPENSSL - if (IsSSL()) - { - n = SSL_write(m_ssl, buf, (int)(m_repeat_length ? m_repeat_length : len)); - if (n == -1) - { - int errnr = SSL_get_error(m_ssl, n); - if ( errnr == SSL_ERROR_WANT_READ || errnr == SSL_ERROR_WANT_WRITE ) - { - m_repeat_length = m_repeat_length ? m_repeat_length : len; - } - else - { - OnDisconnect(); - OnDisconnect(TCP_DISCONNECT_WRITE|TCP_DISCONNECT_ERROR|TCP_DISCONNECT_SSL, errnr); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - { - char errbuf[256]; - ERR_error_string_n(errnr, errbuf, 256); - Handler().LogError(this, "OnWrite/SSL_write", errnr, errbuf, LOG_LEVEL_FATAL); - } - } - return 0; - } - else - if (!n) - { - OnDisconnect(); - OnDisconnect(TCP_DISCONNECT_WRITE|TCP_DISCONNECT_SSL, 0); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - } - m_repeat_length = 0; - } - else -#endif // HAVE_OPENSSL - { - n = send(GetSocket(), buf, (int)len, MSG_NOSIGNAL); - if (n == -1) - { - // normal error codes: - // WSAEWOULDBLOCK - // EAGAIN or EWOULDBLOCK -#ifdef _WIN32 - if (Errno != WSAEWOULDBLOCK) -#else - if (Errno != EWOULDBLOCK) -#endif - { - Handler().LogError(this, "send", Errno, StrError(Errno), LOG_LEVEL_FATAL); - OnDisconnect(); - OnDisconnect(TCP_DISCONNECT_WRITE|TCP_DISCONNECT_ERROR, Errno); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - } - return 0; - } - } - if (n > 0) - { - m_bytes_sent += n; - if (GetTrafficMonitor()) - { - GetTrafficMonitor() -> fwrite(buf, 1, n); - } - } - return n; -} - - -void TcpSocket::Buffer(const char *buf, size_t len) -{ - size_t ptr = 0; - m_output_length += len; - while (ptr < len) - { - // buf/len => pbuf/sz - size_t space = 0; - if ((space = m_obuf_top ? m_obuf_top -> Space() : 0) > 0) - { - const char *pbuf = buf + ptr; - size_t sz = len - ptr; - if (space >= sz) - { - m_obuf_top -> Add(pbuf, sz); - ptr += sz; - } - else - { - m_obuf_top -> Add(pbuf, space); - ptr += space; - } - } - else - { - m_obuf_top = new OUTPUT; - m_obuf.push_back( m_obuf_top ); - } - } -} - - -void TcpSocket::Send(const std::string &str,int i) -{ - SendBuf(str.c_str(),str.size(),i); -} - - -void TcpSocket::SendBuf(const char *buf,size_t len,int) -{ - if (!Ready() && !Connecting()) - { - Handler().LogError(this, "SendBuf", -1, "Attempt to write to a non-ready socket" ); // warning - if (GetSocket() == INVALID_SOCKET) - Handler().LogError(this, "SendBuf", 0, " * GetSocket() == INVALID_SOCKET", LOG_LEVEL_INFO); - if (Connecting()) - Handler().LogError(this, "SendBuf", 0, " * Connecting()", LOG_LEVEL_INFO); - if (CloseAndDelete()) - Handler().LogError(this, "SendBuf", 0, " * CloseAndDelete()", LOG_LEVEL_INFO); - return; - } - if (!IsConnected()) - { - Handler().LogError(this, "SendBuf", -1, "Attempt to write to a non-connected socket, will be sent on connect" ); // warning - Buffer(buf, len); - return; - } - if (m_obuf_top) - { - Buffer(buf, len); - return; - } -#ifdef HAVE_OPENSSL - if (IsSSL()) - { - Buffer(buf, len); - SendFromOutputBuffer(); - return; - } -#endif - int n = TryWrite(buf, len); - if (n >= 0 && n < (int)len) - { - Buffer(buf + n, len - n); - } - // if ( data in buffer || !IsConnected ) - // { - // add to buffer - // } - // else - // try_send - // if any data is unsent, buffer it and set m_wfds - - // check output buffer set, set/reset m_wfds accordingly - { - bool br = !IsDisableRead(); - if (m_obuf.size()) - Handler().ISocketHandler_Mod(this, br, true); - else - Handler().ISocketHandler_Mod(this, br, false); - } -} - - -void TcpSocket::OnLine(const std::string& ) -{ -} - - -#ifdef _MSC_VER -#pragma warning(disable:4355) -#endif -TcpSocket::TcpSocket(const TcpSocket& s) -:StreamSocket(s) -,ibuf(0) -{ -} -#ifdef _MSC_VER -#pragma warning(default:4355) -#endif - - -#ifdef ENABLE_SOCKS4 -void TcpSocket::OnSocks4Connect() -{ - char request[1000]; - memset(request, 0, sizeof(request)); - request[0] = 4; // socks v4 - request[1] = 1; // command code: CONNECT - { - std::auto_ptr<SocketAddress> ad = GetClientRemoteAddress(); - if (ad.get()) - { - struct sockaddr *p0 = (struct sockaddr *)*ad; - struct sockaddr_in *p = (struct sockaddr_in *)p0; - if (p -> sin_family == AF_INET) - { - memcpy(request + 2, &p -> sin_port, 2); // nwbo is ok here - memcpy(request + 4, &p -> sin_addr, sizeof(struct in_addr)); - } - else - { - /// \todo warn - } - } - else - { - /// \todo warn - } - } -#if defined( _WIN32) && !defined(__CYGWIN__) - strcpy_s(request + 8, sizeof(request) - 8, GetSocks4Userid().c_str()); -#else - strcpy(request + 8, GetSocks4Userid().c_str()); -#endif - size_t length = GetSocks4Userid().size() + 8 + 1; - SendBuf(request, length); - m_socks4_state = 0; -} - - -void TcpSocket::OnSocks4ConnectFailed() -{ - Handler().LogError(this,"OnSocks4ConnectFailed",0,"connection to socks4 server failed, trying direct connection",LOG_LEVEL_WARNING); - if (!Handler().Socks4TryDirect()) - { - SetConnecting(false); - SetCloseAndDelete(); - OnConnectFailed(); // just in case - } - else - { - SetRetryClientConnect(); - } -} - - -bool TcpSocket::OnSocks4Read() -{ - switch (m_socks4_state) - { - case 0: - ibuf.Read(&m_socks4_vn, 1); - m_socks4_state = 1; - break; - case 1: - ibuf.Read(&m_socks4_cd, 1); - m_socks4_state = 2; - break; - case 2: - if (GetInputLength() > 1) - { - ibuf.Read( (char *)&m_socks4_dstport, 2); - m_socks4_state = 3; - } - else - { - return true; - } - break; - case 3: - if (GetInputLength() > 3) - { - ibuf.Read( (char *)&m_socks4_dstip, 4); - SetSocks4(false); - - switch (m_socks4_cd) - { - case 90: - OnConnect(); - Handler().LogError(this, "OnSocks4Read", 0, "Connection established", LOG_LEVEL_INFO); - break; - case 91: - case 92: - case 93: - Handler().LogError(this,"OnSocks4Read",m_socks4_cd,"socks4 server reports connect failed",LOG_LEVEL_FATAL); - SetConnecting(false); - SetCloseAndDelete(); - OnConnectFailed(); - break; - default: - Handler().LogError(this,"OnSocks4Read",m_socks4_cd,"socks4 server unrecognized response",LOG_LEVEL_FATAL); - SetCloseAndDelete(); - break; - } - } - else - { - return true; - } - break; - } - return false; -} -#endif - - -void TcpSocket::Sendf(const char *format, ...) -{ - va_list ap; - va_start(ap, format); - char slask[5000]; // vsprintf / vsnprintf temporary - vsnprintf(slask, sizeof(slask), format, ap); - va_end(ap); - Send( slask ); -} - - -#ifdef HAVE_OPENSSL -void TcpSocket::OnSSLConnect() -{ - SetNonblocking(true); - { - if (m_ssl_ctx) - { -DEB( fprintf(stderr, "SSL Context already initialized - closing socket\n");) - SetCloseAndDelete(true); - return; - } - InitSSLClient(); - } - if (m_ssl_ctx) - { - /* Connect the SSL socket */ - m_ssl = SSL_new(m_ssl_ctx); - if (!m_ssl) - { -DEB( fprintf(stderr, " m_ssl is NULL\n");) - SetCloseAndDelete(true); - return; - } - m_sbio = BIO_new_socket((int)GetSocket(), BIO_NOCLOSE); - if (!m_sbio) - { -DEB( fprintf(stderr, " m_sbio is NULL\n");) - SetCloseAndDelete(true); - return; - } - SSL_set_bio(m_ssl, m_sbio, m_sbio); - if (!SSLNegotiate()) - { - SetSSLNegotiate(); - } - } - else - { - SetCloseAndDelete(); - } -} - - -void TcpSocket::OnSSLAccept() -{ - SetNonblocking(true); - { - if (m_ssl_ctx) - { -DEB( fprintf(stderr, "SSL Context already initialized - closing socket\n");) - SetCloseAndDelete(true); - return; - } - InitSSLServer(); - SetSSLServer(); - } - if (m_ssl_ctx) - { - m_ssl = SSL_new(m_ssl_ctx); - if (!m_ssl) - { -DEB( fprintf(stderr, " m_ssl is NULL\n");) - SetCloseAndDelete(true); - return; - } - m_sbio = BIO_new_socket((int)GetSocket(), BIO_NOCLOSE); - if (!m_sbio) - { -DEB( fprintf(stderr, " m_sbio is NULL\n");) - SetCloseAndDelete(true); - return; - } - SSL_set_bio(m_ssl, m_sbio, m_sbio); -// if (!SSLNegotiate()) - { - SetSSLNegotiate(); - } - } -} - - -bool TcpSocket::SSLNegotiate() -{ - if (!IsSSLServer()) // client - { - int r = SSL_connect(m_ssl); - if (r > 0) - { - SetSSLNegotiate(false); - /// \todo: resurrect certificate check... client -// CheckCertificateChain( "");//ServerHOST); - SetConnected(); - if (GetOutputLength()) - { - OnWrite(); - } -#ifdef ENABLE_RECONNECT - if (IsReconnect()) - { - OnReconnect(); - } - else -#endif - { - OnConnect(); - } - Handler().LogError(this, "SSLNegotiate/SSL_connect", 0, "Connection established", LOG_LEVEL_INFO); - return true; - } - else - if (!r) - { - Handler().LogError(this, "SSLNegotiate/SSL_connect", 0, "Connection failed", LOG_LEVEL_INFO); - SetSSLNegotiate(false); - SetCloseAndDelete(); - OnSSLConnectFailed(); - } - else - { - r = SSL_get_error(m_ssl, r); - if (r != SSL_ERROR_WANT_READ && r != SSL_ERROR_WANT_WRITE) - { - Handler().LogError(this, "SSLNegotiate/SSL_connect", -1, "Connection failed", LOG_LEVEL_INFO); -DEB( fprintf(stderr, "SSL_connect() failed - closing socket, return code: %d\n",r);) - SetSSLNegotiate(false); - SetCloseAndDelete(true); - OnSSLConnectFailed(); - } - } - } - else // server - { - int r = SSL_accept(m_ssl); - if (r > 0) - { - SetSSLNegotiate(false); - /// \todo: resurrect certificate check... server -// CheckCertificateChain( "");//ClientHOST); - SetConnected(); - if (GetOutputLength()) - { - OnWrite(); - } - OnAccept(); - Handler().LogError(this, "SSLNegotiate/SSL_accept", 0, "Connection established", LOG_LEVEL_INFO); - return true; - } - else - if (!r) - { - Handler().LogError(this, "SSLNegotiate/SSL_accept", 0, "Connection failed", LOG_LEVEL_INFO); - SetSSLNegotiate(false); - SetCloseAndDelete(); - OnSSLAcceptFailed(); - } - else - { - r = SSL_get_error(m_ssl, r); - if (r != SSL_ERROR_WANT_READ && r != SSL_ERROR_WANT_WRITE) - { - Handler().LogError(this, "SSLNegotiate/SSL_accept", -1, "Connection failed", LOG_LEVEL_INFO); -DEB( fprintf(stderr, "SSL_accept() failed - closing socket, return code: %d\n",r);) - SetSSLNegotiate(false); - SetCloseAndDelete(true); - OnSSLAcceptFailed(); - } - } - } - return false; -} - - -void TcpSocket::InitSSLClient() -{ - InitializeContext("", SSLv23_method()); -} - - -void TcpSocket::InitSSLServer() -{ - Handler().LogError(this, "InitSSLServer", 0, "You MUST implement your own InitSSLServer method", LOG_LEVEL_FATAL); - SetCloseAndDelete(); -} - - -void TcpSocket::InitializeContext(const std::string& context, const SSL_METHOD *meth_in) -{ - static Mutex mutex; - Lock lock(mutex); - /* Create our context*/ - if (m_client_contexts.find(context) == m_client_contexts.end()) - { - SSL_METHOD *meth = const_cast<SSL_METHOD *>(meth_in) ? - const_cast<SSL_METHOD *>(meth_in) : const_cast<SSL_METHOD *>(SSLv3_method()); - m_ssl_ctx = m_client_contexts[context] = SSL_CTX_new(meth); - SSL_CTX_set_mode(m_ssl_ctx, SSL_MODE_AUTO_RETRY|SSL_MODE_ENABLE_PARTIAL_WRITE); - } - else - { - m_ssl_ctx = m_client_contexts[context]; - } -} - - -void TcpSocket::InitializeContext(const std::string& context,const std::string& keyfile,const std::string& password,const SSL_METHOD *meth_in) -{ - Lock lock(m_server_ssl_mutex); - /* Create our context*/ - if (m_server_contexts.find(context) == m_server_contexts.end()) - { - SSL_METHOD *meth = meth_in ? const_cast<SSL_METHOD *>(meth_in) : SSLv3_method(); - m_ssl_ctx = m_server_contexts[context] = SSL_CTX_new(meth); - SSL_CTX_set_mode(m_ssl_ctx, SSL_MODE_AUTO_RETRY|SSL_MODE_ENABLE_PARTIAL_WRITE); - // session id - if (context.size()) - SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)context.c_str(), (unsigned int)context.size()); - else - SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)"--empty--", 9); - } - else - { - m_ssl_ctx = m_server_contexts[context]; - } - - /* Load our keys and certificates*/ - if (!(SSL_CTX_use_certificate_file(m_ssl_ctx, keyfile.c_str(), SSL_FILETYPE_PEM))) - { - Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read certificate file " + keyfile, LOG_LEVEL_FATAL); - } - - m_password = password; - SSL_CTX_set_default_passwd_cb(m_ssl_ctx, SSL_password_cb); - SSL_CTX_set_default_passwd_cb_userdata(m_ssl_ctx, this); - if (!(SSL_CTX_use_PrivateKey_file(m_ssl_ctx, keyfile.c_str(), SSL_FILETYPE_PEM))) - { - Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read private key file " + keyfile, LOG_LEVEL_FATAL); - } -} - - -void TcpSocket::InitializeContext(const std::string& context,const std::string& certfile,const std::string& keyfile,const std::string& password,const SSL_METHOD *meth_in) -{ - Lock lock(m_server_ssl_mutex); - /* Create our context*/ - if (m_server_contexts.find(context) == m_server_contexts.end()) - { - SSL_METHOD *meth = meth_in ? const_cast<SSL_METHOD *>(meth_in) : SSLv3_method(); - m_ssl_ctx = m_server_contexts[context] = SSL_CTX_new(meth); - SSL_CTX_set_mode(m_ssl_ctx, SSL_MODE_AUTO_RETRY|SSL_MODE_ENABLE_PARTIAL_WRITE); - // session id - if (context.size()) - SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)context.c_str(), (unsigned int)context.size()); - else - SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)"--empty--", 9); - } - else - { - m_ssl_ctx = m_server_contexts[context]; - } - - /* Load our keys and certificates*/ - if (!(SSL_CTX_use_certificate_file(m_ssl_ctx, certfile.c_str(), SSL_FILETYPE_PEM))) - { - Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read certificate file " + keyfile, LOG_LEVEL_FATAL); - } - - m_password = password; - SSL_CTX_set_default_passwd_cb(m_ssl_ctx, SSL_password_cb); - SSL_CTX_set_default_passwd_cb_userdata(m_ssl_ctx, this); - if (!(SSL_CTX_use_PrivateKey_file(m_ssl_ctx, keyfile.c_str(), SSL_FILETYPE_PEM))) - { - Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read private key file " + keyfile, LOG_LEVEL_FATAL); - } -} - - -int TcpSocket::SSL_password_cb(char *buf,int num,int rwflag,void *userdata) -{ - Socket *p0 = static_cast<Socket *>(userdata); - TcpSocket *p = dynamic_cast<TcpSocket *>(p0); - std::string pw = p ? p -> GetPassword() : ""; - if ( (size_t)num < pw.size() + 1) - { - return 0; - } -#if defined( _WIN32) && !defined(__CYGWIN__) - strcpy_s(buf, num, pw.c_str()); -#else - strcpy(buf,pw.c_str()); -#endif - return (int)pw.size(); -} -#endif // HAVE_OPENSSL - - -int TcpSocket::Close() -{ - if (GetSocket() == INVALID_SOCKET) // this could happen - { - Handler().LogError(this, "Socket::Close", 0, "file descriptor invalid", LOG_LEVEL_WARNING); - return 0; - } - int n; - SetNonblocking(true); - if (!Lost() && IsConnected() && !(GetShutdown() & SHUT_WR)) - { - if (shutdown(GetSocket(), SHUT_WR) == -1) - { - // failed... - Handler().LogError(this, "shutdown", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - } - // - char tmp[1000]; - if (!Lost() && (n = recv(GetSocket(),tmp,1000,0)) >= 0) - { - if (n) - { - Handler().LogError(this, "read() after shutdown", n, "bytes read", LOG_LEVEL_WARNING); - } - } -#ifdef HAVE_OPENSSL - if (IsSSL() && m_ssl) - SSL_shutdown(m_ssl); - if (m_ssl) - { - SSL_free(m_ssl); - m_ssl = NULL; - } -#endif - return Socket::Close(); -} - - -#ifdef HAVE_OPENSSL -SSL_CTX *TcpSocket::GetSslContext() -{ - if (!m_ssl_ctx) - Handler().LogError(this, "GetSslContext", 0, "SSL Context is NULL; check InitSSLServer/InitSSLClient", LOG_LEVEL_WARNING); - return m_ssl_ctx; -} - -SSL *TcpSocket::GetSsl() -{ - if (!m_ssl) - Handler().LogError(this, "GetSsl", 0, "SSL is NULL; check InitSSLServer/InitSSLClient", LOG_LEVEL_WARNING); - return m_ssl; -} -#endif - - -#ifdef ENABLE_RECONNECT -void TcpSocket::SetReconnect(bool x) -{ - m_b_reconnect = x; -} -#endif - - -void TcpSocket::OnRawData(const char *buf_in,size_t len) -{ -} - - -size_t TcpSocket::GetInputLength() -{ - return ibuf.GetLength(); -} - - -size_t TcpSocket::ReadInput(char *buf, size_t max_sz) -{ - size_t sz = max_sz < GetInputLength() ? max_sz : GetInputLength(); - ibuf.Read(buf, sz); - return sz; -} - - -size_t TcpSocket::GetOutputLength() -{ - return m_output_length; -} - - -uint64_t TcpSocket::GetBytesReceived(bool clear) -{ - uint64_t z = m_bytes_received; - if (clear) - m_bytes_received = 0; - return z; -} - - -uint64_t TcpSocket::GetBytesSent(bool clear) -{ - uint64_t z = m_bytes_sent; - if (clear) - m_bytes_sent = 0; - return z; -} - - -#ifdef ENABLE_RECONNECT -bool TcpSocket::Reconnect() -{ - return m_b_reconnect; -} - - -void TcpSocket::SetIsReconnect(bool x) -{ - m_b_is_reconnect = x; -} - - -bool TcpSocket::IsReconnect() -{ - return m_b_is_reconnect; -} -#endif - - -#ifdef HAVE_OPENSSL -const std::string& TcpSocket::GetPassword() -{ - return m_password; -} -#endif - - -void TcpSocket::DisableInputBuffer(bool x) -{ - m_b_input_buffer_disabled = x; -} - - -void TcpSocket::OnOptions(int family,int type,int protocol,SOCKET s) -{ -DEB( fprintf(stderr, "Socket::OnOptions()\n");) -#ifdef SO_NOSIGPIPE - SetSoNosigpipe(true); -#endif - SetSoReuseaddr(true); - SetSoKeepalive(true); -} - - -void TcpSocket::SetLineProtocol(bool x) -{ - StreamSocket::SetLineProtocol(x); - DisableInputBuffer(x); -} - - -const std::string TcpSocket::GetLine() const -{ - if (!m_line_ptr) - return ""; - return std::string(&m_line[0], m_line_ptr); -} - - -bool TcpSocket::SetTcpNodelay(bool x) -{ -#ifdef TCP_NODELAY - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_TCP, TCP_NODELAY, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_TCP, TCP_NODELAY)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; -#else - Handler().LogError(this, "socket option not available", 0, "TCP_NODELAY", LOG_LEVEL_INFO); - return false; -#endif -} - - -TcpSocket::CircularBuffer::CircularBuffer(size_t size) -:buf(new char[2 * size]) -,m_max(size) -,m_q(0) -,m_b(0) -,m_t(0) -,m_count(0) -{ -} - - -TcpSocket::CircularBuffer::~CircularBuffer() -{ - delete[] buf; -} - - -bool TcpSocket::CircularBuffer::Write(const char *s,size_t l) -{ - if (m_q + l > m_max) - { - return false; // overflow - } - m_count += (unsigned long)l; - if (m_t + l > m_max) // block crosses circular border - { - size_t l1 = m_max - m_t; // size left until circular border crossing - // always copy full block to buffer(buf) + top pointer(m_t) - // because we have doubled the buffer size for performance reasons - memcpy(buf + m_t, s, l); - memcpy(buf, s + l1, l - l1); - m_t = l - l1; - m_q += l; - } - else - { - memcpy(buf + m_t, s, l); - memcpy(buf + m_max + m_t, s, l); - m_t += l; - if (m_t >= m_max) - m_t -= m_max; - m_q += l; - } - return true; -} - - -bool TcpSocket::CircularBuffer::Read(char *s,size_t l) -{ - if (l > m_q) - { - return false; // not enough chars - } - if (m_b + l > m_max) // block crosses circular border - { - size_t l1 = m_max - m_b; - if (s) - { - memcpy(s, buf + m_b, l1); - memcpy(s + l1, buf, l - l1); - } - m_b = l - l1; - m_q -= l; - } - else - { - if (s) - { - memcpy(s, buf + m_b, l); - } - m_b += l; - if (m_b >= m_max) - m_b -= m_max; - m_q -= l; - } - if (!m_q) - { - m_b = m_t = 0; - } - return true; -} - - -bool TcpSocket::CircularBuffer::Remove(size_t l) -{ - return Read(NULL, l); -} - - -size_t TcpSocket::CircularBuffer::GetLength() -{ - return m_q; -} - - -const char *TcpSocket::CircularBuffer::GetStart() -{ - return buf + m_b; -} - - -size_t TcpSocket::CircularBuffer::GetL() -{ - return (m_b + m_q > m_max) ? m_max - m_b : m_q; -} - - -size_t TcpSocket::CircularBuffer::Space() -{ - return m_max - m_q; -} - - -unsigned long TcpSocket::CircularBuffer::ByteCounter(bool clear) -{ - if (clear) - { - unsigned long x = m_count; - m_count = 0; - return x; - } - return m_count; -} - - -std::string TcpSocket::CircularBuffer::ReadString(size_t l) -{ - char *sz = new char[l + 1]; - if (!Read(sz, l)) // failed, debug printout in Read() method - { - delete[] sz; - return ""; - } - sz[l] = 0; - std::string tmp = sz; - delete[] sz; - return tmp; -} - - -void TcpSocket::OnConnectTimeout() -{ - Handler().LogError(this, "connect", -1, "connect timeout", LOG_LEVEL_FATAL); -#ifdef ENABLE_SOCKS4 - if (Socks4()) - { - OnSocks4ConnectFailed(); - // retry direct connection - } - else -#endif - if (GetConnectionRetry() == -1 || - (GetConnectionRetry() && GetConnectionRetries() < GetConnectionRetry()) ) - { - IncreaseConnectionRetries(); - // ask socket via OnConnectRetry callback if we should continue trying - if (OnConnectRetry()) - { - SetRetryClientConnect(); - } - else - { - SetCloseAndDelete( true ); - /// \todo state reason why connect failed - OnConnectFailed(); - // - SetConnecting(false); - } - } - else - { - SetCloseAndDelete(true); - /// \todo state reason why connect failed - OnConnectFailed(); - // - SetConnecting(false); - } -} - - -#ifdef _WIN32 -void TcpSocket::OnException() -{ - if (Connecting()) - { -#ifdef ENABLE_SOCKS4 - if (Socks4()) - OnSocks4ConnectFailed(); - else -#endif - if (GetConnectionRetry() == -1 || - (GetConnectionRetry() && - GetConnectionRetries() < GetConnectionRetry() )) - { - // even though the connection failed at once, only retry after - // the connection timeout - // should we even try to connect again, when CheckConnect returns - // false it's because of a connection error - not a timeout... - } - else - { - SetConnecting(false); // tnx snibbe - SetCloseAndDelete(); - OnConnectFailed(); - } - return; - } - // %! exception doesn't always mean something bad happened, this code should be reworked - // errno valid here? - int err = SoError(); - Handler().LogError(this, "exception on select", err, StrError(err), LOG_LEVEL_FATAL); - SetCloseAndDelete(); -} -#endif // _WIN32 - - -int TcpSocket::Protocol() -{ - return IPPROTO_TCP; -} - - -void TcpSocket::SetTransferLimit(size_t sz) -{ - m_transfer_limit = sz; -} - - -void TcpSocket::OnTransferLimit() -{ -} - - -TcpSocket::OUTPUT::OUTPUT() : _b(0), _t(0), _q(0) -{ -} - - -TcpSocket::OUTPUT::OUTPUT(const char *buf, size_t len) : _b(0), _t(len), _q(len) -{ - memcpy(_buf, buf, len); -} - - -size_t TcpSocket::OUTPUT::Space() -{ - return TCP_OUTPUT_CAPACITY - _t; -} - - -void TcpSocket::OUTPUT::Add(const char *buf, size_t len) -{ - memcpy(_buf + _t, buf, len); - _t += len; - _q += len; -} - - -size_t TcpSocket::OUTPUT::Remove(size_t len) -{ - _b += len; - _q -= len; - return _q; -} - - -const char *TcpSocket::OUTPUT::Buf() -{ - return _buf + _b; -} - - -size_t TcpSocket::OUTPUT::Len() -{ - return _q; -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/TcpSocket.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/TcpSocket.h deleted file mode 100755 index 426b5b658a7..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/TcpSocket.h +++ /dev/null @@ -1,370 +0,0 @@ -/** \file TcpSocket.h - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_TcpSocket_H -#define _SOCKETS_TcpSocket_H -#include "sockets-config.h" -#include "StreamSocket.h" -#ifdef HAVE_OPENSSL -#include <openssl/ssl.h> -#include "SSLInitializer.h" -#endif -#include "Mutex.h" -#include <map> - - -#define TCP_BUFSIZE_READ 16400 -#define TCP_OUTPUT_CAPACITY 1024000 - -// flags used in OnDisconnect callback -#define TCP_DISCONNECT_WRITE 1 -#define TCP_DISCONNECT_ERROR 2 -#define TCP_DISCONNECT_SSL 4 - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -class SocketAddress; - - -/** Socket implementation for TCP. - \ingroup basic */ -class TcpSocket : public StreamSocket -{ - /** \defgroup internal Internal utility */ -protected: - /** Buffer class containing one read/write circular buffer. - \ingroup internal */ - class CircularBuffer - { - public: - CircularBuffer(size_t size); - ~CircularBuffer(); - - /** append l bytes from p to buffer */ - bool Write(const char *p,size_t l); - /** copy l bytes from buffer to dest */ - bool Read(char *dest,size_t l); - /** skip l bytes from buffer */ - bool Remove(size_t l); - /** read l bytes from buffer, returns as string. */ - std::string ReadString(size_t l); - - /** total buffer length */ - size_t GetLength(); - /** pointer to circular buffer beginning */ - const char *GetStart(); - /** return number of bytes from circular buffer beginning to buffer physical end */ - size_t GetL(); - /** return free space in buffer, number of bytes until buffer overrun */ - size_t Space(); - - /** return total number of bytes written to this buffer, ever */ - unsigned long ByteCounter(bool clear = false); - - private: - CircularBuffer(const CircularBuffer& s) {} - CircularBuffer& operator=(const CircularBuffer& ) { - return *this; - } - char *buf; - size_t m_max; - size_t m_q; - size_t m_b; - size_t m_t; - unsigned long m_count; - }; - /** Output buffer struct. - \ingroup internal */ - struct OUTPUT { - OUTPUT(); - OUTPUT(const char *buf, size_t len); - size_t Space(); - void Add(const char *buf, size_t len); - size_t Remove(size_t len); - const char *Buf(); - size_t Len(); - - size_t _b; - size_t _t; - size_t _q; - char _buf[TCP_OUTPUT_CAPACITY]; - }; - typedef std::list<OUTPUT *> output_l; - -public: - /** Constructor with standard values on input/output buffers. */ - TcpSocket(ISocketHandler& ); - /** Constructor with custom values for i/o buffer. - \param h ISocketHandler reference - \param isize Input buffer size - \param osize Output buffer size */ - TcpSocket(ISocketHandler& h,size_t isize,size_t osize); - ~TcpSocket(); - - /** Open a connection to a remote server. - If you want your socket to connect to a server, - always call Open before Add'ing a socket to the sockethandler. - If not, the connection attempt will not be monitored by the - socket handler... - \param ip IP address - \param port Port number - \param skip_socks Do not use socks4 even if configured */ - bool Open(ipaddr_t ip,port_t port,bool skip_socks = false); -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 - /** Open connection. - \param ip Ipv6 address - \param port Port number - \param skip_socks Do not use socks4 even if configured */ - bool Open(in6_addr ip,port_t port,bool skip_socks = false); -#endif -#endif - bool Open(SocketAddress&,bool skip_socks = false); - bool Open(SocketAddress&,SocketAddress& bind_address,bool skip_socks = false); - /** Open connection. - \param host Hostname - \param port Port number */ - bool Open(const std::string &host,port_t port); - - /** Connect timeout callback. */ - void OnConnectTimeout(); -#ifdef _WIN32 - /** Connection failed reported as exception on win32 */ - void OnException(); -#endif - - /** Close file descriptor - internal use only. - \sa SetCloseAndDelete */ - int Close(); - - /** Send a string. - \param s String to send - \param f Dummy flags -- not used */ - void Send(const std::string &s,int f = 0); - /** Send string using printf formatting. */ - void Sendf(const char *format, ...); - /** Send buffer of bytes. - \param buf Buffer pointer - \param len Length of data - \param f Dummy flags -- not used */ - void SendBuf(const char *buf,size_t len,int f = 0); - /** This callback is executed after a successful read from the socket. - \param buf Pointer to the data - \param len Length of the data */ - virtual void OnRawData(const char *buf,size_t len); - - /** Called when output buffer has been sent. - Note: Will only be called IF the output buffer has been used. - Send's that was successful without needing the output buffer - will not generate a call to this method. */ - virtual void OnWriteComplete(); - /** Number of bytes in input buffer. */ - size_t GetInputLength(); - /** Read from input buffer. */ - size_t ReadInput(char *buf, size_t sz); - /** Number of bytes in output buffer. */ - size_t GetOutputLength(); - - /** Callback fires when a socket in line protocol has read one full line. - \param line Line read */ - void OnLine(const std::string& line); - /** Get counter of number of bytes received. */ - uint64_t GetBytesReceived(bool clear = false); - /** Get counter of number of bytes sent. */ - uint64_t GetBytesSent(bool clear = false); - - /** Socks4 specific callback. */ - void OnSocks4Connect(); - /** Socks4 specific callback. */ - void OnSocks4ConnectFailed(); - /** Socks4 specific callback. - \return 'need_more' */ - bool OnSocks4Read(); - -#ifdef ENABLE_RESOLVER - /** Callback executed when resolver thread has finished a resolve request. */ - void OnResolved(int id,ipaddr_t a,port_t port); -#ifdef ENABLE_IPV6 - void OnResolved(int id,in6_addr& a,port_t port); -#endif -#endif -#ifdef HAVE_OPENSSL - /** Callback for 'New' ssl support - replaces SSLSocket. Internal use. */ - void OnSSLConnect(); - /** Callback for 'New' ssl support - replaces SSLSocket. Internal use. */ - void OnSSLAccept(); - /** This method must be implemented to initialize - the ssl context for an outgoing connection. */ - virtual void InitSSLClient(); - /** This method must be implemented to initialize - the ssl context for an incoming connection. */ - virtual void InitSSLServer(); -#endif - -#ifdef ENABLE_RECONNECT - /** Flag that says a broken connection will try to reconnect. */ - void SetReconnect(bool = true); - /** Check reconnect on lost connection flag status. */ - bool Reconnect(); - /** Flag to determine if a reconnect is in progress. */ - void SetIsReconnect(bool x = true); - /** Socket is reconnecting. */ - bool IsReconnect(); -#endif - - /** Use this if you only use OnRawData to process received data. */ - void DisableInputBuffer(bool = true); - - void OnOptions(int,int,int,SOCKET); - - void SetLineProtocol(bool = true); - - /** Get the unfinished line when using SetLineProtocol = true. - The finished line will always be reported with a call to OnLine. - */ - const std::string GetLine() const; - - // TCP options - bool SetTcpNodelay(bool = true); - - virtual int Protocol(); - - /** Trigger limit for callback OnTransferLimit. */ - void SetTransferLimit(size_t sz); - /** This callback fires when the output buffer drops below the value - set by SetTransferLimit. Default: 0 (disabled). */ - virtual void OnTransferLimit(); - -protected: - TcpSocket(const TcpSocket& ); - - void OnRead(); - void OnRead( char *buf, size_t n ); - void OnWrite(); -#ifdef HAVE_OPENSSL - /** SSL; Initialize ssl context for a client socket. - \param meth_in SSL method */ - void InitializeContext(const std::string& context, const SSL_METHOD *meth_in = NULL); - /** SSL; Initialize ssl context for a server socket. - \param keyfile Combined private key/certificate file - \param password Password for private key - \param meth_in SSL method */ - void InitializeContext(const std::string& context, const std::string& keyfile, const std::string& password, const SSL_METHOD *meth_in = NULL); - /** SSL; Initialize ssl context for a server socket. - \param certfile Separate certificate file - \param keyfile Combined private key/certificate file - \param password Password for private key - \param meth_in SSL method */ - void InitializeContext(const std::string& context, const std::string& certfile, const std::string& keyfile, const std::string& password, const SSL_METHOD *meth_in = NULL); - /** SSL; Password callback method. */ - static int SSL_password_cb(char *buf,int num,int rwflag,void *userdata); - /** SSL; Get pointer to ssl context structure. */ - virtual SSL_CTX *GetSslContext(); - /** SSL; Get pointer to ssl structure. */ - virtual SSL *GetSsl(); - /** ssl; still negotiating connection. */ - bool SSLNegotiate(); - /** SSL; Get ssl password. */ - const std::string& GetPassword(); -#endif - - CircularBuffer ibuf; ///< Circular input buffer - -private: - TcpSocket& operator=(const TcpSocket& ) { - return *this; - } - - /** */ - void SendFromOutputBuffer(); - /** the actual send() */ - int TryWrite(const char *buf, size_t len); - /** add data to output buffer top */ - void Buffer(const char *buf, size_t len); - - // - bool m_b_input_buffer_disabled; - uint64_t m_bytes_sent; - uint64_t m_bytes_received; - bool m_skip_c; ///< Skip second char of CRLF or LFCR sequence in OnRead - char m_c; ///< First char in CRLF or LFCR sequence - std::vector<char> m_line; ///< Current line in line protocol mode - size_t m_line_ptr; -#ifdef SOCKETS_DYNAMIC_TEMP - char *m_buf; ///< temporary read buffer -#endif - output_l m_obuf; ///< output buffer - OUTPUT *m_obuf_top; ///< output buffer on top - size_t m_transfer_limit; - size_t m_output_length; - size_t m_repeat_length; - -#ifdef HAVE_OPENSSL - static SSLInitializer m_ssl_init; - SSL_CTX *m_ssl_ctx; ///< ssl context - SSL *m_ssl; ///< ssl 'socket' - BIO *m_sbio; ///< ssl bio - std::string m_password; ///< ssl password - static Mutex m_server_ssl_mutex; - static std::map<std::string, SSL_CTX *> m_client_contexts; - static std::map<std::string, SSL_CTX *> m_server_contexts; -#endif - -#ifdef ENABLE_SOCKS4 - int m_socks4_state; ///< socks4 support - char m_socks4_vn; ///< socks4 support, temporary variable - char m_socks4_cd; ///< socks4 support, temporary variable - unsigned short m_socks4_dstport; ///< socks4 support - unsigned long m_socks4_dstip; ///< socks4 support -#endif - -#ifdef ENABLE_RESOLVER - int m_resolver_id; ///< Resolver id (if any) for current Open call -#endif - -#ifdef ENABLE_RECONNECT - bool m_b_reconnect; ///< Reconnect on lost connection flag - bool m_b_is_reconnect; ///< Trying to reconnect -#endif - -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_TcpSocket_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Thread.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Thread.cpp deleted file mode 100755 index e794856d2ae..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Thread.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/** \file Thread.cpp - ** \date 2004-10-30 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include <stdio.h> -#ifdef _WIN32 -#include <process.h> -#include "socket_include.h" -#else -#include <unistd.h> -#endif - -#include "Thread.h" -#include "Utility.h" - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -Thread::Thread(bool release) -:m_thread(0) -,m_running(true) -,m_release(false) -,m_b_delete_on_exit(false) -,m_b_destructor(false) -{ -#ifdef _WIN32 -// m_thread = ::CreateThread(NULL, 0, StartThread, this, 0, &m_dwThreadId); - m_thread = (HANDLE)_beginthreadex(NULL, 0, &StartThread, this, 0, &m_dwThreadId); -#else - pthread_attr_t attr; - - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED); - if (pthread_create(&m_thread,&attr, StartThread,this) == -1) - { - perror("Thread: create failed"); - SetRunning(false); - } -// pthread_attr_destroy(&attr); -#endif - m_release = release; - if (release) - m_sem.Post(); -} - - -Thread::~Thread() -{ - m_b_destructor = true; - if (m_running) - { - SetRelease(true); - SetRunning(false); - /* - Sleep one second to give thread class Run method enough time to - release from run loop - */ - Utility::Sleep(1000); - } -#ifdef _WIN32 - if (m_thread) - ::CloseHandle(m_thread); -#endif -} - - -threadfunc_t STDPREFIX Thread::StartThread(threadparam_t zz) -{ - /* - Sleep here to wait for derived thread class constructor to setup - vtable... hurts just looking at it - */ - Utility::Sleep(5); - - Thread *p = (Thread *)zz; - - p -> Wait(); - if (p -> m_running) - { - p -> Run(); - } - p -> SetRunning(false); // if return - if (p -> DeleteOnExit() && !p -> IsDestructor()) - { - delete p; - } -#ifdef _WIN32 - _endthreadex(0); -#endif - return (threadfunc_t)NULL; -} - - -bool Thread::IsRunning() -{ - return m_running; -} - - -void Thread::SetRunning(bool x) -{ - m_running = x; -} - - -bool Thread::IsReleased() -{ - return m_release; -} - - -void Thread::SetRelease(bool x) -{ - m_release = x; - if (x) - m_sem.Post(); -} - - -bool Thread::DeleteOnExit() -{ - return m_b_delete_on_exit; -} - - -void Thread::SetDeleteOnExit(bool x) -{ - m_b_delete_on_exit = x; -} - - -bool Thread::IsDestructor() -{ - return m_b_destructor; -} - - -void Thread::Wait() -{ - m_sem.Wait(); -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Thread.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Thread.h deleted file mode 100755 index 33262cdc982..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Thread.h +++ /dev/null @@ -1,137 +0,0 @@ -/** \file Thread.h - ** \date 2004-10-30 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Thread_H -#define _SOCKETS_Thread_H - -#include "sockets-config.h" -#ifdef _WIN32 -#else -#include <pthread.h> -#endif -#include "Semaphore.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -#ifdef _WIN32 -// to be -//typedef DWORD threadfunc_t; -//typedef LPVOID threadparam_t; -//#define STDPREFIX WINAPI -typedef unsigned threadfunc_t; -typedef void * threadparam_t; -#define STDPREFIX __stdcall -#else - -typedef void * threadfunc_t; -typedef void * threadparam_t; -#define STDPREFIX -#endif - -/** \defgroup threading Threading */ -/** Thread base class. -The Thread class is used by the resolver (ResolvServer) and running a detached socket (SocketThread). -When you know some processing will take a long time and will freeze up a socket, there is always the -possibility to call Detach() on that socket before starting the processing. -When the OnDetached() callback is later called the processing can continue, now in its own thread. - \ingroup threading */ -class Thread -{ -public: - Thread(bool release = true); - virtual ~Thread(); - - static threadfunc_t STDPREFIX StartThread(threadparam_t); - - virtual void Run() = 0; - -#ifdef _WIN32 - HANDLE GetThread() { - return m_thread; - } - unsigned GetThreadId() { - return m_dwThreadId; - } -#else - pthread_t GetThread() { - return m_thread; - } -#endif - - bool IsRunning(); - void SetRunning(bool x); - bool IsReleased(); - void SetRelease(bool x); - bool DeleteOnExit(); - void SetDeleteOnExit(bool x = true); - bool IsDestructor(); - - void Start() { - SetRelease(true); - } - - void Stop() { - Start(); - SetRunning(false); - } - - void Wait(); - -protected: -#ifdef _WIN32 - HANDLE m_thread; - unsigned m_dwThreadId; -#else - pthread_t m_thread; -#endif - -private: - Thread(const Thread& ) {} - Thread& operator=(const Thread& ) { - return *this; - } - Semaphore m_sem; - bool m_running; - bool m_release; - bool m_b_delete_on_exit; - bool m_b_destructor; -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_Thread_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/UdpSocket.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/UdpSocket.cpp deleted file mode 100755 index bca1c6c5014..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/UdpSocket.cpp +++ /dev/null @@ -1,922 +0,0 @@ -/** \file UdpSocket.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include <stdio.h> // LG -#ifdef _WIN32 -#ifdef _MSC_VER -#pragma warning(disable:4786) -#endif -#include <stdlib.h> -#else -#include <errno.h> -#endif - -#include "ISocketHandler.h" -#include "UdpSocket.h" -#include "Utility.h" -#include "Ipv4Address.h" -#include "Ipv6Address.h" -#ifdef ENABLE_EXCEPTIONS -#include "Exception.h" -#endif -// include this to see strange sights -//#include <linux/in6.h> - - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -UdpSocket::UdpSocket(ISocketHandler& h, int ibufsz, bool ipv6, int retries) : Socket(h) -, m_ibuf(new char[ibufsz]) -, m_ibufsz(ibufsz) -, m_bind_ok(false) -, m_port(0) -, m_last_size_written(-1) -, m_retries(retries) -, m_b_read_ts(false) -{ -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 - SetIpv6(ipv6); -//#endif -//#endif -} - - -UdpSocket::~UdpSocket() -{ - Close(); - delete[] m_ibuf; -} - - -int UdpSocket::Bind(port_t &port, int range) -{ -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(port); - return Bind(ad, range); - } -//#endif -//#endif - Ipv4Address ad(port); - return Bind(ad, range); -} - - -int UdpSocket::Bind(const std::string& intf, port_t &port, int range) -{ -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(intf, port); - if (ad.IsValid()) - { - return Bind(ad, range); - } - SetCloseAndDelete(); - return -1; - } -//#endif -//#endif - Ipv4Address ad(intf, port); - if (ad.IsValid()) - { - return Bind(ad, range); - } - SetCloseAndDelete(); - return -1; -} - - -int UdpSocket::Bind(ipaddr_t a, port_t &port, int range) -{ - Ipv4Address ad(a, port); - return Bind(ad, range); -} - - -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 -int UdpSocket::Bind(in6_addr a, port_t &port, int range) -{ - Ipv6Address ad(a, port); - return Bind(ad, range); -} -//#endif -//#endif - - -int UdpSocket::Bind(SocketAddress& ad, int range) -{ - if (GetSocket() == INVALID_SOCKET) - { - Attach(CreateSocket(ad.GetFamily(), SOCK_DGRAM, "udp")); - } - if (GetSocket() != INVALID_SOCKET) - { - SetNonblocking(true); - int n = bind(GetSocket(), ad, ad); - int tries = range; - while (n == -1 && tries--) - { - ad.SetPort(ad.GetPort() + 1); - n = bind(GetSocket(), ad, ad); - } - if (n == -1) - { - Handler().LogError(this, "bind", Errno, StrError(Errno), LOG_LEVEL_FATAL); - SetCloseAndDelete(); -#ifdef ENABLE_EXCEPTIONS - throw Exception("bind() failed for UdpSocket, port:range: " + Utility::l2string(ad.GetPort()) + ":" + Utility::l2string(range)); -#endif - return -1; - } - m_bind_ok = true; - m_port = ad.GetPort(); - return 0; - } - return -1; -} - - -/** if you wish to use Send, first Open a connection */ -bool UdpSocket::Open(ipaddr_t l, port_t port) -{ - Ipv4Address ad(l, port); - return Open(ad); -} - - -bool UdpSocket::Open(const std::string& host, port_t port) -{ -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(host, port); - if (ad.IsValid()) - { - return Open(ad); - } - return false; - } -//#endif -//#endif - Ipv4Address ad(host, port); - if (ad.IsValid()) - { - return Open(ad); - } - return false; -} - - -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 -bool UdpSocket::Open(struct in6_addr& a, port_t port) -{ - Ipv6Address ad(a, port); - return Open(ad); -} -//#endif -//#endif - - -bool UdpSocket::Open(SocketAddress& ad) -{ - if (GetSocket() == INVALID_SOCKET) - { - Attach(CreateSocket(ad.GetFamily(), SOCK_DGRAM, "udp")); - } - if (GetSocket() != INVALID_SOCKET) - { - SetNonblocking(true); - if (connect(GetSocket(), ad, ad) == -1) - { - Handler().LogError(this, "connect", Errno, StrError(Errno), LOG_LEVEL_FATAL); - SetCloseAndDelete(); - return false; - } - SetConnected(); - return true; - } - return false; -} - - -void UdpSocket::CreateConnection() -{ -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - if (GetSocket() == INVALID_SOCKET) - { - SOCKET s = CreateSocket(AF_INET6, SOCK_DGRAM, "udp"); - if (s == INVALID_SOCKET) - { - return; - } - SetNonblocking(true, s); - Attach(s); - } - return; - } -//#endif -//#endif - if (GetSocket() == INVALID_SOCKET) - { - SOCKET s = CreateSocket(AF_INET, SOCK_DGRAM, "udp"); - if (s == INVALID_SOCKET) - { - return; - } - SetNonblocking(true, s); - Attach(s); - } -} - - -/** send to specified address */ -void UdpSocket::SendToBuf(const std::string& h, port_t p, const char *data, int len, int flags) -{ -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(h, p); - if (ad.IsValid()) - { - fprintf(stderr, "UdpSocket::SendToBuf( IPv6 @=%s, port = %d, const char *data, len = %d, flags = %d)\n", h.c_str(), p, len, flags); - SendToBuf(ad, data, len, flags); - } else { - fprintf(stderr, "UdpSocket::SendToBuf(const std::string& h, port_t p, const char *data, int len, int flags) invalid @ IPv6\n"); - } - return; - } -//#endif -//#endif - Ipv4Address ad(h, p); - if (ad.IsValid()) - { - fprintf(stderr, "UdpSocket::SendToBuf( IPv4 @=%s, port = %d, const char *data, len = %d, flags = %d)\n", h.c_str(), p, len, flags); - SendToBuf(ad, data, len, flags); - } else { - fprintf(stderr, "UdpSocket::SendToBuf(const std::string& h, port_t p, const char *data, int len, int flags) invalid @ IPv4\n"); - } -} - - -/** send to specified address */ -void UdpSocket::SendToBuf(ipaddr_t a, port_t p, const char *data, int len, int flags) -{ - Ipv4Address ad(a, p); - fprintf(stderr, "UdpSocket::SendToBuf(ipaddr_t a, port_t p, const char *data, int len, int flags)\n"); - SendToBuf(ad, data, len, flags); -} - - -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 -void UdpSocket::SendToBuf(in6_addr a, port_t p, const char *data, int len, int flags) -{ - Ipv6Address ad(a, p); - fprintf(stderr, "UdpSocket::SendToBuf(in6_addr a, port_t p, const char *data, int len, int flags)\n"); - SendToBuf(ad, data, len, flags); -} -//#endif -//#endif - - -void UdpSocket::SendToBuf(SocketAddress& ad, const char *data, int len, int flags) -{ - if (GetSocket() == INVALID_SOCKET) - { - fprintf(stderr, "UdpSocket::SendToBuf INVALID_SOCKET\n"); - Attach(CreateSocket(ad.GetFamily(), SOCK_DGRAM, "udp")); - } - if (GetSocket() != INVALID_SOCKET) - { - SetNonblocking(true); - if ((m_last_size_written = sendto(GetSocket(), data, len, flags, ad, ad)) == -1) - { - fprintf(stderr, "UdpSocket::SendToBuf ERROR\n"); - Handler().LogError(this, "sendto", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - } -} - - -void UdpSocket::SendTo(const std::string& a, port_t p, const std::string& str, int flags) -{ - fprintf(stderr, "UdpSocket::SendTo(const std::string& a, port_t p, const std::string& str, int flags)\n"); - SendToBuf(a, p, str.c_str(), (int)str.size(), flags); -} - - -void UdpSocket::SendTo(ipaddr_t a, port_t p, const std::string& str, int flags) -{ - fprintf(stderr, "UdpSocket::SendTo(ipaddr_t a, port_t p, const std::string& str, int flags)\n"); - SendToBuf(a, p, str.c_str(), (int)str.size(), flags); -} - - -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 -void UdpSocket::SendTo(in6_addr a, port_t p, const std::string& str, int flags) -{ - fprintf(stderr, "UdpSocket::SendTo(in6_addr a, port_t p, const std::string& str, int flags)\n"); - SendToBuf(a, p, str.c_str(), (int)str.size(), flags); -} -//#endif -//#endif - - -void UdpSocket::SendTo(SocketAddress& ad, const std::string& str, int flags) -{ - fprintf(stderr, "UdpSocket::SendTo(SocketAddress& ad, const std::string& str, int flags)\n"); - SendToBuf(ad, str.c_str(), (int)str.size(), flags); -} - - -/** send to connected address */ -void UdpSocket::SendBuf(const char *data, size_t len, int flags) -{ - fprintf(stderr, "UdpSocket::SendBuf(const char *data, size_t len, int flags)\n"); - if (!IsConnected()) - { - Handler().LogError(this, "SendBuf", 0, "not connected", LOG_LEVEL_ERROR); - return; - } - if ((m_last_size_written = send(GetSocket(), data, (int)len, flags)) == -1) - { - Handler().LogError(this, "send", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } -} - - -void UdpSocket::Send(const std::string& str, int flags) -{ - fprintf(stderr, "UdpSocket::Send(const std::string& str, int flags)\n"); - SendBuf(str.c_str(), (int)str.size(), flags); -} - - -#if defined(LINUX) || defined(MACOSX) -int UdpSocket::ReadTS(char *ioBuf, int inBufSize, struct sockaddr *from, socklen_t fromlen, struct timeval *ts) -{ - struct msghdr msg; - struct iovec vec[1]; - union { - struct cmsghdr cm; -#ifdef MACOSX -#ifdef __DARWIN_UNIX03 -#define ALIGNBYTES __DARWIN_ALIGNBYTES -#endif -#define myALIGN(p) (((unsigned int)(p) + ALIGNBYTES) &~ ALIGNBYTES) -#define myCMSG_SPACE(l) (myALIGN(sizeof(struct cmsghdr)) + myALIGN(l)) - char data[ myCMSG_SPACE(sizeof(struct timeval)) ]; -#else - char data[ CMSG_SPACE(sizeof(struct timeval)) ]; -#endif - } cmsg_un; - struct cmsghdr *cmsg; - struct timeval *tv; - - vec[0].iov_base = ioBuf; - vec[0].iov_len = inBufSize; - - memset(&msg, 0, sizeof(msg)); - memset(from, 0, fromlen); - memset(ioBuf, 0, inBufSize); - memset(&cmsg_un, 0, sizeof(cmsg_un)); - - msg.msg_name = (caddr_t)from; - msg.msg_namelen = fromlen; - msg.msg_iov = vec; - msg.msg_iovlen = 1; - msg.msg_control = cmsg_un.data; - msg.msg_controllen = sizeof(cmsg_un.data); - msg.msg_flags = 0; - - // Original version - for reference only - //int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); - - int n = recvmsg(GetSocket(), &msg, MSG_DONTWAIT); - - // now ioBuf will contain the data, as if we used recvfrom - - // Now get the time - if(n != -1 && msg.msg_controllen >= sizeof(struct cmsghdr) && !(msg.msg_flags & MSG_CTRUNC)) - { - tv = 0; - for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) - { - if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_TIMESTAMP) - { - tv = (struct timeval *)CMSG_DATA(cmsg); - } - } - if (tv) - { - memcpy(ts, tv, sizeof(struct timeval)); - } - } - // The address is in network order, but that's OK right now - return n; -} -#endif - - -void UdpSocket::OnRead() -{ -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - struct sockaddr_in6 sa; - socklen_t sa_len = sizeof(sa); - if (m_b_read_ts) - { - struct timeval ts; - Utility::GetTime(&ts); -#if !defined(LINUX) && !defined(MACOSX) - int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); -#else - int n = ReadTS(m_ibuf, m_ibufsz, (struct sockaddr *)&sa, sa_len, &ts); -#endif - if (n > 0) - { - this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len, &ts); - } - else - if (n == -1) - { -#ifdef _WIN32 - if (Errno != WSAEWOULDBLOCK) -#else - if (Errno != EWOULDBLOCK) -#endif - Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - return; - } - int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); - int q = m_retries; // receive max 10 at one cycle - while (n > 0) - { - if (sa_len != sizeof(sa)) - { - Handler().LogError(this, "recvfrom", 0, "unexpected address struct size", LOG_LEVEL_WARNING); - } - this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len); - if (!q--) - break; - // - n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); - } - if (n == -1) - { -#ifdef _WIN32 - if (Errno != WSAEWOULDBLOCK) -#else - if (Errno != EWOULDBLOCK) -#endif - Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - return; - } -//#endif -//#endif - struct sockaddr_in sa; - socklen_t sa_len = sizeof(sa); - if (m_b_read_ts) - { - struct timeval ts; - Utility::GetTime(&ts); -#if !defined(LINUX) && !defined(MACOSX) - int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); -#else - int n = ReadTS(m_ibuf, m_ibufsz, (struct sockaddr *)&sa, sa_len, &ts); -#endif - if (n > 0) - { - this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len, &ts); - } - else - if (n == -1) - { -#ifdef _WIN32 - if (Errno != WSAEWOULDBLOCK) -#else - if (Errno != EWOULDBLOCK) -#endif - Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - return; - } - int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); - int q = m_retries; - while (n > 0) - { - if (sa_len != sizeof(sa)) - { - Handler().LogError(this, "recvfrom", 0, "unexpected address struct size", LOG_LEVEL_WARNING); - } - this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len); - if (!q--) - break; - // - n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); - } - if (n == -1) - { -#ifdef _WIN32 - if (Errno != WSAEWOULDBLOCK) -#else - if (Errno != EWOULDBLOCK) -#endif - Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } -} - - -void UdpSocket::SetBroadcast(bool b) -{ - int one = 1; - int zero = 0; - - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } - if (b) - { - if (setsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *) &one, sizeof(one)) == -1) - { - Handler().LogError(this, "SetBroadcast", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - } - else - { - if (setsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *) &zero, sizeof(zero)) == -1) - { - Handler().LogError(this, "SetBroadcast", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - } -} - - -bool UdpSocket::IsBroadcast() -{ - int is_broadcast = 0; - socklen_t size; - - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } - if (getsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *)&is_broadcast, &size) == -1) - { - Handler().LogError(this, "IsBroadcast", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - return is_broadcast != 0; -} - - -void UdpSocket::SetMulticastTTL(int ttl) -{ - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } - if (setsockopt(GetSocket(), SOL_IP, IP_MULTICAST_TTL, (char *)&ttl, sizeof(int)) == -1) - { - Handler().LogError(this, "SetMulticastTTL", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } -} - - -int UdpSocket::GetMulticastTTL() -{ - int ttl = 0; - socklen_t size = sizeof(int); - - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } - if (getsockopt(GetSocket(), SOL_IP, IP_MULTICAST_TTL, (char *)&ttl, &size) == -1) - { - Handler().LogError(this, "GetMulticastTTL", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - return ttl; -} - - -void UdpSocket::SetMulticastLoop(bool x) -{ - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - int val = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (char *)&val, sizeof(int)) == -1) - { - Handler().LogError(this, "SetMulticastLoop(ipv6)", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - return; - } -//#endif -//#endif - int val = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_IP, IP_MULTICAST_LOOP, (char *)&val, sizeof(int)) == -1) - { - Handler().LogError(this, "SetMulticastLoop(ipv4)", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } -} - - -bool UdpSocket::IsMulticastLoop() -{ - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - int is_loop = 0; - socklen_t size = sizeof(int); - if (getsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (char *)&is_loop, &size) == -1) - { - Handler().LogError(this, "IsMulticastLoop(ipv6)", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - return is_loop ? true : false; - } -//#endif -//#endif - int is_loop = 0; - socklen_t size = sizeof(int); - if (getsockopt(GetSocket(), SOL_IP, IP_MULTICAST_LOOP, (char *)&is_loop, &size) == -1) - { - Handler().LogError(this, "IsMulticastLoop(ipv4)", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - return is_loop ? true : false; -} - - -void UdpSocket::AddMulticastMembership(const std::string& group, const std::string& local_if, int if_index) -{ - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - struct ipv6_mreq x; - struct in6_addr addr; - if (Utility::u2ip( group, addr )) - { - x.ipv6mr_multiaddr = addr; - x.ipv6mr_interface = if_index; - if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, (char *)&x, sizeof(struct ipv6_mreq)) == -1) - { - Handler().LogError(this, "AddMulticastMembership(ipv6)", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - } - return; - } -//#endif -//#endif - struct ip_mreq x; // ip_mreqn - ipaddr_t addr; - if (Utility::u2ip( group, addr )) - { - memcpy(&x.imr_multiaddr.s_addr, &addr, sizeof(addr)); - Utility::u2ip( local_if, addr); - memcpy(&x.imr_interface.s_addr, &addr, sizeof(addr)); -// x.imr_ifindex = if_index; - if (setsockopt(GetSocket(), SOL_IP, IP_ADD_MEMBERSHIP, (char *)&x, sizeof(struct ip_mreq)) == -1) - { - Handler().LogError(this, "AddMulticastMembership(ipv4)", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - } -} - - -void UdpSocket::DropMulticastMembership(const std::string& group, const std::string& local_if, int if_index) -{ - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - struct ipv6_mreq x; - struct in6_addr addr; - if (Utility::u2ip( group, addr )) - { - x.ipv6mr_multiaddr = addr; - x.ipv6mr_interface = if_index; - if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, (char *)&x, sizeof(struct ipv6_mreq)) == -1) - { - Handler().LogError(this, "DropMulticastMembership(ipv6)", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - } - return; - } -//#endif -//#endif - struct ip_mreq x; // ip_mreqn - ipaddr_t addr; - if (Utility::u2ip( group, addr )) - { - memcpy(&x.imr_multiaddr.s_addr, &addr, sizeof(addr)); - Utility::u2ip( local_if, addr); - memcpy(&x.imr_interface.s_addr, &addr, sizeof(addr)); -// x.imr_ifindex = if_index; - if (setsockopt(GetSocket(), SOL_IP, IP_DROP_MEMBERSHIP, (char *)&x, sizeof(struct ip_mreq)) == -1) - { - Handler().LogError(this, "DropMulticastMembership(ipv4)", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - } -} - - -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 -void UdpSocket::SetMulticastHops(int hops) -{ - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } - if (!IsIpv6()) - { - Handler().LogError(this, "SetMulticastHops", 0, "Ipv6 only", LOG_LEVEL_ERROR); - return; - } - if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (char *)&hops, sizeof(int)) == -1) - { - Handler().LogError(this, "SetMulticastHops", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } -} - - -int UdpSocket::GetMulticastHops() -{ - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } - if (!IsIpv6()) - { - Handler().LogError(this, "SetMulticastHops", 0, "Ipv6 only", LOG_LEVEL_ERROR); - return -1; - } - int hops = 0; - socklen_t size = sizeof(int); - if (getsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (char *)&hops, &size) == -1) - { - Handler().LogError(this, "GetMulticastHops", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - return hops; -} -//#endif // IPPROTO_IPV6 -//#endif - - -bool UdpSocket::IsBound() -{ - return m_bind_ok; -} - - -void UdpSocket::OnRawData(const char *buf, size_t len, struct sockaddr *sa, socklen_t sa_len) -{ -} - - -void UdpSocket::OnRawData(const char *buf, size_t len, struct sockaddr *sa, socklen_t sa_len, struct timeval *ts) -{ -} - - -port_t UdpSocket::GetPort() -{ - return m_port; -} - - -int UdpSocket::GetLastSizeWritten() -{ - return m_last_size_written; -} - - -void UdpSocket::SetTimestamp(bool x) -{ - m_b_read_ts = x; -} - - -void UdpSocket::SetMulticastDefaultInterface(ipaddr_t a, int if_index) -{ - struct in_addr x; - memcpy(&x.s_addr, &a, sizeof(a)); - if (setsockopt(GetSocket(), IPPROTO_IP, IP_MULTICAST_IF, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "SetMulticastDefaultInterface(ipv4)", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } -} - - -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 -void UdpSocket::SetMulticastDefaultInterface(in6_addr a, int if_index) -{ - if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_IF, &if_index, sizeof(if_index)) == -1) - { - Handler().LogError(this, "SetMulticastDefaultInterface(ipv6)", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } -} -//#endif -//#endif - - -void UdpSocket::SetMulticastDefaultInterface(const std::string& intf, int if_index) -{ - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - struct in6_addr a; - if (Utility::u2ip( intf, a )) - { - SetMulticastDefaultInterface( a, if_index ); - } - return; - } -//#endif -//#endif - ipaddr_t a; - if (Utility::u2ip( intf, a )) - { - SetMulticastDefaultInterface( a, if_index ); - } -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/UdpSocket.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/UdpSocket.h deleted file mode 100755 index da635f55913..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/UdpSocket.h +++ /dev/null @@ -1,227 +0,0 @@ -/** \file UdpSocket.h - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_UdpSocket_H -#define _SOCKETS_UdpSocket_H - -#include "sockets-config.h" -#include "Socket.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -/** Socket implementation for UDP. - \ingroup basic */ -class UdpSocket : public Socket -{ -public: - /** Constructor. - \param h ISocketHandler reference - \param ibufsz Maximum size of receive message (extra bytes will be truncated) - \param ipv6 'true' if this is an ipv6 socket */ - UdpSocket(ISocketHandler& h,int ibufsz = 16384,bool ipv6 = false, int retries = 0); - ~UdpSocket(); - - /** Called when incoming data has been received. - \param buf Pointer to data - \param len Length of data - \param sa Pointer to sockaddr struct of sender - \param sa_len Length of sockaddr struct */ - virtual void OnRawData(const char *buf,size_t len,struct sockaddr *sa,socklen_t sa_len); - - /** Called when incoming data has been received and read timestamp is enabled. - \param buf Pointer to data - \param len Length of data - \param sa Pointer to sockaddr struct of sender - \param sa_len Length of sockaddr struct - \param ts Timestamp from message */ - virtual void OnRawData(const char *buf,size_t len,struct sockaddr *sa,socklen_t sa_len,struct timeval *ts); - - /** To receive incoming data, call Bind to setup an incoming port. - \param port Incoming port number - \param range Port range to try if ports already in use - \return 0 if bind succeeded */ - int Bind(port_t& port,int range = 1); - /** To receive data on a specific interface:port, use this. - \param intf Interface ip/hostname - \param port Port number - \param range Port range - \return 0 if bind succeeded */ - int Bind(const std::string& intf,port_t& port,int range = 1); - /** To receive data on a specific interface:port, use this. - \param a Ip address - \param port Port number - \param range Port range - \return 0 if bind succeeded */ - int Bind(ipaddr_t a,port_t& port,int range = 1); - //#ifdef ENABLE_IPV6 - //#ifdef IPPROTO_IPV6 - /** To receive data on a specific interface:port, use this. - \param a Ipv6 address - \param port Port number - \param range Port range - \return 0 if bind succeeded */ - int Bind(in6_addr a,port_t& port,int range = 1); - //#endif - //#endif - /** To receive data on a specific interface:port, use this. - \param ad Socket address - \param range Port range - \return 0 if bind succeeded */ - int Bind(SocketAddress& ad,int range = 1); - - /** Define remote host. - \param l Address of remote host - \param port Port of remote host - \return true if successful */ - bool Open(ipaddr_t l,port_t port); - /** Define remote host. - \param host Hostname - \param port Port number - \return true if successful */ - bool Open(const std::string& host,port_t port); - //#ifdef ENABLE_IPV6 - //#ifdef IPPROTO_IPV6 - /** Define remote host. - \param a Address of remote host, ipv6 - \param port Port of remote host - \return true if successful */ - bool Open(struct in6_addr& a,port_t port); - //#endif - //#endif - /** Define remote host. - \param ad Socket address - \return true if successful */ - bool Open(SocketAddress& ad); - - /** Send to specified host */ - void SendToBuf(const std::string& ,port_t,const char *data,int len,int flags = 0); - /** Send to specified address */ - void SendToBuf(ipaddr_t,port_t,const char *data,int len,int flags = 0); - //#ifdef ENABLE_IPV6 - //#ifdef IPPROTO_IPV6 - /** Send to specified ipv6 address */ - void SendToBuf(in6_addr,port_t,const char *data,int len,int flags = 0); - //#endif - //#endif - /** Send to specified socket address */ - void SendToBuf(SocketAddress& ad,const char *data,int len,int flags = 0); - - /** Send string to specified host */ - void SendTo(const std::string&,port_t,const std::string&,int flags = 0); - /** Send string to specified address */ - void SendTo(ipaddr_t,port_t,const std::string&,int flags = 0); - //#ifdef ENABLE_IPV6 - //#ifdef IPPROTO_IPV6 - /** Send string to specified ipv6 address */ - void SendTo(in6_addr,port_t,const std::string&,int flags = 0); - //#endif - //#endif - /** Send string to specified socket address */ - void SendTo(SocketAddress& ad,const std::string&,int flags = 0); - - /** Send to connected address */ - void SendBuf(const char *data,size_t,int flags = 0); - /** Send string to connected address. */ - void Send(const std::string& ,int flags = 0); - - /** Set broadcast */ - void SetBroadcast(bool b = true); - /** Check broadcast flag. - \return true broadcast is enabled. */ - bool IsBroadcast(); - - /** multicast */ - void SetMulticastTTL(int ttl = 1); - int GetMulticastTTL(); - void SetMulticastLoop(bool = true); - bool IsMulticastLoop(); - void SetMulticastDefaultInterface(ipaddr_t a, int if_index = 0); - //#ifdef ENABLE_IPV6 - //#ifdef IPPROTO_IPV6 - void SetMulticastDefaultInterface(in6_addr a, int if_index = 0); - //#endif - //#endif - void SetMulticastDefaultInterface(const std::string& intf, int if_index = 0); - void AddMulticastMembership(const std::string& group,const std::string& intf = "0.0.0.0",int if_index = 0); - void DropMulticastMembership(const std::string& group,const std::string& intf = "0.0.0.0",int if_index = 0); - //#ifdef ENABLE_IPV6 - //#ifdef IPPROTO_IPV6 - /** multicast, ipv6 only */ - void SetMulticastHops(int = -1); - /** multicast, ipv6 only */ - int GetMulticastHops(); - //#endif - //#endif - /** Returns true if Bind succeeded. */ - bool IsBound(); - /** Return Bind port number */ - port_t GetPort(); - - void OnOptions(int,int,int,SOCKET) {} - - int GetLastSizeWritten(); - - /** Also read timestamp information from incoming message */ - void SetTimestamp(bool = true); - -protected: - UdpSocket(const UdpSocket& s) : Socket(s) {} - void OnRead(); -#if defined(LINUX) || defined(MACOSX) - /** This method emulates socket recvfrom, but uses messages so we can get the timestamp */ - int ReadTS(char *ioBuf, int inBufSize, struct sockaddr *from, socklen_t fromlen, struct timeval *ts); -#endif - -private: - UdpSocket& operator=(const UdpSocket& ) { - return *this; - } - /** create before using sendto methods */ - void CreateConnection(); - char *m_ibuf; ///< Input buffer - int m_ibufsz; ///< Size of input buffer - bool m_bind_ok; ///< Bind completed successfully - port_t m_port; ///< Bind port number - int m_last_size_written; - int m_retries; - bool m_b_read_ts; -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_UdpSocket_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Utility.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Utility.cpp deleted file mode 100755 index 946867da490..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Utility.cpp +++ /dev/null @@ -1,1440 +0,0 @@ -/** \file Utility.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include <stdio.h> -#include "Utility.h" -#include "Parse.h" -#include "Ipv4Address.h" -#include "Ipv6Address.h" -#include "Base64.h" -#include <vector> -#ifdef _WIN32 -#include <time.h> -#else -#include <netdb.h> -#include <pthread.h> -#include <sys/types.h> -#include <sys/stat.h> -#endif -// --- stack -#ifdef LINUX -#include <cxxabi.h> -#include <execinfo.h> -#include <dlfcn.h> -#endif -// --- -#include <map> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif - - -// defines for the random number generator -#define TWIST_IA 397 -#define TWIST_IB (TWIST_LEN - TWIST_IA) -#define UMASK 0x80000000 -#define LMASK 0x7FFFFFFF -#define MATRIX_A 0x9908B0DF -#define TWIST(b,i,j) ((b)[i] & UMASK) | ((b)[j] & LMASK) -#define MAGIC_TWIST(s) (((s) & 1) * MATRIX_A) - - -// statics -std::string Utility::m_host; -bool Utility::m_local_resolved = false; -ipaddr_t Utility::m_ip = 0; -std::string Utility::m_addr; -#ifdef ENABLE_IPV6 -#ifdef IPPROTO_IPV6 -struct in6_addr Utility::m_local_ip6; -std::string Utility::m_local_addr6; -#endif -#endif -const char *Utility::Logo = - "iVBORw0KGgoAAAANSUhEUgAAAGAAAABeCAIAAABTioayAAAACXBIWXMAAABkAAAAZAAPlsXdAAAAUHRF" - "WHRSYXcgcHJvZmlsZSB0eXBlIEFQUDEyAApnZW5lcmljIHByb2ZpbGUKICAgICAgMTUKNDQ3NTYzNmI3" - "OTAwMDEwMDA0MDAwMDAwM2MwMDAwCg2F1B0AABb4SURBVHja7Xx7rGVXed/3WGs/zvPeuTPXMzbjcUpq" - "HAwlpQlYoUlDaJsAiVuFFKSKGlUlKgXqIKJAKxfRR4IUZEpSt1FoQEK4oYQEErlSFAoKIEoo2BQasBmc" - "2NjyYzxz5957Hnufvfd6fF//2Oecez2hvbXvmZkg3U9b556Zc85ea//291rf+n0bVRWO5P8udLUn8Jdd" - "jgA6QI4AOkCOADpAjgA6QI4AOkCOADpAjgA6QI4AOkCOADpAjgA6QI4AOkCOADpAjgA6QMxVHHtfoUWx" - "/dP+C5fvABGv4gwBAK9qPWg5NLbvrjIY302ujgapAmKrQQiqC3xAQQF0H1AIcyXSq4XeZdegfedfWs78" - "jYKAAgDi3sVri4mqzH+D9DSTu+I2dyVNTEFRl34GUTUikiqotrgoAqqIAhBxqzj7ZocAighXWJUuI0Cq" - "injJ+SMAIZKolkXlGrOzM61mjfckCoN+X9UjorU26wgb7HTSPAfDRlVVFQAR21NeOT26XAC1p10CpKoI" - "iKTO+ckkFpO4vVX1Bh3kkKRsDCIBE4sIMRNx8FTPYgwQfJ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9NciRAa+agDtR2oJ" - "kAiEIGTs5uZ6NZv1el0RiTEAQu0ccQYosQl33fUr933ts6dP3/C+975FoicGBNy+cFEizqpqVpZFUW2e" - "uOn0mTMqjoiYGaJOZ42xPR9pMhkVxSwEQJQonsgAKJMR0PX19cY51amE1sL2V74PZW6HctLt8CISI6hQ" - "nnYIaTjsqcJ4PBkOB8SAqDHGTqf7B7939+/8zm+dueH5SL3zF84bY0UFVMqicIJFUZSzWTkbAVVpKgRC" - "BIjqnEuzCNhUs3I2mznvptNadcyUEHOWdkSE2cQYm8apoggorcA3rwagef4sKCJRBNgIBFVjDB8/fgxQ" - "CAEMJIbP3n//r773jtPX3/zP3/Yh5swY7ORZFAEwH/iPb/va1/64CaFpmqZyvdycOG4tISEBooidVaFu" - "uqpSOwhBogICIGrTVE3tQpQQfZqmo9F0Y70nogrKtLJgf9gwL6KiAKBN02xvT4hNJ82SxBpj806GKDFI" - "1ci7/tVbtnYvvPvffHzj2BnndrMsURCM5D35RqtZ5byv66quK9FgjHZSawzPLYUQALwPABCjDIdZU9fW" - "2DRLvZO6dgpS13WeZ7z4yQqToVVokGqMAgAhhG6WFeV4wIOqruumMgZ63WN3vu9f3PeVz7/lbXfe/MJb" - "Gr+1udlhQiT1XqsZGwoiERRANEQBVQARjcQUQqjrWhQBE5B51EeEPM+tsSKSJmysb1wdY0ySTGIZY0RE" - "YFxuq1w1gFpPqICiEqIqmMEgiYLdXj8EEY1BJOHhf/34f/7QB371lpfd+qpXvzHEyclret2cLRMAlI3v" - "pmnVjGblyLtZiD4ExxiJmE1AVIkBAEV0NqtCmAFAjI0hCKJISMgxQpJam1gFcFUTfIyArFHEECEAtstj" - "OETGeDgTUxBRERWJqpLnSZKse+/KcrZ+bC3GEIKcP7f9s6+7/Wd++o2G0RqXGCOxVrLGMIJToB//2z93" - "zbUveN6NL/GvelOMs43jJ6whZgYAUcny1MUmRveyv/X31teve+73v3Bra5JkTlW982nWAQUEBERmTVKM" - "Isv8bCVu+hmXXJel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9n76omirAvnC3nxAjAtOCLIyoQARIgYowa" - "YqQAIiBRFz0sqqD7am+I+5WH2hxiniAbg8aSNdZYtoYSIsNsGKmNa4gAArrSGHZ4H7QPo7YnDIgVgBRV" - "ERNgDG3sjRikLYSKgJCIggrqJYRLFNhvVy0TcZEQGottOmgNW0OGqTUuwqU54cpb7lZCwZt7IiKAFhhS" - "QEbECNrmJoTIJMIUAkdZCqqAzjf3W19Ne9pD86yPGYnJEBlLxpBhYwwZg0xA7TGvbyxnskom8Ep40stZ" - "KQEqoKIAKBChUSRAAgJgJolqWH2MIlFUVEi17VFddnjMzYsIFot0ZAZitMxsyDAaZDZIDLioJQAoos49" - "0F9OEmcr863QFhqNhIotNoREFEVjUCIlQVGKIhpx2ciyNLNFgbJ1K+16AucHATOaeWFjrzxGcwtfrfNZ" - "NUB7ffCgiECttpMitMUPYQJBiCRRMLaaIyAK836fvS2kdqt9bmI8RwqJgQiZieep6Tx3aksul6+xdJUa" - "tLyBrZlw6ywVkQCh7elSZozCoqqCCu0eP+3xefZyn7k/MqhtcjNXJ8KFNQG2vAVcphp7r6u8qMuB/b7e" - "sbYFF1RVZb5vFURk7nsIVEV0uaEluFeraAFibJkuS+Rg8bnuux8rYwNdIYBgX/chwDy2qMCCM4xzy4I2" - "c95rFtzPN1jokS42BeZnJmrLKC0ul8XvXAmAYMlZaiGY3+TWHWP7CIa9msBfmALCHJe9dcjyKRZIl7Sq" - "fI+1hV+CUXu5oHvE8z2a9SJz0Zb7vO/JHrjvKRSLh5vsQ2+Oy+Wb+JUC6LuAden47Wf/HxO9Igb1Xca9" - "ks8PWjjvxXV+F7X4f/12/sUrC9KVfsDSpcPtIbX/sq+aQf1FubpPoPoekKOHvB0gRwAdIEcAHSBHAB0g" - "RwAdIEcAHSBHAB0gRwAdIEcAHSBHAB0gRwAdIP8HqHccFP4Rq4QAAAAASUVORK5CYII="; - - -std::string Utility::base64(const std::string& str_in) -{ - std::string str; - Base64 m_b; - m_b.encode(str_in, str, false); // , false == do not add cr/lf - return str; -} - - -std::string Utility::base64d(const std::string& str_in) -{ - std::string str; - Base64 m_b; - m_b.decode(str_in, str); - return str; -} - - -std::string Utility::l2string(long l) -{ - std::string str; - char tmp[100]; - snprintf(tmp,sizeof(tmp),"%ld",l); - str = tmp; - return str; -} - - -std::string Utility::bigint2string(int64_t l) -{ - std::string str; - int64_t tmp = l; - if (l < 0) - { - str = "-"; - tmp = -l; - } - while (tmp) - { - uint64_t a = tmp % 10; - str = (char)(a + 48) + str; - tmp /= 10; - } - if (!str.size()) - { - str = "0"; - } - return str; -} - - -std::string Utility::bigint2string(uint64_t l) -{ - std::string str; - uint64_t tmp = l; - while (tmp) - { - uint64_t a = tmp % 10; - str = (char)(a + 48) + str; - tmp /= 10; - } - if (!str.size()) - { - str = "0"; - } - return str; -} - - -uint64_t Utility::atoi64(const std::string& str) -{ - uint64_t l = 0; - for (size_t i = 0; i < str.size(); ++i) - { - l = l * 10 + str[i] - 48; - } - return l; -} - - -unsigned int Utility::hex2unsigned(const std::string& str) -{ - unsigned int r = 0; - for (size_t i = 0; i < str.size(); ++i) - { - r = r * 16 + str[i] - 48 - ((str[i] >= 'A') ? 7 : 0) - ((str[i] >= 'a') ? 32 : 0); - } - return r; -} - - -/* -* Encode string per RFC1738 URL encoding rules -* tnx rstaveley -*/ -std::string Utility::rfc1738_encode(const std::string& src) -{ -static char hex[] = "0123456789ABCDEF"; - std::string dst; - for (size_t i = 0; i < src.size(); ++i) - { - if (isalnum(src[i])) - { - dst += src[i]; - } - else - if (src[i] == ' ') - { - dst += '+'; - } - else - { - unsigned char c = static_cast<unsigned char>(src[i]); - dst += '%'; - dst += hex[c / 16]; - dst += hex[c % 16]; - } - } - return dst; -} // rfc1738_encode - - -/* -* Decode string per RFC1738 URL encoding rules -* tnx rstaveley -*/ -std::string Utility::rfc1738_decode(const std::string& src) -{ - std::string dst; - for (size_t i = 0; i < src.size(); ++i) - { - if (src[i] == '%' && isxdigit(src[i + 1]) && isxdigit(src[i + 2])) - { - char c1 = src[++i]; - char c2 = src[++i]; - c1 = c1 - 48 - ((c1 >= 'A') ? 7 : 0) - ((c1 >= 'a') ? 32 : 0); - c2 = c2 - 48 - ((c2 >= 'A') ? 7 : 0) - ((c2 >= 'a') ? 32 : 0); - dst += (char)(c1 * 16 + c2); - } - else - if (src[i] == '+') - { - dst += ' '; - } - else - { - dst += src[i]; - } - } - return dst; -} // rfc1738_decode - - -bool Utility::isipv4(const std::string& str) -{ - int dots = 0; - // %! ignore :port? - for (size_t i = 0; i < str.size(); ++i) - { - if (str[i] == '.') - dots++; - else - if (!isdigit(str[i])) - return false; - } - if (dots != 3) - return false; - return true; -} - - -bool Utility::isipv6(const std::string& str) -{ - size_t qc = 0; - size_t qd = 0; - for (size_t i = 0; i < str.size(); ++i) - { - qc += (str[i] == ':') ? 1 : 0; - qd += (str[i] == '.') ? 1 : 0; - } - if (qc > 7) - { - fprintf(stderr, "tility::isipv6(%s) FALSE @1\n", str.c_str()); - return false; - } - if (qd && qd != 3) - { - fprintf(stderr, "tility::isipv6(%s) FALSE @2\n", str.c_str()); - return false; - } - Parse pa(str,":."); - std::string tmp = pa.getword(); - while (tmp.size()) - { - if (tmp.size() > 4) - { - fprintf(stderr, "tility::isipv6(%s) FALSE@3\n", str.c_str()); - return false; - } - for (size_t i = 0; i < tmp.size(); ++i) - { - if (tmp[i] < '0' || (tmp[i] > '9' && tmp[i] < 'A') || - (tmp[i] > 'F' && tmp[i] < 'a') || tmp[i] > 'f') - { - fprintf(stderr, "tility::isipv6(%s) FALSE@4\n", str.c_str()); - return false; - } - } - // - tmp = pa.getword(); - } - return true; -} - - -bool Utility::u2ip(const std::string& str, ipaddr_t& l) -{ - struct sockaddr_in sa; - bool r = Utility::u2ip(str, sa); - memcpy(&l, &sa.sin_addr, sizeof(l)); - return r; -} - - -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 -bool Utility::u2ip(const std::string& str, struct in6_addr& l) -{ - struct sockaddr_in6 sa; - bool r = Utility::u2ip(str, sa); - l = sa.sin6_addr; - return r; -} -//#endif -//#endif - - -void Utility::l2ip(const ipaddr_t ip, std::string& str) -{ - struct sockaddr_in sa; - memset(&sa, 0, sizeof(sa)); - sa.sin_family = AF_INET; - memcpy(&sa.sin_addr, &ip, sizeof(sa.sin_addr)); - Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), str, NI_NUMERICHOST); -} - - -void Utility::l2ip(const in_addr& ip, std::string& str) -{ - struct sockaddr_in sa; - memset(&sa, 0, sizeof(sa)); - sa.sin_family = AF_INET; - sa.sin_addr = ip; - Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), str, NI_NUMERICHOST); -} - - -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 -void Utility::l2ip(const struct in6_addr& ip, std::string& str,bool mixed) -{ - char slask[100]; // l2ip temporary - *slask = 0; - unsigned int prev = 0; - bool skipped = false; - bool ok_to_skip = true; - if (mixed) - { - unsigned short x; - unsigned short addr16[8]; - memcpy(addr16, &ip, sizeof(addr16)); - for (size_t i = 0; i < 6; ++i) - { - x = ntohs(addr16[i]); - if (*slask && (x || !ok_to_skip || prev)) - { -#if defined( _WIN32) && !defined(__CYGWIN__) - strcat_s(slask,sizeof(slask),":"); -#else - strcat(slask,":"); -#endif - } - if (x || !ok_to_skip) - { - snprintf(slask + strlen(slask),sizeof(slask) - strlen(slask),"%x", x); - if (x && skipped) - ok_to_skip = false; - } - else - { - skipped = true; - } - prev = x; - } - x = ntohs(addr16[6]); - snprintf(slask + strlen(slask),sizeof(slask) - strlen(slask),":%u.%u",x / 256,x & 255); - x = ntohs(addr16[7]); - snprintf(slask + strlen(slask),sizeof(slask) - strlen(slask),".%u.%u",x / 256,x & 255); - } - else - { - struct sockaddr_in6 sa; - memset(&sa, 0, sizeof(sa)); - sa.sin6_family = AF_INET6; - sa.sin6_addr = ip; - Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), str, NI_NUMERICHOST); - return; - } - str = slask; -} - - -int Utility::in6_addr_compare(in6_addr a,in6_addr b) -{ - for (size_t i = 0; i < 16; ++i) - { - if (a.s6_addr[i] < b.s6_addr[i]) - return -1; - if (a.s6_addr[i] > b.s6_addr[i]) - return 1; - } - return 0; -} -//#endif -//#endif - - -void Utility::ResolveLocal() -{ - char h[256]; - - // get local hostname and translate into ip-address - *h = 0; - gethostname(h,255); - { - if (Utility::u2ip(h, m_ip)) - { - Utility::l2ip(m_ip, m_addr); - } - } -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 - memset(&m_local_ip6, 0, sizeof(m_local_ip6)); - { - if (Utility::u2ip(h, m_local_ip6)) - { - Utility::l2ip(m_local_ip6, m_local_addr6); - } - } -//#endif -//#endif - m_host = h; - m_local_resolved = true; -} - - -const std::string& Utility::GetLocalHostname() -{ - if (!m_local_resolved) - { - ResolveLocal(); - } - return m_host; -} - - -ipaddr_t Utility::GetLocalIP() -{ - if (!m_local_resolved) - { - ResolveLocal(); - } - return m_ip; -} - - -const std::string& Utility::GetLocalAddress() -{ - if (!m_local_resolved) - { - ResolveLocal(); - } - return m_addr; -} - - -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 -const struct in6_addr& Utility::GetLocalIP6() -{ - if (!m_local_resolved) - { - ResolveLocal(); - } - return m_local_ip6; -} - - -const std::string& Utility::GetLocalAddress6() -{ - if (!m_local_resolved) - { - ResolveLocal(); - } - return m_local_addr6; -} -//#endif -//#endif - - -const std::string Utility::GetEnv(const std::string& name) -{ -#if defined( _WIN32) && !defined(__CYGWIN__) - size_t sz = 0; - char tmp[2048]; - if (getenv_s(&sz, tmp, sizeof(tmp), name.c_str())) - { - *tmp = 0; - } - return tmp; -#else - char *s = getenv(name.c_str()); - if (!s) - return ""; - return s; -#endif -} - - -void Utility::SetEnv(const std::string& var,const std::string& value) -{ -#if (defined(SOLARIS8) || defined(SOLARIS)) - { - static std::map<std::string, char *> vmap; - if (vmap.find(var) != vmap.end()) - { - delete[] vmap[var]; - } - size_t sz = var.size() + 1 + value.size() + 1; - vmap[var] = new char[sz]; - snprintf(vmap[var], sz, "%s=%s", var.c_str(), value.c_str()); - putenv( vmap[var] ); - } -#elif defined _WIN32 - { - std::string slask = var + "=" + value; - _putenv( (char *)slask.c_str()); - } -#else - setenv(var.c_str(), value.c_str(), 1); -#endif -} - - -std::string Utility::Sa2String(struct sockaddr *sa) -{ -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 - if (sa -> sa_family == AF_INET6) - { - struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)sa; - std::string tmp; - Utility::l2ip(sa6 -> sin6_addr, tmp); - return tmp + ":" + Utility::l2string(ntohs(sa6 -> sin6_port)); - } -//#endif -//#endif - if (sa -> sa_family == AF_INET) - { - struct sockaddr_in *sa4 = (struct sockaddr_in *)sa; - ipaddr_t a; - memcpy(&a, &sa4 -> sin_addr, 4); - std::string tmp; - Utility::l2ip(a, tmp); - return tmp + ":" + Utility::l2string(ntohs(sa4 -> sin_port)); - } - return ""; -} - - -void Utility::GetTime(struct timeval *p) -{ -#ifdef _WIN32 - FILETIME ft; // Contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC). - GetSystemTimeAsFileTime(&ft); - uint64_t tt; - memcpy(&tt, &ft, sizeof(tt)); - tt /= 10; // make it usecs - p->tv_sec = (long)tt / 1000000; - p->tv_usec = (long)tt % 1000000; -#else - gettimeofday(p, NULL); -#endif -} - - -std::auto_ptr<SocketAddress> Utility::CreateAddress(struct sockaddr *sa,socklen_t sa_len) -{ - switch (sa -> sa_family) - { - case AF_INET: - if (sa_len == sizeof(struct sockaddr_in)) - { - struct sockaddr_in *p = (struct sockaddr_in *)sa; - return std::auto_ptr<SocketAddress>(new Ipv4Address(*p)); - } - break; -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 - case AF_INET6: - if (sa_len == sizeof(struct sockaddr_in6)) - { - struct sockaddr_in6 *p = (struct sockaddr_in6 *)sa; - return std::auto_ptr<SocketAddress>(new Ipv6Address(*p)); - } - break; -//#endif -//#endif - } - return std::auto_ptr<SocketAddress>(NULL); -} - - -bool Utility::u2ip(const std::string& host, struct sockaddr_in& sa, int ai_flags) -{ - memset(&sa, 0, sizeof(sa)); - sa.sin_family = AF_INET; -#ifdef NO_GETADDRINFO - if ((ai_flags & AI_NUMERICHOST) != 0 || isipv4(host)) - { - Parse pa((char *)host.c_str(), "."); - union { - struct { - unsigned char b1; - unsigned char b2; - unsigned char b3; - unsigned char b4; - } a; - ipaddr_t l; - } u; - u.a.b1 = static_cast<unsigned char>(pa.getvalue()); - u.a.b2 = static_cast<unsigned char>(pa.getvalue()); - u.a.b3 = static_cast<unsigned char>(pa.getvalue()); - u.a.b4 = static_cast<unsigned char>(pa.getvalue()); - memcpy(&sa.sin_addr, &u.l, sizeof(sa.sin_addr)); - return true; - } -#ifndef LINUX - struct hostent *he = gethostbyname( host.c_str() ); - if (!he) - { - return false; - } - memcpy(&sa.sin_addr, he -> h_addr, sizeof(sa.sin_addr)); -#else - struct hostent he; - struct hostent *result = NULL; - int myerrno = 0; - char buf[2000]; - int n = gethostbyname_r(host.c_str(), &he, buf, sizeof(buf), &result, &myerrno); - if (n || !result) - { - return false; - } - if (he.h_addr_list && he.h_addr_list[0]) - memcpy(&sa.sin_addr, he.h_addr, 4); - else - return false; -#endif - return true; -#else - struct addrinfo hints; - memset(&hints, 0, sizeof(hints)); - // AI_NUMERICHOST - // AI_CANONNAME - // AI_PASSIVE - server - // AI_ADDRCONFIG - // AI_V4MAPPED - // AI_ALL - // AI_NUMERICSERV - hints.ai_flags = ai_flags; - hints.ai_family = AF_INET; - hints.ai_socktype = 0; - hints.ai_protocol = 0; - struct addrinfo *res; - if (Utility::isipv4(host)) - hints.ai_flags |= AI_NUMERICHOST; - int n = getaddrinfo(host.c_str(), NULL, &hints, &res); - if (!n) - { - std::vector<struct addrinfo *> vec; - struct addrinfo *ai = res; - while (ai) - { - if (ai -> ai_addrlen == sizeof(sa)) - vec.push_back( ai ); - ai = ai -> ai_next; - } - if (!vec.size()) - return false; - ai = vec[Utility::Rnd() % vec.size()]; - { - memcpy(&sa, ai -> ai_addr, ai -> ai_addrlen); - } - freeaddrinfo(res); - return true; - } - std::string error = "Error: "; -#ifndef __CYGWIN__ - error += gai_strerror(n); -#endif - return false; -#endif // NO_GETADDRINFO -} - - -//#ifdef ENABLE_IPV6 -//#ifdef IPPROTO_IPV6 -bool Utility::u2ip(const std::string& host, struct sockaddr_in6& sa, int ai_flags) -{ - memset(&sa, 0, sizeof(sa)); - sa.sin6_family = AF_INET6; -#ifdef NO_GETADDRINFO - if ((ai_flags & AI_NUMERICHOST) != 0 || isipv6(host)) - { - std::list<std::string> vec; - size_t x = 0; - for (size_t i = 0; i <= host.size(); ++i) - { - if (i == host.size() || host[i] == ':') - { - std::string s = host.substr(x, i - x); - // - if (strstr(s.c_str(),".")) // x.x.x.x - { - Parse pa(s,"."); - char slask[100]; // u2ip temporary hex2string conversion - unsigned long b0 = static_cast<unsigned long>(pa.getvalue()); - unsigned long b1 = static_cast<unsigned long>(pa.getvalue()); - unsigned long b2 = static_cast<unsigned long>(pa.getvalue()); - unsigned long b3 = static_cast<unsigned long>(pa.getvalue()); - snprintf(slask,sizeof(slask),"%lx",b0 * 256 + b1); - vec.push_back(slask); - snprintf(slask,sizeof(slask),"%lx",b2 * 256 + b3); - vec.push_back(slask); - } - else - { - vec.push_back(s); - } - // - x = i + 1; - } - } - size_t sz = vec.size(); // number of byte pairs - size_t i = 0; // index in in6_addr.in6_u.u6_addr16[] ( 0 .. 7 ) - unsigned short addr16[8]; - for (std::list<std::string>::iterator it = vec.begin(); it != vec.end(); ++it) - { - std::string bytepair = *it; - if (bytepair.size()) - { - addr16[i++] = htons(Utility::hex2unsigned(bytepair)); - } - else - { - addr16[i++] = 0; - while (sz++ < 8) - { - addr16[i++] = 0; - } - } - } - memcpy(&sa.sin6_addr, addr16, sizeof(addr16)); - return true; - } -#ifdef SOLARIS - int errnum = 0; - struct hostent *he = getipnodebyname( host.c_str(), AF_INET6, 0, &errnum ); -#else - struct hostent *he = gethostbyname2( host.c_str(), AF_INET6 ); -#endif - if (!he) - { - return false; - } - memcpy(&sa.sin6_addr,he -> h_addr_list[0],he -> h_length); -#ifdef SOLARIS - free(he); -#endif - return true; -#else - struct addrinfo hints; - memset(&hints, 0, sizeof(hints)); - hints.ai_flags = ai_flags; - hints.ai_family = AF_INET6; - hints.ai_socktype = 0; - hints.ai_protocol = 0; - struct addrinfo *res; - if (Utility::isipv6(host)) - hints.ai_flags |= AI_NUMERICHOST; - int n = getaddrinfo(host.c_str(), NULL, &hints, &res); - if (!n) - { - std::vector<struct addrinfo *> vec; - struct addrinfo *ai = res; - while (ai) - { - if (ai -> ai_addrlen == sizeof(sa)) - vec.push_back( ai ); - ai = ai -> ai_next; - } - if (!vec.size()) - return false; - ai = vec[Utility::Rnd() % vec.size()]; - { - memcpy(&sa, ai -> ai_addr, ai -> ai_addrlen); - } - freeaddrinfo(res); - return true; - } - std::string error = "Error: "; -#ifndef __CYGWIN__ - error += gai_strerror(n); -#endif - return false; -#endif // NO_GETADDRINFO -} -//#endif // IPPROTO_IPV6 -//#endif // ENABLE_IPV6 - - -bool Utility::reverse(struct sockaddr *sa, socklen_t sa_len, std::string& hostname, int flags) -{ - std::string service; - return Utility::reverse(sa, sa_len, hostname, service, flags); -} - - -bool Utility::reverse(struct sockaddr *sa, socklen_t sa_len, std::string& hostname, std::string& service, int flags) -{ - hostname = ""; - service = ""; -#ifdef NO_GETADDRINFO - switch (sa -> sa_family) - { - case AF_INET: - if (flags & NI_NUMERICHOST) - { - union { - struct { - unsigned char b1; - unsigned char b2; - unsigned char b3; - unsigned char b4; - } a; - ipaddr_t l; - } u; - struct sockaddr_in *sa_in = (struct sockaddr_in *)sa; - memcpy(&u.l, &sa_in -> sin_addr, sizeof(u.l)); - char tmp[100]; - snprintf(tmp, sizeof(tmp), "%u.%u.%u.%u", u.a.b1, u.a.b2, u.a.b3, u.a.b4); - hostname = tmp; - return true; - } - else - { - struct sockaddr_in *sa_in = (struct sockaddr_in *)sa; - struct hostent *h = gethostbyaddr( (const char *)&sa_in -> sin_addr, sizeof(sa_in -> sin_addr), AF_INET); - if (h) - { - hostname = h -> h_name; - return true; - } - } - break; -//#ifdef ENABLE_IPV6 - case AF_INET6: - if (flags & NI_NUMERICHOST) - { - char slask[100]; // l2ip temporary - *slask = 0; - unsigned int prev = 0; - bool skipped = false; - bool ok_to_skip = true; - { - unsigned short addr16[8]; - struct sockaddr_in6 *sa_in6 = (struct sockaddr_in6 *)sa; - memcpy(addr16, &sa_in6 -> sin6_addr, sizeof(addr16)); - for (size_t i = 0; i < 8; ++i) - { - unsigned short x = ntohs(addr16[i]); - if (*slask && (x || !ok_to_skip || prev)) - { -#if defined( _WIN32) && !defined(__CYGWIN__) - strcat_s(slask, sizeof(slask),":"); -#else - strcat(slask,":"); -#endif - } - if (x || !ok_to_skip) - { - snprintf(slask + strlen(slask), sizeof(slask) - strlen(slask),"%x", x); - if (x && skipped) - ok_to_skip = false; - } - else - { - skipped = true; - } - prev = x; - } - } - if (!*slask) - { -#if defined( _WIN32) && !defined(__CYGWIN__) - strcpy_s(slask, sizeof(slask), "::"); -#else - strcpy(slask, "::"); -#endif - } - hostname = slask; - return true; - } - else - { - // %! TODO: ipv6 reverse lookup - struct sockaddr_in6 *sa_in = (struct sockaddr_in6 *)sa; - struct hostent *h = gethostbyaddr( (const char *)&sa_in -> sin6_addr, sizeof(sa_in -> sin6_addr), AF_INET6); - if (h) - { - hostname = h -> h_name; - return true; - } - } - break; -//#endif - } - return false; -#else - char host[NI_MAXHOST]; - // NI_NOFQDN - // NI_NUMERICHOST - // NI_NAMEREQD - // NI_NUMERICSERV - // NI_DGRAM - int n = getnameinfo(sa, sa_len, host, sizeof(host), NULL, 0, flags); - if (n) - { - // EAI_AGAIN - // EAI_BADFLAGS - // EAI_FAIL - // EAI_FAMILY - // EAI_MEMORY - // EAI_NONAME - // EAI_OVERFLOW - // EAI_SYSTEM - return false; - } - hostname = host; - return true; -#endif // NO_GETADDRINFO -} - - -bool Utility::u2service(const std::string& name, int& service, int ai_flags) -{ -#ifdef NO_GETADDRINFO - // %! - return false; -#else - struct addrinfo hints; - service = 0; - memset(&hints, 0, sizeof(hints)); - // AI_NUMERICHOST - // AI_CANONNAME - // AI_PASSIVE - server - // AI_ADDRCONFIG - // AI_V4MAPPED - // AI_ALL - // AI_NUMERICSERV - hints.ai_flags = ai_flags; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = 0; - hints.ai_protocol = 0; - struct addrinfo *res; - int n = getaddrinfo(NULL, name.c_str(), &hints, &res); - if (!n) - { - service = res -> ai_protocol; - freeaddrinfo(res); - return true; - } - return false; -#endif // NO_GETADDRINFO -} - - -unsigned long Utility::ThreadID() -{ -#ifdef _WIN32 - return GetCurrentThreadId(); -#else - return (unsigned long)pthread_self(); -#endif -} - - -std::string Utility::ToLower(const std::string& str) -{ - std::string r; - for (size_t i = 0; i < str.size(); ++i) - { - if (str[i] >= 'A' && str[i] <= 'Z') - r += str[i] | 32; - else - r += str[i]; - } - return r; -} - - -std::string Utility::ToUpper(const std::string& str) -{ - std::string r; - for (size_t i = 0; i < str.size(); ++i) - { - if (str[i] >= 'a' && str[i] <= 'z') - r += (char)(str[i] - 32); - else - r += str[i]; - } - return r; -} - - -std::string Utility::ToString(double d) -{ - char tmp[100]; - snprintf(tmp, sizeof(tmp), "%f", d); - return tmp; -} - - -unsigned long Utility::Rnd() -{ -static Utility::Rng generator( (unsigned long)time(NULL) ); - return generator.Get(); -} - - -Utility::Rng::Rng(unsigned long seed) : m_value( 0 ) -{ - m_tmp[0] = seed & 0xffffffffUL; - for (int i = 1; i < TWIST_LEN; ++i) - { - m_tmp[i] = (1812433253UL * (m_tmp[i - 1] ^ (m_tmp[i - 1] >> 30)) + i); - } -} - - -unsigned long Utility::Rng::Get() -{ - unsigned long val = m_tmp[m_value]; - ++m_value; - if (m_value == TWIST_LEN) - { - for (int i = 0; i < TWIST_IB; ++i) - { - unsigned long s = TWIST(m_tmp, i, i + 1); - m_tmp[i] = m_tmp[i + TWIST_IA] ^ (s >> 1) ^ MAGIC_TWIST(s); - } - { - for (int i = 0; i < TWIST_LEN - 1; ++i) - { - unsigned long s = TWIST(m_tmp, i, i + 1); - m_tmp[i] = m_tmp[i - TWIST_IB] ^ (s >> 1) ^ MAGIC_TWIST(s); - } - } - unsigned long s = TWIST(m_tmp, TWIST_LEN - 1, 0); - m_tmp[TWIST_LEN - 1] = m_tmp[TWIST_IA - 1] ^ (s >> 1) ^ MAGIC_TWIST(s); - - m_value = 0; - } - return val; -} - - -bool Utility::ncmap_compare::operator()(const std::string& x, const std::string& y) const -{ - return strcasecmp(x.c_str(), y.c_str()) < 0; -} - - -Utility::Uri::Uri(const std::string& url) : m_url(url), m_port(0), m_path(url) -{ - size_t pos = url.find("://"); - if (pos != std::string::npos) - { - m_protocol = Utility::ToLower(url.substr(0, pos)); - m_port = (m_protocol == "http") ? 80 : - (m_protocol == "https") ? 443 : 0; - m_host = url.substr(pos + 3); - pos = m_host.find("/"); - if (pos != std::string::npos) - { - m_path = m_host.substr(pos); - m_host = m_host.substr(0, pos); - } - pos = m_host.find(":"); - if (pos != std::string::npos) - { - m_port = atoi(m_host.substr(pos + 1).c_str()); - m_host = m_host.substr(0, pos); - } - } - pos = m_path.find("?"); - if (pos != std::string::npos) - { - m_uri = m_path.substr(0, pos); - m_query_string = m_path.substr(pos + 1); - } - else - { - m_uri = m_path; - } - pos = std::string::npos; - for (size_t i = 0; i < m_uri.size(); ++i) - if (m_uri[i] == '/') - pos = i; - if (pos != std::string::npos) - m_file = m_uri.substr(pos + 1); - pos = std::string::npos; - for (size_t i = 0; i < m_uri.size(); ++i) - if (m_uri[i] == '.') - pos = i; - if (pos != std::string::npos) - m_ext = m_uri.substr(pos + 1); -} - - -Utility::Path::Path(const std::string& _str) -{ - std::string str = _str; - for (size_t i = 0; i < str.size(); ++i) - { -#ifdef _WIN32 - if (str[i] == '/') - str[i] = '\\'; -#else - if (str[i] == '\\') - str[i] = '/'; -#endif - } -#ifndef _WIN32 - struct stat st; - stat(str.c_str(), &st); - if (S_ISDIR(st.st_mode)) - { - m_path = str; - return; - } -#endif - size_t x = 0; - for (size_t i = 0; i < str.size(); ++i) - if (str[i] == '/' || str[i] == '\\') - x = i + 1; - m_path = str.substr(0, x); - m_file = str.substr(x); - for (size_t i = 0; i < m_file.size(); ++i) - if (m_file[i] == '.') - m_ext = m_file.substr(i + 1); -} - - -const std::string Utility::Stack() -{ -#if defined LINUX -#define BFSIZE 255 - void *buffer[BFSIZE]; - int n = backtrace(buffer, BFSIZE); - char **res = backtrace_symbols(buffer, n); - std::string tmp; - for (int i = 0; i < n; ++i) - { - std::string x = res[i]; - std::string plus; - std::string addr; - size_t pos = x.find("("); - if (pos != std::string::npos) - { - x = x.substr(pos + 1); // skip executable name - - pos = x.find(")"); - if (pos != std::string::npos) - { - addr = x.substr(pos + 1); - x = x.substr(0, pos); - } - - pos = x.find("+"); - if (pos != std::string::npos) - { - plus = x.substr(pos); - x = x.substr(0, pos); - } - } - char zz[1000]; - { - size_t sz = 1000; - int status = 0; - abi::__cxa_demangle( x.c_str(), zz, &sz, &status); - - if (!status) - { - tmp += zz; - tmp += plus; - tmp += addr; - } - else - { - tmp += res[i]; - } - tmp += "\n"; - } - // dladdr() test - if (0) - { - Dl_info info; - int n = dladdr(buffer[i], &info); - if (!n) - printf("%d: dladdr() failed\n", i); - else - { - size_t sz = 1000; - int status = 0; - abi::__cxa_demangle( info.dli_sname, zz, &sz, &status); - - printf("%d: %s: %s\n", i, info.dli_fname, info.dli_sname); - if (!status) - printf(" %s\n", zz); - } - } // end of dladdr() test - } // for (i) - free(res); - return tmp; -#else - return "Not available"; -#endif -} - - -const std::string Utility::FromUtf8(const std::string& str) -{ - if (!str.size()) - return ""; - std::string r; - for (size_t i = 0; i < str.size(); ++i) - { - if (i < str.size() - 1 && (str[i] & 0xe0) == 0xc0 && (str[i + 1] & 0xc0) == 0x80) - { - int c1 = str[i] & 0x1f; - int c2 = str[++i] & 0x3f; - int c = (c1 << 6) + c2; - r += (char)c; - } - else - { - r += str[i]; - } - } - return r; -} - -// 110yyyxx 10xxxxxx - -const std::string Utility::ToUtf8(const std::string& str) -{ - if (str.empty()) - return ""; - std::string r; - for (size_t i = 0; i < str.size(); ++i) - { - if (((unsigned)str[i] & 0x80) == 0x80) - { - r += (str[i] >> 6) | 0xc0; - r += (str[i] & 0x3f) | 0x80; - } - else - { - r += str[i]; - } - } - return r; -} - - -const Utility::Path Utility::CurrentDirectory() -{ -#ifdef _WIN32 - TCHAR slask[MAX_PATH + 1]; - DWORD ret = -#ifdef UNICODE - ::GetCurrentDirectoryW(MAX_PATH, slask); -#else - ::GetCurrentDirectoryA(MAX_PATH, slask); -#endif - if (!ret) - { - *slask = 0; - DWORD err = GetLastError(); - } - return Path(slask); -#else - char slask[32000]; - if (!getcwd(slask, 32000)) - { - return Path("."); - } - return Path(slask); -#endif -} - - -bool Utility::ChangeDirectory(const Utility::Path& to_dir) -{ -#ifdef _WIN32 - return SetCurrentDirectory(to_dir.GetPath().c_str()) ? true : false; -#else - if (chdir( to_dir.GetPath().c_str() ) == -1) - { - return false; - } - return true; -#endif -} - - -void Utility::Sleep(int ms) -{ -#ifdef _WIN32 - ::Sleep(ms); -#else - struct timeval tv; - tv.tv_sec = ms / 1000; - tv.tv_usec = (ms % 1000) * 1000; - select(0, NULL, NULL, NULL, &tv); -#endif -} - - -#ifdef SOCKETS_NAMESPACE -} -#endif - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Utility.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Utility.h deleted file mode 100755 index 24366bb631b..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/Utility.h +++ /dev/null @@ -1,276 +0,0 @@ -/** \file Utility.h - ** \date 2004-02-13 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Utility_H -#define _SOCKETS_Utility_H - -#include "sockets-config.h" -#include <ctype.h> -#include <memory> -#include "socket_include.h" -#include <map> -#include <string> -#include <cstring> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -#define TWIST_LEN 624 - -class SocketAddress; - -/** Conversion utilities. - \ingroup util */ -class Utility -{ - /** - The Mersenne Twister - http://www.math.keio.ac.jp/~matumoto/emt.html - */ - class Rng - { - public: - Rng(unsigned long seed); - - unsigned long Get(); - - private: - int m_value; - unsigned long m_tmp[TWIST_LEN]; - }; - class ncmap_compare - { - public: - bool operator()(const std::string& x, const std::string& y) const; - }; -public: - template<typename Y> class ncmap : public std::map<std::string, Y, ncmap_compare> - { - public: - ncmap() {} - }; - class Uri - { - public: - Uri(const std::string& url); - - const std::string& Url() const { - return m_url; - } - const std::string& UrlUri() const { - return m_uri; - } - const std::string& QueryString() const { - return m_query_string; - } - const std::string& Protocol() const { - return m_protocol; - } - const std::string& Host() const { - return m_host; - } - int Port() const { - return m_port; - } - const std::string& Path() const { - return m_path; - } - const std::string& File() const { - return m_file; - } - const std::string& Extension() const { - return m_ext; - } - - const std::string& ToString() const { - return m_url; - } - - private: - std::string m_url; - std::string m_uri; - std::string m_query_string; - std::string m_protocol; - std::string m_host; - int m_port; - std::string m_path; - std::string m_file; - std::string m_ext; - }; - class Path - { - public: - Path(const std::string& ); - - const std::string& GetPath() const { - return m_path; - } - const std::string& GetFilename() const { - return m_file; - } - const std::string& GetExtension() const { - return m_ext; - } - - private: - std::string m_path; - std::string m_file; - std::string m_ext; - }; -public: - static std::string base64(const std::string& str_in); - static std::string base64d(const std::string& str_in); - static std::string l2string(long l); - static std::string bigint2string(int64_t l); - static std::string bigint2string(uint64_t l); - static uint64_t atoi64(const std::string& str); - static unsigned int hex2unsigned(const std::string& str); - static std::string rfc1738_encode(const std::string& src); - static std::string rfc1738_decode(const std::string& src); - - /** Checks whether a string is a valid ipv4/ipv6 ip number. */ - static bool isipv4(const std::string&); - /** Checks whether a string is a valid ipv4/ipv6 ip number. */ - static bool isipv6(const std::string&); - - /** Hostname to ip resolution ipv4, not asynchronous. */ - static bool u2ip(const std::string&, ipaddr_t&); - static bool u2ip(const std::string&, struct sockaddr_in& sa, int ai_flags = 0); - - //#ifdef ENABLE_IPV6 - //#ifdef IPPROTO_IPV6 - /** Hostname to ip resolution ipv6, not asynchronous. */ - static bool u2ip(const std::string&, struct in6_addr&); - static bool u2ip(const std::string&, struct sockaddr_in6& sa, int ai_flags = 0); - //#endif - //#endif - - /** Reverse lookup of address to hostname */ - static bool reverse(struct sockaddr *sa, socklen_t sa_len, std::string&, int flags = 0); - static bool reverse(struct sockaddr *sa, socklen_t sa_len, std::string& hostname, std::string& service, int flags = 0); - - static bool u2service(const std::string& name, int& service, int ai_flags = 0); - - /** Convert binary ip address to string: ipv4. */ - static void l2ip(const ipaddr_t,std::string& ); - static void l2ip(const in_addr&,std::string& ); - //#ifdef ENABLE_IPV6 - //#ifdef IPPROTO_IPV6 - /** Convert binary ip address to string: ipv6. */ - static void l2ip(const struct in6_addr&,std::string& ,bool mixed = false); - - /** ipv6 address compare. */ - static int in6_addr_compare(in6_addr,in6_addr); - //#endif - //#endif - /** ResolveLocal (hostname) - call once before calling any GetLocal method. */ - static void ResolveLocal(); - /** Returns local hostname, ResolveLocal must be called once before using. - \sa ResolveLocal */ - static const std::string& GetLocalHostname(); - /** Returns local ip, ResolveLocal must be called once before using. - \sa ResolveLocal */ - static ipaddr_t GetLocalIP(); - /** Returns local ip number as string. - \sa ResolveLocal */ - static const std::string& GetLocalAddress(); - //#ifdef ENABLE_IPV6 - //#ifdef IPPROTO_IPV6 - /** Returns local ipv6 ip. - \sa ResolveLocal */ - static const struct in6_addr& GetLocalIP6(); - /** Returns local ipv6 address. - \sa ResolveLocal */ - static const std::string& GetLocalAddress6(); - //#endif - //#endif - /** Get environment variable */ - static const std::string GetEnv(const std::string& name); - /** Set environment variable. - \param var Name of variable to set - \param value Value */ - static void SetEnv(const std::string& var,const std::string& value); - /** Convert sockaddr struct to human readable string. - \param sa Ptr to sockaddr struct */ - static std::string Sa2String(struct sockaddr *sa); - - /** Get current time in sec/microseconds. */ - static void GetTime(struct timeval *); - - static std::auto_ptr<SocketAddress> CreateAddress(struct sockaddr *,socklen_t); - - static unsigned long ThreadID(); - - static std::string ToLower(const std::string& str); - static std::string ToUpper(const std::string& str); - - static std::string ToString(double d); - - /** Returns a random 32-bit integer */ - static unsigned long Rnd(); - - static const char *Logo; - - static const std::string Stack(); - - /** Utf8 decrypt, encrypt. */ - static const std::string FromUtf8(const std::string& ); - static const std::string ToUtf8(const std::string&); - - /** File system stuff */ - static const Path CurrentDirectory(); - static bool ChangeDirectory(const Path& to_dir); - - /** wait a specified number of ms */ - static void Sleep(int ms); - -private: - static std::string m_host; ///< local hostname - static ipaddr_t m_ip; ///< local ip address - static std::string m_addr; ///< local ip address in string format - //#ifdef ENABLE_IPV6 - //#ifdef IPPROTO_IPV6 - static struct in6_addr m_local_ip6; ///< local ipv6 address - //#endif - static std::string m_local_addr6; ///< local ipv6 address in string format - //#endif - static bool m_local_resolved; ///< ResolveLocal has been called if true -}; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // _SOCKETS_Utility_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlDocument.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlDocument.cpp deleted file mode 100755 index 7147a1008ae..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlDocument.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/** - ** \file XmlDocument.cpp - ** \date 2008-02-09 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2008-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "XmlDocument.h" -#include "XmlException.h" - -#ifdef ENABLE_XML - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif -namespace Xml { - - -XmlDocument::XmlDocument(const std::string& filename,const std::string& verify_ns,const std::string& verify_root) -: m_doc(NULL) -, m_ok(false) -{ - xmlNodePtr cur; - xmlNsPtr ns; - - if (!(m_doc = xmlParseFile(filename.c_str() ))) - { - throw XmlException("Parse of file failed: " + filename); - } - if (!(cur = xmlDocGetRootElement(m_doc))) - { - xmlFreeDoc(m_doc); - m_doc = NULL; - throw XmlException("Document is empty: " + filename); - } - if (verify_ns.size()) - { - if (!(ns = xmlSearchNsByHref(m_doc, cur, (const xmlChar *) verify_ns.c_str() ))) - { - xmlFreeDoc(m_doc); - m_doc = NULL; - throw XmlException("Document namespace != " + verify_ns); - } - } - if (verify_root.size()) - { - if (xmlStrcmp(cur -> name, (const xmlChar *) verify_root.c_str() )) - { - xmlFreeDoc(m_doc); - m_doc = NULL; - throw XmlException("Document root != " + verify_root); - } - } - m_ok = true; -} - - -XmlDocument::~XmlDocument() -{ - if (m_doc) - { - xmlFreeDoc(m_doc); - } -} - - -XmlDocument::operator xmlDocPtr() -{ - return m_doc; -} - - -} -#ifdef SOCKETS_NAMESPACE -} -#endif -#endif // ENABLE_XML diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlDocument.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlDocument.h deleted file mode 100755 index 11925e8540c..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlDocument.h +++ /dev/null @@ -1,85 +0,0 @@ -/** - ** \file XmlDocument.h - ** \date 2008-02-09 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2008-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _XmlDocument_H -#define _XmlDocument_H - -#include "sockets-config.h" - -#ifdef ENABLE_XML - -#include <string> -#include <libxml/xmlmemory.h> -#include <libxml/parser.h> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif -namespace Xml -{ - - -class XmlDocument -{ -public: - XmlDocument(const std::string& filename,const std::string& verify_ns = "",const std::string& verify_root = ""); - virtual ~XmlDocument(); - - /** Document parse successful. */ - bool IsOk() { - return m_ok; - } - - operator xmlDocPtr(); - -protected: - XmlDocument(const XmlDocument& ) {} // copy constructor - -private: - XmlDocument& operator=(const XmlDocument& ) { - return *this; // assignment operator - } - - xmlDocPtr m_doc; - bool m_ok; -}; - - -} -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // ENABLE_XML - -#endif // _XmlDocument_H diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlException.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlException.cpp deleted file mode 100755 index 045994ae244..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlException.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/** - ** \file XmlException.cpp - ** \date 2008-02-09 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2008-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "XmlException.h" -#ifdef ENABLE_XML - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif -namespace Xml { - - -XmlException::XmlException(const std::string& descr) -:Exception(descr) -{ -} - - -} -#ifdef SOCKETS_NAMESPACE -} -#endif -#endif // ENABLE_XML diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlException.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlException.h deleted file mode 100755 index 1504b27eb84..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlException.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - ** \file XmlException.h - ** \date 2008-02-09 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2008-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _XmlException_H -#define _XmlException_H - -#include "sockets-config.h" -#ifdef ENABLE_XML -#include "Exception.h" - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif -namespace Xml -{ - - -class XmlException : public Exception -{ -public: - XmlException(const std::string& descr); - - XmlException(const XmlException& x) : Exception(x) {} // copy constructor - -private: - XmlException& operator=(const XmlException& ) { - return *this; // assignment operator - } - -}; - - -} -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // ENABLE_XML -#endif // _XmlException_H diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlNode.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlNode.cpp deleted file mode 100755 index 881c09936fa..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlNode.cpp +++ /dev/null @@ -1,357 +0,0 @@ -/** - ** \file XmlNode.cpp - ** \date 2008-02-09 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2008-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "XmlNode.h" -#include "XmlDocument.h" -#include "XmlException.h" -#include "Utility.h" - -#ifdef ENABLE_XML - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE { -#endif -namespace Xml { - - -XmlNode::XmlNode(XmlDocument& doc) -: m_doc(doc) -, m_current( GetRootElement() ) -{ -} - - -XmlNode::XmlNode(XmlDocument& doc, const std::string& nodepath) -: m_doc(doc) -, m_current( GetRootElement() ) -{ - xmlNodePtr p = GetFirstElement( nodepath ); - SetCurrent( p ); -} - - -XmlNode::XmlNode(const XmlNode& node, const std::string& nodepath) -: m_doc( node.GetDocument() ) -, m_current( node ) -{ - xmlNodePtr p = GetFirstElement( node, nodepath ); - SetCurrent( p ); -} - - -XmlNode::XmlNode(XmlDocument& doc, xmlNodePtr ptr) -: m_doc(doc) -, m_current( ptr ) -{ -} - - -XmlNode::XmlNode(xmlDocPtr doc, xmlNodePtr ptr) -: m_doc(doc) -, m_current( ptr ) -{ -} - - -XmlNode::~XmlNode() -{ -} - - -xmlNodePtr XmlNode::GetRootElement() const -{ - m_current = xmlDocGetRootElement(m_doc); - return m_current; -} - - -std::string XmlNode::GetProperty(const std::string& name) const -{ - xmlChar *p = m_current ? xmlGetProp(m_current, (const xmlChar *) name.c_str() ) : NULL; - if (!p) - { - throw XmlException( "Property '" + name + "' not found in node: " + GetNodeName() ); - } - std::string str = (char *)p; - xmlFree(p); - return Utility::FromUtf8(str); -} - - -bool XmlNode::PropertyExists(const std::string& name) const -{ - xmlChar *p = m_current ? xmlGetProp(m_current, (const xmlChar *) name.c_str() ) : NULL; - if (!p) - { - return false; - } - xmlFree(p); - return true; -} - - -xmlNodePtr XmlNode::GetChildrenNode() const -{ - m_current = m_current ? m_current -> xmlChildrenNode : NULL; - return m_current; -} - - -xmlNodePtr XmlNode::GetNextNode() const -{ - do - { - m_current = m_current ? m_current -> next : NULL; - } while (m_current && xmlIsBlankNode( m_current )); - return m_current; -} - - -const std::string& XmlNode::GetNodeName() const -{ - if (m_current) - { - m_current_name = Utility::FromUtf8((char *)m_current -> name); - } - else - { - m_current_name = ""; - } - return m_current_name; -} - - -const std::string& XmlNode::GetContent() const -{ - m_content = ""; - if (m_current) - { - xmlNodePtr p = m_current; - xmlNodePtr p2 = GetChildrenNode(); - if (p2 && p2 -> content) - { - m_content = Utility::FromUtf8((char *)p2 -> content); - } - SetCurrent(p); - } - return m_content; -} - - -xmlNsPtr XmlNode::GetNodeNs() const -{ - if (m_current) - return m_current -> ns; - return NULL; -} - - -const std::string& XmlNode::GetNodeNsPrefix() const -{ - if (m_current && m_current -> ns && m_current -> ns -> prefix) - { - m_ns_prefix = Utility::FromUtf8((char *)m_current -> ns -> prefix); - } - else - { - m_ns_prefix = ""; - } - return m_ns_prefix; -} - - -const std::string& XmlNode::GetNodeNsHref() const -{ - if (m_current && m_current -> ns && m_current -> ns -> href) - { - m_ns_href = Utility::FromUtf8((char *)m_current -> ns -> href); - } - else - { - m_ns_href = ""; - } - return m_ns_href; -} - - -xmlNodePtr XmlNode::GetFirstElement(const std::string& name) const -{ - if (m_lookup_name.empty()) - m_lookup_name = name; - GetRootElement(); - xmlNodePtr p = GetChildrenNode(); - while (p) - { - if (name == GetNodeName()) - { - return p; - } - p = GetNextNode(); - } - return NULL; -} - - -xmlNodePtr XmlNode::GetFirstElement(xmlNodePtr base,const std::string& name) const -{ - if (m_lookup_name.empty()) - m_lookup_name = name; - SetCurrent(base); - xmlNodePtr p = GetChildrenNode(); - while (p) - { - if (name == GetNodeName()) - { - return p; - } - p = GetNextNode(); - } - return NULL; -} - - -xmlNodePtr XmlNode::GetNextElement(xmlNodePtr p,const std::string& name) const -{ - SetCurrent(p); - p = GetNextNode(); - while (p) - { - if (name == GetNodeName()) - { - return p; - } - p = GetNextNode(); - } - return NULL; -} - - -XmlNode::operator xmlNodePtr() const -{ - return m_current; -} - - -XmlNode XmlNode::operator[](const std::string& name) const -{ - xmlNodePtr p0 = m_current; - xmlNodePtr p = GetFirstElement( m_current, name ); - SetCurrent( p0 ); - if (p) - return XmlNode( m_doc, p ); - throw XmlException("Didn't find node: " + name); -} - - -bool XmlNode::Exists(const std::string& name) const -{ - xmlNodePtr p0 = m_current; - xmlNodePtr p = GetFirstElement( m_current, name ); - SetCurrent( p0 ); - if (p) - return true; - return false; -} - - -void XmlNode::operator++() const -{ - GetNextNode(); - while (m_current) - { - if (m_lookup_name == GetNodeName()) - { - return; - } - GetNextNode(); - } -} - - -std::map<std::string, std::string> XmlNode::GetNsMap() const -{ - xmlNsPtr *p = xmlGetNsList(m_doc, m_current); - std::map<std::string, std::string> vec; - int i = 0; - while (p[i]) - { - std::string href = Utility::FromUtf8((char *)p[i] -> href); - std::string prefix = p[i] -> prefix ? Utility::FromUtf8((char *)p[i] -> prefix) : ""; - vec[prefix] = href; - ++i; - } - return vec; -} - - -std::map<std::string, std::string> XmlNode::GetNsMapRe() const -{ - xmlNsPtr *p = xmlGetNsList(m_doc, m_current); - std::map<std::string, std::string> vec; - int i = 0; - while (p[i]) - { - std::string href = Utility::FromUtf8((char *)p[i] -> href); - std::string prefix = p[i] -> prefix ? Utility::FromUtf8((char *)p[i] -> prefix) : ""; - vec[href] = prefix; - if (!p[i] -> next) - break; - ++i; - } - return vec; -} - - -const std::string XmlNode::FindProperty(const std::string& propname, bool climb) const -{ - while (m_current) - { - if (PropertyExists(propname)) - { - return GetProperty(propname); - } - if (!climb) - { - break; - } - m_current = m_current -> parent; - } - return ""; -} - - -} -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // ENABLE_XML diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlNode.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlNode.h deleted file mode 100755 index 2e78485de98..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/XmlNode.h +++ /dev/null @@ -1,160 +0,0 @@ -/** - ** \file XmlNode.h - ** \date 2008-02-09 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2008-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _XmlNode_H -#define _XmlNode_H - -#include "sockets-config.h" - -#ifdef ENABLE_XML - -#include <string> -#include <libxml/xmlmemory.h> -#include <libxml/parser.h> -#include <map> - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif -namespace Xml -{ - -class XmlDocument; - -class XmlNode -{ -public: - XmlNode() {} - XmlNode(XmlDocument&); - XmlNode(XmlDocument&, const std::string& nodepath); - XmlNode(const XmlNode&, const std::string& nodepath); - XmlNode(xmlDocPtr, xmlNodePtr ptr); - XmlNode(XmlDocument&, xmlNodePtr ptr); - ~XmlNode(); - - operator xmlNodePtr() const; - XmlNode operator[](const std::string& name) const; - operator std::string() const { - return GetContent(); - } - void operator++() const; - - xmlDocPtr GetDocument() const { - return m_doc; - } - - bool Valid() const { - return m_current ? true : false; - } - - /** Assign document root element to 'current node'. - \return Current Node */ - xmlNodePtr GetRootElement() const; - - /** Return property 'propname' for 'current node'. */ - std::string GetProperty(const std::string& propname) const; - bool PropertyExists(const std::string& propname) const; - - /** Assign first child node of 'current node' to 'current node'. - \return Current Node */ - xmlNodePtr GetChildrenNode() const; - - /** Assign next non-blank (xmlIsBlankNode) node of 'current node' to 'current node'. - \return Current Node */ - xmlNodePtr GetNextNode() const; - - /** Return nodename of 'current node'. */ - const std::string& GetNodeName() const; - /** Return content of 'current node'. */ - const std::string& GetContent() const; - - /** Sets 'current node' that the following methods act on: - GetProperty - GetNodeName - GetContent - GetNodeNs - GetNodeNsPrefix - GetNodeNsHref - */ - void SetCurrent(xmlNodePtr p) const { - m_current = p; - } - - /** \return Namespace of 'current node'. */ - xmlNsPtr GetNodeNs() const; - /** \return Namespace prefix of 'current node'. */ - const std::string& GetNodeNsPrefix() const; - /** \return Namespace href of 'current node'. */ - const std::string& GetNodeNsHref() const; - - /** Search element named 'name' in Root element child nodes. - Set 'current node' to Root element. */ - xmlNodePtr GetFirstElement(const std::string& name) const; - - /** Search element named 'name' in 'parent' element child nodes. - Set 'current node' to 'parent'. */ - xmlNodePtr GetFirstElement(xmlNodePtr parent,const std::string& name) const; - - /** Find next element named 'name' on same level as 'node'. - Set 'current node' to 'p'. */ - xmlNodePtr GetNextElement(xmlNodePtr node,const std::string& name) const; - - /** Check that child element with name 'name' exists. */ - bool Exists(const std::string& name) const; - - /** [prefix] = href */ - std::map<std::string, std::string> GetNsMap() const; - - /** [href] = prefix */ - std::map<std::string, std::string> GetNsMapRe() const; - - const std::string FindProperty(const std::string& propname, bool climb = false) const; - -private: - xmlDocPtr m_doc; - mutable xmlNodePtr m_current; - mutable std::string m_current_name; - mutable std::string m_ns_prefix; - mutable std::string m_ns_href; - mutable std::string m_content; - mutable std::string m_lookup_name; -}; - - -} -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // ENABLE_XML -#endif // _XmlNode_H diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ajp13.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ajp13.h deleted file mode 100755 index d60fe4786db..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/ajp13.h +++ /dev/null @@ -1,102 +0,0 @@ -/** - ** \file ajp13.h - ** \date 2007-10-05 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_Ajp13_H -#define _SOCKETS_Ajp13_H - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - -#define HTTP_REQUEST_ACCEPT 0xa001 -#define HTTP_REQUEST_ACCEPT_CHARSET 0xa002 -#define HTTP_REQUEST_ACCEPT_ENCODING 0xa003 -#define HTTP_REQUEST_ACCEPT_LANGUAGE 0xa004 -#define HTTP_REQUEST_AUTHORIZATION 0xa005 -#define HTTP_REQUEST_CONNECTION 0xa006 -#define HTTP_REQUEST_CONTENT_TYPE 0xa007 -#define HTTP_REQUEST_CONTENT_LENGTH 0xa008 -#define HTTP_REQUEST_COOKIE 0xa009 -#define HTTP_REQUEST_COOKIE2 0xa00a -#define HTTP_REQUEST_HOST 0xa00b -#define HTTP_REQUEST_PRAGMA 0xa00c -#define HTTP_REQUEST_REFERER 0xa00d -#define HTTP_REQUEST_USER_AGENT 0xa00e - -#define HTTP_METHOD_OPTIONS 1 -#define HTTP_METHOD_GET 2 -#define HTTP_METHOD_HEAD 3 -#define HTTP_METHOD_POST 4 -#define HTTP_METHOD_PUT 5 -#define HTTP_METHOD_DELETE 6 -#define HTTP_METHOD_TRACE 7 -#define HTTP_METHOD_PROPFIND 8 -#define HTTP_METHOD_PROPPATCH 9 -#define HTTP_METHOD_MKCOL 10 -#define HTTP_METHOD_COPY 11 -#define HTTP_METHOD_MOVE 12 -#define HTTP_METHOD_LOCK 13 -#define HTTP_METHOD_UNLOCK 14 -#define HTTP_METHOD_ACL 15 -#define HTTP_METHOD_REPORT 16 -#define HTTP_METHOD_VERSION_CONTROL 17 // with a dash "VERSION-CONTROL" -#define HTTP_METHOD_CHECKIN 18 -#define HTTP_METHOD_CHECKOUT 19 -#define HTTP_METHOD_UNCHECKOUT 20 -#define HTTP_METHOD_SEARCH 21 -#define HTTP_METHOD_MKWORKSPACE 22 -#define HTTP_METHOD_UPDATE 23 -#define HTTP_METHOD_LABEL 24 -#define HTTP_METHOD_MERGE 25 -#define HTTP_METHOD_BASELINE_CONTROL 26 -#define HTTP_METHOD_MKACTIVITY 27 - -#define ATTR_CONTEXT 1 -#define ATTR_SERVLET_PATH 2 -#define ATTR_REMOTE_USER 3 -#define ATTR_AUTH_TYPE 4 -#define ATTR_QUERY_STRING 5 -#define ATTR_ROUTE 6 -#define ATTR_SSL_CERT 7 -#define ATTR_SSL_CIPHER 8 -#define ATTR_SSL_SESSION 9 -#define ATTR_SSL_KEY_SIZE 11 -#define ATTR_SECRET 12 -#define ATTR_STORED_METHOD 13 - -#ifdef SOCKETS_NAMESPACE -} // namespace SOCKETS_NAMESPACE { -#endif - -#endif // _SOCKETS_Ajp13_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/gpl.txt b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/gpl.txt deleted file mode 100755 index 5b6e7c66c27..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/gpl.txt +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/mkdot.sh b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/mkdot.sh deleted file mode 100755 index 9999aff0f6a..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/mkdot.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -PROJECT_DIR=/usr/local/apache/www.alhem.net/htdocs/Sockets -PROJECT_NAME=sockets -/usr/local/bin/dp \ - -D_RUN_DP \ - -DUSE_SCTP -D_THREADSAFE_SOCKETS \ - -DHAVE_OPENSSL -DENABLE_POOL -DENABLE_RECONNECT -DENABLE_SOCKS4 \ - -DENABLE_IPV6 -DENABLE_DETACH -DENABLE_RESOLVER -DENABLE_TRIGGERS \ - -DENABLE_XML \ - -fontsize 12 \ - -lr -dot -cluster | grep -v std > x.dot -dot -Tpng -o $PROJECT_DIR/sockets.png x.dot -dot -Tcmapx -o $PROJECT_DIR/sockets.cmap x.dot -/usr/local/bin/mkjs $PROJECT_DIR/$PROJECT_NAME.cmap > $PROJECT_DIR/$PROJECT_NAME.js diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/pkgconfig/libSockets.pc b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/pkgconfig/libSockets.pc deleted file mode 100755 index 51f6953f2dc..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/pkgconfig/libSockets.pc +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: libSockets -Description: C++ Sockets Library -Version: 2.3.9.4 -Requires: libxml-2.0, libssl -Libs: -L${libdir} -lSockets -Libs.private: -lpthread -Cflags: -I${includedir} diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/pkgconfig/libSockets.pc.IN b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/pkgconfig/libSockets.pc.IN deleted file mode 100755 index 05b625f55fe..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/pkgconfig/libSockets.pc.IN +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: lib%NAME% -Description: C++ Sockets Library -Version: %VERSION% -Requires: libxml-2.0, libssl -Libs: -L${libdir} -l%NAME% -Libs.private: -lpthread -Cflags: -I${includedir} diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/pkgconfig/libsockets2.pc b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/pkgconfig/libsockets2.pc deleted file mode 100755 index d4db1c93c99..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/pkgconfig/libsockets2.pc +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: libsockets2 -Description: C++ Sockets Library -Version: 2.3.9.4 -Requires: -Libs: -L${libdir} -lSockets -Libs.private: -lssl -lcrypto -lxml2 -lpthread -Cflags: -I${includedir} diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/pkgconfig/libsockets2.pc.IN b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/pkgconfig/libsockets2.pc.IN deleted file mode 100755 index aa7af6b57b3..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/pkgconfig/libsockets2.pc.IN +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: libsockets2 -Description: C++ Sockets Library -Version: %VERSION% -Requires: -Libs: -L${libdir} -l%NAME% -Libs.private: -lssl -lcrypto -lxml2 -lpthread -Cflags: -I${includedir} diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/socket_include.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/socket_include.cpp deleted file mode 100755 index c6082382076..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/socket_include.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/** \file socket_include.cpp - ** \date 2004-11-28 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include <stdio.h> -#include "socket_include.h" - -// only to be included in win32 projects -const char *StrError(int x) -{ -static char tmp[100]; - switch (x) - { - case 10004: return "Interrupted function call."; - case 10013: return "Permission denied."; - case 10014: return "Bad address."; - case 10022: return "Invalid argument."; - case 10024: return "Too many open files."; - case 10035: return "Resource temporarily unavailable."; - case 10036: return "Operation now in progress."; - case 10037: return "Operation already in progress."; - case 10038: return "Socket operation on nonsocket."; - case 10039: return "Destination address required."; - case 10040: return "Message too long."; - case 10041: return "Protocol wrong type for socket."; - case 10042: return "Bad protocol option."; - case 10043: return "Protocol not supported."; - case 10044: return "Socket type not supported."; - case 10045: return "Operation not supported."; - case 10046: return "Protocol family not supported."; - case 10047: return "Address family not supported by protocol family."; - case 10048: return "Address already in use."; - case 10049: return "Cannot assign requested address."; - case 10050: return "Network is down."; - case 10051: return "Network is unreachable."; - case 10052: return "Network dropped connection on reset."; - case 10053: return "Software caused connection abort."; - case 10054: return "Connection reset by peer."; - case 10055: return "No buffer space available."; - case 10056: return "Socket is already connected."; - case 10057: return "Socket is not connected."; - case 10058: return "Cannot send after socket shutdown."; - case 10060: return "Connection timed out."; - case 10061: return "Connection refused."; - case 10064: return "Host is down."; - case 10065: return "No route to host."; - case 10067: return "Too many processes."; - case 10091: return "Network subsystem is unavailable."; - case 10092: return "Winsock.dll version out of range."; - case 10093: return "Successful WSAStartup not yet performed."; - case 10101: return "Graceful shutdown in progress."; - case 10109: return "Class type not found."; - case 11001: return "Host not found."; - case 11002: return "Nonauthoritative host not found."; - case 11003: return "This is a nonrecoverable error."; - case 11004: return "Valid name, no data record of requested type."; - - default: - break; - } - snprintf(tmp, sizeof(tmp), "Winsock error code: %d", x); - return tmp; -} - - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/socket_include.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/socket_include.h deleted file mode 100755 index 26602306709..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/socket_include.h +++ /dev/null @@ -1,305 +0,0 @@ -/** \file socket_include.h - ** \date 2005-04-12 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2004-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_socket_include_H -#define _SOCKETS_socket_include_H -#include "sockets-config.h" - -#ifdef _MSC_VER -#pragma warning(disable:4514) -#endif - -// common defines affecting library and applications using library - -/* Define SOCKETS_DYNAMIC_TEMP to use dynamically allocated buffers - in read operations - helps on ECOS */ -#define SOCKETS_DYNAMIC_TEMP - -/** define type to uniquely identify a socket instance. */ -typedef unsigned long socketuid_t; - -// platform specific stuff -#if (defined(__unix__) || defined(unix)) && !defined(USG) -#include <sys/param.h> -#endif -#include <list> - -// int64 -#ifdef _WIN32 -typedef unsigned __int64 uint64_t; -#else -#include <stdlib.h> -#ifdef SOLARIS -# include <sys/types.h> -#else -# include <stdint.h> -#endif -#endif - -#ifndef _WIN32 -// ---------------------------------------- -// common unix includes / defines -#include <sys/time.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> - -// all typedefs in this file will be declared outside the sockets namespace, -// because some os's will already have one or more of the type defined. -typedef int SOCKET; -#define Errno errno -#define StrError strerror - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -// WIN32 adapt -#define closesocket close -#define INVALID_SOCKET -1 -#define SOCKET_ERROR -1 - -#ifndef INADDR_NONE -#define INADDR_NONE ((unsigned long) -1) -#endif // INADDR_NONE - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#endif // !_WIN32 - - -// ---------------------------------------- -// Generic -#ifndef SOL_IP -#define SOL_IP IPPROTO_IP -#endif - - -// ---------------------------------------- -// OS specific adaptions - -#ifdef SOLARIS -// ---------------------------------------- -// Solaris -typedef unsigned short port_t; -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif -// no defs - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#define s6_addr16 _S6_un._S6_u8 -#define MSG_NOSIGNAL 0 - -#elif defined __FreeBSD__ -// ---------------------------------------- -// FreeBSD -# if __FreeBSD_version >= 400014 -# define s6_addr16 __u6_addr.__u6_addr16 -# if !defined(MSG_NOSIGNAL) -# define MSG_NOSIGNAL 0 -# endif -# include <netinet/in.h> -typedef in_addr_t ipaddr_t; -typedef in_port_t port_t; -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif -// no defs - -#ifdef SOCKETS_NAMESPACE -} -#endif - -# define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP -# define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP -# else -# error FreeBSD versions prior to 400014 does not support ipv6 -# endif - -#elif defined MACOSX -// ---------------------------------------- -// Mac OS X -//#include <string.h> -#ifdef __DARWIN_UNIX03 -typedef unsigned short port_t; -#else -#include <mach/port.h> -#endif // __DARWIN_UNIX03 -typedef unsigned long ipaddr_t; -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif -// no defs - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#define s6_addr16 __u6_addr.__u6_addr16 -#define MSG_NOSIGNAL 0 // oops - thanks Derek -#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP -#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP - -#elif defined _WIN32 -// ---------------------------------------- -// Win32 -#ifdef _MSC_VER -#pragma comment(lib, "wsock32.lib") -#endif -#define strcasecmp _stricmp -#ifndef __CYGWIN__ -#define snprintf sprintf_s -#define vsnprintf vsprintf_s -#endif - -typedef unsigned long ipaddr_t; -typedef unsigned short port_t; -typedef int socklen_t; -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif -// no defs - -#ifdef SOCKETS_NAMESPACE -} -#endif - -// 1.8.6: define FD_SETSIZE to something bigger than 64 if there are a lot of -// simultaneous connections (must be done before including winsock.h) -//#define FD_SETSIZE 1024 - -// windows 2000 with ipv6 preview installed: -// http://msdn.microsoft.com/downloads/sdks/platform/tpipv6.asp -// see the FAQ on how to install -#define WIN32_LEAN_AND_MEAN -#include <winsock2.h> -#include <ws2tcpip.h> -#if _MSC_VER < 1200 -#ifndef __CYGWIN__ -#ifdef ENABLE_IPV6 -#include <tpipv6.h> // For IPv6 Tech Preview. -#endif -#endif -#endif // _MSC_VER < 1200 - - -#define MSG_NOSIGNAL 0 -//#define SHUT_RDWR 2 -#define SHUT_WR 1 - -#define Errno WSAGetLastError() -const char *StrError(int x); - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif - - -// class WSAInitializer is a part of the Socket class (on win32) -// as a static instance - so whenever an application uses a Socket, -// winsock is initialized -class WSAInitializer // Winsock Initializer -{ -public: - WSAInitializer() { - if (WSAStartup(0x101,&m_wsadata)) { - exit(-1); - } - } - ~WSAInitializer() { - WSACleanup(); - } -private: - WSADATA m_wsadata; -}; - -#ifdef SOCKETS_NAMESPACE -} -#endif - -#else -// ---------------------------------------- -// LINUX -typedef unsigned long ipaddr_t; -typedef unsigned short port_t; -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif -// no defs - -#ifdef SOCKETS_NAMESPACE -} -#endif - - -#endif - -#ifdef SOCKETS_NAMESPACE -namespace SOCKETS_NAMESPACE -{ -#endif -/** List type containing file descriptors. */ -typedef std::list<SOCKET> socket_v; - - -#ifdef SOCKETS_NAMESPACE -} -#endif - - -// getaddrinfo / getnameinfo replacements -#ifdef NO_GETADDRINFO -#ifndef AI_NUMERICHOST -#define AI_NUMERICHOST 1 -#endif -#ifndef NI_NUMERICHOST -#define NI_NUMERICHOST 1 -#endif -#endif - - -#endif // _SOCKETS_socket_include_H - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/sockets-config.h b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/sockets-config.h deleted file mode 100755 index f85272ff904..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/sockets-config.h +++ /dev/null @@ -1,110 +0,0 @@ -/** - ** \file sockets-config.h - ** \date 2007-04-14 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2007-2010 Anders Hedstrom - -This library is made available under the terms of the GNU GPL, with -the additional exemption that compiling, linking, and/or using OpenSSL -is allowed. - -If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about -the closed-source license agreement for the C++ sockets library, -please visit http://www.alhem.net/Sockets/license.html and/or -email license@alhem.net. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef _SOCKETS_CONFIG_H -#define _SOCKETS_CONFIG_H - -/* Limits */ -#define TCP_LINE_SIZE 8192 -#define MAX_HTTP_HEADER_COUNT 200 - -#ifndef _RUN_DP -/* First undefine symbols if already defined. */ -#undef HAVE_OPENSSL -#undef ENABLE_IPV6 -#undef USE_SCTP -#undef NO_GETADDRINFO -#undef ENABLE_POOL -#undef ENABLE_SOCKS4 -#undef ENABLE_RESOLVER -#undef ENABLE_RECONNECT -#undef ENABLE_DETACH -#undef ENABLE_EXCEPTIONS -#undef ENABLE_XML -#endif // _RUN_DP - - -/* OpenSSL support. */ -//#define HAVE_OPENSSL - - -/* Ipv6 support. */ -#define ENABLE_IPV6 - - -/* SCTP support. */ -//#define USE_SCTP - - -/* Define NO_GETADDRINFO if your operating system does not support - the "getaddrinfo" and "getnameinfo" function calls. */ -#define NO_GETADDRINFO - - -/* Connection pool support. */ -//#define ENABLE_POOL - - -/* Socks4 client support. */ -//#define ENABLE_SOCKS4 - - -/* Asynchronous resolver. */ -#define ENABLE_RESOLVER - - -/* Enable TCP reconnect on lost connection. - Socket::OnReconnect - Socket::OnDisconnect -*/ -#define ENABLE_RECONNECT - - -/* Enable socket thread detach functionality. */ -#define ENABLE_DETACH - - -/* Enabled exceptions. */ -#define ENABLE_EXCEPTIONS - - -/* XML classes. */ -//#define ENABLE_XML - - -/* Resolver uses the detach function so either enable both or disable both. */ -#ifndef ENABLE_DETACH -#undef ENABLE_RESOLVER -#endif - - -#endif // _SOCKETS_CONFIG_H diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/Makefile b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/Makefile deleted file mode 100755 index f3b8904287d..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/Makefile +++ /dev/null @@ -1,95 +0,0 @@ -SOCKETS = .. -PLATFORM = linux-x86-32 -LIBS = -#-L$(SOCKETS) -lSockets - -INCLUDE = -I$(SOCKETS) -include $(SOCKETS)/Makefile.version -include $(SOCKETS)/Makefile.Defines.$(PLATFORM) - -CPPFLAGS = $(CFLAGS) - -#LIBS += -lsctp - -LDFLAGS += -rdynamic - -PROGS = events resolve sockets_test base64 semtest \ - echoserver stressclient http httpd retry resume \ - http_post x copy crlf https sloppy_http chunked \ - threadstress listener httpd_test scanr json - -all: $(PROGS) - -events: events.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -resolve: resolve.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -sockets_test: sockets_test.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -base64: base64.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -semtest: semtest.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -echoserver: echoserver.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -stressclient: stressclient.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -http: http.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -httpd: httpd.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -retry: retry.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -resume: resume.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -http_post: http_post.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -x: x.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -copy: copy.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -crlf: crlf.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -https: https.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -sloppy_http: sloppy_http.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -chunked: chunked.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -threadstress: threadstress.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -listener: listener.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -scanr: scanr.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -httpd_test: httpd_test.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -json: json.o ../libSockets.a - $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) - -clean: - rm -f *.o *~ slask *.d $(PROGS) - --include *.d diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/base64.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/base64.cpp deleted file mode 100755 index b7e5456a9fb..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/base64.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include <stdio.h> -#include <cstring> - -#include "Base64.h" - - -int main(int argc,char *argv[]) -{ - if (argc < 2) - return -1; - std::string str; - std::string str2; - Base64 b; - if (!strcmp(argv[1],"-file")) - { - if (argc < 3) - return -2; - FILE *fil; - if ((fil = fopen(argv[2],"rt")) != NULL) - { - b.encode(fil, str); - fclose(fil); - } - printf("File:\n%s\n--End of File\n",str.c_str()); - b.decode(str, str2); - printf("Content:\n%s\n--End of Content\n",str2.c_str()); - } - else - { - b.encode(argv[1], strlen(argv[1]), str); - printf("'%s' ==> '%s'",argv[1], str.c_str()); - b.decode(str, str2); - printf(" ==> '%s'\n",str2.c_str()); - } -} diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/chunked.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/chunked.cpp deleted file mode 100755 index 32d6189d52c..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/chunked.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include <SocketHandler.h> -#include <TcpSocket.h> -#include <ListenSocket.h> -#include <iostream> - - -class Server : public TcpSocket -{ -public: - Server(ISocketHandler& h) : TcpSocket(h), m_header(true) { - SetLineProtocol(); - } - - void OnLine(const std::string& line) { - if (m_header && line.empty()) - { - m_header = false; - Send("HTTP/1.1 200 OK\r\n" -// "Server: Microsoft-IIS/5.0\r\n" -// "Date: Mon, 15 Aug 2005 11:39:18 GMT\r\n" - "Content-Type: text/html\r\n" -// "Set-Cookie: ASPSESSIONIDASTATTTA=PIMPPEJBIMEGJLHOBNPHMIDC; path=/\r\n" -// "Cache-control: private\r\n" - "Transfer-Encoding: chunked\r\n" - "\r\n" - "a\r\n" - "XXXXXXXXXX\r\n" - "a\r\n" - "XXXXXXXXXX\r\n" - "a\r\n" - "XXXXXXXXXX\r\n" - "a\r\n" - "XXXXXXXXXX\r\n" - "a\r\n" - "XXXXXXXXXX\r\n" - "0\r\n" - "\r\n"); - } - } - -private: - bool m_header; -}; - - -int main() -{ - SocketHandler h; - ListenSocket<Server> l(h); - try - { - l.Bind(12345); - h.Add(&l); - while (true) - { - h.Select(1, 0); - } - } - catch (const Exception& e) - { - std::cout << e.ToString() << std::endl; - } -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/copy.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/copy.cpp deleted file mode 100755 index 2134ac26a2a..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/copy.cpp +++ /dev/null @@ -1,264 +0,0 @@ -#include <TcpSocket.h> -#include <SocketHandler.h> -#include <ListenSocket.h> -#include <Utility.h> - -#define BUFSZ 7024 - -#ifdef _WIN32 -#define MIN(a,b) (a<b?a:b) - -#endif - -static int quit = 0; -static size_t lim = 120000; - - -class CopySocket : public TcpSocket -{ -public: - CopySocket(ISocketHandler& h) : TcpSocket(h), m_fil(NULL), m_out(NULL), m_b_server(false), m_sz(0) { - SetTransferLimit(60000); - } - CopySocket(ISocketHandler& h, size_t sz) : TcpSocket(h), m_fil(NULL), m_out(NULL), m_b_server(false), m_sz(sz) { - SetTransferLimit(60000); - quit++; - } - CopySocket(ISocketHandler& h, const std::string& filename) : TcpSocket(h), m_filename(filename), m_fil(NULL), m_out(NULL), m_b_server(false), m_sz(0) { - SetTransferLimit(60000); - quit++; - } - ~CopySocket() { - quit--; - } - - void OnConnect() { - Utility::GetTime(&m_start); - if (!m_filename.size()) - { - Send("\n"); - char buf[BUFSZ]; - int n = MIN(m_sz, BUFSZ); - while (n > 0 && GetOutputLength() < lim) - { - SendBuf(buf, n); - m_sz -= n; - n = MIN(m_sz, BUFSZ); - } - if (!n) - { - SetCloseAndDelete(); - } - else - { - SendBuf(buf, n); - m_sz -= n; - } - return; - } - size_t x = 0; - for (size_t i = 0; i < m_filename.size(); i++) - if (m_filename[i] == '/') - x = i + 1; - Send(m_filename.substr(x) + "\n"); - m_fil = fopen(m_filename.c_str(), "rb"); - if (m_fil) - { - char buf[BUFSZ]; - int n = fread(buf, 1, BUFSZ, m_fil); - while (n > 0 && GetOutputLength() < lim) - { - SendBuf(buf, n); - n = fread(buf, 1, BUFSZ, m_fil); - } - if (!n) - { - SetCloseAndDelete(); - fclose(m_fil); - m_fil = NULL; - } - else - { - SendBuf(buf, n); - } - } - } - - void OnWriteComplete() { - } - - void OnTransferLimit() { - if (!m_filename.size()) - { - char buf[BUFSZ]; - int n = MIN(m_sz, BUFSZ); - while (n > 0 && GetOutputLength() < lim) - { - SendBuf(buf, n); - m_sz -= n; - n = MIN(m_sz, BUFSZ); - } - if (!n) - { - SetCloseAndDelete(); - } - else - { - SendBuf(buf, n); - m_sz -= n; - } - return; - } - if (m_fil) - { - char buf[BUFSZ]; - int n = fread(buf, 1, BUFSZ, m_fil); - while (n > 0 && GetOutputLength() < lim) - { - SendBuf(buf, n); - n = fread(buf, 1, BUFSZ, m_fil); - } - if (!n) - { - SetCloseAndDelete(); - fclose(m_fil); - m_fil = NULL; - } - else - { - SendBuf(buf, n); - } - } - } - - void OnAccept() { - Utility::GetTime(&m_start); - m_b_server = true; - SetLineProtocol(); - DisableInputBuffer(); - } - - void OnLine(const std::string& line) { - if (line.size()) - m_out = fopen(line.c_str(), "wb"); - SetLineProtocol(false); - DisableInputBuffer(); - } - - void OnDelete() { - struct timeval stop; - Utility::GetTime(&stop); - stop.tv_sec -= m_start.tv_sec; - stop.tv_usec -= m_start.tv_usec; - if (stop.tv_usec < 0) - { - stop.tv_usec += 1000000; - stop.tv_sec -= 1; - } - double t = stop.tv_usec; - t /= 1000000; - t += stop.tv_sec; - printf("OnDelete: %s\n", m_b_server ? "SERVER" : "CLIENT"); - printf(" Time: %ld.%06ld (%f)\n", stop.tv_sec, stop.tv_usec, t); - double r = GetBytesReceived(); - printf(" bytes in: %lld (%f Mbytes/sec)\n", GetBytesReceived(), r / t / 1000000); - double s = GetBytesSent(); - printf(" bytes out: %lld (%f Mbytes/sec)\n", GetBytesSent(), s / t / 1000000); - printf("\n"); - if (m_out) - fclose(m_out); - } - - void OnRawData(const char *buf, size_t len) { - if (m_out) - fwrite(buf, 1, len, m_out); - } - -private: - std::string m_filename; - FILE *m_fil; - FILE *m_out; - bool m_b_server; - struct timeval m_start; - size_t m_sz; -}; - - -int main(int argc, char *argv[]) -{ - std::string host = "127.0.0.1"; - int port = 12344; - std::list<std::string> filenames; - - for (int i = 1; i < argc; i++) - { - if (!strcmp(argv[i], "-host") && i < argc - 1) - host = argv[++i]; - else - if (!strcmp(argv[i], "-port") && i < argc - 1) - port = atoi(argv[++i]); - else - if (!strcmp(argv[i], "-h")) - { - fprintf(stderr, "Usage: %s [-host <host>] [-port <port>] [<file to send>]\n", *argv); - fprintf(stderr, " Will run as host only if <file to send> isn't specified.\n"); - fprintf(stderr, " host default: 127.0.0.1\n"); - fprintf(stderr, " port default: 12344\n"); - return 0; - } - else - { - filenames.push_back( argv[i] ); - } - } - - try - { - SocketHandler h; - ListenSocket<CopySocket> l(h); - if (filenames.empty()) - { - if (l.Bind( port ) != 0) - { - fprintf(stderr, "Bind() port %d failed - exiting\n", port); - return -1; - } - h.Add(&l); - } - for (std::list<std::string>::iterator it = filenames.begin(); it != filenames.end(); it++) - { - std::string filename = *it; - size_t sz = atol(filename.c_str()); - if (sz) - { - CopySocket *sock = new CopySocket(h, sz); - sock -> SetDeleteByHandler(); - sock -> Open(host, port); - h.Add(sock); - } - else - { - CopySocket *sock = new CopySocket(h, filename); - sock -> SetDeleteByHandler(); - sock -> Open(host, port); - h.Add(sock); - } - } - if (!filenames.size()) - { - fprintf(stderr, "Starting as server only, listening on port %d\n", port); - quit++; - } - while (quit > 0) - { - h.Select(5, 0); - } - return 0; - } - catch (const Exception& e) - { - printf("%s\n", e.ToString().c_str()); - } -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/crlf.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/crlf.cpp deleted file mode 100755 index 34500c48cbb..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/crlf.cpp +++ /dev/null @@ -1,139 +0,0 @@ -#include <TcpSocket.h> -#include <SocketHandler.h> -#include <ListenSocket.h> - - -static bool quit = false; - - -class IOSocket : public TcpSocket -{ -public: - IOSocket(ISocketHandler& h) : TcpSocket(h) { - SetLineProtocol(); - } - ~IOSocket() {} - - void OnConnect() { - Utility::GetTime(&m_start); - while (GetOutputLength() < 500000) - { - Send("zzzzzzzzzmmmmmmmmm1234lkkk54\r\n"); - Send("zzzzzzzzzmmmmmmmmm1234lkkk543\r\n"); - Send("zzzzzzzzzmmmmmmmmm1234lkkk54\r\n"); - Send("zzzzzzzzzmmmmmmmmm1234lkkk543\r\n"); - Send("zzzzzzzzzmmmmmmmmm1234lkkk54\r\n"); - Send("zzzzzzzzzmmmmmmmmm1234lkkk543\r\n"); - Send("zzzzzzzzzmmmmmmmmm1234lkkk54\r\n"); - Send("zzzzzzzzzmmmmmmmmm1234lkkk543\r\n"); - } -// Send("\r\n"); - } - - void OnAccept() { - SetLineProtocol(); - } - - void OnDelete() { - printf("OnDelete\n"); - } - - void OnWriteComplete() { -printf("OnWriteComplete\n"); - struct timeval tv; - Utility::GetTime(&tv); - - tv.tv_sec -= m_start.tv_sec; - tv.tv_usec -= m_start.tv_usec; - Utility::GetTime(&m_start); - if (tv.tv_usec < 0) - { - tv.tv_usec += 1000000; - tv.tv_sec -= 1; - } - double t = tv.tv_usec; - t /= 1000000; - t += tv.tv_sec; - printf(" Time: %ld.%06ld (%f)\n", tv.tv_sec, tv.tv_usec, t); - double r = GetBytesReceived(); - printf(" bytes in: %lld (%f Mbytes/sec)\n", GetBytesReceived(true), r / t / 1000000); - double s = GetBytesSent(); - printf(" bytes out: %lld (%f Mbytes/sec)\n", GetBytesSent(true), s / t / 1000000); - printf("\n"); - - while (GetOutputLength() < 500000) - { - Send("zzzzzzzzzmmmmmmmmm1234lkkk54\r\n"); - Send("zzzzzzzzzmmmmmmmmm1234lkkk543\r\n"); - Send("zzzzzzzzzmmmmmmmmm1234lkkk54\r\n"); - Send("zzzzzzzzzmmmmmmmmm1234lkkk543\r\n"); - Send("zzzzzzzzzmmmmmmmmm1234lkkk54\r\n"); - Send("zzzzzzzzzmmmmmmmmm1234lkkk543\r\n"); - Send("zzzzzzzzzmmmmmmmmm1234lkkk54\r\n"); - Send("zzzzzzzzzmmmmmmmmm1234lkkk543\r\n"); - } -// Send("\r\n"); - } - - void OnLine(const std::string& line) { - if (line == "") - { - struct timeval tv; - Utility::GetTime(&tv); - - tv.tv_sec -= m_start.tv_sec; - tv.tv_usec -= m_start.tv_usec; - Utility::GetTime(&m_start); - if (tv.tv_usec < 0) - { - tv.tv_usec += 1000000; - tv.tv_sec -= 1; - } - double t = tv.tv_usec; - t /= 1000000; - t += tv.tv_sec; - printf(" Time: %ld.%06ld (%f)\n", tv.tv_sec, tv.tv_usec, t); - double r = GetBytesReceived(); - printf(" bytes in: %lld (%f Mbytes/sec)\n", GetBytesReceived(true), r / t / 1000000); - double s = GetBytesSent(); - printf(" bytes out: %lld (%f Mbytes/sec)\n", GetBytesSent(true), s / t / 1000000); - printf("\n"); - - } - else - if (line != "zzzzzzzzzmmmmmmmmm1234lkkk54" && - line != "zzzzzzzzzmmmmmmmmm1234lkkk543") - { -printf("\n-------------------------------------------------------\n"); - for (size_t i = 0; i < line.size(); i++) - if (!isprint(line[i])) - printf("<%d>", line[i]); - else - printf("%c", line[i]); - printf("\n"); -fflush(stdout); -exit(-1); - quit = true; - } - } - - struct timeval m_start; -}; - - -int main(int argc, char *argv[]) -{ - SocketHandler h; - ListenSocket<IOSocket> l(h); - l.Bind(12344); - h.Add(&l); - IOSocket sock(h); - sock.Open("192.168.7.4", 12344); - h.Add(&sock); - while (!quit) - { - h.Select(1, 0); - } -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/echoserver.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/echoserver.cpp deleted file mode 100755 index 35c23d06369..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/echoserver.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/** - ** \file echoserver.cpp - ** \date 2006-10-02 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2006 Anders Hedstrom - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _WIN32 -#pragma warning(disable:4786) -#endif -#include <StdoutLog.h> -#include <ListenSocket.h> -#include <SocketHandlerEp.h> -#include <TcpSocket.h> -#ifndef _WIN32 -#include <signal.h> -#endif -#include <HttpDebugSocket.h> - - -#ifdef ENABLE_DETACH -static bool g_b_detach = false; -#endif -#ifdef HAVE_OPENSSL -static bool g_b_ssl = false; -#endif -static std::string gFilename = "server.pem"; -static std::string gPw; -static bool quit = false; -static bool g_b_http = false; -static bool g_b_nobuf = false; -#ifdef ENABLE_DETACH -static bool g_b_detach2 = false; -#endif - -#define DEB(x) - - -class MySocket : public TcpSocket -{ -public: - MySocket(ISocketHandler& h) : TcpSocket(h) { - SetLineProtocol(); -#ifdef HAVE_OPENSSL - if (g_b_ssl) - EnableSSL(); -#endif - if (g_b_nobuf) - DisableInputBuffer(); - } - ~MySocket() { - } - - void OnAccept() { -#ifdef ENABLE_DETACH - if (g_b_detach) - { - if (!Detach()) - fprintf(stderr, "\nDetach failed\n"); - } -#endif - } - - void OnRawData(const char *buf,size_t len) { - if (g_b_nobuf) - { - SendBuf(buf, len); - } - } - - void OnLine(const std::string& line) { -#ifdef ENABLE_DETACH - if (g_b_detach2 && !IsDetach()) - { - m_line = line; - if (!Detach()) - { - fprintf(stderr, "\nDetach failed\n"); - } - return; - } -DEB(printf("fd %d OnLine; %s\n", GetSocket(), Handler().IsSlave() ? "slave" : "master");) -#endif - Send(line + "\n"); - } - - void OnDetached() { -DEB(printf("fd %d OnDetached; %s\n", GetSocket(), Handler().IsSlave() ? "slave" : "master");) -// fprintf(stderr, "-"); -// fflush(stderr); -#ifdef ENABLE_DETACH - if (g_b_detach2) - { - Send(m_line + "\n"); - } -#endif - } - -#ifdef HAVE_OPENSSL - void InitSSLServer() { - InitializeContext("echoserver", gFilename, gPw, SSLv23_method()); - } -#endif - -private: - std::string m_line; -}; - - -#ifndef _WIN32 -void sigint(int) -{ - quit = true; -} -#endif - -int main(int argc,char *argv[]) -{ -#ifndef _WIN32 - signal(SIGPIPE, SIG_IGN); - signal(SIGINT, sigint); -#endif - port_t port = 2222; - bool enableLog = false; - int queue = 20; - for (int i = 1; i < argc; i++) - { -#ifdef ENABLE_DETACH - if (!strcmp(argv[i], "-detach")) - g_b_detach = true; - if (!strcmp(argv[i], "-detach2")) - g_b_detach2 = true; -#endif -#ifdef HAVE_OPENSSL - if (!strcmp(argv[i], "-ssl")) - g_b_ssl = true; - if (!strcmp(argv[i], "-file") && i < argc - 1) - gFilename = argv[++i]; -#endif - if (!strcmp(argv[i], "-port") && i < argc - 1) - port = atoi(argv[++i]); - if (!strcmp(argv[i], "-pw") && i < argc - 1) - gPw = argv[++i]; - if (!strcmp(argv[i], "-log")) - enableLog = true; - if (!strcmp(argv[i], "-queue") && i < argc - 1) - queue = atoi(argv[++i]); - if (!strcmp(argv[i], "-http")) - g_b_http = true; - if (!strcmp(argv[i], "-nobuf")) - g_b_nobuf = true; - if (!strcmp(argv[i], "-h")) - { - printf("Usage: %s [ options ] [-ssl]\n", *argv); - printf(" -port nn listen on port nn\n"); -#ifdef ENABLE_DETACH - printf(" -detach detach each socket on accept\n"); - printf(" -detach2 detach when line received\n"); -#endif -#ifdef HAVE_OPENSSL - printf(" -ssl run as ssl server, .pem file needed\n"); - printf(" -file xx .pem filename, default is \"server.pem\"\n"); -#endif - printf(" -pw xx private key password\n"); - printf(" -log enable sockethandler debug log\n"); - printf(" -queue nn listen queue size (default 20)\n"); - printf(" -http enable http server with dummy response\n"); - printf(" -nobuf echo raw data\n"); - exit(-1); - } - } - if (g_b_http && g_b_nobuf) - { - printf("Nobuf and Http does not work together\n"); - exit(-1); - } - StdoutLog *log = enableLog ? new StdoutLog() : NULL; - SocketHandlerEp h(log); - ListenSocket<MySocket> l(h); - ListenSocket<HttpDebugSocket> l2(h); - h.SetNumberOfThreads(10); - if (!g_b_http) - { - if (l.Bind(port, queue)) - { - fprintf(stderr, "Bind to port %d failed\n", port); - return -1; - } - fprintf(stderr, "Listening on port %d\n", port); - h.Add(&l); - } - else - { - printf("Enable HttpDebugSocket\n"); - if (l2.Bind(port, queue)) - { - fprintf(stderr, "Bind to port %d failed\n", port); - return -1; - } - fprintf(stderr, "Listening on port %d\n", port); - h.Add(&l2); - } -#ifdef ENABLE_DETACH - if (g_b_detach) - fprintf(stderr, "Will detach each incoming socket\n"); -#endif -#ifdef HAVE_OPENSSL - if (g_b_ssl) - fprintf(stderr, "Using SSL\n"); -#endif - while (!quit) - { - h.Select(1, 0); - } - fprintf(stderr, "\nExiting...\n"); - if (log) - { -// delete log; - } - return 0; -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/events.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/events.cpp deleted file mode 100755 index f92ecd58c83..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/events.cpp +++ /dev/null @@ -1,217 +0,0 @@ -#include <EventHandler.h> -#include <TcpSocket.h> -#include <IEventOwner.h> -#include <ListenSocket.h> -#include <StdoutLog.h> -#include <iostream> -#include <Debug.h> - - -double start; - -double gettime() -{ - struct timeval tv; - Utility::GetTime(&tv); - return tv.tv_sec + (double)tv.tv_usec / 1000000; -} - - -class MyEvHandler : public EventHandler -{ -public: - MyEvHandler() : EventHandler() {} - MyEvHandler(StdLog *p) : EventHandler(p) {} - -}; - - -class EvThread : public Thread -{ -public: - EvThread(Socket *p) : m_socket(p) {} - - void Run(); - -private: - Socket *m_socket; -}; - - -class EvSocket : public TcpSocket, public IEventOwner -{ -public: - EvSocket(ISocketHandler& h) : TcpSocket(h) - , IEventOwner( static_cast<MyEvHandler&>(h) ) { - } - - void OnEvent(int id) { - std::cout << "OnEvent" << std::endl; - std::cout << gettime() - start << std::endl; - SetCloseAndDelete(); - } - - void OnAccept() { - std::cout << "Incoming" << std::endl; - } - - void OnConnect() { - std::cout << "Connected" << std::endl; - EvThread *thr = new EvThread( this ); - thr -> SetDeleteOnExit(); - } - - void OnDelete() { - std::cout << "EvSocket::OnDelete()" << std::endl; - } -}; - - -void EvThread::Run() -{ - Socket *p0 = (Socket *)m_socket; - EvSocket *p = dynamic_cast<EvSocket *>(p0); - if (p) - { -#ifdef _WIN32 - Sleep( 5000 ); -#else - sleep(10); -#endif - std::cout << "Add event" << std::endl; - start = gettime(); - p -> AddEvent(1, 50000); - } - else - { - std::cout << "Thread: not an EvSocket" << std::endl; - } -} - - -//------------------------------------------------------------ -// myTimer class -//------------------------------------------------------------ -class myTimer : public IEventOwner -{ -public: - // Prototype of user call back function - typedef void (*myTimer_cb)(myTimer* user_func, void* user_id); - - myTimer(IEventHandler& h, long ssec, long susec, - long psec, long pusec, myTimer_cb func, void* id); - ~myTimer(); - -private: - void OnEvent(int id); - long ssec_; - long susec_; - long psec_; - long pusec_; - myTimer_cb user_func_; - void* user_id_; - bool periodic_; -}; - - -//------------------------------------------------------------ -myTimer::myTimer(IEventHandler& h, long ssec, long susec, - long psec, long pusec, myTimer_cb user_func, - void* user_id) : - IEventOwner(h), - ssec_(ssec), - susec_(susec), - psec_(psec), - pusec_(pusec), - user_func_(user_func), - user_id_(user_id), - periodic_(psec != 0 || pusec != 0) -{ - Debug deb("myTimer()"); - AddEvent(ssec_, susec_); -} - - -//------------------------------------------------------------ -myTimer::~myTimer() -{ - Debug deb("~myTimer()"); - ClearEvents(); -} - - -//------------------------------------------------------------ -void myTimer::OnEvent(int id) -{ - Debug deb("myTimer::OnEvent()"); - if (periodic_) - { - AddEvent(psec_, pusec_); - } - - user_func_(this, user_id_); - - if (!periodic_) - { - delete this; - } -} - - -//------------------------------------------------------------ -static void myfunc(myTimer* t, void* user_id) -{ - Debug deb("myTimer::myfunc()"); - deb << "Event " << ((char*)user_id) << Debug::endl(); -} - - -/* -int main(int argc, char *argv[]) -{ - EventHandler h; - - // Example 1: Create a 2 sec one-shot timer. - // No need to save the pointer as it will delete - // itself upon expiry. - new myTimer(h, 2, 0, 0, 0, myfunc, (void*)"My Timer 0"); - - // Example 2: Create a 1 sec periodic timer. - // Save the pointer because we can stop the timer - // later with a "delete mytimer". - myTimer* mytimer = new myTimer(h, 0, 0, 1, 0, myfunc, - (void*)"My Timer 1"); - - // Drop into the event handler .. - h.EventLoop(); -} -*/ - - -int main(int argc, char *argv[]) -{ - StdoutLog log; - MyEvHandler h(&log); - ListenSocket<EvSocket> l(h); - l.Bind("localhost", 12344); - h.Add(&l); - - EvSocket sock(h); - sock.Open("localhost", 12344); - h.Add(&sock); - - // Example 1: Create a 2 sec one-shot timer. - // No need to save the pointer as it will delete - // itself upon expiry. - new myTimer(h, 2, 0, 0, 0, myfunc, (void*)"My Timer 0"); - - // Example 2: Create a 1 sec periodic timer. - // Save the pointer because we can stop the timer - // later with a "delete mytimer". - myTimer* mytimer = new myTimer(h, 0, 0, 1, 0, myfunc, - (void*)"My Timer 1"); - - h.EventLoop(); -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/http.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/http.cpp deleted file mode 100755 index a15d4dbe1ad..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/http.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include <HTTPSocket.h> -#include <SocketHandler.h> -#include <StdoutLog.h> - - -class tSocket : public HTTPSocket -{ -public: - tSocket(ISocketHandler& h, const std::string& host, int port) : HTTPSocket(h), m_host(host) - , m_first(false) - , m_sz(0) { - Open(host, port); - } - - void OnConnect() { - Send("GET /index.html HTTP/1.0\r\n"); - Send("Host: " + m_host + "\r\n"); - Send("\r\n"); - } - void OnDisconnect() { // or OnDelete() - Handler().LogError(this, "Disconnect", 0, "ServerSocket", LOG_LEVEL_INFO); - } - - void OnFirst() { - } - - void OnHeader(const std::string& key, const std::string& value) { - fprintf(stderr, "%s: %s\n", key.c_str(), value.c_str()); - } - - void OnHeaderComplete() { - fprintf(stderr, "\n"); - } - - void OnData(const char *buf, size_t sz) { -printf(" %d bytes\n", sz); - if (1||!m_first) - { - std::string str = buf; - str.resize( sz ); - printf("%s", str.c_str()); - m_first = true; - } - m_sz += sz; - } - - void OnDelete() { - fprintf(stderr, "Content length: %d\n", m_sz); - } - -private: - std::string m_host; - bool m_first; - size_t m_sz; -}; - - -int main(int argc, char *argv[]) -{ - std::string host = argc > 1 ? argv[1] : "www.alhem.net"; - int port = argc > 2 ? atoi(argv[2]) : 80; - StdoutLog log; - SocketHandler h(&log); - tSocket sock(h, host, port); - h.Add(&sock); - while (h.GetCount()) - { - h.Select(1, 0); - } -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/http_post.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/http_post.cpp deleted file mode 100755 index 3b0b830281c..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/http_post.cpp +++ /dev/null @@ -1,107 +0,0 @@ -#include <HttpdSocket.h> -#include <SocketHandler.h> -#include <ListenSocket.h> -#include <StdoutLog.h> -#include <HttpPostSocket.h> -#include <HttpPutSocket.h> -#include <HttpdForm.h> - - -class sSocket : public HttpdSocket -{ -public: - sSocket(ISocketHandler& h) : HttpdSocket(h) { - } - - void Init() - { - if (GetParent() -> GetPort() == 443 || GetParent() -> GetPort() == 8443) - { -#ifdef HAVE_OPENSSL - EnableSSL(); -#else - fprintf(stderr, "SSL not available\n"); -#endif - } - } - - void Exec() - { - std::string name; - std::string value; - GetForm() -> getfirst(name, value); - while (name.size()) - { -fprintf(stderr, "%s: '%s'\n", name.c_str(), value.c_str()); - GetForm() -> getnext(name, value); - } - CreateHeader(); - GenerateDocument(); - } - - void CreateHeader() - { - SetStatus("200"); - SetStatusText("OK"); -fprintf(stderr, "Uri: '%s'\n", GetUri().c_str()); - { - size_t x = 0; - for (size_t i = 0; i < GetUri().size(); i++) - if (GetUri()[i] == '.') - x = i; - std::string ext = GetUri().substr(x + 1); - if (ext == "gif" || ext == "jpg" || ext == "png") - AddResponseHeader("Content-type", "image/" + ext); - else - AddResponseHeader("Content-type", "text/" + ext); - } - AddResponseHeader("Connection", "close"); - SendResponse(); - } - - void GenerateDocument() - { - Send("<html></html>"); - SetCloseAndDelete(); - } - -#ifdef HAVE_OPENSSL - void InitSSLServer() - { - InitializeContext("httpd", "comb.pem", "", SSLv23_method()); - } -#endif - -}; - - -int main(int argc, char *argv[]) -{ - std::string host = argc > 1 ? argv[1] : "www.alhem.net"; - StdoutLog log; - SocketHandler h(&log); - ListenSocket<sSocket> l(h); - if (l.Bind(1028)) - { - printf("Bind port 1028 failed\n"); - return -1; - } - h.Add(&l); - ListenSocket<sSocket> l2(h); - if (l2.Bind(8443)) - { - printf("Bind port 8443 failed\n"); - return -1; - } - h.Add(&l2); - HttpPostSocket sock(h, "http://localhost:1028/postdata"); - sock.AddField("name", "value"); - sock.Open(); - h.Add(&sock); - while (h.GetCount()) - { - h.Select(1, 0); - } -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/httpd.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/httpd.cpp deleted file mode 100755 index e1106a0b6be..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/httpd.cpp +++ /dev/null @@ -1,109 +0,0 @@ -#include <HttpdSocket.h> -#include <SocketHandler.h> -#include <ListenSocket.h> -#include <StdoutLog.h> - - -class sSocket : public HttpdSocket -{ -public: - sSocket(ISocketHandler& h) : HttpdSocket(h) { - } - - void Init() - { - if (GetParent() -> GetPort() == 443 || GetParent() -> GetPort() == 8443) - { -#ifdef HAVE_OPENSSL - EnableSSL(); -#else - fprintf(stderr, "SSL not available\n"); -#endif - } - } - - void Exec() - { - CreateHeader(); - GenerateDocument(); - } - - void CreateHeader() - { - SetStatus("200"); - SetStatusText("OK"); -fprintf(stderr, "Uri: '%s'\n", GetUri().c_str()); - { - size_t x = 0; - for (size_t i = 0; i < GetUri().size(); i++) - if (GetUri()[i] == '.') - x = i; - std::string ext = GetUri().substr(x + 1); - if (ext == "gif" || ext == "jpg" || ext == "png") - AddResponseHeader("Content-type", "image/" + ext); - else - AddResponseHeader("Content-type", "text/" + ext); - } - AddResponseHeader("Connection", "close"); - SendResponse(); - } - - void GenerateDocument() - { - std::string fn = GetUri().substr(1); - FILE *fil = fopen(fn.c_str(), "rb"); - if (fil) - { - char slask[1000]; - int n = fread(slask,1,1000,fil); - while (n > 0) - { - SendBuf(slask, n); - n = fread(slask,1,1000,fil); - } - fclose(fil); - } - else - { - SetStatus("404"); - SetStatusText("Not Found"); - } - SetCloseAndDelete(); - } - -#ifdef HAVE_OPENSSL - void InitSSLServer() - { - InitializeContext("httpd", "comb.pem", "", SSLv23_method()); - } -#endif - -}; - - -int main(int argc, char *argv[]) -{ - std::string host = argc > 1 ? argv[1] : "www.alhem.net"; - StdoutLog log; - SocketHandler h(&log); - ListenSocket<sSocket> l(h); - if (l.Bind(1028)) - { - printf("Bind port 1028 failed\n"); - return -1; - } - h.Add(&l); - ListenSocket<sSocket> l2(h); - if (l2.Bind(8443)) - { - printf("Bind port 8443 failed\n"); - return -1; - } - h.Add(&l2); - while (h.GetCount()) - { - h.Select(1, 0); - } -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/httpd_test.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/httpd_test.cpp deleted file mode 100755 index b8a42867051..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/httpd_test.cpp +++ /dev/null @@ -1,214 +0,0 @@ -#include <TcpSocket.h> -#include <IEventOwner.h> -#include <EventHandler.h> -#include <Utility.h> -#include <Exception.h> -#include <iostream> - - - std::string host; - int port = 0; - bool https = false; - std::string full_request; - - int antal = 500; - - int interval = 500; - int delay = 5000; - - int connected = 0; - int failed = 0; - int lost = 0; - -class TestSocket : public TcpSocket, public IEventOwner -{ -public: - TestSocket(class EventHandler& h, bool add = false) : TcpSocket(h), IEventOwner(h) - , m_req_index(0) { - if (https) - { - EnableSSL(); - } - if (add) - { - m_event_open = AddEvent(interval / 1000, (interval % 1000) * 1000); - } - } - ~TestSocket() {} - - void OnConnect() { - connected++; - m_event_request = AddEvent(delay / 1000, (delay % 1000) * 1000); - printf("%9lu %5u Connected: %d\n", UniqueIdentifier(), GetSockPort(), connected); - } - - void OnConnectFailed() { - failed++; - printf("%9lu %5u Failed: %d\n", UniqueIdentifier(), GetSockPort(), failed); - } - - void OnDisconnect() { - printf("\n"); - printf("%s\n", Utility::Stack().c_str()); - lost++; - connected--; - printf("%9lu %5u Lost: %d\n", UniqueIdentifier(), GetSockPort(), lost); - } - - void OnEvent(int id) { - if (id == m_event_open) - { - if (connected < antal) - { - TestSocket *p = new TestSocket(static_cast<EventHandler&>(Handler())); - p -> SetDeleteByHandler(); - p -> Open(host, port); - Handler().Add(p); - } - else - { - printf("Finished connecting. %d connected / %d failed / %d lost\n", connected, failed, lost); - } - m_event_open = AddEvent(interval / 1000, (interval % 1000) * 1000); - } - else - if (id == m_event_request) - { - if (m_req_index < full_request.size()) - { - if (full_request[m_req_index] == '\r') - { - printf("<CR>"); - fflush(stdout); - } - if (full_request[m_req_index] == '\n') - { - printf("<LF>"); - fflush(stdout); - } - SendBuf( &full_request[m_req_index], 1 ); - m_req_index++; - m_event_request = AddEvent(delay / 1000, (delay % 1000) * 1000); - } - else - { - m_event_restart = AddEvent(3, 0); - } - } - else - if (id == m_event_restart) - { - m_req_index = 0; - m_event_request = AddEvent(delay / 1000, (delay % 1000) * 1000); - } - else - { - fprintf(stderr, "%9lu %5u Unknown event id\n", UniqueIdentifier(), GetSockPort()); - SetCloseAndDelete(); - } - } - - void OnRawData(const char *buf, size_t len) { - printf("<%lu,%d>", UniqueIdentifier(), len); - fflush(stdout); - } - -private: - long m_event_open; - long m_event_request; - long m_event_restart; - size_t m_req_index; -}; - - -int main(int argc, char *argv[]) -{ - try - { - EventHandler h; - - /* - $ httpd_test [options] url - - -host override host part of url - -port override port part of url - -uri override uri part of url - -qs override query string part of url - - -nn nn number of connections - - -interval interval between connections, in ms - -delay interval between each request char sent - */ - std::string url; - - std::string uri; - std::string qs; - - for (int i = 1; i < argc; i++) - { - if (!strcmp(argv[i], "-host") && i < argc - 1) - host = argv[++i]; - else - if (!strcmp(argv[i], "-port") && i < argc - 1) - port = atoi(argv[++i]); - else - if (!strcmp(argv[i], "-uri") && i < argc - 1) - uri = argv[++i]; - else - if (!strcmp(argv[i], "-qs") && i < argc - 1) - qs = argv[++i]; - else - if (strlen(argv[i]) > 1 && argv[i][0] == '-' && isdigit(argv[i][1])) - antal = atoi(&argv[i][1]); - else - if (!strcmp(argv[i], "-interval") && i < argc - 1) - interval = atoi(argv[++i]); - else - if (!strcmp(argv[i], "-delay") && i < argc - 1) - delay = atoi(argv[++i]); - else - if (argv[i][0] == '-') - printf("Huh? %s\n", argv[i]); - else - url = argv[i]; - } - Utility::Uri parser(url); - if (host.empty()) - host = parser.Host(); - if (!port) - port = parser.Port(); - if (uri.empty()) - uri = parser.UrlUri(); - if (qs.empty()) - qs = parser.QueryString(); - if (parser.Protocol() == "https") - https = true; - - full_request = "GET " + uri; - if (!qs.empty()) - full_request += "?" + qs; - full_request += " HTTP/1.1\r\n"; - full_request += "Host: " + parser.Host() + "\r\n"; - full_request += "\r\n"; - - printf("Host: %s\n", host.c_str()); - printf("Port: %d\n", port); - printf("----------------------------------\n"); - printf("%s", full_request.c_str()); - printf("----------------------------------\n"); - - TestSocket *p = new TestSocket(h, true); - p -> SetDeleteByHandler(); - p -> Open(host, port); - h.Add(p); - - h.EventLoop(); - } - catch (const Exception& e) - { - std::cerr << e.ToString() << std::endl; - } -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/https.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/https.cpp deleted file mode 100755 index 45b36ff80fc..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/https.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include <HTTPSocket.h> -#include <SocketHandler.h> -#include <ListenSocket.h> -#include <Exception.h> - - -class tSocket : public HTTPSocket -{ -public: - tSocket(ISocketHandler& h) : HTTPSocket(h) - , m_first(false) - , m_sz(0) { - EnableSSL(); - } - - tSocket(ISocketHandler& h, const std::string& host) : HTTPSocket(h), m_host(host) - , m_first(false) - , m_sz(0) { - EnableSSL(); - Open(host, 4443); - } - - void InitSSLServer() { - InitializeContext("", "comb.pem", "", SSLv23_method()); - } - - void OnSSLAccept() { - printf("OnSSLAccept()\n"); - HTTPSocket::OnSSLAccept(); - } - - void OnSSLConnect() { - printf("OnSSLConnect()\n"); - HTTPSocket::OnSSLConnect(); - } - - void OnAccept() { -printf("OnAccept\n"); - } - - void OnConnect() { -printf("OnConnect\n"); - Send("GET /index.html HTTP/1.0\r\n"); - Send("Host: " + m_host + "\r\n"); - Send("\r\n"); - } - - void OnFirst() { - } - - void OnHeader(const std::string& key, const std::string& value) { - fprintf(stderr, "%s: %s\n", key.c_str(), value.c_str()); - } - - void OnHeaderComplete() { - fprintf(stderr, "\n"); - } - - void OnData(const char *buf, size_t sz) { - if (1||!m_first) - { - std::string str = buf; - str.resize( sz ); - printf("%s", str.c_str()); - m_first = true; - } - m_sz += sz; - } - - void OnDelete() { - fprintf(stderr, "Content length: %d\n", m_sz); - } - -private: - std::string m_host; - bool m_first; - size_t m_sz; -}; - - -int main(int argc, char *argv[]) -{ - try - { - SocketHandler h; - if (argc > 1 && !strcmp(argv[1], "-server")) - { - ListenSocket<tSocket> l(h); - l.Bind(4443); - h.Add(&l); - while (h.GetCount()) - { - h.Select(1, 0); - } - } - else - { - std::string host = argc > 1 ? argv[1] : "www.alhem.net"; - tSocket sock(h, host); - h.Add(&sock); - while (h.GetCount()) - { - h.Select(1, 0); - } - } - } - catch (const Exception& e) - { - printf("%s\n", e.ToString().c_str()); - } -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/json.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/json.cpp deleted file mode 100755 index efe0f9c8838..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/json.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "Json.h" -#include <iostream> - - -int main(int argc, char *argv[]) -{ - try - { - Json js; - - std::string str("Test\\ string\\ end\\\nAnders was here\n\"Quoted string inside string\"\n"); - std::cout << " --------------- original\n"; - std::cout << str << std::endl; - - js.encode(str); - std::cout << " --------------- encoded\n"; - std::cout << str << std::endl; - - js.decode(str); - std::cout << " --------------- decoded\n"; - std::cout << str << std::endl; - - js["String"] = str; - str = js.ToString(); - std::cout << " --------------- from ToString()\n"; - std::cout << str << std::endl; - - Json js2 = Json::Parse(str); - std::cout << js2.ToString() << std::endl; - - std::cout << (std::string)js2["String"] << std::endl; - - str = "{\"no-value\":null}"; - Json js3 = Json::Parse(str); - std::cout << js3.ToString() << std::endl; - - std::cout << " --------------- request\n"; - Json req; - req["method"] = "test"; - Json params; - params["value1"] = 1L; - params["value2"] = "2"; - req["params"] = params; - std::cout << req.ToString() << std::endl; - } - catch (const Exception& e) - { - std::cerr << e.ToString() << std::endl; - } -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/listener.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/listener.cpp deleted file mode 100755 index 2c10951a4af..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/listener.cpp +++ /dev/null @@ -1,152 +0,0 @@ -#include <TcpSocket.h> -#include <SocketHandler.h> -#include <ListenSocket.h> -#include <Exception.h> -#include <Parse.h> -#include <iostream> - - -bool quit = false; - - -class ControlHandler : public SocketHandler -{ -public: - ControlHandler() : SocketHandler() {} - ~ControlHandler() {} - - void List(TcpSocket *p); - - void StopListen(); -}; - - -class ControlSocket : public TcpSocket -{ -public: - ControlSocket(ISocketHandler& h) : TcpSocket(h) { - SetLineProtocol(); - } - - void OnAccept() { - SendHelp(); - Send(">> "); - } - - void OnLine(const std::string& line) { - Parse pa(line); - std::string cmd = pa.getword(); - std::string arg = pa.getrest(); - - ControlHandler& h = static_cast<ControlHandler&>(Handler()); - if (cmd == "help") - { - SendHelp(); - } - else - if (cmd == "quit") - { - SetCloseAndDelete(); - Send("Bye.\n"); - return; - } - else - if (cmd == "list") - { - h.List(this); - } - else - if (cmd == "stop") - { - h.StopListen(); - } - else - if (cmd == "bind") - { - port_t port = (port_t)atoi(arg.c_str()); - ListenSocket<ControlSocket> *p = new ListenSocket<ControlSocket>(Handler()); - p -> SetDeleteByHandler(); - p -> Bind(port); - h.Add(p); - } - else - { - Send("Huh?\n"); - } - Send(">> "); - } - - void SendHelp() { - Send("Commands available\n" - " help, quit, list, stop, bind <port number>\n" - "\n" - " list - list all sockets\n" - " stop - stop all listening sockets\n" - " bind <port number> - add a new listening socket\n" - " quit - leave\n" - " help - show this text\n" - "\n"); - } - -private: -}; - - -void ControlHandler::List(TcpSocket *from) -{ - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) - { - SOCKET s = it -> first; - Socket *p0 = it -> second; - ListenSocket<ControlSocket> *l = dynamic_cast<ListenSocket<ControlSocket> *>(p0); - ControlSocket *p = dynamic_cast<ControlSocket *>(p0); - if (l) - { - from -> Send(Utility::l2string(s) + ": ListenSocket on port " + Utility::l2string(l -> GetPort()) + "\n"); - } - else - if (p) - { - from -> Send(Utility::l2string(s) + ": ControlSocket\n"); - } - else - { - from -> Send(Utility::l2string(s) + ": <unknown>\n"); - } - } -} - - -void ControlHandler::StopListen() -{ - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) - { - Socket *p0 = it -> second; - ListenSocket<ControlSocket> *l = dynamic_cast<ListenSocket<ControlSocket> *>(p0); - if (l) - { - l -> SetCloseAndDelete(); - } - } -} - - -int main(int argc, char *argv[]) -{ - try - { - ControlHandler h; - ListenSocket<ControlSocket> l(h); - l.Bind(2000); - h.Add(&l); - while (!quit && h.GetCount()) - { - h.Select(); - } - } - catch (const Exception& e) - { - std::cout << e.ToString() << std::endl; - } -} - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/resolve.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/resolve.cpp deleted file mode 100755 index 802b91016ad..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/resolve.cpp +++ /dev/null @@ -1,156 +0,0 @@ -#include <sys/types.h> -#ifndef _WIN32 -#include <sys/socket.h> -#include <netdb.h> -#endif -#include <string.h> -#include <string> -#include <Utility.h> -#include <Ipv4Address.h> -#include <Ipv6Address.h> -#include <assert.h> -#include <SocketHandler.h> -#include <StdoutLog.h> - - -int main(int argc, char *argv[]) -{ - StdoutLog log; - SocketHandler h(&log); -/* - h.EnableResolver(9999); - -// printf("Waiting for resolver ..."); - while (!h.ResolverReady()) - ; -// printf(" resolver ready!\n"); -*/ - std::string hostname = argc < 2 ? "www.ipv6.org" : argv[1]; - - { - printf("Using hostname : %s\n", hostname.c_str()); - printf("------------------------------------------- normal (old) Utility::u2ip\n"); - ipaddr_t oa; - if (!Utility::u2ip(hostname, oa)) - printf("Ipv4 lookup failed\n"); -#ifdef ENABLE_IPV6 - in6_addr oa6; - if (!Utility::u2ip(hostname, oa6)) - printf("Ipv6 lookup failed\n"); -#endif - std::string oname; - Utility::l2ip(oa, oname); - printf("Ipv4 : %s (old)\n", oname.c_str()); - -#ifdef ENABLE_IPV6 - std::string oname6; - Utility::l2ip(oa6, oname6); - printf("Ipv6 : %s (old)\n", oname6.c_str()); -#endif - - printf("------------------------------------------- new Utility::u2ip, Utility::reverse\n"); - struct sockaddr_in sa; - if (!Utility::u2ip(hostname, sa)) - printf("Ipv4 lookup failed\n"); - - ipaddr_t a; - memcpy(&a, &sa.sin_addr, sizeof(a)); - std::string l2ipname; - Utility::l2ip(a, l2ipname); - printf("Ipv4 : %s\n", l2ipname.c_str()); - - std::string numeric; - Utility::reverse((struct sockaddr *)&sa, sizeof(sa), numeric, NI_NUMERICHOST); - printf("Ipv4 numeric : %s\n", numeric.c_str()); - - std::string rname; - if (!Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), rname)) - printf("Reverse Ipv4 failed\n"); - else - printf("Ipv4 Utility::reverse : %s\n", rname.c_str()); - -#ifdef ENABLE_IPV6 - printf("------------------------------------------- new Utility::u2ip, Utility::reverse (Ipv6)\n"); - struct sockaddr_in6 sa6; - if (!Utility::u2ip(hostname, sa6)) - printf("Ipv6 lookup failed\n"); - - std::string l2ipname6; - Utility::l2ip(sa6.sin6_addr, l2ipname6); - printf("Ipv6 : %s\n", l2ipname6.c_str()); - - std::string numeric6; - Utility::reverse((struct sockaddr *)&sa6, sizeof(sa6), numeric6, NI_NUMERICHOST); - printf("Ipv6 numeric : %s\n", numeric6.c_str()); - - std::string rname6; - if (!Utility::reverse( (struct sockaddr *)&sa6, sizeof(sa6), rname6)) - printf("Reverse Ipv6 failed\n"); - else - printf("Ipv6 Utility::reverse : %s\n", rname6.c_str()); -#endif - - printf("-------------------------------------------\n"); - in_addr ia; - /** Resolve hostname. */ -//static bool Resolve(const std::string& hostname,struct in_addr& a); - /** Reverse resolve (IP to hostname). */ -//static bool Reverse(struct in_addr& a,std::string& name); - /** Convert address struct to text. */ -//static std::string Convert(struct in_addr& a); - std::string name; - if (!Ipv4Address::Resolve(hostname, ia)) - printf("Ipv4 lookup failed (Ipv4Address)\n"); - memcpy(&a, &ia, sizeof(a)); - Utility::l2ip(a, name); - printf("Ipv4 : %s (Ipv4Address)\n", name.c_str()); - assert(name == l2ipname); - if (!Ipv4Address::Reverse(ia, name)) - printf("Reverse Ipv4 lookup failed (Ipv4Address)\n"); - else - printf("Reverse Ipv4 : %s\n", name.c_str()); - assert(name == rname); - assert(Ipv4Address::Convert(ia) == l2ipname); - -#ifdef ENABLE_IPV6 - printf("-------------------------------------------\n"); - /** Resolve hostname. */ -//static bool Resolve(const std::string& hostname,struct in6_addr& a); - /** Reverse resolve (IP to hostname). */ -//static bool Reverse(struct in6_addr& a,std::string& name); - /** Convert address struct to text. */ -//static std::string Convert(struct in6_addr& a,bool mixed = false); - if (!Ipv6Address::Resolve(hostname, oa6)) - printf("Ipv6 lookup failed (Ipv4Address)\n"); - Utility::l2ip(oa6, name); - assert(name == l2ipname6); - printf("Ipv6 : %s (Ipv6Address)\n", name.c_str()); - if (!Ipv6Address::Reverse(oa6, name)) - printf("Reverse Ipv6 lookup failed (Ipv4Address)\n"); - else - printf("Reverse Ipv6 : %s\n", name.c_str()); - assert(name == rname6); - std::string mixed_false = Ipv6Address::Convert(oa6, false); - std::string mixed_true = Ipv6Address::Convert(oa6, true); - printf("Ipv6Address::Convert(false) : %s\n", mixed_false.c_str()); - printf("Ipv6Address::Convert(true ) : %s\n", mixed_true.c_str()); - assert(mixed_false == l2ipname6); -#endif -/* - printf("-------------------------------------------\n"); - int protocol; - Utility::u2service("tcp", protocol); - printf("tcp: %d\n", protocol); - Utility::u2service("udp", protocol); - printf("udp: %d\n", protocol); - Utility::u2service("echo", protocol); - printf("echo: %d\n", protocol); -*/ - } - printf("\n"); - printf("OK\n"); - -// sleep(100); -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/resume.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/resume.cpp deleted file mode 100755 index 29d15ae979a..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/resume.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#include <EventHandler.h> -#include <TcpSocket.h> -#include <Utility.h> -#include <IEventOwner.h> -#include <ListenSocket.h> - - -class eHandler : public EventHandler -{ -public: - eHandler() : EventHandler() {} - ~eHandler() { - } -}; - - -#define ID_STOP_SOCKET 1 -#define ID_STOP_LISTEN 2 - - -class eSocket : public TcpSocket, public IEventOwner -{ -public: - eSocket(ISocketHandler& h) : TcpSocket(h), IEventOwner(static_cast<eHandler&>(h)), m_listen_socket(NULL), m_server(false) { - SetLineProtocol(); - } - ~eSocket() { - } - - bool OnConnectRetry() { - printf("Retrying connect\n"); - if (GetConnectionRetries() == 3) - { - printf("Creating ListenSocket\n"); - m_listen_socket = new ListenSocket<eSocket>(Handler()); - if (m_listen_socket -> Bind(12345)) - { - printf("Bind port 12345 failed\n"); - } - m_listen_socket -> SetDeleteByHandler(); - Handler().Add( m_listen_socket ); - } - return true; - } - - void OnAccept() { - m_events[AddEvent(5, 0)] = ID_STOP_SOCKET; - m_server = true; - } - - void OnConnect() { - m_events[AddEvent(10, 0)] = ID_STOP_LISTEN; - } - - void OnReconnect() { - m_events[AddEvent(10, 0)] = ID_STOP_LISTEN; - } - - void OnEvent(int id) { - if (m_events[id] == ID_STOP_SOCKET && m_server) - { - printf("Event: Server disconnect\n"); - SetCloseAndDelete(); - } - if (m_events[id] == ID_STOP_LISTEN && !m_server) - { - printf("Event: Stop listensocket\n"); - if (m_listen_socket) - { - m_listen_socket -> SetCloseAndDelete(); - m_listen_socket = NULL; - } - } - } - - void OnLine(const std::string& line) { - printf(" Incoming data: %s\n", line.c_str()); - } - - void OnDelete() { - printf("eSocket::OnDelete(), server: %s\n", m_server ? "true" : "false"); - } - - void OnDisconnect() { - printf("Disconnect, server: %s\n", m_server ? "true" : "false"); - } - -private: - ListenSocket<eSocket> *m_listen_socket; - std::map<int, int> m_events; - bool m_server; -}; - - -class Sender : public IEventOwner -{ -public: - Sender(IEventHandler& h, TcpSocket& ref) : IEventOwner(h), m_socket(ref), m_count(1) { - } - - void OnEvent(int id) { - if (static_cast<eHandler&>(GetEventHandler()).Valid(&m_socket)) - m_socket.Send("Event#" + Utility::l2string(m_count++) + "\n"); - AddEvent(1, 0); - } - -private: - TcpSocket& m_socket; - int m_count; -}; - - -int main(int argc, char *argv[]) -{ - eHandler h; - eSocket sock(h); - sock.SetConnectTimeout(3); - sock.SetConnectionRetry(-1); -#ifdef ENABLE_RECONNECT - sock.SetReconnect(); -#endif - sock.Open("localhost", 12345); - h.Add( &sock ); - Sender send(h, sock); - h.AddEvent( &send, 1, 0 ); - h.EventLoop(); -} - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/retry.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/retry.cpp deleted file mode 100755 index 36954a6fcf8..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/retry.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include <TcpSocket.h> -#include <SocketHandler.h> -#include <ListenSocket.h> - - - bool quit = false; - -/* - virtual bool OnConnectRetry(); -- void SetRetryClientConnect(bool x = true); -- bool RetryClientConnect(); - void SetConnectionRetry(int n); - int GetConnectionRetry(); - void IncreaseConnectionRetries(); - int GetConnectionRetries(); - void ResetConnectionRetries(); -*/ -class RetrySocket : public TcpSocket -{ -public: - RetrySocket(ISocketHandler& h) : TcpSocket(h) { - SetConnectTimeout(2); - SetConnectionRetry(-1); - } - - bool OnConnectRetry() { - printf("Connection attempt#%d\n", GetConnectionRetries()); - if (GetConnectionRetries() == 3) - { - ListenSocket<RetrySocket> *l = new ListenSocket<RetrySocket>(Handler()); - if (l -> Bind(12345)) - { - printf("Bind port 12345 failed\n"); - } - l -> SetDeleteByHandler(); - Handler().Add(l); - } - return true; - } - - void OnConnect() { - printf("Connected\n"); - printf("GetRemoteAddress(): %s\n", GetRemoteAddress().c_str()); - printf("Remote address: %s\n", GetRemoteSocketAddress() -> Convert(false).c_str()); - printf("Remote address: %s\n", GetRemoteSocketAddress() -> Convert(true).c_str()); - SetCloseAndDelete(); - } - - void OnDelete() { - quit = true; - } -}; - - -int main(int argc, char *argv[]) -{ - SocketHandler h; - RetrySocket sock(h); - sock.Open("localhost", 12345); - h.Add(&sock); - while (!quit) - { - h.Select(0, 200000); - } -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/scanr.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/scanr.cpp deleted file mode 100755 index b6c4e2b2db4..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/scanr.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include <TcpSocket.h> -#include <SocketHandler.h> -#include <StdoutLog.h> -#include <iostream> - - -class tSocket : public TcpSocket -{ -public: - tSocket(ISocketHandler& h, const std::string& host, int port) : TcpSocket(h), m_host(host) - { - SetLineProtocol(); - Open(host, port); - } - - void OnLine(const std::string& line) - { - printf("%s :: ", GetRemoteAddress().c_str()); - for (size_t i = 0; i < line.size(); i++) - { - if (isprint(line[i]) || line[i] == 13 || line[i] == 10) - { - printf("%c", line[i]); - } - } - printf("\n"); - } - -private: - std::string m_host; -}; - - -int main(int argc, char *argv[]) -{ - std::string host = argc > 1 ? argv[1] : "www.alhem.net"; - int port = argc > 2 ? atoi(argv[2]) : 80; - SocketHandler h; - for (int i = 1; i < 255; i++) - { - char host[40]; - sprintf(host, "10.170.23.%d", i); - tSocket *p = new tSocket(h, host, 23); - h.Add(p); - } - while (h.GetCount()) - { - h.Select(1, 0); - } -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/semtest.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/semtest.cpp deleted file mode 100755 index 442d5d663dd..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/semtest.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#ifndef _WIN32 -#include <unistd.h> -#include <Semaphore.h> -#include <Mutex.h> -#include <Thread.h> -#include <Utility.h> -#include <Lock.h> - - -class MyThread : public Thread -{ -public: - void Run() { - printf("Thread\n"); - } -}; - - -class SemLock -{ -public: - SemLock(Semaphore& sem) : m_sem(sem) { - m_sem.Wait(); - } - ~SemLock() { - m_sem.Post(); - } - -private: - Semaphore& m_sem; -}; - - -/** - * Return time difference between two struct timeval's, in seconds - * \param t0 start time - * \param t end time - */ -double Diff(struct timeval t0,struct timeval t) -{ - t.tv_sec -= t0.tv_sec; - t.tv_usec -= t0.tv_usec; - if (t.tv_usec < 0) - { - t.tv_usec += 1000000; - t.tv_sec -= 1; - } - return t.tv_sec + (double)t.tv_usec / 1000000; -} - - -static int val = 0; - -void lock(Mutex& m, int i) -{ - Lock l(m); - val += i; -} - - -void lock(Semaphore& s, int i) -{ - SemLock l(s); - val += i; -} -#endif // WIN32 - - -int main() -{ -#ifndef _WIN32 - Mutex mutex; - Semaphore sema(1); - struct timeval start; - struct timeval tt; - double d; - - Utility::GetTime(&start); - for (int i = 0; i < 100000; i++) - lock(mutex, i); - Utility::GetTime(&tt); - d = Diff(start, tt); - printf("%.4f sec\n", d); - - Utility::GetTime(&start); - for (int i = 0; i < 100000; i++) - lock(sema, i); - Utility::GetTime(&tt); - d = Diff(start, tt); - printf("%.4f sec\n", d); -#endif -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/sloppy_http.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/sloppy_http.cpp deleted file mode 100755 index b6bf07520fa..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/sloppy_http.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include <SocketHandler.h> -#include <TcpSocket.h> - - -class GetHttp : public TcpSocket -{ -public: - GetHttp(ISocketHandler& h, const char *request) : TcpSocket(h) - , m_request(request) {} - - void OnConnect() { - printf("... connected\n"); - Send( m_request ); - } - - void OnRawData( const char *buf, size_t len ) { - printf("... data\n"); - if (len > 0) { - std::string tmp; - tmp.resize( len ); - memcpy( &tmp[0], buf, len ); - m_response += tmp; - } - } - - const std::string& Response() { - return m_response; - } - -private: - std::string m_request; - std::string m_response; -}; - - -std::string get_http(const char *host, int port, const char *request) -{ - SocketHandler h; - GetHttp sock(h, request); - sock.Open( host, port ); - h.Add(&sock); - while (h.GetCount()) { - h.Select(1, 0); - } - return sock.Response(); -} - - -int main(int argc, char *argv[]) -{ - std::string zz = get_http("www.alhem.net", 80, "GET /index.html HTTP/1.0\r\n" - "Host: www.alhem.net\r\n" - "Connection: close\r\n" - "\r\n"); - printf("%s\n%d\n", zz.c_str(), zz.size()); -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/sockets_test.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/sockets_test.cpp deleted file mode 100755 index 966732f9bcc..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/sockets_test.cpp +++ /dev/null @@ -1,356 +0,0 @@ -#ifdef _WIN32 -#pragma warning(disable:4786) -#endif -#include <StdoutLog.h> -#include <SocketHandler.h> -#include <TcpSocket.h> -#include <ListenSocket.h> -#include <Utility.h> -#include <Parse.h> -#include <HttpGetSocket.h> -#include <Socket.h> -#include <HttpDebugSocket.h> -#include <iostream> - -#ifdef SOCKETS_NAMESPACE -using namespace SOCKETS_NAMESPACE; -#endif - - -class MyHandler : public SocketHandler -{ -public: - MyHandler(StdLog *p) : SocketHandler(p),m_done(false),m_quit(false) {} - ~MyHandler() {} - - void List(TcpSocket *p) { - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) - { - Socket *p0 = (*it).second; -#ifdef ENABLE_POOL - if (dynamic_cast<ISocketHandler::PoolSocket *>(p0)) - { - p -> Send("PoolSocket\n"); - } - else -#endif - if (dynamic_cast<HttpGetSocket *>(p0)) - { - p -> Send("HttpGetSocket\n"); - } - else - if (dynamic_cast<TcpSocket *>(p0)) - { - p -> Send("TcpSocket\n"); - } - else - { - p -> Send("Some kind of Socket\n"); - } - } - } - void SetQuit() { m_quit = true; } - bool Quit() { return m_quit; } - void CheckHtml() { - if (m_done) - { - if (m_ok) - printf("Html OK:\n%s\n", m_html.c_str()); - else - printf("Html Failed\n"); - m_done = false; - } - } - - std::string m_html; - bool m_ok; - bool m_done; - -private: - bool m_quit; -}; - - -class MySocket : public TcpSocket -{ -public: - MySocket(ISocketHandler& h) : TcpSocket(h) { - } - void OnAccept() { - int port = GetParent() -> GetPort(); - Send("I'm the server at port " + - Utility::l2string(port) + "\n"); - SetCloseAndDelete(); - } -}; - - -class hSocket : public HttpGetSocket -{ -public: - hSocket(ISocketHandler& h,const std::string& x,const std::string& y) : HttpGetSocket(h,x,y) {} - - void OnConnect() { - printf("hSocket::OnConnect\n"); - HttpGetSocket::OnConnect(); - } -}; - - -class OrderSocket : public TcpSocket -{ -public: - OrderSocket(ISocketHandler& h) : TcpSocket(h) { - SetLineProtocol(); - } - Socket *Create() { - Handler().LogError(this, "Create", 0, "OrderSocket", LOG_LEVEL_INFO); - return new OrderSocket(Handler()); - } - void OnAccept() { - Send("Cmd (get,quit,list,stop,detach,count,resolve <name>)>"); - } - void OnLine(const std::string& line) { - Parse pa(line); - std::string cmd = pa.getword(); - std::string arg = pa.getrest(); - try - { - if (cmd == "get") - { - HttpGetSocket *p = new hSocket(Handler(), arg, "tmpfile.html"); - p -> SetHttpVersion("HTTP/1.1"); - p -> AddResponseHeader("Connection", "keep-alive"); - p -> SetDeleteByHandler(); - Handler().Add( p ); - Send("Reading url '" + arg + "'\n"); - } - else - if (cmd == "quit") - { - Send("Goodbye!\n"); - SetCloseAndDelete(); - } - else - if (cmd == "list") - { - dynamic_cast<MyHandler&>(Handler()).List( this ); - } - else - if (cmd == "stop") - { - dynamic_cast<MyHandler&>(Handler()).SetQuit(); - } - else - if (cmd == "resolve") - { - //Resolve( arg ); - ipaddr_t a; - if (Utility::u2ip(arg, a)) - { - std::string tmp; - Utility::l2ip(a, tmp); - Send("Resolved: " + tmp + "\n"); - } - else - { - Send("Resolve failed: " + arg + "\n"); - } - } - else - /* - if (cmd == "reverse") - { - ipaddr_t a; - Utility::u2ip(arg, a); // ip -> ipaddr_t - int id = Socket::Resolve(a, 0); - Send("Resolve id = " + Utility::l2string(id) + "\n"); - } - else - */ - #ifdef ENABLE_DETACH - if (cmd == "detach") - { - if (!Detach()) - { - Send("Detach() call failed\n"); - } - else - { - Send("Ok.\n"); - } - } - else - #endif - if (cmd == "count") - { - Send("Socket count: " + Utility::l2string( (long)Handler().GetCount()) + "\n"); - } - else - { - Send("Huh?\n"); - } - } - catch (const std::exception& e) - { - Send(e.what() + std::string("\n")); - } - Send("Cmd>"); - } - void OnDelete() { - printf("OrderSocket::OnDelete()\n"); - } -#ifdef ENABLE_RESOLVER - void OnResolved(int id,ipaddr_t a,port_t port) - { - } - void OnResolved(int id,const std::string& name,port_t port) - { - Send("Resolve id " + Utility::l2string(id) + " = " + name + "\n"); - } -/* - void OnResolved(const char *p,size_t l) { - printf("OnResolved, %d bytes:\n", l); - for (size_t i = 0; i < l; i++) - { - unsigned char c = p[i]; - if (isprint(c)) - printf("%c",c); - else - printf("<%02X>",c); - } - printf("\n"); - } -*/ -#endif -#ifdef ENABLE_DETACH - void OnDetached() { - Send("\nDetached.\nCmd>"); - } -#endif -}; - - -class TestSocket : public TcpSocket -{ -public: - TestSocket(ISocketHandler& h) : TcpSocket(h) { - SetLineProtocol(); - } - void OnConnect() { - printf("TestSocket connected, sending QUIT\n"); - Send( "quit\n" ); - } - void OnConnectFailed() { - printf("TestSocket::OnConnectFailed\n"); - SetCloseAndDelete(); - } - void OnLine(const std::string& line) { - printf("TestSocket: %s\n", line.c_str()); - } - void OnDelete() { - printf("TestSocket::OnDelete()\n"); - } -#ifdef ENABLE_RESOLVER - void OnResolved(int id,ipaddr_t a,port_t port) { - printf("TestSocket::OnResolved(): %d, %08x:%d\n", id, a, port); - TcpSocket::OnResolved(id,a,port); - } -#endif -}; - - -int main() -{ - try - { - StdoutLog log; - MyHandler h(&log); - -#ifdef ENABLE_RESOLVER - h.EnableResolver(9999); -#endif -// Utility::ResolveLocal(); - printf(" *** My hostname: %s\n", Utility::GetLocalHostname().c_str()); - printf(" *** My local IP: %s\n", Utility::GetLocalAddress().c_str()); - - // socks4 options -/* - h.SetSocks4Host("127.0.0.1"); - h.SetSocks4Port(1080); - h.SetSocks4Userid("www.alhem.net"); - h.SetSocks4TryDirect( true ); - printf("Socks4Host: %x\n", h.GetSocks4Host()); -*/ - - // first server - ListenSocket<MySocket> l1(h); - if (l1.Bind(1024)) - { - printf("Bind 1024 failed\n"); - exit(-1); - } - h.Add(&l1); - - // second server - ListenSocket<MySocket> l2(h); - if (l2.Bind(1025)) - { - printf("Bind 1025 failed\n"); - exit(-1); - } - h.Add(&l2); - - // line server - ListenSocket<OrderSocket> l3(h); - if (l3.Bind(1027)) - { - printf("Bind 1027 failed\n"); - exit(-1); - } - h.Add(&l3); - - // http debug - ListenSocket<HttpDebugSocket> l4(h); - if (l4.Bind(8080)) - { - printf("Bind 8080 failed\n"); - exit(-1); - } - h.Add(&l4); - - // wait for resolver to really start -#ifdef ENABLE_RESOLVER - printf("Waiting for resolver ..."); - while (!h.ResolverReady()) - ; - printf(" resolver ready!\n"); -#endif - - TestSocket ts(h); -printf(">>> TestSocket.Open\n"); - ts.Open("localhost", 1027); -printf(">>> Adding TestSocket\n"); - h.Add(&ts); - -printf(">>> Enter mainloop\n"); - h.Select(0,0); - while (!h.Quit()) - { - h.Select(1,0); - } -printf(">>> Leaving mainloop\n"); - - return 0; - } - catch (const Exception& e) - { - std::cerr << e.ToString() << std::endl; - } - catch (const std::exception& e) - { - std::cerr << e.what() << std::endl; - } -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/stressclient.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/stressclient.cpp deleted file mode 100755 index 2d38a066e59..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/stressclient.cpp +++ /dev/null @@ -1,631 +0,0 @@ -/** - ** \file stressclient.cpp - ** \date 2006-10-02 - ** \author grymse@alhem.net -**/ -/* -Copyright (C) 2006 Anders Hedstrom - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifdef _WIN32 -#pragma warning(disable:4786) -#endif -#include <StdoutLog.h> -#include <ListenSocket.h> -#include <SocketHandlerEp.h> -#include <TcpSocket.h> -#include <Utility.h> -#ifndef _WIN32 -#include <signal.h> -#include <stdint.h> -#else -typedef __int64 int64_t; -#endif -#include <HttpGetSocket.h> -#include <iostream> - - -static int g_ant = 0; -static double g_min_time = 10000; -static double g_max_time = 0; -static double g_tot_time = 0; - -static int g_ant2 = 0; -static double g_min_time2 = 10000; -static double g_max_time2 = 0; -static double g_tot_time2 = 0; - -static int64_t gBytesIn = 0; -static int64_t gBytesOut = 0; - -static int samples = 0; - -static int g_tot_ant = 0; -static double g_tot_min_t = 0; -static double g_tot_max_t = 0; -static double g_tot_tot_t = 0; - -static int g_tot_ant2 = 0; -static double g_tot_min_t2 = 0; -static double g_tot_max_t2 = 0; -static double g_tot_tot_t2 = 0; - -static int64_t tot_gBytesIn = 0; -static int64_t tot_gBytesOut = 0; - -static double tot_rt = 0; - -static bool gQuit = false; -static size_t g_max_connections = 0; -static std::string gHost = "localhost"; -static port_t gPort = 2222; -static bool g_b_flood = false; -static bool g_b_off = false; -static bool g_b_limit = false; -static bool g_b_repeat = false; -static std::string g_data; -static size_t g_data_size = 1024; -static bool g_b_stop = false; -#ifdef HAVE_OPENSSL -static bool g_b_ssl = false; -#endif -static bool g_b_instant = false; -static struct timeval g_t_start; - - -/** - * Return time difference between two struct timeval's, in seconds - * \param t0 start time - * \param t end time - */ -double Diff(struct timeval t0,struct timeval t) -{ - t.tv_sec -= t0.tv_sec; - t.tv_usec -= t0.tv_usec; - if (t.tv_usec < 0) - { - t.tv_usec += 1000000; - t.tv_sec -= 1; - } - return t.tv_sec + (double)t.tv_usec / 1000000; -} - - -void gettime(struct timeval *p, struct timezone *) -{ -#ifdef _WIN32 - FILETIME ft; // Contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC). - GetSystemTimeAsFileTime(&ft); - uint64_t tt; - memcpy(&tt, &ft, sizeof(tt)); - tt /= 10; - p->tv_sec = tt / 1000000; - p->tv_usec = tt % 1000000; -#else - gettimeofday(p, NULL); -#endif -} - - -void print_tot() -{ - printf("c ----- %6d (%.4f/%.4f/%.4f)", g_tot_ant / samples, g_tot_min_t / samples, g_tot_max_t / samples, g_tot_tot_t / g_tot_ant); - - printf(" r --- %7d (%.4f/%.4f/%.4f)", g_tot_ant2 / samples, g_tot_min_t2 / samples, g_tot_max_t2 / samples, g_tot_tot_t2 / g_tot_ant2); - - double mbi = (double)tot_gBytesIn / 1024 / samples; - mbi /= 1024; - mbi /= tot_rt / samples; - printf(" -/in %11lld", tot_gBytesIn / samples); - printf(" (%5.2f MB/s)", mbi); - - double mbo = (double)tot_gBytesOut / 1024 / samples; - mbo /= 1024; - mbo /= tot_rt / samples; - printf(" -/out %11lld", tot_gBytesOut / samples); - printf(" (%5.2f MB/s)", mbo); - - printf(" %5.2f s\n", tot_rt / samples); - -} - - -void printreport() -{ - struct timeval tv; - gettime(&tv, NULL); - double rt = Diff(g_t_start, tv); - g_t_start = tv; - // -// printf("connect %6d (%.4f/%.4f/%.4f)", g_ant, g_min_time, g_max_time, g_tot_time / g_ant); - g_tot_ant += g_ant; - g_tot_min_t += g_min_time; - g_tot_max_t += g_max_time; - g_tot_tot_t += g_tot_time; - -// printf(" reply %7d (%.4f/%.4f/%.4f)", g_ant2, g_min_time2, g_max_time2, g_tot_time2 / g_ant2); - g_tot_ant2 += g_ant2; - g_tot_min_t2 += g_min_time2; - g_tot_max_t2 += g_max_time2; - g_tot_tot_t2 += g_tot_time2; - - double mbi = (double)gBytesIn / 1024; - mbi /= 1024; - mbi /= rt; -// printf(" b/in %11lld", gBytesIn); -// printf(" (%5.2f MB/s)", mbi); - tot_gBytesIn += gBytesIn; - - double mbo = (double)gBytesOut / 1024; - mbo /= 1024; - mbo /= rt; -// printf(" b/out %11lld", gBytesOut); -// printf(" (%5.2f MB/s)", mbo); - tot_gBytesOut += gBytesOut; - -// printf(" %5.2f s\n", rt); - tot_rt += rt; - - ++samples; - print_tot(); -} - - -void printreport_reset() -{ - printreport(); - // - g_min_time = 10000; - g_max_time = 0; - g_tot_time = 0; - g_ant = 0; - g_min_time2 = 10000; - g_max_time2 = 0; - g_tot_time2 = 0; - g_ant2 = 0; - gBytesIn = gBytesOut = 0; -} - - -class MySocket : public TcpSocket -{ -public: - MySocket(ISocketHandler& h,bool one) : TcpSocket(h), m_b_client(false), m_b_one(one), m_b_created(false), m_b_active(false) { - gettime(&m_create, NULL); - SetLineProtocol(); -#ifdef HAVE_OPENSSL - if (g_b_ssl) - EnableSSL(); -#endif - if (g_max_connections && !m_b_one && Handler().GetCount() >= g_max_connections) - { - fprintf(stderr, "\nConnection limit reached: %d, continuing in single connection stress mode\n", (int)g_max_connections); - if (g_b_off) - printreport_reset(); - g_b_limit = true; - m_b_one = true; - // - g_b_flood = g_b_repeat; - } -#ifndef USE_EPOLL - if (!m_b_one && Handler().GetCount() >= Handler().MaxCount() - 17) - { - fprintf(stderr, "\nFD_SETSIZE connection limit reached: %d, continuing in single connection stress mode\n", (int)Handler().GetCount()); - if (g_b_off) - printreport_reset(); - g_b_limit = true; - m_b_one = true; - // - g_b_flood = g_b_repeat; - } -#endif - } - ~MySocket() { - } - - void OnConnect() { - gettime(&m_connect, NULL); - m_b_active = true; - { - double tconnect = Diff(m_create, m_connect); - // - g_min_time = tconnect < g_min_time ? tconnect : g_min_time; - g_max_time = tconnect > g_max_time ? tconnect : g_max_time; - g_tot_time += tconnect; - g_ant += 1; - } - SendBlock(); - m_b_client = true; - } - - void SendBlock() { - gettime(&m_send, NULL); - Send(g_data + "\n"); - } - - void OnLine(const std::string& line) { - gettime(&m_reply, NULL); - m_b_active = true; - { - double treply = Diff(m_send, m_reply); - // - g_min_time2 = treply < g_min_time2 ? treply : g_min_time2; - g_max_time2 = treply > g_max_time2 ? treply : g_max_time2; - g_tot_time2 += treply; - g_ant2 += 1; - } - // - if (line != g_data) - { - fprintf(stderr, "\n%s\n%s\n", line.c_str(), g_data.c_str()); - fprintf(stderr, "(reply did not match data - exiting)\n"); - exit(-1); - } - // - gBytesIn += GetBytesReceived(true); - gBytesOut += GetBytesSent(true); - if (m_b_one) - { - SetCloseAndDelete(); - } - else - if (g_b_repeat && g_b_limit) - { - SendBlock(); - } - // add another - if (!m_b_created && (!g_b_limit || !g_b_off) && !g_b_instant) - { - MySocket *p = new MySocket(Handler(), m_b_one); - p -> SetDeleteByHandler(); - p -> Open(gHost, gPort); - Handler().Add(p); - m_b_created = true; - } - } - - bool IsActive() { - bool b = m_b_active; - m_b_active = false; - return b; - } - -private: - bool m_b_client; - bool m_b_one; - bool m_b_created; - bool m_b_active; - struct timeval m_create; - struct timeval m_connect; - struct timeval m_send; - struct timeval m_reply; -}; - - -class MyHttpSocket : public HttpGetSocket -{ -public: - MyHttpSocket(ISocketHandler& h,const std::string& url) : HttpGetSocket(h,url), m_url(url) { - gettime(&m_create, NULL); - AddResponseHeader("content-length", Utility::l2string(g_data_size)); - } - ~MyHttpSocket() {} - - void OnConnect() { - gettime(&m_connect, NULL); - { - double tconnect = Diff(m_create, m_connect); - // - g_min_time = tconnect < g_min_time ? tconnect : g_min_time; - g_max_time = tconnect > g_max_time ? tconnect : g_max_time; - g_tot_time += tconnect; - g_ant += 1; - } - gettime(&m_send, NULL); - - // send request header - HttpGetSocket::OnConnect(); - - // send body - Send(g_data); - } - - void OnContent() { -// std::cout << GetContentLength() << std::endl; - gettime(&m_reply, NULL); - { - double treply = Diff(m_send, m_reply); - // - g_min_time2 = treply < g_min_time2 ? treply : g_min_time2; - g_max_time2 = treply > g_max_time2 ? treply : g_max_time2; - g_tot_time2 += treply; - g_ant2 += 1; - } - gBytesIn += GetBytesReceived(true); - gBytesOut += GetBytesSent(true); - CreateNew(); - } - void CreateNew() { - if (g_b_off) - return; - MyHttpSocket *p = new MyHttpSocket(Handler(), m_url); - p -> SetDeleteByHandler(); - Handler().Add(p); - SetCloseAndDelete(); - } - - void OnDelete() { - } - -private: - std::string m_url; - struct timeval m_create; - struct timeval m_connect; - struct timeval m_send; - struct timeval m_reply; -}; - - -int connectors = 0; - -class ConnectorSocket : public TcpSocket -{ -public: - ConnectorSocket(ISocketHandler& h) : TcpSocket(h), m_state(0) { - } - ~ConnectorSocket() {} - - void OnConnect() { - SetTimeout(5); - connectors += 1; - std::cout << "Connected: " << connectors << std::endl; - } - - void OnTimeout() { - SetTimeout(5); - if (!m_state) - { - m_state = 1; - } - else - { - ConnectorSocket *s = new ConnectorSocket(Handler()); - s -> Open(gHost, gPort); - s -> SetDeleteByHandler(); - Handler().Add(s); - } - } - -private: - int m_state; -}; - - -#ifndef _WIN32 -void sigint(int) -{ - printreport(); - gQuit = true; -} - - -void sigusr1(int) -{ - g_b_flood = true; -} - - -void sigusr2(int) -{ - printreport_reset(); -} -#endif - - -class MyHandler : public SocketHandlerEp -{ -public: - MyHandler() : SocketHandlerEp() { - } - MyHandler(StdoutLog *p) : SocketHandlerEp(p) { - } - ~MyHandler() { - } - void Flood() { - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) - { - Socket *p0 = it -> second; - MySocket *p = dynamic_cast<MySocket *>(p0); - if (p) - { - p -> SendBlock(); - } - } - } - void Report() { - int ant = 0; - int act = 0; - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) - { - MySocket *p = dynamic_cast<MySocket *>(it -> second); - if (p) - { - ant++; - if (p -> IsActive()) - { - act++; - } - } - } -// printf(" Number of //stress// sockets: %d Active: %d\n", ant, act); - } -}; - - -int main(int argc,char *argv[]) -{ - bool many = false; - bool one = false; - bool enableLog = false; - bool http = false; - bool connector = false; - std::string url; - time_t report_period = 10; - for (int i = 1; i < argc; i++) - { - if (!strcmp(argv[i], "-many")) - many = true; - if (!strcmp(argv[i], "-one")) - one = true; - if (*argv[i] == '-' && strlen(argv[i]) > 1 && isdigit(argv[i][1]) ) - g_max_connections = atoi(argv[i] + 1); - if (!strcmp(argv[i], "-host") && i < argc - 1) - gHost = argv[++i]; - if (!strcmp(argv[i], "-port") && i < argc - 1) - gPort = atoi(argv[++i]); - if (!strcmp(argv[i], "-off")) - g_b_off = true; - if (!strcmp(argv[i], "-repeat")) - g_b_repeat = true; - if (!strcmp(argv[i], "-size") && i < argc - 1) - g_data_size = atoi(argv[++i]); - if (!strcmp(argv[i], "-log")) - enableLog = true; - if (!strcmp(argv[i], "-time") && i < argc - 1) - report_period = atoi(argv[++i]); - if (!strcmp(argv[i], "-stop")) - g_b_stop = true; -#ifdef HAVE_OPENSSL - if (!strcmp(argv[i], "-ssl")) - g_b_ssl = true; -#endif - if (!strcmp(argv[i], "-instant")) - g_b_instant = true; - if (!strcmp(argv[i], "-http")) - http = true; - if (!strcmp(argv[i], "-url") && i < argc - 1) - url = argv[++i]; - if (!strcmp(argv[i], "-connector")) - connector = true; - } - if (argc < 2 || (!many && !one && !g_max_connections && !http && !connector) ) - { - printf("Usage: %s [mode] [options]\n", *argv); - printf(" Modes (only use one of these):\n"); - printf(" -many start max number of connections\n"); - printf(" -one open - close - repeat\n"); - printf(" -nn open nn connections, then start -one mode\n"); - printf(" -http send/receive http request/response\n"); - printf(" Options:\n"); - printf(" -host xx host to connect to\n"); - printf(" -port nn port number to connection to\n"); - printf(" -off turn off new connections when connection limit reached\n"); - printf(" -repeat send new block when reply is received\n"); - printf(" -size nn size of block to send, default is 1024 bytes\n"); - printf(" -log enable debug log\n"); - printf(" -time nn time between reports, default 10s\n"); - printf(" -stop stop after time elapsed\n"); - printf(" -instant create all sockets at once\n"); -#ifdef HAVE_OPENSSL - printf(" -ssl use ssl\n"); -#endif - printf(" -url xx url to use in http mode (default http://<host>:<port>/)\n"); - printf(" -connector Use connector stress test\n"); - exit(-1); - } - fprintf(stderr, "Using data size: %d bytes\n", (int)g_data_size); - std::string chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; - while (g_data.size() < g_data_size) - { - g_data += chars[rand() % chars.size()]; - } -#ifndef _WIN32 - signal(SIGINT, sigint); - signal(SIGUSR1, sigusr1); - signal(SIGUSR2, sigusr2); - signal(SIGPIPE, SIG_IGN); -#endif - StdoutLog *log = enableLog ? new StdoutLog() : NULL; - MyHandler h(log); - if (connector) - { - report_period = 4; - ConnectorSocket *s = new ConnectorSocket(h); - s -> Open(gHost, gPort); - s -> SetDeleteByHandler(); - h.Add(s); - } - else - if (http) - { - if (!url.size()) - { - url = "http://" + gHost + ":" + Utility::l2string(gPort) + "/"; - } - MyHttpSocket *s = new MyHttpSocket(h, url); - s -> SetDeleteByHandler(); - h.Add(s); - } - else - if (g_b_instant) - { - for (size_t i = 0; i < g_max_connections; i++) - { - MySocket *s = new MySocket(h, one); - s -> SetDeleteByHandler(); - s -> Open(gHost, gPort); - h.Add(s); - } - g_b_limit = true; - } - else - { - MySocket *s = new MySocket(h, one); - s -> SetDeleteByHandler(); - s -> Open(gHost, gPort); - h.Add(s); - } - time_t t = time(NULL); - gettime(&g_t_start, NULL); - while (!gQuit) - { - h.Select(1, 0); - if (g_b_flood) - { - fprintf(stderr, "\nFlooding\n"); - h.Flood(); - g_b_flood = false; - } - if (time(NULL) - t >= report_period) // report - { - t = time(NULL); - printreport_reset(); - h.Report(); - if (g_b_stop) - { - gQuit = true; - } - } - } - fprintf(stderr, "\nExiting...\n"); - if (log) - { -// delete log; - } - return 0; -} - - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/threadstress.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/threadstress.cpp deleted file mode 100755 index 7f758e73914..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/threadstress.cpp +++ /dev/null @@ -1,123 +0,0 @@ -#include <TcpSocket.h> -#include <Exception.h> -#include <Thread.h> -#include <SocketHandler.h> -#include <ListenSocket.h> -#include <StdoutLog.h> -#include <signal.h> -#include <iostream> - -#define DEB(x) x - - int count = 0; - -class EchoSocket : public TcpSocket -{ -public: - EchoSocket(ISocketHandler& h) : TcpSocket(h), m_client(false) { - SetLineProtocol(); - } - - void OnConnect() { - m_uid = "Test"; - Send(m_uid + "\n"); - m_client = true; - } - - void OnLine(const std::string& line) { - if (m_client) - { - if (line != m_uid) - throw Exception("Bad data returned."); - if (m_uid.size() < 8192) - m_uid = line + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[random() % 26]; - else - SetCloseAndDelete(); - Send(m_uid + "\n"); -std::cout << m_uid << std::endl; - } - else - { - Send(line + "\n"); - } - } - - void Init() - { - if (GetParent() -> GetPort() >= 4000) - { -#ifdef HAVE_OPENSSL - EnableSSL(); -#else - throw Exception("SSL not available"); -#endif - } - } - -#ifdef HAVE_OPENSSL - void InitSSLServer() - { - InitializeContext("threadstress", "comb.pem", "", SSLv23_method()); - } -#endif - -private: - std::string m_uid; - bool m_client; -}; - -class StressThread : public Thread -{ -public: - StressThread(port_t port) : Thread(), m_port(port) { - SetDeleteOnExit(); - ++count; - } - ~StressThread() { - --count; - } - - void Run() { - try - { - StdoutLog log; - SocketHandler h(&log); - ListenSocket<EchoSocket> l(h); - l.Bind(m_port); - h.Add(&l); - EchoSocket client(h); - client.EnableSSL(); - client.Open("localhost", m_port); - h.Add(&client); - while (h.GetCount() > 1) - { - h.Select(1, 0); - } - std::cout << "Port#" << m_port << ": Leaving thread" << std::endl; - } - catch (const Exception& e) - { - std::cerr << "Port#" << m_port << ": " << e.ToString() << std::endl; - } - } - -private: - port_t m_port; -}; - -int main(int argc, char *argv[]) -{ - if (argc < 2) - { - printf("Usage: %s <number of threads>\n", *argv); - return -1; - } - signal(SIGPIPE, SIG_IGN); - for (int i = 0; i < atoi(argv[1]); i++) - new StressThread(4000 + i); - while (count > 0) - { - sleep(1); - } -} - diff --git a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/x.cpp b/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/x.cpp deleted file mode 100755 index 2ca9b261a15..00000000000 --- a/openair2/RRM_4_RRC_LITE/src/foreign/sockets-2.3.9.4/tests/x.cpp +++ /dev/null @@ -1,298 +0,0 @@ -#include <SocketHandler.h> -#include <TcpSocket.h> -#include <StdoutLog.h> -#ifndef _WIN32 -#include <signal.h> -#endif -#include <IEventOwner.h> -#include <EventHandler.h> - -#define HOST "localhost" -#define PORT 2222 - -#define TIME_US 250000 - -#define DEB(x) x - - -static bool quit = false; -static EventHandler *ph = NULL; - -static int lc = 0; -static int l2c = 0; -static int l3c = 0; - - -#ifndef _WIN32 -void sighandler(int s) -{ - quit = true; - ph -> SetQuit(); -} - - -void sigpipe(int s) -{ -} -#endif - - -class evHandler : public EventHandler -{ -public: - evHandler() : EventHandler() {} - evHandler(StdLog *p) : EventHandler(p) {} - - void CloseAll() { - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) - { - Socket *p = it -> second; - p -> SetCloseAndDelete(); - } - } - -}; - - -class lSocket : public TcpSocket, public IEventOwner -{ -public: - lSocket(ISocketHandler& h, bool first = false) : TcpSocket(h), IEventOwner(static_cast<evHandler&>(h)), m_id(0), m_first(first) { - SetLineProtocol(); - lc++; - } - ~lSocket() { - } - - void OnConnect() { - if (!m_id) - { - m_id = AddEvent(0, TIME_US); - } - printf("."); - fflush(stdout); - } - void OnConnectFailed() { - printf("lSocket::OnConnectFailed\n"); - } - - void OnDelete() { - if (m_first) - printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n" - "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n" - "@@@@@@@@@@@@@@ OnDelete() first @@@@@@@@@@@@@@@@@@\n" - "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n" - "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); - } - - void OnEvent(int id) { - if (id != m_id) - { - printf("ID MISMATCH!\n"); - exit(-1); - } - if (!quit) - { - lSocket *p = new lSocket(Handler()); - p -> SetDeleteByHandler(); - p -> Open(HOST, PORT); - Handler().Add(p); - } - static_cast<evHandler&>(Handler()).SetQuit( quit ); - SetCloseAndDelete(); - } - -private: - int m_id; - bool m_first; -}; - - -class l2Socket : public TcpSocket, public IEventOwner -{ -public: - l2Socket(ISocketHandler& h, bool first = false) : TcpSocket(h), IEventOwner(static_cast<evHandler&>(h)), m_id(0), m_first(first) { - SetLineProtocol(); - l2c++; - } - ~l2Socket() { - } - - void OnConnect() { - printf("."); - fflush(stdout); - } - void OnConnectFailed() { - printf("l2Socket::OnConnectFailed\n"); - } - - void OnLine(const std::string& line) { - if (!m_id) - { - m_id = AddEvent(0, TIME_US); - } - } - - void OnDelete() { - if (m_first) - printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n" - "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n" - "@@@@@@@@@@@@@@ OnDelete() first @@@@@@@@@@@@@@@@@@\n" - "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n" - "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); - } - - void OnEvent(int id) { - if (id != m_id) - { - printf("ID MISMATCH!\n"); - exit(-1); - } - if (!quit) - { - l2Socket *p = new l2Socket(Handler()); - p -> SetDeleteByHandler(); - p -> Open(HOST, PORT); - Handler().Add(p); - } - static_cast<evHandler&>(Handler()).SetQuit( quit ); - SetCloseAndDelete(); - } - -private: - int m_id; - bool m_first; -}; - - -class l3Socket : public TcpSocket, public IEventOwner -{ -public: - l3Socket(ISocketHandler& h, bool first = false) : TcpSocket(h), IEventOwner(static_cast<evHandler&>(h)), m_ehlo(false), m_id(0), m_first(first) { - SetLineProtocol(); - l3c++; - } - ~l3Socket() { - } - - void OnConnect() { - printf("."); - fflush(stdout); - } - void OnConnectFailed() { - printf("l3Socket::OnConnectFailed\n"); - } - - void OnLine(const std::string& line) { - if (!m_ehlo) - { - Send("EHLO alhem.net\r\n"); - m_ehlo = true; - } - else - if (!m_id) - { - m_id = AddEvent(0, TIME_US); - } - } - - void OnDelete() { - if (m_first) - printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n" - "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n" - "@@@@@@@@@@@@@@ OnDelete() first @@@@@@@@@@@@@@@@@@\n" - "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n" - "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); - } - - void OnEvent(int id) { - if (id != m_id) - { - printf("ID MISMATCH!\n"); - exit(-1); - } - if (!quit) - { - l3Socket *p = new l3Socket(Handler()); - p -> SetDeleteByHandler(); - p -> Open(HOST, PORT); - Handler().Add(p); - } - static_cast<evHandler&>(Handler()).SetQuit( quit ); - Send("QUIT\r\n"); - } - -private: - bool m_ehlo; - int m_id; - bool m_first; -}; - - -int main(int argc, char *argv[]) -{ -#ifndef _WIN32 - signal(SIGHUP, sighandler); - signal(SIGINT, sighandler); - signal(SIGPIPE, sigpipe); -#endif - - time_t tstart = time(NULL); - { - StdoutLog log; - { - evHandler h(&log); - ph = &h; - { - lSocket sock(h, true); - sock.Open(HOST, PORT); - h.Add(&sock); - { - l2Socket sock2(h, true); - sock2.Open(HOST, PORT); - h.Add(&sock2); - { - l3Socket sock3(h, true); - sock3.Open(HOST, PORT); - h.Add(&sock3); - - h.EventLoop(); - h.CloseAll(); - - // %! one socket refuses to go away - while (h.GetCount() > 1) - { - h.Select(1, 0); - } - printf("Exiting 1...\n"); - fflush(stdout); - } - printf("Exiting 2...\n"); - fflush(stdout); - } - printf("Exiting 3...\n"); - fflush(stdout); - } - printf("Exiting 4...\n"); - fflush(stdout); - } - printf("Exiting 5...\n"); - fflush(stdout); - } - printf("Exiting 6...\n"); - fflush(stdout); - - time_t tstop = time(NULL); - - time_t total = tstop - tstart + 1; - - printf("lc: %d\n", lc); - printf("l2c: %d\n", l2c); - printf("l3c: %d\n", l3c); - - printf("lc: %f\n", (double)lc / (double)total); - printf("l2c: %f\n", (double)l2c / (double)total); - printf("l3c: %f\n", (double)l3c / (double)total); -} - - diff --git a/openair2/UTIL/AT_COMMANDS/COPYING b/openair2/UTIL/AT_COMMANDS/COPYING deleted file mode 100644 index 94a9ed024d3..00000000000 --- a/openair2/UTIL/AT_COMMANDS/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair2/UTIL/AT_COMMANDS/parser.c b/openair2/UTIL/AT_COMMANDS/parser.c deleted file mode 100644 index 381a049f9b9..00000000000 --- a/openair2/UTIL/AT_COMMANDS/parser.c +++ /dev/null @@ -1,513 +0,0 @@ -#define PARSER_C -//----------------------------------------------------------------------------- -#include "rtos_header.h" -#include "platform_types.h" -//----------------------------------------------------------------------------- -#include "parser.h" -#include <string.h> -#include <ctype.h> -#include <stdlib.h> // for random -//----------------------------------------------------------------------------- -at_command_t g_at_response_mapping[] = { - { "AT+CGATT=" , at_attach_or_detach }, - { "AT+CGATT?" , at_read_attach_status }, - { "AT+CGDCONT=" , at_set_pdcp_context }, - { "AT+CGDCONT?" , at_read_pdp_context }, - { "AT+CGACT?" , at_read_act_status }, - { "AT+CGACT=" , at_activate_pdp_context }, - { "AT+CGPADDR=" , at_read_pdp_add }, - { "AT+CGEQOS=" , at_show_eps_qos }, - { "AT+CGETFADS=", at_set_tfad_context }, - { "AT+CGETFADR=", at_read_tfad_context }, - { "AT+CGEBRMOD=", at_mod_bearer_req }, - { "AT+CGEBRMOD?", at_read_dedicated_bearer_cid }, - { "null" , NULL} -}; -//----------------------------------------------------------------------------- -size_t at_grab_string(const unsigned char *input, unsigned char **output) -//----------------------------------------------------------------------------- -{ - size_t size = 4, position = 0; - int inside_quotes = 0; - - /* Allocate initial buffer in case string is empty */ - *output = (unsigned char *)malloc(size); - - if (*output == NULL) { - printf("PARSER_LOG:Ran out of memory!\n"); - return 0; - } - - while (inside_quotes || - ( *input != ',' - && *input != ')' - && *input != 0x0d - && *input != 0x0a - && *input != 0x00)) { - - /* Check for quotes */ - if (*input == '"') { - inside_quotes = ! inside_quotes; - } - - /* We also allocate space for traling zero */ - if (position + 2 > size) { - size += 10; - *output = (unsigned char *)realloc(*output, size); - - if (*output == NULL) { - printf("PARSER_LOG:Ran out of memory!\n"); - return 0; - } - } - - /* Copy to output */ - (*output)[position] = *input; - position++; - input ++; - } - - (*output)[position] = 0; - - /* Strip quotes */ - if ((*output)[0] == '"' && (*output)[position - 1]) { - memmove(*output, (*output) + 1, position - 2); - (*output)[position - 2] = 0; - } - - printf("PARSER_LOG:Grabbed string from reply: \"%s\" (parsed %Id bytes)\n", *output, position); - return position; -} -//----------------------------------------------------------------------------- -int at_parse_command(const unsigned char *input, const char *format, ...) -//----------------------------------------------------------------------------- -{ - const char *fmt = format; - const char *inp = (const char *)input; - char *endptr; - unsigned char *out_us; - unsigned char *buffer; - size_t length; - size_t storage_size; - int *out_i; - long int *out_l; - va_list ap; - int error = 1; - - printf("PARSER_LOG:Parsing %s\n with %s\n", input, format); - - va_start(ap, format); - - while (*fmt) { - switch(*fmt++) { - case '@': - if (*fmt == 0) { - printf("PARSER_LOG:Invalid format string: %s\n", format); - error = 0; - goto end; - } - - switch(*fmt++) { - case 'i': - out_i = va_arg(ap, int *); - *out_i = strtol(inp, &endptr, 10); - - if (endptr == inp) { - error = 0; - goto end; - } - - printf("PARSER_LOG:Parsed int %d\n", *out_i); - inp = endptr; - break; - - case 'I': - out_i = va_arg(ap, int *); - *out_i = strtol(inp, &endptr, 10); - - if (endptr == inp) { - printf("PARSER_LOG:Number empty\n"); - *out_i = 0; - } else { - printf("PARSER_LOG:Parsed int %d\n", *out_i); - inp = endptr; - } - - break; - - case 'l': - out_l = va_arg(ap, long int *); - *out_l = strtol(inp, &endptr, 10); - - if (endptr == inp) { - error = 0; - goto end; - } - - printf("PARSER_LOG:Parsed long int %ld\n", *out_l); - inp = endptr; - break; - - case 'r': - out_us = va_arg(ap, unsigned char *); - storage_size = va_arg(ap, size_t); - length = at_grab_string(inp, &buffer); - printf("PARSER_LOG:Parsed raw string \"%s\"\n", buffer); - - if (strlen(buffer) > storage_size) { - free(buffer); - error = 0; - goto end; - } - - strcpy(out_us, buffer); - free(buffer); - inp += length; - break; - - case '@': - if (*inp++ != '@') { - error = 0; - goto end; - } - - break; - - case '0': - /* Just skip the rest */ - goto end; - - default: - printf("PARSER_LOG:Invalid format string (@%c): %s\n", *(fmt - 1), format); - error = 0; - goto end; - } - - break; - - case ' ': - while (isspace(*inp)) inp++; - - break; - - default: - if (*inp++ != *(fmt - 1)) { - error = 0; - goto end; - } - - break; - } - } - - /* Ignore trailing spaces */ - while (isspace(*inp)) inp++; - - if (*inp != 0) { - printf("PARSER_LOG:String do not end same!\n"); - error = 0; - goto end; - } - -end: - va_end(ap); - return error; -} -//----------------------------------------------------------------------------- -void at_attach_or_detach(char *string,int position) -//----------------------------------------------------------------------------- -{ - // From 3GPP TS 27.007 V10.4.0 (2011-06): - //---------------------+-------------------------------------------- - // Command | Possible Response(s) - //---------------------+-------------------------------------------- - // +CGATT=[<state>] | OK - // | ERROR - //---------------------+-------------------------------------------- - // +CGATT? | +CGATT: <state> - //---------------------+-------------------------------------------- - // +CGATT=? | +CGATT: (list of supported <state>s) - //---------------------+-------------------------------------------- - // Description - // The execution command is used to attach the MT to, or detach the MT from, the Packet Domain service. After the - // command has completed, the MT remains in V.250 command state. If the MT is already in the requested state, the - // command is ignored and the OK response is returned. If the requested state cannot be achieved, an ERROR or - // +CME ERROR response is returned. Extended error responses are enabled by the +CMEE command. - // Any active PDP contexts will be automatically deactivated when the attachment state changes to detached. - // The read command returns the current Packet Domain service state. - // The test command is used for requesting information on the supported Packet Domain service states. - // NOTE: - // This command has the characteristics of both the V.250 action and parameter commands. Hence it has the - // read form in addition to the execution/set and test forms. - // - // Defined Values - // <state>: : a numeric parameter that indicates the state of PS attachment - // 0 detached - // 1 attached - // Other values are reserved and will result in an ERROR response to the execution command. - - - char *temp; - char *str="+CGATT: (0,1)\r\nOK\r\n"; - int Error = -1,attach_status = -1; - - if(string[position + 1] == '?') { - printf("AT PARSER sending: %s\n",str); - at_response(str,strlen(str)); - return; - } - - temp = string + position +1; - Error = at_parse_command(temp," @i",&attach_status); - - if(Error == 1) { - switch(attach_status) { - case 1: - printf("AT PARSER: Attach command received\n"); - - if (mt_attach_request() == 1) { - at_response("OK\r\n",strlen("OK\r\n")); - - } else { - at_response("ERROR\r\n",strlen("ERROR\r\n")); - - } - - break; - - case 0: - printf("AT PARSER: Detach command received\n"); - - if (mt_detach_request() == 1) { - at_response("OK\r\n",strlen("OK\r\n")); - - } else { - at_response("ERROR\r\n",strlen("ERROR\r\n")); - - } - - break; - - default: - printf("AT PARSER: Invalid value %d\n",attach_status); - memset(at_error_log,'\0',sizeof(at_error_log)); - sprintf(at_error_log,"Invalid value %d",attach_status); - at_response(at_error_log,strlen(at_error_log)); - break; - } - } else { - printf("AT PARSER: Parse failed\n"); - memset(at_error_log,'\0',sizeof(at_error_log)); - sprintf(at_error_log,"ERROR\r\n"); - at_response(at_error_log,strlen(at_error_log)); - } -} -//----------------------------------------------------------------------------- -void at_read_attach_status(char *string,int position) -//----------------------------------------------------------------------------- -{ - if (mt_attach_state_request() == 1) { - printf( "\n PARSER_LOG: UE is Attached\n"); - at_response("+CGATT: 1\r\nOK\r\n",strlen("+CGATT: 1\r\nOK\r\n")); - } else { - printf( "\n PARSER_LOG: UE is Detached\n"); - at_response("+CGATT: 0\r\nOK\r\n",strlen("+CGATT: 0\r\nOK\r\n")); - } -} -//----------------------------------------------------------------------------- -void at_set_pdcp_context(char *string,int position) -//----------------------------------------------------------------------------- -{ - -} -//----------------------------------------------------------------------------- -void at_activate_pdp_context(char *string,int position) -//----------------------------------------------------------------------------- -{ -} -//----------------------------------------------------------------------------- -void at_read_pdp_add(char *string,int position) -//----------------------------------------------------------------------------- -{ -} - -//----------------------------------------------------------------------------- -void at_read_pdp_context(char *string,int position) -//----------------------------------------------------------------------------- -{ -} -//----------------------------------------------------------------------------- -void at_read_act_status(char *string,int position) -//----------------------------------------------------------------------------- -{ -} -//----------------------------------------------------------------------------- -void at_show_eps_qos(char *string,int position) -//----------------------------------------------------------------------------- -{ -} -//----------------------------------------------------------------------------- -void at_set_tfad_context(char *string,int position) -//----------------------------------------------------------------------------- -{ -} -//----------------------------------------------------------------------------- -void at_read_tfad_context(char *string,int position) -//----------------------------------------------------------------------------- -{ -} -//----------------------------------------------------------------------------- -void at_mod_bearer_req(char *string,int position) -//----------------------------------------------------------------------------- -{ -} -//----------------------------------------------------------------------------- -void at_read_dedicated_bearer_cid(char *string,int position) -//----------------------------------------------------------------------------- -{ -} -//----------------------------------------------------------------------------- -int at_convert_hex_to_dec(char *temp,int size) -//----------------------------------------------------------------------------- -{ - int res = 0,i =0,hex_value = 0,Power = 1,j; - - for(i = 0; i < size; i++) { - switch(temp[size - i - 1]) { - case 'A': - case 'a': - hex_value = 10; - break; - - case 'B': - case 'b': - hex_value = 11; - break; - - case 'C': - case 'c': - hex_value = 12; - break; - - case 'D': - case 'd': - hex_value = 13; - break; - - case 'E': - case 'e': - hex_value = 14; - break; - - case 'F': - case 'f': - hex_value = 15; - break; - - default: - hex_value = temp[size - i - 1] - '0'; - } - - for(j = 1,Power = 1; j <= i ; j++) - Power = Power * 16; - - res = res + (hex_value * Power); - } - - return res; -} -//----------------------------------------------------------------------------- -void at_parse_string(char * at_strP) -//----------------------------------------------------------------------------- -{ - char *buffer = NULL; - char format[4] = "=?\n"; - char * ptr; - int i=0,pos = -1,flag = 0; - - // was /r - if((buffer = strchr(at_strP,'\r'))!=NULL) { - memset(at_command, 0, AT_CMD_BUFFSIZE); - memcpy(at_command, at_strP, buffer-at_strP); - //*(buffer + 1) = '\0'; - printf("AT PARSER:received = %s\n",at_command); - } else { - printf("PARSER_LOG:invalid command : Enter Again\n"); - memset(at_error_log,'\0',sizeof(at_error_log)); - sprintf(at_error_log,"invalid command : Enter Again"); - at_response(at_error_log,strlen(at_error_log)); - return; - } - - buffer = at_command; - ptr = strpbrk(buffer,format); - pos = ptr - buffer; - - while(strcmp(g_at_response_mapping[i].command,"null")!=0) { - if(strncmp(buffer,g_at_response_mapping[i].command,pos+1)== 0) { - flag=1; - break; - } - - i++; - } - - if(flag == 0 ) { - printf("PARSER_LOG:unknown command \n"); - memset(at_error_log,'\0',sizeof(at_error_log)); - sprintf(at_error_log,"unknown command"); - printf("IFM<-UeMgr [ label = \"Unknown AT CMD\" ] ;"); - at_response(at_error_log,strlen(at_error_log)); - return; - } else { - g_at_response_mapping[i].ResponseFunction(at_command,pos); - } -} -//----------------------------------------------------------------------------- -void at_parse_init(void (*at_response_handler)(char*, int), - int (*mt_attach_state_request_handler)(void), - int (*mt_attach_request_handler)(void), - int (*mt_detach_request_handler)(void)) -//----------------------------------------------------------------------------- -{ - at_response = at_response_handler; - mt_attach_state_request = mt_attach_state_request_handler; - mt_attach_request = mt_attach_request_handler; - mt_detach_request = mt_detach_request_handler; -} -//----------------------------------------------------------------------------- -void at_null_callback_handler(char* string, int size) -//----------------------------------------------------------------------------- -{ - char at_response[AT_CMD_BUFFSIZE]; - - assert(size > 0); - assert(size < AT_CMD_BUFFSIZE); - strncpy(at_response, string, size); - at_response[size] = 0; - printf("AT DEFAULT CALLBACK HANDLER RECEIVED RESPONSE: %s\n", at_response); -} -//----------------------------------------------------------------------------- -int mt_null_attach_state_request_handler(void) -//----------------------------------------------------------------------------- -{ - int n; - n=rand() %2; /* n is random number in range of 0 - 1 */ - return(n); -} -//----------------------------------------------------------------------------- -int mt_null_attach_request_handler(void) -//----------------------------------------------------------------------------- -{ - int n; - n=rand() %2; /* n is random number in range of 0 - 1 */ - return(n); -} -//----------------------------------------------------------------------------- -int mt_null_detach_request_handler(void) -//----------------------------------------------------------------------------- -{ - int n; - n=rand() %2; /* n is random number in range of 0 - 1 */ - return(n); -} diff --git a/openair2/UTIL/AT_COMMANDS/parser.h b/openair2/UTIL/AT_COMMANDS/parser.h deleted file mode 100644 index 634b698ebfd..00000000000 --- a/openair2/UTIL/AT_COMMANDS/parser.h +++ /dev/null @@ -1,220 +0,0 @@ -/***************************************************************** - * - * File Name : parser.h - * Author: Sharad Gupta - * Decription: contains declarations for parser functions - * - * Copyright 2009, Hughes Systique India Private Limited - * - ***************************************************************/ -#ifndef _PARSER_H -# define _PARSER_H -# ifdef PARSER_C -# define private_at_commands(x) x -# define protected_at_commands(x) x -# define public_at_commands(x) x -# else -# define private_at_commands(x) -# define protected_at_commands(x) -# define public_at_commands(x) extern x -# endif -# include <sys/types.h> -# include <sys/socket.h> -# include <netinet/in.h> -# include <netdb.h> -# include <stdio.h> -# include <arpa/inet.h> -# include <stdlib.h> -# include <string.h> -# include <stdarg.h> -# include <math.h> - -#include "platform_types.h" -#include "log.h" - - -#define AT_CMD_BUFFSIZE 512 -//---------------------------------------------------------------------------- -typedef struct { - char *command; - void (*ResponseFunction) (char *,int); -} at_command_t; - - -//---------------------------------------------------------------------------- -protected_at_commands(char at_error_log[AT_CMD_BUFFSIZE];) -protected_at_commands(char at_command[AT_CMD_BUFFSIZE];) -//---------------------------------------------------------------------------- -/** -\fn void (*at_response)(char*, int) -Procedure callback for response to AT command. -@param string Response. -@param size Size of response in bytes. -**/ -public_at_commands(void (*at_response)(char* string, int size);) -/** -\fn int (*mt_attach_state_request)(void) -Procedure for requesting the status of the attachment of MT. -@return attach state of MT (1 for attached, 0 for detached). -**/ -public_at_commands(int (*mt_attach_state_request)(void);) -/** -\fn int (*mt_attach_request)(void) -Procedure for requesting the attach of MT. -@return Result of attach (1 for OK, 0 for ERROR). -**/ -public_at_commands(int (*mt_attach_request)(void);) -/** -\fn int (*mt_detach_request)(void) -Procedure for requesting the detach of MT. -@return Result of detach (1 for OK, 0 for ERROR). -**/ -public_at_commands(int (*mt_detach_request)(void);) -/** -\fn size_t at_grab_string(const unsigned char *input, unsigned char **output) - Grabs single string parameter from AT command reply. Removing possible quotes. -@param input Input string to parse. -@param output Pointer to pointer to char, buffer will be allocated. -@return Length of parsed string. -**/ -private_at_commands(size_t at_grab_string(const unsigned char *input, unsigned char **output);) -/** -\fn int at_parse_command(const unsigned char *input, const char *format, ...) -This function actually parses the string on the basis of format string provided. -@param input String to be parsed. -@param format This is the format string which contains format of input string. -@return success (1), or failure (0). -**/ -private_at_commands(int at_parse_command(const unsigned char *input, const char *format, ...);) -/** -\fn void at_attach_or_detach(char *string,int position) -This function attaches or detaches the UE based on the string. -@param string string containing the AT command received. -@param position Position of the string from where the parsing is to be started. -**/ -private_at_commands(void at_attach_or_detach(char *string,int position);) -/** -\fn void at_read_attach_status(char *string,int position) -This function checks whether the UE is attached or detached. -@param string string containing the AT command received. -@param position Position of the string from where the parsing is to be started. -**/ -private_at_commands(void at_read_attach_status(char *string,int position);) -/** -\fn void at_set_pdcp_context(char *string,int position) -This function stores the PDP context of a UE at a particular CID. -@param string string containing the AT command received. -@param position Position of the string from where the parsing is to be started. -**/ -private_at_commands(void at_set_pdcp_context(char *string,int position);) -/** -\fn void at_activate_pdp_context(char *string,int position) -This function activates a particular PDN connection on the basis of CID in the AT command. -@param string string containing the AT command received. -@param position Position of the string from where the parsing is to be started. -**/ -private_at_commands(void at_activate_pdp_context(char *string,int position);) -/** -\fn void at_read_pdp_add(char *string,int position) -This function reads the PDP address on the basis of CID in the AT command. -@param string string containing the AT command received. -@param position Position of the string from where the parsing is to be started. -**/ -private_at_commands(void at_read_pdp_add(char *string,int position);) -/** -\fn void at_read_pdp_context(char *string,int position) -This function reads the PDP context defined by the at_set_pdcp_context function. -@param string string containing the AT command received. -@param position Position of the string from where the parsing is to be started. -**/ -private_at_commands(void at_read_pdp_context(char *string,int position);) -/** -\fn void at_read_act_status(char *string,int position) -This function reads the activation status of a PDP context defined by the at_set_pdcp_context function. -@param string string containing the AT command received. -@param position Position of the string from where the parsing is to be started. -**/ -private_at_commands(void at_read_act_status(char *string,int position);) -/** -\fn void at_show_eps_qos(char *string,int position) -This function reads the QOS parameters on the basis of CID. -@param string string containing the AT command received. -@param position Position of the string from where the parsing is to be started. -**/ -private_at_commands(void at_show_eps_qos(char *string,int position);) -/** -\fn void at_set_tfad_context(char *string,int position) -This function sets the TFAD context for the UE. -@param string string containing the AT command received. -@param position Position of the string from where the parsing is to be started. -**/ -private_at_commands(void at_set_tfad_context(char *string,int position);) -/** -\fn void at_read_tfad_context(char *string,int position) -This function Read the TFAD context for the UE. -@param string string containing the AT command received. -@param position Position of the string from where the parsing is to be started. -**/ -private_at_commands(void at_read_tfad_context(char *string,int position);) -/** -\fn void at_mod_bearer_req(char *string,int position) -This function sends the Modify bearer request to RRC. -@param string string containing the AT command received. -@param position Position of the string from where the parsing is to be started. -**/ -private_at_commands(void at_mod_bearer_req(char *string,int position);) -/** -\fn void at_read_dedicated_bearer_cid(char *string,int position) -This function reads the dedicated bearer CIDs associated with the default bearer CID. -@param string string containing the AT command received. -@param position Position of the string from where the parsing is to be started. -**/ -private_at_commands(void at_read_dedicated_bearer_cid(char *string,int position);) -/** -\fn int at_convert_hex_to_dec(char *temp,int size) -This function converts the Hex string to decimal. -@param temp Hexadecimal string. -@param size bytes of the string to be converted. -@return Converted decimal value as an integer. -**/ -private_at_commands(int at_convert_hex_to_dec(char *temp,int size);) -/** -\fn void at_parse_string(char * str) -This function calls the appropriate parser function for parsing the command. -@param str AT command to be parsed. -**/ -public_at_commands(void at_parse_string(char * str);) -/** -\fn void at_parse_init(void (*at_response_handler)(char*, int)) -This function register the handler, handling responses from AT commands parser. -@param at_response_handler handler procedure. -**/ -public_at_commands(void at_parse_init(void (*at_response_handler)(char*, int), int (*mt_attach_state_request_handler)(void), int (*mt_attach_request_handler)(void), - int (*mt_detach_request_handler)(void));) -/** -\fn void at_null_callback_handler(char* string, int size) -This function register the handler, handling responses from AT commands parser. -@param string message sent back from the AT commands parser to the caller. -@param size Size in bytes of the message. -**/ -public_at_commands(void at_null_callback_handler(char* string, int size);) -/** -\fn int mt_null_attach_state_request_handler(void) -This function is a dummy MT handler for requesting the status of aatachment of the MT. -@return Random/simulated attach state of MT (1 for attached, 0 for detached). -**/ -public_at_commands(int mt_null_attach_state_request_handler(void);) -/** -\fn int mt_null_attach_request_handler(void) -This function is a dummy MT handler for requesting the attach of the MT. -@return Random/simulated attach state of MT (1 for OK, 0 for ERROR). -**/ -public_at_commands(int mt_null_attach_request_handler(void);) -/** -\fn int mt_null_detach_request_handler(void) -This function is a dummy MT handler for requesting the detach of the MT. -@return Random/simulated detach state of MT (1 for OK, 0 for ERROR). -**/ -public_at_commands(int mt_null_detach_request_handler(void);) - -#endif diff --git a/openair2/UTIL/OCG/Readme.doxy b/openair2/UTIL/OCG/Readme.doxy deleted file mode 100644 index e14086e4a0e..00000000000 --- a/openair2/UTIL/OCG/Readme.doxy +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.0 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file Readme.doxy -* \brief explain how this block is organized, and how it works -* \author Lusheng Wang -* \date 2011 -* \version 0.1 -* \note This cde is under GNU GENERAL PUBLIC LICENSE, version 2, June 1991 -* \warning -*/ - -/*! \page _readme Readme - -The content of this readme is the following: - - -# What is this block about in OpenAirInterface - -# Organization of the folders and their dependancies - -# Folders and files description - -# Makefile targets and how to build - -# How to use OCG: run a simple experimentation - - -\section _block What is this block about in OpenAirInterface ? - - This block is called OpenAirInterface Configuration Generation (OCG). Its major function is to parse the XML configuration file and configure an emulation. - - When the user specifies a scenario for emulation from the web portal, the web portal will generate an XML configuration file in the scenario folder of OCG. OCG automatically detects this file and initiates an emulation for it. During the emulation, OCG calls other blocks (such as MobiGen and TrafficGen) and gets feedbacks from them. After the emulation, OCG generates output files in the created folder of the emulation. - - OCG contains the following key modules: - - a) get opt : Get options of the OCG command, e.g. "OCG -f" and "OCG -h" - - b) detect file : Detect new XML configuration file in the scenario folder - - c) parse filename : Parse the filename to get user name and file date - - d) create dir : Create directory in the output directory for an emulation - - e) parse XML : Parse the XML configuration file - - f) save XML : Save the XML configuration file in created directory - - g) call emu : Call the emulator - - h) generate report : Generate a report to show the states of OCG modules - - - \image html fsm_flow_chart.png "Finit State Machine of OCG" width=2cm - - -\section _organization Organization of the folders and their dependancies - -<table border="1" cellpadding="5" cellspacing="5" width="100%"> -<tr><th>Folder</th> <th> Description </th> </tr> -<tr><td width="20%">src/</td><td>contains source files</td></tr> -<tr><td width="20%">include/</td><td>contains header files</td></tr> -<tr><td width="20%">demo/</td><td>contains XML configuration files for demo</td></tr> -<tr><td width="20%">detecting_XML/</td><td>contains nothing, but OCG will detect here the XML files generated by the web portal</td></tr> -<tr><td width="20%">output_folder/</td><td>if filename of the XML file can be successfully parsed, OCG creates output folders for users and generates output files for emulations here</td></tr> -<tr><td width="20%">temp_output_folder/</td><td>if filename of the XML file cannot be successfully parsed, OCG generates an output file here</td></tr> -</table> - - -\section _folders Folders and files description - -<table border="1" cellpadding="5" cellspacing="5" width="100%"> -<tr><th>Folder/File</th> <th> Description </th> </tr> -<tr><td width="20%">src/OCG.c</td><td>contains the main() function with the FSM of OCG</td></tr> -<tr><td width="20%">src/OCG_get_opt.c</td><td>contains the get_opt() function</td></tr> -<tr><td width="20%">src/OCG_detect_file.c</td><td>contains the detect_file() function</td></tr> -<tr><td width="20%">src/OCG_parse_filename.c</td><td>contains the parse_filename() function</td></tr> -<tr><td width="20%">src/OCG_create_dir.c</td><td>contains the create_dir() function</td></tr> -<tr><td width="20%">src/OCG_parse_XML.c</td><td>contains the parse_XML() function</td></tr> -<tr><td width="20%">src/OCG_save_XML.c</td><td>contains the save_XML() function</td></tr> -<tr><td width="20%">src/OCG_call_emu.c</td><td>contains the call_emu() function</td></tr> -<tr><td width="20%">src/OCG_generate_report.c</td><td>contains the generate_report() function</td></tr> -<tr><td width="20%">include/OCG.h</td><td>header file of main(), contains the data structure of the basic OpenAirInterface Scenario Descriptor (OSD), etc.</td></tr> -<tr><td width="20%">include/OCG_get_opt.h</td><td>header file of get_opt()</td></tr> -<tr><td width="20%">include/OCG_detect_file.h</td><td>header file of detect_file()</td></tr> -<tr><td width="20%">include/OCG_parse_filename.h</td><td>header file of parse_filename()</td></tr> -<tr><td width="20%">include/OCG_create_dir.h</td><td>header file of create_dir()</td></tr> -<tr><td width="20%">include/OCG_parse_XML.h</td><td>header file of parse_XML(), contains the declaration of parsing position indicators</td></tr> -<tr><td width="20%">include/OCG_save_XML.h</td><td>header file of save_XML()</td></tr> -<tr><td width="20%">include/OCG_call_emu.h</td><td>header file of call_emu()</td></tr> -<tr><td width="20%">include/OCG_generate_report.h</td><td>header file of generate_report()</td></tr> -<tr><td width="20%">demo/eurecom.20110208110244.xml</td><td>contains a demo</td></tr> -</table> - - -\section _makefile Makefile targets and how to build - - - CC= gcc - CFLAGS = -I/usr/include/libxml2 - LIB = -lxml2 - - OCG: - ${CC} ${CFLAGS} ${LIB} src/OCG.c src/OCG_get_opt.c src/OCG_detect_file.c src/OCG_parse_filename.c src/OCG_create_dir.c src/OCG_parse_XML.c src/OCG_save_XML.c src/OCG_call_emu.c src/OCG_generate_OCG_report.c -o OCG - - -\section _howto How to use OCG: run a simple experimentation - - There are two methods to use the OCG for an emulation: - - a) DEMO mode : use command "OCG -f filename" to run a DEMO mode emulation - - The following steps are required for a DEMO mode emulation: - - i) Put your XML configuration file into the demo/ folder; - - ii) Change the filename as user_name.file_date.xml; - - iii) Run the emulation with the above command; - - iv) Check debug information in the shell, which indicates you the directory where OCG generates the outputs. - - To run an existing demo XML file, step i) and ii) are not required. - - Note that OCG automatically set the path of a demo XML file as demo/, so only filename is required in the command. - - b) USER mode : use command "OCG" to start OCG as a daemon - - The following steps are required for a USER mode emulation: - - i) Run OCG as a daemon with the above command; - - iiA) Configure an emulation scenario through the web portal and press the button to generate an XML file; or - - iiB) Copy your XML file to the detecting_XML/ folder directly; - - iii) Check debug information in the shell, which indicates you the directory where OCG generates the outputs. - - For option iiB), make sure the filename is with the correct format "user_name.file_date.xml". Moreover, make sure the configuration in the XML file is correct. - - For the format of the XML configuration file, refer to "demo/eurecom.20110208110244.xml". - -*/ - diff --git a/openair2/UTIL/OMG/TraCIConstants.h b/openair2/UTIL/OMG/TraCIConstants.h index 8968c2a2836..6a123bb5d50 100644 --- a/openair2/UTIL/OMG/TraCIConstants.h +++ b/openair2/UTIL/OMG/TraCIConstants.h @@ -1,715 +1,52 @@ -/****************************************************************************/ -/// @file TraCIConstants.h -/// @author Axel Wegener <wegener@itm.uni-luebeck.de> -/// @date 2007/10/24 -/// @version $Id: TraCIConstants.h 9525 2011-01-04 21:22:52Z behrisch $ -/// -/// holds codes used for TraCI -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ -// Copyright (C) 2001-2011 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ - #ifndef TRACICONSTANTS_H #define TRACICONSTANTS_H +// command: subscribe simulation variable +#define CMD_SUBSCRIBE_SIM_VARIABLE 0xdb -// **************************************** -// COMMANDS -// **************************************** -// command: get version -#define CMD_GETVERSION 0x00 - -// command: simulation step -#define CMD_SIMSTEP 0x01 +// departed vehicle ids (get: simulation) +#define VAR_DEPARTED_VEHICLES_IDS 0x74 // command: simulation step (new version) #define CMD_SIMSTEP2 0x02 -// command: set maximum speed -#define CMD_SETMAXSPEED 0x11 - -// command: stop node -#define CMD_STOP 0x12 - -// command: set lane -#define CMD_CHANGELANE 0x13 - -// command: slow down -#define CMD_SLOWDOWN 0x14 - -// command: change route -#define CMD_CHANGEROUTE 0x30 - -// command: change target -#define CMD_CHANGETARGET 0x31 - -// command: subscribe lifecycles -#define CMD_SUBSCRIBELIFECYCLES 0x61 - -// command: unsubscribe lifecycles -#define CMD_UNSUBSCRIBELIFECYCLES 0x62 - -// command: object creation -#define CMD_OBJECTCREATION 0x63 - -// command: object destruction -#define CMD_OBJECTDESTRUCTION 0x64 - -// command: object domain subscription -#define CMD_SUBSCRIBEDOMAIN 0x65 - -// command: object domain unsubscription -#define CMD_UNSUBSCRIBEDOMAIN 0x66 - -// command: object update -#define CMD_UPDATEOBJECT 0x67 - -// command: Simulation Parameter -#define CMD_SIMPARAMETER 0x70 - -// command: Position Conversion -#define CMD_POSITIONCONVERSION 0x71 - -// command: Distance Request -#define CMD_DISTANCEREQUEST 0x72 - -// command: Scenario -#define CMD_SCENARIO 0x73 - -// command: add vehicle -#define CMD_ADDVEHICLE 0x74 - -// command: move node -#define CMD_MOVENODE 0x80 - // command: close sumo #define CMD_CLOSE 0x7F -// command: -#define CMD_UPDATECALIBRATOR 0x50 - -// command: get all traffic light ids -#define CMD_GETALLTLIDS 0x40 - -// command: get traffic light status -#define CMD_GETTLSTATUS 0x41 - -// command: report traffic light id -#define CMD_TLIDLIST 0x90 - -// command: report traffic light status switch -#define CMD_TLSWITCH 0x91 - -// command: get induction loop (e1) variable -#define CMD_GET_INDUCTIONLOOP_VARIABLE 0xa0 -// response: get induction loop (e1) variable -#define RESPONSE_GET_INDUCTIONLOOP_VARIABLE 0xb0 -// command: subscribe induction loop (e1) variable -#define CMD_SUBSCRIBE_INDUCTIONLOOP_VARIABLE 0xd0 -// response: subscribe induction loop (e1) variable -#define RESPONSE_SUBSCRIBE_INDUCTIONLOOP_VARIABLE 0xe0 - -// command: get multi-entry/multi-exit detector (e3) variable -#define CMD_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE 0xa1 -// response: get areal detector (e3) variable -#define RESPONSE_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE 0xb1 -// command: subscribe multi-entry/multi-exit detector (e3) variable -#define CMD_SUBSCRIBE_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE 0xd1 -// response: subscribe areal detector (e3) variable -#define RESPONSE_SUBSCRIBE_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE 0xe1 - -// command: get traffic lights variable -#define CMD_GET_TL_VARIABLE 0xa2 -// response: get traffic lights variable -#define RESPONSE_GET_TL_VARIABLE 0xb2 -// command: set traffic lights variable -#define CMD_SET_TL_VARIABLE 0xc2 -// command: subscribe traffic lights variable -#define CMD_SUBSCRIBE_TL_VARIABLE 0xd2 -// response: subscribe traffic lights variable -#define RESPONSE_SUBSCRIBE_TL_VARIABLE 0xe2 - -// command: get lane variable -#define CMD_GET_LANE_VARIABLE 0xa3 -// response: get lane variable -#define RESPONSE_GET_LANE_VARIABLE 0xb3 -// command: set lane variable -#define CMD_SET_LANE_VARIABLE 0xc3 -// command: subscribe lane variable -#define CMD_SUBSCRIBE_LANE_VARIABLE 0xd3 -// response: subscribe lane variable -#define RESPONSE_SUBSCRIBE_LANE_VARIABLE 0xe3 - // command: get vehicle variable #define CMD_GET_VEHICLE_VARIABLE 0xa4 -// response: get vehicle variable -#define RESPONSE_GET_VEHICLE_VARIABLE 0xb4 -// command: set vehicle variable -#define CMD_SET_VEHICLE_VARIABLE 0xc4 -// command: subscribe vehicle variable -#define CMD_SUBSCRIBE_VEHICLE_VARIABLE 0xd4 -// response: subscribe vehicle variable -#define RESPONSE_SUBSCRIBE_VEHICLE_VARIABLE 0xe4 - -// command: get vehicle type variable -#define CMD_GET_VEHICLETYPE_VARIABLE 0xa5 -// response: get vehicle type variable -#define RESPONSE_GET_VEHICLETYPE_VARIABLE 0xb5 -// command: set vehicle type variable -#define CMD_SET_VEHICLETYPE_VARIABLE 0xc5 -// command: subscribe vehicle type variable -#define CMD_SUBSCRIBE_VEHICLETYPE_VARIABLE 0xd5 -// response: subscribe vehicle type variable -#define RESPONSE_SUBSCRIBE_VEHICLETYPE_VARIABLE 0xe5 - -// command: get route variable -#define CMD_GET_ROUTE_VARIABLE 0xa6 -// response: get route variable -#define RESPONSE_GET_ROUTE_VARIABLE 0xb6 -// command: set route variable -#define CMD_SET_ROUTE_VARIABLE 0xc6 -// command: subscribe route variable -#define CMD_SUBSCRIBE_ROUTE_VARIABLE 0xd6 -// response: subscribe route variable -#define RESPONSE_SUBSCRIBE_ROUTE_VARIABLE 0xe6 - -// command: get poi variable -#define CMD_GET_POI_VARIABLE 0xa7 -// response: get poi variable -#define RESPONSE_GET_POI_VARIABLE 0xb7 -// command: set poi variable -#define CMD_SET_POI_VARIABLE 0xc7 -// command: subscribe poi variable -#define CMD_SUBSCRIBE_POI_VARIABLE 0xd7 -// response: subscribe poi variable -#define RESPONSE_SUBSCRIBE_POI_VARIABLE 0xe7 - -// command: get polygon variable -#define CMD_GET_POLYGON_VARIABLE 0xa8 -// response: get polygon variable -#define RESPONSE_GET_POLYGON_VARIABLE 0xb8 -// command: set polygon variable -#define CMD_SET_POLYGON_VARIABLE 0xc8 -// command: subscribe polygon variable -#define CMD_SUBSCRIBE_POLYGON_VARIABLE 0xd8 -// response: subscribe polygon variable -#define RESPONSE_SUBSCRIBE_POLYGON_VARIABLE 0xe8 - -// command: get junction variable -#define CMD_GET_JUNCTION_VARIABLE 0xa9 -// response: get junction variable -#define RESPONSE_GET_JUNCTION_VARIABLE 0xb9 -// command: set junction variable -#define CMD_SET_JUNCTION_VARIABLE 0xc9 -// command: subscribe junction variable -#define CMD_SUBSCRIBE_JUNCTION_VARIABLE 0xd9 -// response: subscribe junction variable -#define RESPONSE_SUBSCRIBE_JUNCTION_VARIABLE 0xe9 - -// command: get edge variable -#define CMD_GET_EDGE_VARIABLE 0xaa -// response: get edge variable -#define RESPONSE_GET_EDGE_VARIABLE 0xba -// command: set edge variable -#define CMD_SET_EDGE_VARIABLE 0xca -// command: subscribe edge variable -#define CMD_SUBSCRIBE_EDGE_VARIABLE 0xda -// response: subscribe edge variable -#define RESPONSE_SUBSCRIBE_EDGE_VARIABLE 0xea - -// command: get simulation variable -#define CMD_GET_SIM_VARIABLE 0xab -// response: get simulation variable -#define RESPONSE_GET_SIM_VARIABLE 0xbb -// command: set simulation variable -#define CMD_SET_SIM_VARIABLE 0xcb -// command: subscribe simulation variable -#define CMD_SUBSCRIBE_SIM_VARIABLE 0xdb -// response: subscribe simulation variable -#define RESPONSE_SUBSCRIBE_SIM_VARIABLE 0xeb - -// command: get GUI variable -#define CMD_GET_GUI_VARIABLE 0xac -// response: get GUI variable -#define RESPONSE_GET_GUI_VARIABLE 0xbc -// command: set GUI variable -#define CMD_SET_GUI_VARIABLE 0xcc -// command: subscribe GUI variable -#define CMD_SUBSCRIBE_GUI_VARIABLE 0xdc -// response: subscribe GUI variable -#define RESPONSE_SUBSCRIBE_GUI_VARIABLE 0xec - - - -// **************************************** -// POSITION REPRESENTATIONS -// **************************************** -// Omit position -#define POSITION_NONE 0x00 -// 2D cartesian coordinates -#define POSITION_2D 0x01 -// 2.5D cartesian coordinates -#define POSITION_2_5D 0x02 -// 3D cartesian coordinates -#define POSITION_3D 0x03 -// Position on road map -#define POSITION_ROADMAP 0x04 +// command: Scenario +#define CMD_SCENARIO 0x73 +// max count of vehicles +#define DOMVAR_MAXCOUNT 0x0A -// **************************************** -// DATA TYPES -// **************************************** -// Boundary Box -#define TYPE_BOUNDINGBOX 0x05 -// Polygon -#define TYPE_POLYGON 0x06 -// unsigned byte -#define TYPE_UBYTE 0x07 -// signed byte -#define TYPE_BYTE 0x08 // 32 bit integer #define TYPE_INTEGER 0x09 -// float -#define TYPE_FLOAT 0x0A -// double -#define TYPE_DOUBLE 0x0B -// 8 bit ASCII string -#define TYPE_STRING 0x0C -// list of traffic light phases -#define TYPE_TLPHASELIST 0x0D -// list of strings -#define TYPE_STRINGLIST 0x0E -// compound object -#define TYPE_COMPOUND 0x0F -// color (four ubytes) -#define TYPE_COLOR 0x11 - - - -// **************************************** -// RESULT TYPES -// **************************************** -// result type: Ok -#define RTYPE_OK 0x00 -// result type: not implemented -#define RTYPE_NOTIMPLEMENTED 0x01 -// result type: error -#define RTYPE_ERR 0xFF - - -// **************************************** -// DOMAIN IDs (FOR SCENARIO COMMAND) -// **************************************** -// road map domain -#define DOM_ROADMAP 0x00 -// vehicle domain -#define DOM_VEHICLE 0x01 -// traffic lights domain -#define DOM_TRAFFICLIGHTS 0x02 -// points of interest domain -#define DOM_POI 0x03 -// polygon domain -#define DOM_POLYGON 0x04 - - - -// **************************************** -// VARIABLE IDs (FOR SCENARIO COMMAND) -// **************************************** -// count of domain objects -#define DOMVAR_COUNT 0x01 -// position of a domain object -#define DOMVAR_POSITION 0x02 -// boundaries of simulation net -#define DOMVAR_BOUNDINGBOX 0x03 // speed of a node #define DOMVAR_SPEED 0x04 -// actual phase of a traffic light -#define DOMVAR_CURTLPHASE 0x05 -// next phase of a traffic light -#define DOMVAR_NEXTTLPHASE 0x06 -// type of a domain object (poi, polygon) -#define DOMVAR_TYPE 0x07 -// layer a domain object is located at (poi, polygon) -#define DOMVAR_LAYER 0x08 -// shape of a polygon -#define DOMVAR_SHAPE 0x09 -// max count of vehicles -#define DOMVAR_MAXCOUNT 0x0A -// count of TraCI vehicles -#define DOMVAR_EQUIPPEDCOUNT 0x0B -// max count of TraCI vehicles -#define DOMVAR_EQUIPPEDCOUNTMAX 0x0C -// id string of a domain object -#define DOMVAR_NAME 0x0D -// route, a car plans to drive -#define DOMVAR_ROUTE 0x0E -// maximum allowed speed of a node -#define DOMVAR_ALLOWED_SPEED 0x0F -// air distance from a certain object to a position -#define DOMVAR_AIRDISTANCE 0x10 -// driving distance from a certain object to a position -#define DOMVAR_DRIVINGDISTANCE 0x11 -// external integer id of a certain object -#define DOMVAR_EXTID 0x12 -// angle of a certain object, in degrees [0..360) -#define DOMVAR_ANGLE 0x13 -// current simulation time -#define DOMVAR_SIMTIME 0x14 -// current CO2 emission of a node -#define DOMVAR_CO2EMISSION 0x20 -// current CO emission of a node -#define DOMVAR_COEMISSION 0x21 -// current HC emission of a node -#define DOMVAR_HCEMISSION 0x22 -// current PMx emission of a node -#define DOMVAR_PMXEMISSION 0x23 -// current NOx emission of a node -#define DOMVAR_NOXEMISSION 0x24 -// current fuel consumption of a node -#define DOMVAR_FUELCONSUMPTION 0x25 -// current noise emission of a node -#define DOMVAR_NOISEEMISSION 0x26 - - - -// **************************************** -// TRAFFIC LIGHT PHASES -// **************************************** -// red phase -#define TLPHASE_RED 0x01 -// yellow phase -#define TLPHASE_YELLOW 0x02 -// green phase -#define TLPHASE_GREEN 0x03 -// tl is blinking -#define TLPHASE_BLINKING 0x04 -// tl is off and not blinking -#define TLPHASE_NOSIGNAL 0x05 - - - -// **************************************** -// DIFFERENT DISTANCE REQUESTS -// **************************************** -// air distance -#define REQUEST_AIRDIST 0x00 -// driving distance -#define REQUEST_DRIVINGDIST 0x01 - - - -// **************************************** -// VARIABLE TYPES (for CMD_GET_*_VARIABLE) -// **************************************** -// list of instances' ids (get: induction loops, areal detector, traffic lights) -#define ID_LIST 0x00 - -// last step vehicle number (get: induction loops, multi-entry/multi-exit detector, lanes, edges) -#define LAST_STEP_VEHICLE_NUMBER 0x10 - -// last step vehicle number (get: induction loops, multi-entry/multi-exit detector, lanes, edges) -#define LAST_STEP_MEAN_SPEED 0x11 - -// last step vehicle number (get: induction loops, multi-entry/multi-exit detector, lanes, edges) -#define LAST_STEP_VEHICLE_ID_LIST 0x12 - -// last step occupancy (get: induction loops, lanes, edges) -#define LAST_STEP_OCCUPANCY 0x13 - -// last step vehicle halting number (get: multi-entry/multi-exit detector, lanes, edges) -#define LAST_STEP_VEHICLE_HALTING_NUMBER 0x14 - -// last step mean vehicle length (get: induction loops, lanes, edges) -#define LAST_STEP_LENGTH 0x15 - -// last step time since last detection (get: induction loops) -#define LAST_STEP_TIME_SINCE_DETECTION 0x16 - - -// traffic light states, encoded as rRgGyYoO tuple (get: traffic lights) -#define TL_RED_YELLOW_GREEN_STATE 0x20 - -// traffic light states, encoded phase, brake, and yellow tuple (get: traffic lights, set: traffic lights) -#define TL_PHASE_BRAKE_YELLOW_STATE 0x21 - -// index of the phase (set: traffic lights) -#define TL_PHASE_INDEX 0x22 - -// traffic light program (set: traffic lights) -#define TL_PROGRAM 0x23 - -// phase duration (set: traffic lights) -#define TL_PHASE_DURATION 0x24 -// complete definition (get: traffic lights) -#define TL_COMPLETE_DEFINITION_PBY 0x25 - -// controlled lanes (get: traffic lights) -#define TL_CONTROLLED_LANES 0x26 - -// controlled links (get: traffic lights) -#define TL_CONTROLLED_LINKS 0x27 - -// index of the current phase (get: traffic lights) -#define TL_CURRENT_PHASE 0x28 - -// name of the current program (get: traffic lights) -#define TL_CURRENT_PROGRAM 0x29 - -// controlled junctions (get: traffic lights) -#define TL_CONTROLLED_JUNCTIONS 0x2a - -// complete definition (get: traffic lights) -#define TL_COMPLETE_DEFINITION_RYG 0x2b - -// complete program (set: traffic lights) -#define TL_COMPLETE_PROGRAM_RYG 0x2c - -// assumed time to next switch (get: traffic lights) -#define TL_NEXT_SWITCH 0x2d - - - -// outgoing link number (get: lanes) -#define LANE_LINK_NUMBER 0x30 - -// id of parent edge (get: lanes) -#define LANE_EDGE_ID 0x31 - -// outgoing link definitions (get: lanes) -#define LANE_LINKS 0x33 - -// list of allowed vehicle classes (get&set: lanes) -#define LANE_ALLOWED 0x34 - -// list of not allowed vehicle classes (get&set: lanes) -#define LANE_DISALLOWED 0x35 - - -// speed (get: vehicle) -#define VAR_SPEED 0x40 - -// maximum allowed/possible speed (get: vehicle types, lanes, set: edges, lanes) -#define VAR_MAXSPEED 0x41 +// position of a domain object +#define DOMVAR_POSITION 0x02 // position (2D) (get: vehicle, poi, set: poi) #define VAR_POSITION 0x42 -// angle (get: vehicle) -#define VAR_ANGLE 0x43 - -// angle (get: vehicle types, lanes, set: lanes) -#define VAR_LENGTH 0x44 - -// color (get: vehicles, vehicle types, polygons, pois) -#define VAR_COLOR 0x45 - -// max. acceleration (get: vehicle types) -#define VAR_ACCEL 0x46 - -// max. deceleration (get: vehicle types) -#define VAR_DECEL 0x47 - -// driver reaction time (get: vehicle types) -#define VAR_TAU 0x48 - -// vehicle class (get: vehicle types) -#define VAR_VEHICLECLASS 0x49 - -// emission class (get: vehicle types) -#define VAR_EMISSIONCLASS 0x4a - -// shape class (get: vehicle types) -#define VAR_SHAPECLASS 0x4b - -// offset (brake gap) (get: vehicle types) -#define VAR_GUIOFFSET 0x4c - -// width (get: vehicle types) -#define VAR_WIDTH 0x4d - -// shape (get: polygons) -#define VAR_SHAPE 0x4e - -// type id (get: vehicles, polygons, pois) -#define VAR_TYPE 0x4f - -// road id (get: vehicles) -#define VAR_ROAD_ID 0x50 - -// lane id (get: vehicles) -#define VAR_LANE_ID 0x51 - -// lane index (get: vehicles) -#define VAR_LANE_INDEX 0x52 - -// route id (get & set: vehicles) -#define VAR_ROUTE_ID 0x53 - -// edges (get: routes) -#define VAR_EDGES 0x54 - -// filled? (get: polygons) -#define VAR_FILL 0x55 - -// position (1D along lane) (get: vehicle) -#define VAR_LANEPOSITION 0x56 - -// route (set: vehicles) -#define VAR_ROUTE 0x57 - -// travel time information (get&set: vehicle) -#define VAR_EDGE_TRAVELTIME 0x58 - -// effort information (get&set: vehicle) -#define VAR_EDGE_EFFORT 0x59 - -// last step travel time (get: edge, lane) -#define VAR_CURRENT_TRAVELTIME 0x5a - -// signals state (get/set: vehicle) -#define VAR_SIGNALS 0x5b - -// new lane/position along (set: vehicle) -#define VAR_MOVE_TO 0x5c - -// driver imperfection (set: vehicle) -#define VAR_IMPERFECTION 0x5d - -// speed factor (set: vehicle) -#define VAR_SPEED_FACTOR 0x5e - -// speed deviation (set: vehicle) -#define VAR_SPEED_DEVIATION 0x5f - -// speed without TraCI influence (get: vehicle) -#define VAR_SPEED_WITHOUT_TRACI 0xb1 - -// best lanes (get: vehicle) -#define VAR_BEST_LANES 0xb2 - - - - -// current CO2 emission of a node (get: vehicle, lane, edge) -#define VAR_CO2EMISSION 0x60 - -// current CO emission of a node (get: vehicle, lane, edge) -#define VAR_COEMISSION 0x61 - -// current HC emission of a node (get: vehicle, lane, edge) -#define VAR_HCEMISSION 0x62 - -// current PMx emission of a node (get: vehicle, lane, edge) -#define VAR_PMXEMISSION 0x63 - -// current NOx emission of a node (get: vehicle, lane, edge) -#define VAR_NOXEMISSION 0x64 - -// current fuel consumption of a node (get: vehicle, lane, edge) -#define VAR_FUELCONSUMPTION 0x65 - -// current noise emission of a node (get: vehicle, lane, edge) -#define VAR_NOISEEMISSION 0x66 - - - -// current time step (get: simulation) -#define VAR_TIME_STEP 0x70 - -// number of loaded vehicles (get: simulation) -#define VAR_LOADED_VEHICLES_NUMBER 0x71 - -// loaded vehicle ids (get: simulation) -#define VAR_LOADED_VEHICLES_IDS 0x72 - -// number of departed vehicle (get: simulation) -#define VAR_DEPARTED_VEHICLES_NUMBER 0x73 - -// departed vehicle ids (get: simulation) -#define VAR_DEPARTED_VEHICLES_IDS 0x74 - -// number of vehicles starting to teleport (get: simulation) -#define VAR_TELEPORT_STARTING_VEHICLES_NUMBER 0x75 - -// ids of vehicles starting to teleport (get: simulation) -#define VAR_TELEPORT_STARTING_VEHICLES_IDS 0x76 - -// number of vehicles ending to teleport (get: simulation) -#define VAR_TELEPORT_ENDING_VEHICLES_NUMBER 0x77 - -// ids of vehicles ending to teleport (get: simulation) -#define VAR_TELEPORT_ENDING_VEHICLES_IDS 0x78 +// speed (get: vehicle) +#define VAR_SPEED 0x40 -// number of arrived vehicles (get: simulation) -#define VAR_ARRIVED_VEHICLES_NUMBER 0x79 +// position of a domain object +#define DOMVAR_POSITION 0x02 // ids of arrived vehicles (get: simulation) #define VAR_ARRIVED_VEHICLES_IDS 0x7a -// delta t (get: simulation) -#define VAR_DELTA_T 0x7b - -// bounding box (get: simulation) -#define VAR_NET_BOUNDING_BOX 0x7c - - - - - - - - -// add an instance (poi, polygon) -#define ADD 0x80 - -// remove an instance (poi, polygon) -#define REMOVE 0x81 - - -// force rerouting based on travel time (vehicles) -#define CMD_REROUTE_TRAVELTIME 0x90 - -// force rerouting based on effort (vehicles) -#define CMD_REROUTE_EFFORT 0x91 - -// validates current route (vehicles) -#define VAR_ROUTE_VALID 0x92 - - - -// zoom -#define VAR_VIEW_ZOOM 0xa0 -// view position -#define VAR_VIEW_OFFSET 0xa1 -// view schema -#define VAR_VIEW_SCHEMA 0xa2 -// view by boundary -#define VAR_VIEW_BOUNDARY 0xa3 -// background color -#define VAR_VIEW_BACKGROUNDCOLOR 0xa4 -// screenshot -#define VAR_SCREENSHOT 0xa5 -// track vehicle -#define VAR_TRACK_VEHICLE 0xa6 -// network size (get: ) -#define VAR_NET_SIZE 0xa7 - - - - -#endif - - +// **************************************** +// RESULT TYPES +// **************************************** +// result type: Ok +#define RTYPE_OK 0x00 +#endif \ No newline at end of file diff --git a/openair2/UTIL/OPT/packet-mac-lte.c b/openair2/UTIL/OPT/packet-mac-lte.c deleted file mode 100644 index 6fd7ddd826d..00000000000 --- a/openair2/UTIL/OPT/packet-mac-lte.c +++ /dev/null @@ -1,6195 +0,0 @@ -/* Routines for LTE MAC disassembly - * - * Martin Mathieson - * - * $Id: packet-mac-lte.c 42240 2012-04-25 20:02:12Z pascal $ - * - * Wireshark - Network traffic analyzer - * By Gerald Combs <gerald@wireshark.org> - * Copyright 1998 Gerald Combs - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <string.h> - -#include <epan/packet.h> -#include <epan/expert.h> -#include <epan/prefs.h> -#include <epan/tap.h> -#include <epan/uat.h> - -#include "packet-mac-lte.h" -#include "packet-rlc-lte.h" - - -/* Described in: - * 3GPP TS 36.321 Evolved Universal Terrestrial Radio Access (E-UTRA) - * Medium Access Control (MAC) protocol specification (Release 10) - */ - - -/* Initialize the protocol and registered fields. */ -int proto_mac_lte = -1; - -static int mac_lte_tap = -1; - -/* Decoding context */ -static int hf_mac_lte_context = -1; -static int hf_mac_lte_context_radio_type = -1; -static int hf_mac_lte_context_direction = -1; -static int hf_mac_lte_context_rnti = -1; -static int hf_mac_lte_context_rnti_type = -1; -static int hf_mac_lte_context_ueid = -1; -static int hf_mac_lte_context_sysframe_number = -1; -static int hf_mac_lte_context_subframe_number = -1; -static int hf_mac_lte_context_grant_subframe_number = -1; -static int hf_mac_lte_context_predefined_frame = -1; -static int hf_mac_lte_context_length = -1; -static int hf_mac_lte_context_ul_grant_size = -1; -static int hf_mac_lte_context_bch_transport_channel = -1; -static int hf_mac_lte_context_retx_count = -1; -static int hf_mac_lte_context_retx_reason = -1; -static int hf_mac_lte_context_crc_status = -1; -static int hf_mac_lte_context_rapid = -1; -static int hf_mac_lte_context_rach_attempt_number = -1; - -/* Inferred context */ -static int hf_mac_lte_ues_ul_per_tti = -1; -static int hf_mac_lte_ues_dl_per_tti = -1; - - -/* Extra PHY context */ -static int hf_mac_lte_context_phy_ul = -1; -static int hf_mac_lte_context_phy_ul_modulation_type = -1; -static int hf_mac_lte_context_phy_ul_tbs_index = -1; -static int hf_mac_lte_context_phy_ul_resource_block_length = -1; -static int hf_mac_lte_context_phy_ul_resource_block_start = -1; -static int hf_mac_lte_context_phy_ul_harq_id = -1; -static int hf_mac_lte_context_phy_ul_ndi = -1; - -static int hf_mac_lte_context_phy_dl = -1; -static int hf_mac_lte_context_phy_dl_dci_format = -1; -static int hf_mac_lte_context_phy_dl_resource_allocation_type = -1; -static int hf_mac_lte_context_phy_dl_aggregation_level = -1; -static int hf_mac_lte_context_phy_dl_mcs_index = -1; -static int hf_mac_lte_context_phy_dl_redundancy_version_index = -1; -static int hf_mac_lte_context_phy_dl_retx = -1; -static int hf_mac_lte_context_phy_dl_resource_block_length = -1; -static int hf_mac_lte_context_phy_dl_crc_status = -1; -static int hf_mac_lte_context_phy_dl_harq_id = -1; -static int hf_mac_lte_context_phy_dl_ndi = -1; -static int hf_mac_lte_context_phy_dl_tb = -1; - - -/* Out-of-band events */ -static int hf_mac_lte_oob_send_preamble = -1; -static int hf_mac_lte_oob_send_sr = -1; -static int hf_mac_lte_number_of_srs = -1; -static int hf_mac_lte_oob_sr_failure = -1; - -/* MAC SCH/MCH header fields */ -static int hf_mac_lte_ulsch = -1; -static int hf_mac_lte_ulsch_header = -1; -static int hf_mac_lte_dlsch = -1; -static int hf_mac_lte_dlsch_header = -1; -static int hf_mac_lte_sch_subheader = -1; -static int hf_mac_lte_mch = -1; -static int hf_mac_lte_mch_header = -1; -static int hf_mac_lte_mch_subheader = -1; - -static int hf_mac_lte_sch_reserved = -1; -static int hf_mac_lte_dlsch_lcid = -1; -static int hf_mac_lte_ulsch_lcid = -1; -static int hf_mac_lte_sch_extended = -1; -static int hf_mac_lte_sch_format = -1; -static int hf_mac_lte_sch_length = -1; -static int hf_mac_lte_mch_reserved = -1; -static int hf_mac_lte_mch_lcid = -1; -static int hf_mac_lte_mch_extended = -1; -static int hf_mac_lte_mch_format = -1; -static int hf_mac_lte_mch_length = -1; - -static int hf_mac_lte_sch_header_only = -1; -static int hf_mac_lte_mch_header_only = -1; - -/* Data */ -static int hf_mac_lte_sch_sdu = -1; -static int hf_mac_lte_mch_sdu = -1; -static int hf_mac_lte_bch_pdu = -1; -static int hf_mac_lte_pch_pdu = -1; -static int hf_mac_lte_predefined_pdu = -1; -static int hf_mac_lte_raw_pdu = -1; -static int hf_mac_lte_padding_data = -1; -static int hf_mac_lte_padding_length = -1; - - -/* RAR fields */ -static int hf_mac_lte_rar = -1; -static int hf_mac_lte_rar_headers = -1; -static int hf_mac_lte_rar_header = -1; -static int hf_mac_lte_rar_extension = -1; -static int hf_mac_lte_rar_t = -1; -static int hf_mac_lte_rar_bi = -1; -static int hf_mac_lte_rar_rapid = -1; -static int hf_mac_lte_rar_reserved = -1; -static int hf_mac_lte_rar_body = -1; -static int hf_mac_lte_rar_reserved2 = -1; -static int hf_mac_lte_rar_ta = -1; -static int hf_mac_lte_rar_ul_grant = -1; -static int hf_mac_lte_rar_ul_grant_hopping = -1; -static int hf_mac_lte_rar_ul_grant_fsrba = -1; -static int hf_mac_lte_rar_ul_grant_tmcs = -1; -static int hf_mac_lte_rar_ul_grant_tcsp = -1; -static int hf_mac_lte_rar_ul_grant_ul_delay = -1; -static int hf_mac_lte_rar_ul_grant_cqi_request = -1; -static int hf_mac_lte_rar_temporary_crnti = -1; - -/* Common channel control values */ -static int hf_mac_lte_control_bsr = -1; -static int hf_mac_lte_control_bsr_lcg_id = -1; -static int hf_mac_lte_control_short_bsr_buffer_size = -1; -static int hf_mac_lte_control_long_bsr_buffer_size_0 = -1; -static int hf_mac_lte_control_long_bsr_buffer_size_1 = -1; -static int hf_mac_lte_control_long_bsr_buffer_size_2 = -1; -static int hf_mac_lte_control_long_bsr_buffer_size_3 = -1; -static int hf_mac_lte_control_short_ext_bsr_buffer_size = -1; -static int hf_mac_lte_control_long_ext_bsr_buffer_size_0 = -1; -static int hf_mac_lte_control_long_ext_bsr_buffer_size_1 = -1; -static int hf_mac_lte_control_long_ext_bsr_buffer_size_2 = -1; -static int hf_mac_lte_control_long_ext_bsr_buffer_size_3 = -1; -static int hf_mac_lte_control_crnti = -1; -static int hf_mac_lte_control_timing_advance = -1; -static int hf_mac_lte_control_timing_advance_reserved = -1; -static int hf_mac_lte_control_ue_contention_resolution = -1; -static int hf_mac_lte_control_ue_contention_resolution_identity = -1; -static int hf_mac_lte_control_ue_contention_resolution_msg3 = -1; -static int hf_mac_lte_control_ue_contention_resolution_msg3_matched = -1; -static int hf_mac_lte_control_ue_contention_resolution_time_since_msg3 = -1; -static int hf_mac_lte_control_power_headroom = -1; -static int hf_mac_lte_control_power_headroom_reserved = -1; -static int hf_mac_lte_control_power_headroom_level = -1; -static int hf_mac_lte_control_ext_power_headroom = -1; -static int hf_mac_lte_control_ext_power_headroom_c7 = -1; -static int hf_mac_lte_control_ext_power_headroom_c6 = -1; -static int hf_mac_lte_control_ext_power_headroom_c5 = -1; -static int hf_mac_lte_control_ext_power_headroom_c4 = -1; -static int hf_mac_lte_control_ext_power_headroom_c3 = -1; -static int hf_mac_lte_control_ext_power_headroom_c2 = -1; -static int hf_mac_lte_control_ext_power_headroom_c1 = -1; -static int hf_mac_lte_control_ext_power_headroom_reserved = -1; -static int hf_mac_lte_control_ext_power_headroom_power_backoff = -1; -static int hf_mac_lte_control_ext_power_headroom_value = -1; -static int hf_mac_lte_control_ext_power_headroom_level = -1; -static int hf_mac_lte_control_ext_power_headroom_reserved2 = -1; -static int hf_mac_lte_control_ext_power_headroom_pcmaxc = -1; -static int hf_mac_lte_control_activation_deactivation = -1; -static int hf_mac_lte_control_activation_deactivation_c7 = -1; -static int hf_mac_lte_control_activation_deactivation_c6 = -1; -static int hf_mac_lte_control_activation_deactivation_c5 = -1; -static int hf_mac_lte_control_activation_deactivation_c4 = -1; -static int hf_mac_lte_control_activation_deactivation_c3 = -1; -static int hf_mac_lte_control_activation_deactivation_c2 = -1; -static int hf_mac_lte_control_activation_deactivation_c1 = -1; -static int hf_mac_lte_control_activation_deactivation_reserved = -1; -static int hf_mac_lte_control_mch_scheduling_info = -1; -static int hf_mac_lte_control_mch_scheduling_info_lcid = -1; -static int hf_mac_lte_control_mch_scheduling_info_stop_mtch = -1; - -static int hf_mac_lte_dl_harq_resend_original_frame = -1; -static int hf_mac_lte_dl_harq_resend_time_since_previous_frame = -1; -static int hf_mac_lte_dl_harq_resend_next_frame = -1; -static int hf_mac_lte_dl_harq_resend_time_until_next_frame = -1; - -static int hf_mac_lte_ul_harq_resend_original_frame = -1; -static int hf_mac_lte_ul_harq_resend_time_since_previous_frame = -1; -static int hf_mac_lte_ul_harq_resend_next_frame = -1; -static int hf_mac_lte_ul_harq_resend_time_until_next_frame = -1; - - -static int hf_mac_lte_grant_answering_sr = -1; -static int hf_mac_lte_failure_answering_sr = -1; -static int hf_mac_lte_sr_leading_to_failure = -1; -static int hf_mac_lte_sr_leading_to_grant = -1; -static int hf_mac_lte_sr_invalid_event = -1; -static int hf_mac_lte_sr_time_since_request = -1; -static int hf_mac_lte_sr_time_until_answer = -1; - - -/* Subtrees. */ -static int ett_mac_lte = -1; -static int ett_mac_lte_context = -1; -static int ett_mac_lte_phy_context = -1; -static int ett_mac_lte_ulsch_header = -1; -static int ett_mac_lte_dlsch_header = -1; -static int ett_mac_lte_mch_header = -1; -static int ett_mac_lte_sch_subheader = -1; -static int ett_mac_lte_mch_subheader = -1; -static int ett_mac_lte_rar_headers = -1; -static int ett_mac_lte_rar_header = -1; -static int ett_mac_lte_rar_body = -1; -static int ett_mac_lte_rar_ul_grant = -1; -static int ett_mac_lte_bsr = -1; -static int ett_mac_lte_bch = -1; -static int ett_mac_lte_pch = -1; -static int ett_mac_lte_activation_deactivation = -1; -static int ett_mac_lte_contention_resolution = -1; -static int ett_mac_lte_power_headroom = -1; -static int ett_mac_lte_extended_power_headroom = -1; -static int ett_mac_lte_extended_power_headroom_cell = -1; -static int ett_mac_lte_mch_scheduling_info = -1; -static int ett_mac_lte_oob = -1; - - - -/* Constants and value strings */ - -static const value_string radio_type_vals[] = { - { FDD_RADIO, "FDD"}, - { TDD_RADIO, "TDD"}, - { 0, NULL } -}; - - -static const value_string direction_vals[] = { - { DIRECTION_UPLINK, "Uplink"}, - { DIRECTION_DOWNLINK, "Downlink"}, - { 0, NULL } -}; - - -static const value_string rnti_type_vals[] = { - { NO_RNTI, "NO-RNTI"}, - { P_RNTI, "P-RNTI"}, - { RA_RNTI, "RA-RNTI"}, - { C_RNTI, "C-RNTI"}, - { SI_RNTI, "SI-RNTI"}, - { SPS_RNTI, "SPS-RNTI"}, - { M_RNTI, "M-RNTI"}, - { 0, NULL } -}; - -static const value_string bch_transport_channel_vals[] = { - { SI_RNTI, "DL-SCH"}, - { NO_RNTI, "BCH"}, - { 0, NULL } -}; - -static const value_string crc_status_vals[] = { - { crc_success, "OK"}, - { crc_fail, "Failed"}, - { crc_high_code_rate, "High Code Rate"}, - { crc_pdsch_lost, "PDSCH Lost"}, - { crc_duplicate_nonzero_rv, "Duplicate_nonzero_rv"}, - { 0, NULL } -}; - - -static const value_string dci_format_vals[] = { - { 0, "0"}, - { 1, "1"}, - { 2, "1A"}, - { 3, "1B"}, - { 4, "1C"}, - { 5, "1D"}, - { 6, "2"}, - { 7, "2A"}, - { 8, "3/3A"}, - { 0, NULL } -}; - -static const value_string aggregation_level_vals[] = { - { 0, "1"}, - { 1, "2"}, - { 2, "4"}, - { 3, "8"}, - { 0, NULL } -}; - -static const value_string modulation_type_vals[] = { - { 2, "QPSK"}, - { 4, "QAM16"}, - { 6, "QAM64"}, - { 0, NULL } -}; - -static const true_false_string mac_lte_scell_ph_vals = { - "Reported", - "Not reported" -}; - -static const true_false_string mac_lte_power_backoff_vals = { - "Applied", - "Not applied" -}; - -static const true_false_string mac_lte_ph_value_vals = { - "Based on reference format", - "Based on real transmission" -}; - -static const true_false_string mac_lte_scell_status_vals = { - "Activated", - "Deactivated" -}; - -#define ACTIVATION_DEACTIVATION_LCID 0x1b -#define UE_CONTENTION_RESOLUTION_IDENTITY_LCID 0x1c -#define TIMING_ADVANCE_LCID 0x1d -#define DRX_COMMAND_LCID 0x1e -#define PADDING_LCID 0x1f - -static const value_string dlsch_lcid_vals[] = { - { 0, "CCCH"}, - { 1, "1"}, - { 2, "2"}, - { 3, "3"}, - { 4, "4"}, - { 5, "5"}, - { 6, "6"}, - { 7, "7"}, - { 8, "8"}, - { 9, "9"}, - { 10, "10"}, - { ACTIVATION_DEACTIVATION_LCID , "Activation/Deactivation"}, - { UE_CONTENTION_RESOLUTION_IDENTITY_LCID, "UE Contention Resolution Identity"}, - { TIMING_ADVANCE_LCID , "Timing Advance"}, - { DRX_COMMAND_LCID , "DRX Command"}, - { PADDING_LCID , "Padding" }, - { 0, NULL } -}; - -#define EXTENDED_POWER_HEADROOM_REPORT_LCID 0x19 -#define POWER_HEADROOM_REPORT_LCID 0x1a -#define CRNTI_LCID 0x1b -#define TRUNCATED_BSR_LCID 0x1c -#define SHORT_BSR_LCID 0x1d -#define LONG_BSR_LCID 0x1e - -static const value_string ulsch_lcid_vals[] = { - { 0, "CCCH"}, - { 1, "1"}, - { 2, "2"}, - { 3, "3"}, - { 4, "4"}, - { 5, "5"}, - { 6, "6"}, - { 7, "7"}, - { 8, "8"}, - { 9, "9"}, - { 10, "10"}, - { EXTENDED_POWER_HEADROOM_REPORT_LCID, "Extended Power Headroom Report"}, - { POWER_HEADROOM_REPORT_LCID, "Power Headroom Report"}, - { CRNTI_LCID, "C-RNTI"}, - { TRUNCATED_BSR_LCID, "Truncated BSR"}, - { SHORT_BSR_LCID, "Short BSR"}, - { LONG_BSR_LCID, "Long BSR"}, - { PADDING_LCID, "Padding" }, - { 0, NULL } -}; - -#define MCH_SCHEDULING_INFO_LCID 0x1e - -static const value_string mch_lcid_vals[] = { - { 0, "MCCH"}, - { 1, "1"}, - { 2, "2"}, - { 3, "3"}, - { 4, "4"}, - { 5, "5"}, - { 6, "6"}, - { 7, "7"}, - { 8, "8"}, - { 9, "9"}, - { 10, "10"}, - { 11, "11"}, - { 12, "12"}, - { 13, "13"}, - { 14, "14"}, - { 15, "15"}, - { 16, "16"}, - { 17, "17"}, - { 18, "18"}, - { 19, "19"}, - { 20, "20"}, - { 21, "21"}, - { 22, "22"}, - { 23, "23"}, - { 24, "24"}, - { 25, "25"}, - { 26, "26"}, - { 27, "27"}, - { 28, "28"}, - { MCH_SCHEDULING_INFO_LCID, "MCH Scheduling Information"}, - { PADDING_LCID, "Padding" }, - { 0, NULL } -}; - -static const value_string format_vals[] = { - { 0, "Data length is < 128 bytes"}, - { 1, "Data length is >= 128 bytes"}, - { 0, NULL } -}; - - -static const value_string rar_type_vals[] = { - { 0, "Backoff Indicator present"}, - { 1, "RAPID present"}, - { 0, NULL } -}; - - -static const value_string rar_bi_vals[] = { - { 0, "0"}, - { 1, "10"}, - { 2, "20"}, - { 3, "30"}, - { 4, "40"}, - { 5, "60"}, - { 6, "80"}, - { 7, "120"}, - { 8, "160"}, - { 9, "240"}, - { 10, "320"}, - { 11, "480"}, - { 12, "960"}, - { 0, NULL } -}; - - -static const value_string buffer_size_vals[] = { - { 0, "BS = 0"}, - { 1, "0 < BS <= 10"}, - { 2, "10 < BS <= 12"}, - { 3, "12 < BS <= 14"}, - { 4, "14 < BS <= 17"}, - { 5, "17 < BS <= 19"}, - { 6, "19 < BS <= 22"}, - { 7, "22 < BS <= 26"}, - { 8, "26 < BS <= 31"}, - { 9, "31 < BS <= 36"}, - { 10, "36 < BS <= 42"}, - { 11, "42 < BS <= 49"}, - { 12, "49 < BS <= 57"}, - { 13, "47 < BS <= 67"}, - { 14, "67 < BS <= 78"}, - { 15, "78 < BS <= 91"}, - { 16, "91 < BS <= 107"}, - { 17, "107 < BS <= 125"}, - { 18, "125 < BS <= 146"}, - { 19, "146 < BS <= 171"}, - { 20, "171 < BS <= 200"}, - { 21, "200 < BS <= 234"}, - { 22, "234 < BS <= 274"}, - { 23, "274 < BS <= 321"}, - { 24, "321 < BS <= 376"}, - { 25, "376 < BS <= 440"}, - { 26, "440 < BS <= 515"}, - { 27, "515 < BS <= 603"}, - { 28, "603 < BS <= 706"}, - { 29, "706 < BS <= 826"}, - { 30, "826 < BS <= 967"}, - { 31, "967 < BS <= 1132"}, - { 32, "1132 < BS <= 1326"}, - { 33, "1326 < BS <= 1552"}, - { 34, "1552 < BS <= 1817"}, - { 35, "1817 < BS <= 2127"}, - { 36, "2127 < BS <= 2490"}, - { 37, "2490 < BS <= 2915"}, - { 38, "2915 < BS <= 3413"}, - { 39, "3413 < BS <= 3995"}, - { 40, "3995 < BS <= 4677"}, - { 41, "4677 < BS <= 5476"}, - { 42, "5476 < BS <= 6411"}, - { 43, "6411 < BS <= 7505"}, - { 44, "7505 < BS <= 8787"}, - { 45, "8787 < BS <= 10276"}, - { 46, "10287 < BS <= 12043"}, - { 47, "12043 < BS <= 14099"}, - { 48, "14099 < BS <= 16507"}, - { 49, "16507 < BS <= 19325"}, - { 50, "19325 < BS <= 22624"}, - { 51, "22624 < BS <= 26487"}, - { 52, "26487 < BS <= 31009"}, - { 53, "31009 < BS <= 36304"}, - { 54, "36304 < BS <= 42502"}, - { 55, "42502 < BS <= 49759"}, - { 56, "49759 < BS <= 58255"}, - { 57, "58255 < BS <= 68201"}, - { 58, "68201 < BS <= 79846"}, - { 59, "79846 < BS <= 93479"}, - { 60, "93479 < BS <= 109439"}, - { 61, "109439 < BS <= 128125"}, - { 62, "128125 < BS <= 150000"}, - { 63, "BS > 150000"}, - { 0, NULL } -}; -static value_string_ext buffer_size_vals_ext = VALUE_STRING_EXT_INIT(buffer_size_vals); - -static const value_string ext_buffer_size_vals[] = { - { 0, "BS = 0"}, - { 1, "0 < BS <= 10"}, - { 2, "10 < BS <= 13"}, - { 3, "13 < BS <= 16"}, - { 4, "16 < BS <= 19"}, - { 5, "19 < BS <= 23"}, - { 6, "23 < BS <= 29"}, - { 7, "29 < BS <= 35"}, - { 8, "35 < BS <= 43"}, - { 9, "43 < BS <= 53"}, - { 10, "53 < BS <= 65"}, - { 11, "65 < BS <= 80"}, - { 12, "80 < BS <= 98"}, - { 13, "98 < BS <= 120"}, - { 14, "120 < BS <= 147"}, - { 15, "147 < BS <= 181"}, - { 16, "181 < BS <= 223"}, - { 17, "223 < BS <= 274"}, - { 18, "274 < BS <= 337"}, - { 19, "337 < BS <= 414"}, - { 20, "414 < BS <= 509"}, - { 21, "509 < BS <= 625"}, - { 22, "625 < BS <= 769"}, - { 23, "769 < BS <= 945"}, - { 24, "945 < BS <= 1162"}, - { 25, "1162 < BS <= 1429"}, - { 26, "1429 < BS <= 1757"}, - { 27, "1757 < BS <= 2161"}, - { 28, "2161 < BS <= 2657"}, - { 29, "2657 < BS <= 3267"}, - { 30, "3267 < BS <= 4017"}, - { 31, "4017 < BS <= 4940"}, - { 32, "4940 < BS <= 6074"}, - { 33, "6074 < BS <= 7469"}, - { 34, "7469 < BS <= 9185"}, - { 35, "9185 < BS <= 11294"}, - { 36, "11294 < BS <= 13888"}, - { 37, "13888 < BS <= 17077"}, - { 38, "17077 < BS <= 20999"}, - { 39, "20999 < BS <= 25822"}, - { 40, "25822 < BS <= 31752"}, - { 41, "31752 < BS <= 39045"}, - { 42, "39045 < BS <= 48012"}, - { 43, "48012 < BS <= 59039"}, - { 44, "59039 < BS <= 72598"}, - { 45, "72598 < BS <= 89272"}, - { 46, "89272 < BS <= 109774"}, - { 47, "109774 < BS <= 134986"}, - { 48, "134986 < BS <= 165989"}, - { 49, "165989 < BS <= 204111"}, - { 50, "204111 < BS <= 250990"}, - { 51, "250990 < BS <= 308634"}, - { 52, "308634 < BS <= 379519"}, - { 53, "379519 < BS <= 466683"}, - { 54, "466683 < BS <= 573866"}, - { 55, "573866 < BS <= 705666"}, - { 56, "705666 < BS <= 867737"}, - { 57, "867737 < BS <= 1067031"}, - { 58, "1067031 < BS <= 1312097"}, - { 59, "1312097 < BS <= 1613447"}, - { 60, "1613447 < BS <= 1984009"}, - { 61, "1984009 < BS <= 2439678"}, - { 62, "2439678 < BS <= 3000000"}, - { 63, "BS > 3000000"}, - { 0, NULL } -}; -static value_string_ext ext_buffer_size_vals_ext = VALUE_STRING_EXT_INIT(ext_buffer_size_vals); - -static const value_string power_headroom_vals[] = { - { 0, "-23 <= PH < -22"}, - { 1, "-22 <= PH < -21"}, - { 2, "-21 <= PH < -20"}, - { 3, "-20 <= PH < -19"}, - { 4, "-19 <= PH < -18"}, - { 5, "-18 <= PH < -17"}, - { 6, "-17 <= PH < -16"}, - { 7, "-16 <= PH < -15"}, - { 8, "-15 <= PH < -14"}, - { 9, "-14 <= PH < -13"}, - { 10, "-13 <= PH < -12"}, - { 11, "-12 <= PH < -11"}, - { 12, "-11 <= PH < -10"}, - { 13, "-10 <= PH < -9"}, - { 14, "-9 <= PH < -8"}, - { 15, "-8 <= PH < -7"}, - { 16, "-7 <= PH < -6"}, - { 17, "-6 <= PH < -5"}, - { 18, "-5 <= PH < -4"}, - { 19, "-4 <= PH < -3"}, - { 20, "-3 <= PH < -2"}, - { 21, "-2 <= PH < -1"}, - { 22, "-1 <= PH < 0"}, - { 23, "0 <= PH < 1"}, - { 24, "1 <= PH < 2"}, - { 25, "2 <= PH < 3"}, - { 26, "3 <= PH < 4"}, - { 27, "4 <= PH < 5"}, - { 28, "5 <= PH < 6"}, - { 29, "6 <= PH < 7"}, - { 30, "7 <= PH < 8"}, - { 31, "8 <= PH < 9"}, - { 32, "9 <= PH < 10"}, - { 33, "10 <= PH < 11"}, - { 34, "11 <= PH < 12"}, - { 35, "12 <= PH < 13"}, - { 36, "13 <= PH < 14"}, - { 37, "14 <= PH < 15"}, - { 38, "15 <= PH < 16"}, - { 39, "16 <= PH < 17"}, - { 40, "17 <= PH < 18"}, - { 41, "18 <= PH < 19"}, - { 42, "19 <= PH < 20"}, - { 43, "20 <= PH < 21"}, - { 44, "21 <= PH < 22"}, - { 45, "22 <= PH < 23"}, - { 46, "23 <= PH < 24"}, - { 47, "24 <= PH < 25"}, - { 48, "25 <= PH < 26"}, - { 49, "26 <= PH < 27"}, - { 50, "27 <= PH < 28"}, - { 51, "28 <= PH < 29"}, - { 52, "29 <= PH < 30"}, - { 53, "30 <= PH < 31"}, - { 54, "31 <= PH < 32"}, - { 55, "32 <= PH < 33"}, - { 56, "33 <= PH < 34"}, - { 57, "34 <= PH < 35"}, - { 58, "34 <= PH < 36"}, - { 59, "36 <= PH < 37"}, - { 60, "37 <= PH < 38"}, - { 61, "38 <= PH < 39"}, - { 62, "39 <= PH < 40"}, - { 63, "PH >= 40"}, - { 0, NULL } -}; -static value_string_ext power_headroom_vals_ext = VALUE_STRING_EXT_INIT(power_headroom_vals); - -static const value_string pcmaxc_vals[] = { - { 0, "Pcmax,c < -29"}, - { 1, "-29 <= Pcmax,c < -28"}, - { 2, "-28 <= Pcmax,c < -27"}, - { 3, "-27 <= Pcmax,c < -26"}, - { 4, "-26 <= Pcmax,c < -25"}, - { 5, "-25 <= Pcmax,c < -24"}, - { 6, "-24 <= Pcmax,c < -23"}, - { 7, "-23 <= Pcmax,c < -22"}, - { 8, "-22 <= Pcmax,c < -21"}, - { 9, "-21 <= Pcmax,c < -20"}, - { 10, "-20 <= Pcmax,c < -19"}, - { 11, "-19 <= Pcmax,c < -18"}, - { 12, "-18 <= Pcmax,c < -17"}, - { 13, "-17 <= Pcmax,c < -16"}, - { 14, "-16 <= Pcmax,c < -15"}, - { 15, "-15 <= Pcmax,c < -14"}, - { 16, "-14 <= Pcmax,c < -13"}, - { 17, "-13 <= Pcmax,c < -12"}, - { 18, "-12 <= Pcmax,c < -11"}, - { 19, "-11 <= Pcmax,c < -10"}, - { 20, "-10 <= Pcmax,c < -9"}, - { 21, "-9 <= Pcmax,c < -8"}, - { 22, "-8 <= Pcmax,c < -7"}, - { 23, "-7 <= Pcmax,c < -6"}, - { 24, "-6 <= Pcmax,c < -5"}, - { 25, "-5 <= Pcmax,c < -4"}, - { 26, "-4 <= Pcmax,c < -3"}, - { 27, "-3 <= Pcmax,c < -2"}, - { 28, "-2 <= Pcmax,c < -1"}, - { 29, "-1 <= Pcmax,c < 0"}, - { 30, "0 <= Pcmax,c < 1"}, - { 31, "1 <= Pcmax,c < 2"}, - { 32, "2 <= Pcmax,c < 3"}, - { 33, "3 <= Pcmax,c < 4"}, - { 34, "4 <= Pcmax,c < 5"}, - { 35, "5 <= Pcmax,c < 6"}, - { 36, "6 <= Pcmax,c < 7"}, - { 37, "7 <= Pcmax,c < 8"}, - { 38, "8 <= Pcmax,c < 9"}, - { 39, "9 <= Pcmax,c < 10"}, - { 40, "10 <= Pcmax,c < 11"}, - { 41, "11 <= Pcmax,c < 12"}, - { 42, "12 <= Pcmax,c < 13"}, - { 43, "13 <= Pcmax,c < 14"}, - { 44, "14 <= Pcmax,c < 15"}, - { 45, "15 <= Pcmax,c < 16"}, - { 46, "16 <= Pcmax,c < 17"}, - { 47, "17 <= Pcmax,c < 18"}, - { 48, "18 <= Pcmax,c < 19"}, - { 49, "19 <= Pcmax,c < 20"}, - { 50, "20 <= Pcmax,c < 21"}, - { 51, "21 <= Pcmax,c < 22"}, - { 52, "22 <= Pcmax,c < 23"}, - { 53, "23 <= Pcmax,c < 24"}, - { 54, "24 <= Pcmax,c < 25"}, - { 55, "25 <= Pcmax,c < 26"}, - { 56, "26 <= Pcmax,c < 27"}, - { 57, "27 <= Pcmax,c < 28"}, - { 58, "28 <= Pcmax,c < 29"}, - { 59, "29 <= Pcmax,c < 30"}, - { 60, "30 <= Pcmax,c < 31"}, - { 61, "31 <= Pcmax,c < 32"}, - { 62, "32 <= Pcmax,c < 33"}, - { 63, "33 <= Pcmax,c"}, - { 0, NULL } -}; -static value_string_ext pcmaxc_vals_ext = VALUE_STRING_EXT_INIT(pcmaxc_vals); - -static const value_string header_only_vals[] = { - { 0, "MAC PDU Headers and body present"}, - { 1, "MAC PDU Headers only"}, - { 0, NULL } -}; - -static const value_string predefined_frame_vals[] = { - { 0, "Real MAC PDU present - will dissect"}, - { 1, "Predefined frame present - will not dissect"}, - { 0, NULL } -}; - -static const value_string ul_retx_grant_vals[] = { - { 0, "PDCCH ReTx"}, - { 1, "PHICH NACK"}, - { 0, NULL } -}; - -/**************************************************************************/ -/* Preferences state */ -/**************************************************************************/ - -/* If this PDU has been NACK'd (by HARQ) more than a certain number of times, - we trigger an expert warning. */ -static gint global_mac_lte_retx_counter_trigger = 3; - -/* By default try to decode transparent data (BCH, PCH and CCCH) data using LTE RRC dissector */ -static gboolean global_mac_lte_attempt_rrc_decode = TRUE; - -/* Whether should attempt to dissect frames failing CRC check */ -static gboolean global_mac_lte_dissect_crc_failures = FALSE; - -/* Whether should attempt to decode lcid 1&2 SDUs as srb1/2 (i.e. AM RLC) */ -static gboolean global_mac_lte_attempt_srb_decode = TRUE; - -/* Where to take LCID -> DRB mappings from */ -enum lcid_drb_source { - FromStaticTable, FromConfigurationProtocol -}; -static gint global_mac_lte_lcid_drb_source = (gint)FromStaticTable; - -/* Threshold for warning in expert info about high BSR values */ -static gint global_mac_lte_bsr_warn_threshold = 50; /* default is 19325 -> 22624 */ - -/* Whether or not to track SRs and related frames */ -static gboolean global_mac_lte_track_sr = TRUE; - -/* Which layer info to show in the info column */ -enum layer_to_show { - ShowPHYLayer, ShowMACLayer, ShowRLCLayer -}; - -/* Which layer's details to show in Info column */ -static gint global_mac_lte_layer_to_show = (gint)ShowRLCLayer; - -/* When showing RLC info, count PDUs so can append info column properly */ -static guint8 s_number_of_rlc_pdus_shown = 0; - -/***********************************************************************/ -/* How to dissect lcid 3-10 (presume drb logical channels) */ - -static const value_string drb_lcid_vals[] = { - { 3, "LCID 3"}, - { 4, "LCID 4"}, - { 5, "LCID 5"}, - { 6, "LCID 6"}, - { 7, "LCID 7"}, - { 8, "LCID 8"}, - { 9, "LCID 9"}, - { 10, "LCID 10"}, - { 0, NULL } -}; - -typedef enum rlc_channel_type_t { - rlcRaw, - rlcTM, - rlcUM5, - rlcUM10, - rlcAM -} rlc_channel_type_t; - -static const value_string rlc_channel_type_vals[] = { - { rlcTM, "TM"}, - { rlcUM5 , "UM, SN Len=5"}, - { rlcUM10, "UM, SN Len=10"}, - { rlcAM , "AM"}, - { 0, NULL } -}; - - -/* Mapping type */ -typedef struct lcid_drb_mapping_t { - guint16 lcid; - gint drbid; - rlc_channel_type_t channel_type; -} lcid_drb_mapping_t; - -/* Mapping entity */ -static lcid_drb_mapping_t *lcid_drb_mappings = NULL; -static guint num_lcid_drb_mappings = 0; - -UAT_VS_DEF(lcid_drb_mappings, lcid, lcid_drb_mapping_t, 3, "LCID 3") -UAT_DEC_CB_DEF(lcid_drb_mappings, drbid, lcid_drb_mapping_t) -UAT_VS_DEF(lcid_drb_mappings, channel_type, lcid_drb_mapping_t, 2, "AM") - -/* UAT object */ -static uat_t* lcid_drb_mappings_uat; - -/* Dynamic mappings (set by configuration protocol) - LCID is the index into the array of these */ -typedef struct dynamic_lcid_drb_mapping_t { - gboolean valid; - gint drbid; - rlc_channel_type_t channel_type; - guint8 ul_priority; -} dynamic_lcid_drb_mapping_t; - -static dynamic_lcid_drb_mapping_t dynamic_lcid_drb_mapping[11]; - - -extern int proto_rlc_lte; - -/***************************************************************/ - - - -/***************************************************************/ -/* Keeping track of Msg3 bodies so they can be compared with */ -/* Contention Resolution bodies. */ - -typedef struct Msg3Data { - guint8 data[6]; - nstime_t msg3Time; - guint32 framenum; -} Msg3Data; - - -/* This table stores (RNTI -> Msg3Data*). Will be populated when - Msg3 frames are first read. */ -static GHashTable *mac_lte_msg3_hash = NULL; - -/* Hash table functions for mac_lte_msg3_hash. Hash is just the (RNTI) key */ -static gint mac_lte_rnti_hash_equal(gconstpointer v, gconstpointer v2) -{ - return (v == v2); -} - -static guint mac_lte_rnti_hash_func(gconstpointer v) -{ - return GPOINTER_TO_UINT(v); -} - - -typedef enum ContentionResolutionStatus { - NoMsg3, - Msg3Match, - Msg3NoMatch -} ContentionResolutionStatus; - -typedef struct ContentionResolutionResult { - ContentionResolutionStatus status; - guint msg3FrameNum; - guint msSinceMsg3; -} ContentionResolutionResult; - - -/* This table stores (CRFrameNum -> CRResult). It is assigned during the first - pass and used thereafter */ -static GHashTable *mac_lte_cr_result_hash = NULL; - -/* Hash table functions for mac_lte_cr_result_hash. Hash is just the (framenum) key */ -static gint mac_lte_framenum_hash_equal(gconstpointer v, gconstpointer v2) -{ - return (v == v2); -} - -static guint mac_lte_framenum_hash_func(gconstpointer v) -{ - return GPOINTER_TO_UINT(v); -} - -/**************************************************************************/ - - - -/****************************************************************/ -/* Keeping track of last DL frames per C-RNTI so can guess when */ -/* there has been a HARQ retransmission */ -/* TODO: this should be simplified now that harq-id & ndi are */ -/* being logged! */ - -/* Could be bigger, but more than enough to flag suspected resends */ -#define MAX_EXPECTED_PDU_LENGTH 2048 - -typedef struct LastFrameData { - gboolean inUse; - guint32 framenum; - gboolean ndi; - nstime_t received_time; - gint length; - guint8 data[MAX_EXPECTED_PDU_LENGTH]; -} LastFrameData; - -typedef struct DLHarqBuffers { - LastFrameData harqid[2][15]; /* 2 blocks (1 for each antenna) needed for DL */ -} DLHarqBuffers; - - -/* This table stores (RNTI -> DLHARQBuffers*). Will be populated when - DL frames are first read. */ -static GHashTable *mac_lte_dl_harq_hash = NULL; - -typedef struct DLHARQResult { - gboolean previousSet, nextSet; - guint previousFrameNum; - guint timeSincePreviousFrame; - guint nextFrameNum; - guint timeToNextFrame; -} DLHARQResult; - - -/* This table stores (FrameNumber -> *DLHARQResult). It is assigned during the first - pass and used thereafter */ -static GHashTable *mac_lte_dl_harq_result_hash = NULL; - -/**************************************************************************/ - - -/*****************************************************************/ -/* Keeping track of last UL frames per C-RNTI so can verify when */ -/* told that a frame is a retx */ - -typedef struct ULHarqBuffers { - LastFrameData harqid[8]; -} ULHarqBuffers; - - -/* This table stores (RNTI -> ULHarqBuffers*). Will be populated when - UL frames are first read. */ -static GHashTable *mac_lte_ul_harq_hash = NULL; - -typedef struct ULHARQResult { - gboolean previousSet, nextSet; - guint previousFrameNum; - guint timeSincePreviousFrame; - guint nextFrameNum; - guint timeToNextFrame; -} ULHARQResult; - - -/* This table stores (FrameNum -> ULHARQResult). It is assigned during the first - pass and used thereafter */ -static GHashTable *mac_lte_ul_harq_result_hash = NULL; - -/**************************************************************************/ - - -/**************************************************************************/ -/* Tracking of Scheduling Requests (SRs). */ -/* Keep track of: */ -/* - last grant before SR */ -/* - SR failures following request */ -/* - grant following SR */ - -typedef enum SREvent { - SR_Grant, - SR_Request, - SR_Failure -} SREvent; - -static const value_string sr_event_vals[] = { - { SR_Grant, "Grant"}, - { SR_Request, "SR Request"}, - { SR_Failure, "SR Failure"}, - { 0, NULL} -}; - -typedef enum SRStatus { - None, - SR_Outstanding, - SR_Failed -} SRStatus; - -static const value_string sr_status_vals[] = { - { None, "Receiving grants"}, - { SR_Outstanding, "SR Request outstanding"}, - { SR_Failed, "SR has Failed"}, - { 0, NULL} -}; - - -typedef struct SRState { - SRStatus status; - guint32 lastSRFramenum; - guint32 lastGrantFramenum; - nstime_t requestTime; -} SRState; - - -/* This table keeps track of the SR state for each UE. - (RNTI -> SRState) */ -static GHashTable *mac_lte_ue_sr_state = NULL; - - -typedef enum SRResultType { - GrantAnsweringSR, - FailureAnsweringSR, - SRLeadingToGrant, - SRLeadingToFailure, - InvalidSREvent -} SRResultType; - - -typedef struct SRResult { - SRResultType type; - guint32 frameNum; - guint32 timeDifference; - - /* These 2 are only used with InvalidSREvent */ - SRStatus status; - SREvent event; -} SRResult; - -/* Entries in this table are created during the first pass - It maps (SRFrameNum -> SRResult) */ -static GHashTable *mac_lte_sr_request_hash = NULL; - - -/**************************************************************************/ - - - -/* Forward declarations */ -void proto_reg_handoff_mac_lte(void); -void dissect_mac_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); - -static guint8 get_mac_lte_channel_priority(guint16 ueid _U_, guint8 lcid, - guint8 direction); - - -/* Heuristic dissection */ -static gboolean global_mac_lte_heur = FALSE; - -static void call_with_catch_all(dissector_handle_t handle, tvbuff_t* tvb, packet_info *pinfo, proto_tree *tree) -{ - /* Call it (catch exceptions so that stats will be updated) */ - TRY { - call_dissector_only(handle, tvb, pinfo, tree); - } - CATCH_ALL { - } - ENDTRY -} - -/* Dissect context fields in the format described in packet-mac-lte.h. - Return TRUE if the necessary information was successfully found */ -gboolean dissect_mac_lte_context_fields(struct mac_lte_info *p_mac_lte_info, tvbuff_t *tvb, - gint *p_offset) -{ - gint offset = *p_offset; - guint8 tag = 0; - - /* Read fixed fields */ - p_mac_lte_info->radioType = tvb_get_guint8(tvb, offset++); - p_mac_lte_info->direction = tvb_get_guint8(tvb, offset++); - - /* TODO: currently no support for detailed PHY info... */ - if (p_mac_lte_info->direction == DIRECTION_UPLINK) { - p_mac_lte_info->detailed_phy_info.ul_info.present = FALSE; - } else { - p_mac_lte_info->detailed_phy_info.dl_info.present = FALSE; - } - - p_mac_lte_info->rntiType = tvb_get_guint8(tvb, offset++); - - /* Initialize RNTI with a default value in case optional field is not present */ - switch (p_mac_lte_info->rntiType) { - case M_RNTI: - p_mac_lte_info->rnti = 0xFFFD; - break; - - case P_RNTI: - p_mac_lte_info->rnti = 0xFFFE; - break; - - case SI_RNTI: - p_mac_lte_info->rnti = 0xFFFF; - break; - - case RA_RNTI: - case C_RNTI: - case SPS_RNTI: - p_mac_lte_info->rnti = 0x0001; - break; - - default: - break; - } - - /* Read optional fields */ - while (tag != MAC_LTE_PAYLOAD_TAG) { - /* Process next tag */ - tag = tvb_get_guint8(tvb, offset++); - - switch (tag) { - case MAC_LTE_RNTI_TAG: - p_mac_lte_info->rnti = tvb_get_ntohs(tvb, offset); - offset += 2; - break; - - case MAC_LTE_UEID_TAG: - p_mac_lte_info->ueid = tvb_get_ntohs(tvb, offset); - offset += 2; - break; - - case MAC_LTE_SUBFRAME_TAG: - p_mac_lte_info->sysframeNumber = tvb_get_ntohs(tvb, offset); - offset += 2; - p_mac_lte_info->subframeNumber = tvb_get_ntohs(tvb, offset); - offset += 2; - break; - - case MAC_LTE_PREDEFINED_DATA_TAG: - p_mac_lte_info->isPredefinedData = tvb_get_guint8(tvb, offset); - offset++; - break; - - case MAC_LTE_RETX_TAG: - p_mac_lte_info->reTxCount = tvb_get_guint8(tvb, offset); - offset++; - break; - - case MAC_LTE_CRC_STATUS_TAG: - p_mac_lte_info->crcStatusValid = TRUE; - p_mac_lte_info->detailed_phy_info.dl_info.crc_status = tvb_get_guint8(tvb, offset); - offset++; - break; - - case MAC_LTE_EXT_BSR_SIZES_TAG: - p_mac_lte_info->isExtendedBSRSizes = TRUE; - break; - - case MAC_LTE_OOB_EVENT_TAG: - p_mac_lte_info->oob_event = tvb_get_guint8(tvb, offset); - offset++; - p_mac_lte_info->rapid = tvb_get_guint8(tvb, offset); - offset++; - p_mac_lte_info->rach_attempt_number = tvb_get_guint8(tvb, offset); - offset++; - break; - - case MAC_LTE_PAYLOAD_TAG: - /* Have reached data, so set payload length and get out of loop */ - p_mac_lte_info->length= tvb_length_remaining(tvb, offset); - continue; - - default: - /* It must be a recognised tag */ - return FALSE; - } - } - - /* Pass out where offset is now */ - *p_offset = offset; - - return TRUE; -} - -/* Heuristic dissector looks for supported framing protocol (see wiki page) */ -static gboolean dissect_mac_lte_heur(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree) -{ - gint offset = 0; - struct mac_lte_info *p_mac_lte_info; - tvbuff_t *mac_tvb; - gboolean infoAlreadySet = FALSE; - - /* This is a heuristic dissector, which means we get all the UDP - * traffic not sent to a known dissector and not claimed by - * a heuristic dissector called before us! - */ - - if (!global_mac_lte_heur) { - return FALSE; - } - - /* Do this again on re-dissection to re-discover offset of actual PDU */ - - /* Needs to be at least as long as: - - the signature string - - fixed header bytes - - tag for data - - at least one byte of MAC PDU payload */ - if ((size_t)tvb_length_remaining(tvb, offset) < (strlen(MAC_LTE_START_STRING)+3+2)) { - return FALSE; - } - - /* OK, compare with signature string */ - if (tvb_strneql(tvb, offset, MAC_LTE_START_STRING, strlen(MAC_LTE_START_STRING)) != 0) { - return FALSE; - } - - offset += (gint)strlen(MAC_LTE_START_STRING); - - /* If redissecting, use previous info struct (if available) */ - p_mac_lte_info = p_get_proto_data(pinfo->fd, proto_mac_lte); - - if (p_mac_lte_info == NULL) { - /* Allocate new info struct for this frame */ - p_mac_lte_info = se_alloc0(sizeof(struct mac_lte_info)); - infoAlreadySet = FALSE; - } else { - infoAlreadySet = TRUE; - } - - /* Dissect the fields to populate p_mac_lte */ - if (!dissect_mac_lte_context_fields(p_mac_lte_info, tvb, &offset)) { - return FALSE; - } - - - if (!infoAlreadySet) { - /* Store info in packet */ - p_add_proto_data(pinfo->fd, proto_mac_lte, p_mac_lte_info); - } - - /**************************************/ - /* OK, now dissect as MAC LTE */ - - /* Create tvb that starts at actual MAC PDU */ - mac_tvb = tvb_new_subset(tvb, offset, -1, tvb_reported_length(tvb)-offset); - dissect_mac_lte(mac_tvb, pinfo, tree); - - return TRUE; -} - - -/* Write the given formatted text to: - - the info column (if pinfo != NULL) - - 1 or 2 other labels (optional) -*/ -static void write_pdu_label_and_info(proto_item *ti1, proto_item *ti2, - packet_info *pinfo, const char *format, ...) -{ -#define MAX_INFO_BUFFER 256 - static char info_buffer[MAX_INFO_BUFFER]; - - va_list ap; - - va_start(ap, format); - g_vsnprintf(info_buffer, MAX_INFO_BUFFER, format, ap); - va_end(ap); - - /* Add to indicated places */ - if (pinfo != NULL) { - col_append_str(pinfo->cinfo, COL_INFO, info_buffer); - } - - if (ti1 != NULL) { - proto_item_append_text(ti1, "%s", info_buffer); - } - - if (ti2 != NULL) { - proto_item_append_text(ti2, "%s", info_buffer); - } -} - -/* Show extra PHY parameters (if present) */ -static void show_extra_phy_parameters(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree, - struct mac_lte_info *p_mac_lte_info) -{ - proto_item *phy_ti; - proto_tree *phy_tree; - proto_item *ti; - - if (global_mac_lte_layer_to_show == ShowPHYLayer) { - /* Clear the info column */ - col_clear(pinfo->cinfo, COL_INFO); - } - - if (p_mac_lte_info->direction == DIRECTION_UPLINK) { - if (p_mac_lte_info->detailed_phy_info.ul_info.present) { - - /* Create root */ - phy_ti = proto_tree_add_string_format(tree, hf_mac_lte_context_phy_ul, - tvb, 0, 0, "", "UL PHY Context"); - phy_tree = proto_item_add_subtree(phy_ti, ett_mac_lte_phy_context); - PROTO_ITEM_SET_GENERATED(phy_ti); - - /* Add items */ - ti = proto_tree_add_uint(phy_tree, hf_mac_lte_context_phy_ul_modulation_type, - tvb, 0, 0, - p_mac_lte_info->detailed_phy_info.ul_info.modulation_type); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_uint(phy_tree, hf_mac_lte_context_phy_ul_tbs_index, - tvb, 0, 0, - p_mac_lte_info->detailed_phy_info.ul_info.tbs_index); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_uint(phy_tree, hf_mac_lte_context_phy_ul_resource_block_length, - tvb, 0, 0, - p_mac_lte_info->detailed_phy_info.ul_info.resource_block_length); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_uint(phy_tree, hf_mac_lte_context_phy_ul_resource_block_start, - tvb, 0, 0, - p_mac_lte_info->detailed_phy_info.ul_info.resource_block_start); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_uint(phy_tree, hf_mac_lte_context_phy_ul_harq_id, - tvb, 0, 0, - p_mac_lte_info->detailed_phy_info.ul_info.harq_id); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_uint(phy_tree, hf_mac_lte_context_phy_ul_ndi, - tvb, 0, 0, - p_mac_lte_info->detailed_phy_info.ul_info.ndi); - PROTO_ITEM_SET_GENERATED(ti); - - - proto_item_append_text(phy_ti, " ("); - - write_pdu_label_and_info(phy_ti, NULL, - (global_mac_lte_layer_to_show == ShowPHYLayer) ? pinfo : NULL, - "UL: UEId=%u RNTI=%u %s Tbs_Index=%u RB_len=%u RB_start=%u", - p_mac_lte_info->ueid, - p_mac_lte_info->rnti, - val_to_str_const(p_mac_lte_info->detailed_phy_info.ul_info.modulation_type, - modulation_type_vals, "Unknown"), - p_mac_lte_info->detailed_phy_info.ul_info.tbs_index, - p_mac_lte_info->detailed_phy_info.ul_info.resource_block_length, - p_mac_lte_info->detailed_phy_info.ul_info.resource_block_start); - - proto_item_append_text(phy_ti, ")"); - - /* Don't want columns to be replaced now */ - if (global_mac_lte_layer_to_show == ShowPHYLayer) { - col_set_writable(pinfo->cinfo, FALSE); - } - } - } else { - if (p_mac_lte_info->detailed_phy_info.dl_info.present) { - - /* Create root */ - phy_ti = proto_tree_add_string_format(tree, hf_mac_lte_context_phy_dl, - tvb, 0, 0, "", "DL PHY Context"); - phy_tree = proto_item_add_subtree(phy_ti, ett_mac_lte_phy_context); - PROTO_ITEM_SET_GENERATED(phy_ti); - - /* Add items */ - ti = proto_tree_add_uint(phy_tree, hf_mac_lte_context_phy_dl_dci_format, - tvb, 0, 0, - p_mac_lte_info->detailed_phy_info.dl_info.dci_format); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_uint(phy_tree, hf_mac_lte_context_phy_dl_resource_allocation_type, - tvb, 0, 0, - p_mac_lte_info->detailed_phy_info.dl_info.resource_allocation_type); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_uint(phy_tree, hf_mac_lte_context_phy_dl_aggregation_level, - tvb, 0, 0, - p_mac_lte_info->detailed_phy_info.dl_info.aggregation_level); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_uint(phy_tree, hf_mac_lte_context_phy_dl_mcs_index, - tvb, 0, 0, - p_mac_lte_info->detailed_phy_info.dl_info.mcs_index); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_uint(phy_tree, hf_mac_lte_context_phy_dl_redundancy_version_index, - tvb, 0, 0, - p_mac_lte_info->detailed_phy_info.dl_info.redundancy_version_index); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_boolean(phy_tree, hf_mac_lte_context_phy_dl_retx, - tvb, 0, 0, - p_mac_lte_info->dl_retx); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_uint(phy_tree, hf_mac_lte_context_phy_dl_resource_block_length, - tvb, 0, 0, - p_mac_lte_info->detailed_phy_info.dl_info.resource_block_length); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_uint(phy_tree, hf_mac_lte_context_phy_dl_crc_status, - tvb, 0, 0, - p_mac_lte_info->detailed_phy_info.dl_info.crc_status); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_uint(phy_tree, hf_mac_lte_context_phy_dl_harq_id, - tvb, 0, 0, - p_mac_lte_info->detailed_phy_info.dl_info.harq_id); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_uint(phy_tree, hf_mac_lte_context_phy_dl_ndi, - tvb, 0, 0, - p_mac_lte_info->detailed_phy_info.dl_info.ndi); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_uint(phy_tree, hf_mac_lte_context_phy_dl_tb, - tvb, 0, 0, - p_mac_lte_info->detailed_phy_info.dl_info.transport_block); - PROTO_ITEM_SET_GENERATED(ti); - - - proto_item_append_text(phy_ti, " ("); - - write_pdu_label_and_info(phy_ti, NULL, - (global_mac_lte_layer_to_show == ShowPHYLayer) ? pinfo : NULL, - "DL: UEId=%u RNTI=%u DCI_Format=%s Res_Alloc=%u Aggr_Level=%s MCS=%u RV=%u " - "Res_Block_len=%u CRC_status=%s HARQ_id=%u NDI=%u", - p_mac_lte_info->ueid, - p_mac_lte_info->rnti, - val_to_str_const(p_mac_lte_info->detailed_phy_info.dl_info.dci_format, - dci_format_vals, "Unknown"), - p_mac_lte_info->detailed_phy_info.dl_info.resource_allocation_type, - val_to_str_const(p_mac_lte_info->detailed_phy_info.dl_info.aggregation_level, - aggregation_level_vals, "Unknown"), - p_mac_lte_info->detailed_phy_info.dl_info.mcs_index, - p_mac_lte_info->detailed_phy_info.dl_info.redundancy_version_index, - p_mac_lte_info->detailed_phy_info.dl_info.resource_block_length, - val_to_str_const(p_mac_lte_info->detailed_phy_info.dl_info.crc_status, - crc_status_vals, "Unknown"), - p_mac_lte_info->detailed_phy_info.dl_info.harq_id, - p_mac_lte_info->detailed_phy_info.dl_info.ndi); - proto_item_append_text(phy_ti, ")"); - - /* Don't want columns to be replaced now */ - if (global_mac_lte_layer_to_show == ShowPHYLayer) { - col_set_writable(pinfo->cinfo, FALSE); - } - } - } -} - - -/* Dissect a single Random Access Reponse body */ -static gint dissect_rar_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - proto_item *pdu_ti, - gint offset, guint8 rapid) -{ - guint8 reserved; - guint start_body_offset = offset; - proto_item *ti; - proto_item *rar_body_ti; - proto_tree *rar_body_tree; - proto_tree *ul_grant_tree; - proto_item *ul_grant_ti; - guint16 timing_advance; - guint32 ul_grant; - guint16 temp_crnti; - - /* Create tree for this Body */ - rar_body_ti = proto_tree_add_item(tree, - hf_mac_lte_rar_body, - tvb, offset, 0, ENC_ASCII|ENC_NA); - rar_body_tree = proto_item_add_subtree(rar_body_ti, ett_mac_lte_rar_body); - - /* Dissect an RAR entry */ - - /* Check reserved bit */ - reserved = (tvb_get_guint8(tvb, offset) & 0x80) >> 7; - ti = proto_tree_add_item(rar_body_tree, hf_mac_lte_rar_reserved2, tvb, offset, 1, ENC_BIG_ENDIAN); - - if (reserved != 0) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "RAR body Reserved bit not zero (found 0x%x)", reserved); - } - - /* Timing Advance */ - timing_advance = (tvb_get_ntohs(tvb, offset) & 0x7ff0) >> 4; - ti = proto_tree_add_item(rar_body_tree, hf_mac_lte_rar_ta, tvb, offset, 2, ENC_BIG_ENDIAN); - - if (timing_advance != 0) { - expert_add_info_format(pinfo, ti, PI_SEQUENCE, (timing_advance <= 31) ? PI_NOTE : PI_WARN, - "RAR Timing advance not zero (%u)", timing_advance); - } - - offset++; - - /* UL Grant */ - ul_grant = (tvb_get_ntohl(tvb, offset) & 0x0fffff00) >> 8; - ul_grant_ti = proto_tree_add_item(rar_body_tree, hf_mac_lte_rar_ul_grant, tvb, offset, 3, ENC_BIG_ENDIAN); - - /* Break these 20 bits down as described in 36.213, section 6.2 */ - /* Create subtree for UL grant break-down */ - ul_grant_tree = proto_item_add_subtree(ul_grant_ti, ett_mac_lte_rar_ul_grant); - - /* Hopping flag (1 bit) */ - proto_tree_add_item(ul_grant_tree, hf_mac_lte_rar_ul_grant_hopping, - tvb, offset, 1, ENC_BIG_ENDIAN); - - /* Fixed sized resource block assignment (10 bits) */ - proto_tree_add_item(ul_grant_tree, hf_mac_lte_rar_ul_grant_fsrba, - tvb, offset, 2, ENC_BIG_ENDIAN); - - /* Truncated Modulation and coding scheme (4 bits) */ - proto_tree_add_item(ul_grant_tree, hf_mac_lte_rar_ul_grant_tmcs, - tvb, offset+1, 2, ENC_BIG_ENDIAN); - - /* TPC command for scheduled PUSCH (3 bits) */ - proto_tree_add_item(ul_grant_tree, hf_mac_lte_rar_ul_grant_tcsp, - tvb, offset+2, 1, ENC_BIG_ENDIAN); - - /* UL delay (1 bit) */ - proto_tree_add_item(ul_grant_tree, hf_mac_lte_rar_ul_grant_ul_delay, - tvb, offset+2, 1, ENC_BIG_ENDIAN); - - /* CQI request (1 bit) */ - proto_tree_add_item(ul_grant_tree, hf_mac_lte_rar_ul_grant_cqi_request, - tvb, offset+2, 1, ENC_BIG_ENDIAN); - - offset += 3; - - /* Temporary C-RNTI */ - temp_crnti = tvb_get_ntohs(tvb, offset); - proto_tree_add_item(rar_body_tree, hf_mac_lte_rar_temporary_crnti, tvb, offset, 2, ENC_BIG_ENDIAN); - offset += 2; - - write_pdu_label_and_info(pdu_ti, rar_body_ti, pinfo, - "(RAPID=%u: TA=%u, UL-Grant=%u, Temp C-RNTI=%u) ", - rapid, timing_advance, ul_grant, temp_crnti); - - proto_item_set_len(rar_body_ti, offset-start_body_offset); - - return offset; -} - - -#define MAX_RAR_PDUS 64 -/* Dissect Random Access Reponse (RAR) PDU */ -static void dissect_rar(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *pdu_ti, - gint offset, mac_lte_info *p_mac_lte_info, mac_lte_tap_info *tap_info) -{ - gint number_of_rars = 0; /* No of RAR bodies expected following headers */ - guint8 *rapids = ep_alloc(MAX_RAR_PDUS * sizeof(guint8)); - gboolean backoff_indicator_seen = FALSE; - guint8 backoff_indicator = 0; - guint8 extension; - gint n; - proto_tree *rar_headers_tree; - proto_item *ti; - proto_item *rar_headers_ti; - proto_item *padding_length_ti; - int start_headers_offset = offset; - - write_pdu_label_and_info(pdu_ti, NULL, pinfo, - "RAR (RA-RNTI=%u, SF=%u) ", - p_mac_lte_info->rnti, p_mac_lte_info->subframeNumber); - - /* Create hidden 'virtual root' so can filter on mac-lte.rar */ - ti = proto_tree_add_item(tree, hf_mac_lte_rar, tvb, offset, -1, ENC_NA); - PROTO_ITEM_SET_HIDDEN(ti); - - /* Create headers tree */ - rar_headers_ti = proto_tree_add_item(tree, - hf_mac_lte_rar_headers, - tvb, offset, 0, ENC_ASCII|ENC_NA); - rar_headers_tree = proto_item_add_subtree(rar_headers_ti, ett_mac_lte_rar_headers); - - - /***************************/ - /* Read the header entries */ - do { - int start_header_offset = offset; - proto_tree *rar_header_tree; - proto_item *rar_header_ti; - guint8 type_value; - guint8 first_byte = tvb_get_guint8(tvb, offset); - - /* Create tree for this header */ - rar_header_ti = proto_tree_add_item(rar_headers_tree, - hf_mac_lte_rar_header, - tvb, offset, 0, ENC_ASCII|ENC_NA); - rar_header_tree = proto_item_add_subtree(rar_header_ti, ett_mac_lte_rar_header); - - /* Extension */ - extension = (first_byte & 0x80) >> 7; - proto_tree_add_item(rar_header_tree, hf_mac_lte_rar_extension, tvb, offset, 1, ENC_BIG_ENDIAN); - - /* Type */ - type_value = (first_byte & 0x40) >> 6; - proto_tree_add_item(rar_header_tree, hf_mac_lte_rar_t, tvb, offset, 1, ENC_BIG_ENDIAN); - - if (type_value == 0) { - /* Backoff Indicator (BI) case */ - - guint8 reserved; - proto_item *tii; - proto_item *bi_ti; - - /* 2 Reserved bits */ - reserved = (tvb_get_guint8(tvb, offset) & 0x30) >> 4; - tii = proto_tree_add_item(rar_header_tree, hf_mac_lte_rar_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); - - if (reserved != 0) { - expert_add_info_format(pinfo, tii, PI_MALFORMED, PI_ERROR, - "RAR header Reserved bits not zero (found 0x%x)", reserved); - } - - /* Backoff Indicator */ - backoff_indicator = tvb_get_guint8(tvb, offset) & 0x0f; - bi_ti = proto_tree_add_item(rar_header_tree, hf_mac_lte_rar_bi, tvb, offset, 1, ENC_BIG_ENDIAN); - - /* As of March 2009 spec, it must be first, and may only appear once */ - if (backoff_indicator_seen) { - expert_add_info_format(pinfo, bi_ti, PI_MALFORMED, PI_ERROR, - "MAC RAR PDU has > 1 Backoff Indicator subheader present"); - } - - backoff_indicator_seen = TRUE; - - write_pdu_label_and_info(pdu_ti, rar_header_ti, pinfo, - "(Backoff Indicator=%sms)", - val_to_str_const(backoff_indicator, rar_bi_vals, "Illegal-value ")); - - /* If present, it must be the first subheader */ - if (number_of_rars > 0) { - expert_add_info_format(pinfo, bi_ti, PI_MALFORMED, PI_WARN, - "Backoff Indicator must appear as first subheader"); - } - - } else { - /* RAPID case */ - /* TODO: complain if the same RAPID appears twice in same frame? */ - rapids[number_of_rars] = tvb_get_guint8(tvb, offset) & 0x3f; - proto_tree_add_item(rar_header_tree, hf_mac_lte_rar_rapid, tvb, offset, 1, ENC_BIG_ENDIAN); - - proto_item_append_text(rar_header_ti, "(RAPID=%u)", rapids[number_of_rars]); - - number_of_rars++; - } - - offset++; - - /* Finalise length of header tree selection */ - proto_item_set_len(rar_header_ti, offset - start_header_offset); - - } while (extension && number_of_rars < MAX_RAR_PDUS); - - /* Append summary to headers root */ - proto_item_append_text(rar_headers_ti, " (%u RARs", number_of_rars); - - if (backoff_indicator_seen) { - proto_item_append_text(rar_headers_ti, ", BI=%sms)", - val_to_str_const(backoff_indicator, rar_bi_vals, "Illegal-value ")); - } else { - proto_item_append_text(rar_headers_ti, ")"); - } - - /* Set length for headers root */ - proto_item_set_len(rar_headers_ti, offset-start_headers_offset); - - - /***************************/ - /* Read any indicated RARs */ - for (n=0; n < number_of_rars; n++) { - offset = dissect_rar_entry(tvb, pinfo, tree, pdu_ti, offset, rapids[n]); - } - - /* Update TAP info */ - tap_info->number_of_rars += number_of_rars; - - /* Padding may follow */ - if (tvb_length_remaining(tvb, offset) > 0) { - proto_tree_add_item(tree, hf_mac_lte_padding_data, - tvb, offset, -1, ENC_NA); - } - - padding_length_ti = proto_tree_add_int(tree, hf_mac_lte_padding_length, - tvb, offset, 0, - p_mac_lte_info->length - offset); - PROTO_ITEM_SET_GENERATED(padding_length_ti); - - /* Update padding bytes in stats */ - tap_info->padding_bytes += (p_mac_lte_info->length - offset); -} - - -/* Dissect BCH PDU */ -static void dissect_bch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - proto_item *pdu_ti, - int offset, mac_lte_info *p_mac_lte_info) -{ - proto_item *ti; - - write_pdu_label_and_info(pdu_ti, NULL, pinfo, - "BCH PDU (%u bytes, on %s transport) ", - tvb_length_remaining(tvb, offset), - val_to_str_const(p_mac_lte_info->rntiType, - bch_transport_channel_vals, - "Unknown")); - - /* Show which transport layer it came in on (inferred from RNTI type) */ - ti = proto_tree_add_uint(tree, hf_mac_lte_context_bch_transport_channel, - tvb, offset, 0, p_mac_lte_info->rntiType); - PROTO_ITEM_SET_GENERATED(ti); - - /****************************************/ - /* Whole frame is BCH data */ - - /* Raw data */ - ti = proto_tree_add_item(tree, hf_mac_lte_bch_pdu, - tvb, offset, -1, ENC_NA); - - if (global_mac_lte_attempt_rrc_decode) { - /* Attempt to decode payload using LTE RRC dissector */ - tvbuff_t *rrc_tvb = tvb_new_subset(tvb, offset, -1, tvb_length_remaining(tvb, offset)); - - /* Get appropriate dissector handle */ - dissector_handle_t protocol_handle = 0; - - if (p_mac_lte_info->rntiType == SI_RNTI) { - protocol_handle = find_dissector("lte_rrc.bcch_dl_sch"); - } else { - protocol_handle = find_dissector("lte_rrc.bcch_bch"); - } - - /* Hide raw view of bytes */ - PROTO_ITEM_SET_HIDDEN(ti); - - call_with_catch_all(protocol_handle, rrc_tvb, pinfo, tree); - } - - /* Check that this *is* downlink! */ - if (p_mac_lte_info->direction == DIRECTION_UPLINK) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "BCH data should not be received in Uplink!"); - } -} - - -/* Dissect PCH PDU */ -static void dissect_pch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - proto_item *pdu_ti, int offset, guint8 direction) -{ - proto_item *ti; - - write_pdu_label_and_info(pdu_ti, NULL, pinfo, - "PCH PDU (%u bytes) ", - tvb_length_remaining(tvb, offset)); - - /****************************************/ - /* Whole frame is PCH data */ - - /* Always show as raw data */ - ti = proto_tree_add_item(tree, hf_mac_lte_pch_pdu, - tvb, offset, -1, ENC_NA); - - if (global_mac_lte_attempt_rrc_decode) { - - /* Attempt to decode payload using LTE RRC dissector */ - tvbuff_t *rrc_tvb = tvb_new_subset(tvb, offset, -1, tvb_length_remaining(tvb, offset)); - - /* Get appropriate dissector handle */ - dissector_handle_t protocol_handle = find_dissector("lte-rrc.pcch"); - - /* Hide raw view of bytes */ - PROTO_ITEM_SET_HIDDEN(ti); - - /* Call it (catch exceptions so that stats will be updated) */ - TRY { - call_dissector_only(protocol_handle, rrc_tvb, pinfo, tree); - } - CATCH_ALL { - } - ENDTRY - } - - /* Check that this *is* downlink! */ - if (direction == DIRECTION_UPLINK) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "PCH data should not be received in Uplink!"); - } -} - - -/* Does this header entry correspond to a fixed-sized control element? */ -static int is_fixed_sized_control_element(guint8 lcid, guint8 direction) -{ - if (direction == DIRECTION_UPLINK) { - /* Uplink */ - switch (lcid) { - case POWER_HEADROOM_REPORT_LCID: - case CRNTI_LCID: - case TRUNCATED_BSR_LCID: - case SHORT_BSR_LCID: - case LONG_BSR_LCID: - return TRUE; - - default: - return FALSE; - } - } else { - /* Assume Downlink */ - switch (lcid) { - case ACTIVATION_DEACTIVATION_LCID: - case UE_CONTENTION_RESOLUTION_IDENTITY_LCID: - case TIMING_ADVANCE_LCID: - case DRX_COMMAND_LCID: - return TRUE; - - default: - return FALSE; - } - } -} - - -/* Is this a BSR report header? */ -static int is_bsr_lcid(guint8 lcid) -{ - return ((lcid == TRUNCATED_BSR_LCID) || - (lcid == SHORT_BSR_LCID) || - (lcid == LONG_BSR_LCID)); -} - - -/* Helper function to call RLC dissector for SDUs (where channel params are known) */ -static void call_rlc_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - proto_item *pdu_ti, - int offset, guint16 data_length, - guint8 mode, guint8 direction, guint16 ueid, - guint16 channelType, guint16 channelId, - guint8 UMSequenceNumberLength, - guint8 priority) -{ - tvbuff_t *srb_tvb = tvb_new_subset(tvb, offset, data_length, data_length); - struct rlc_lte_info *p_rlc_lte_info; - - /* Get RLC dissector handle */ - volatile dissector_handle_t protocol_handle = find_dissector("rlc-lte"); - - /* Resuse or create RLC info */ - p_rlc_lte_info = p_get_proto_data(pinfo->fd, proto_rlc_lte); - - if (p_rlc_lte_info == NULL) { - p_rlc_lte_info = se_alloc0(sizeof(struct rlc_lte_info)); - } - - /* Fill in struct details for srb channels */ - p_rlc_lte_info->rlcMode = mode; - p_rlc_lte_info->direction = direction; - p_rlc_lte_info->priority = priority; - p_rlc_lte_info->ueid = ueid; - p_rlc_lte_info->channelType = channelType; - p_rlc_lte_info->channelId = channelId; - p_rlc_lte_info->pduLength = data_length; - p_rlc_lte_info->UMSequenceNumberLength = UMSequenceNumberLength; - - /* Store info in packet */ - p_add_proto_data(pinfo->fd, proto_rlc_lte, p_rlc_lte_info); - - if (global_mac_lte_layer_to_show != ShowRLCLayer) { - /* Don't want these columns replaced */ - col_set_writable(pinfo->cinfo, FALSE); - } else { - /* Clear info column before first RLC PDU */ - if (s_number_of_rlc_pdus_shown == 0) { - col_clear(pinfo->cinfo, COL_INFO); - } else { - /* Add a separator and protect column contents here */ - write_pdu_label_and_info(pdu_ti, NULL, pinfo, " || "); - col_set_fence(pinfo->cinfo, COL_INFO); - } - } - - s_number_of_rlc_pdus_shown++; - - /* Call it (catch exceptions so that stats will be updated) */ - TRY { - call_dissector_only(protocol_handle, srb_tvb, pinfo, tree); - } - CATCH_ALL { - } - ENDTRY - - /* Let columns be written to again */ - col_set_writable(pinfo->cinfo, TRUE); -} - - -/* For DL frames, look for previous Tx. Add link back if found */ -static void TrackReportedDLHARQResend(packet_info *pinfo, tvbuff_t *tvb, volatile int length, - proto_tree *tree, mac_lte_info *p_mac_lte_info) -{ - DLHARQResult *result = NULL; - DLHARQResult *original_result = NULL; - - /* If don't have detailed DL PHy info, just give up */ - if (!p_mac_lte_info->detailed_phy_info.dl_info.present) { - return; - } - - /* TDD may not work... */ - - if (!pinfo->fd->flags.visited) { - /* First time, so set result and update DL harq table */ - LastFrameData *lastData = NULL; - LastFrameData *thisData = NULL; - - DLHarqBuffers *ueData; - - /* Read these for convenience */ - guint8 harq_id = p_mac_lte_info->detailed_phy_info.dl_info.harq_id; - guint8 transport_block = p_mac_lte_info->detailed_phy_info.dl_info.transport_block; - - /* Check harq-id bounds, give up if invalid */ - if ((harq_id >= 15) || (transport_block+1 > 2)) { - return; - } - - /* Look up entry for this UE/RNTI */ - ueData = g_hash_table_lookup(mac_lte_dl_harq_hash, GUINT_TO_POINTER((guint)p_mac_lte_info->rnti)); - - if (ueData != NULL) { - /* Get previous info for this harq-id */ - lastData = &(ueData->harqid[transport_block][harq_id]); - - if (lastData->inUse) { - /* Compare time difference, ndi, data to see if this looks like a retx */ - if ((length == lastData->length) && - (p_mac_lte_info->detailed_phy_info.dl_info.ndi == lastData->ndi) && - tvb_memeql(tvb, 0, lastData->data, MIN(lastData->length, MAX_EXPECTED_PDU_LENGTH)) == 0) { - - /* Work out gap between frames */ - gint seconds_between_packets = (gint) - (pinfo->fd->abs_ts.secs - lastData->received_time.secs); - gint nseconds_between_packets = - pinfo->fd->abs_ts.nsecs - lastData->received_time.nsecs; - - /* Round difference to nearest millisecond */ - gint total_gap = (seconds_between_packets*1000) + - ((nseconds_between_packets+500000) / 1000000); - - /* Expect to be within (say) 8-13 subframes since previous */ - if ((total_gap >= 8) && (total_gap <= 13)) { - - /* Resend detected! Store result pointing back. */ - result = se_alloc0(sizeof(DLHARQResult)); - result->previousSet = TRUE; - result->previousFrameNum = lastData->framenum; - result->timeSincePreviousFrame = total_gap; - g_hash_table_insert(mac_lte_dl_harq_result_hash, GUINT_TO_POINTER(pinfo->fd->num), result); - - /* Now make previous frame point forward to here */ - original_result = g_hash_table_lookup(mac_lte_dl_harq_result_hash, GUINT_TO_POINTER(lastData->framenum)); - - if (original_result == NULL) { - original_result = se_alloc0(sizeof(ULHARQResult)); - g_hash_table_insert(mac_lte_dl_harq_result_hash, GUINT_TO_POINTER(lastData->framenum), original_result); - } - - original_result->nextSet = TRUE; - original_result->nextFrameNum = pinfo->fd->num; - original_result->timeToNextFrame = total_gap; - } - } - } - } else { - /* Allocate entry in table for this UE/RNTI */ - ueData = se_alloc0(sizeof(DLHarqBuffers)); - g_hash_table_insert(mac_lte_dl_harq_hash, GUINT_TO_POINTER((guint)p_mac_lte_info->rnti), ueData); - } - - /* Store this frame's details in table */ - thisData = &(ueData->harqid[transport_block][harq_id]); - thisData->inUse = TRUE; - thisData->length = length; - tvb_memcpy(tvb, thisData->data, 0, MIN(thisData->length, MAX_EXPECTED_PDU_LENGTH)); - thisData->ndi = p_mac_lte_info->detailed_phy_info.dl_info.ndi; - thisData->framenum = pinfo->fd->num; - thisData->received_time = pinfo->fd->abs_ts; - } else { - /* Not first time, so just set whats already stored in result */ - result = g_hash_table_lookup(mac_lte_dl_harq_result_hash, GUINT_TO_POINTER(pinfo->fd->num)); - } - - - /***************************************************/ - /* Show link back to original frame (if available) */ - if (result != NULL) { - if (result->previousSet) { - proto_item *gap_ti; - proto_item *original_ti = proto_tree_add_uint(tree, hf_mac_lte_dl_harq_resend_original_frame, - tvb, 0, 0, result->previousFrameNum); - PROTO_ITEM_SET_GENERATED(original_ti); - - gap_ti = proto_tree_add_uint(tree, hf_mac_lte_dl_harq_resend_time_since_previous_frame, - tvb, 0, 0, result->timeSincePreviousFrame); - PROTO_ITEM_SET_GENERATED(gap_ti); - } - - if (result->nextSet) { - proto_item *gap_ti; - proto_item *next_ti = proto_tree_add_uint(tree, hf_mac_lte_dl_harq_resend_next_frame, - tvb, 0, 0, result->nextFrameNum); - PROTO_ITEM_SET_GENERATED(next_ti); - - gap_ti = proto_tree_add_uint(tree, hf_mac_lte_dl_harq_resend_time_until_next_frame, - tvb, 0, 0, result->timeToNextFrame); - PROTO_ITEM_SET_GENERATED(gap_ti); - } - - } -} - - -/* Return TRUE if the given packet is thought to be a retx */ -int is_mac_lte_frame_retx(packet_info *pinfo, guint8 direction) -{ - struct mac_lte_info *p_mac_lte_info = p_get_proto_data(pinfo->fd, proto_mac_lte); - - if (direction == DIRECTION_UPLINK) { - /* For UL, retx count is stored in per-packet struct */ - return ((p_mac_lte_info != NULL) && (p_mac_lte_info->reTxCount > 0)); - } else { - /* Use answer if told directly */ - if (p_mac_lte_info->dl_retx == dl_retx_yes) { - return TRUE; - } else { - /* Otherwise look up in table */ - DLHARQResult *result = g_hash_table_lookup(mac_lte_dl_harq_result_hash, GUINT_TO_POINTER(pinfo->fd->num)); - return ((result != NULL) && result->previousSet); - } - } -} - - -/* Track UL frames, so that when a retx is indicated, we can search for - the original tx. We will either find it, and provide a link back to it, - or flag that we couldn't find as an expert error */ -static void TrackReportedULHARQResend(packet_info *pinfo, tvbuff_t *tvb, volatile int offset, - proto_tree *tree, mac_lte_info *p_mac_lte_info, - proto_item *retx_ti) -{ - ULHARQResult *result = NULL; - - /* If don't have detailed DL PHY info, just give up */ - if (!p_mac_lte_info->detailed_phy_info.ul_info.present) { - return; - } - - /* Give up if harqid is out of range */ - if (p_mac_lte_info->detailed_phy_info.ul_info.harq_id >= 8) { - return; - } - - if (!pinfo->fd->flags.visited) { - /* First time, so set result and update UL harq table */ - LastFrameData *lastData = NULL; - LastFrameData *thisData = NULL; - - /* Look up entry for this UE/RNTI */ - ULHarqBuffers *ueData = - g_hash_table_lookup(mac_lte_ul_harq_hash, GUINT_TO_POINTER((guint)p_mac_lte_info->rnti)); - - if (ueData != NULL) { - if (p_mac_lte_info->reTxCount >= 1) { - /* Looking for frame previously on this harq-id */ - lastData = &(ueData->harqid[p_mac_lte_info->detailed_phy_info.ul_info.harq_id]); - - if (lastData->inUse) { - /* Compare time, sf, data to see if this looks like a retx */ - if ((tvb_length_remaining(tvb, offset) == lastData->length) && - (p_mac_lte_info->detailed_phy_info.ul_info.ndi == lastData->ndi) && - tvb_memeql(tvb, offset, lastData->data, MIN(lastData->length, MAX_EXPECTED_PDU_LENGTH)) == 0) { - - /* Work out gap between frames */ - gint seconds_between_packets = (gint) - (pinfo->fd->abs_ts.secs - lastData->received_time.secs); - gint nseconds_between_packets = - pinfo->fd->abs_ts.nsecs - lastData->received_time.nsecs; - - /* Round to nearest ms */ - gint total_gap = (seconds_between_packets*1000) + - ((nseconds_between_packets+500000) / 1000000); - - /* Could be as many as max-tx (which we don't know) * 8ms ago. - 32 is the most I've seen... */ - if (total_gap <= 33) { - ULHARQResult *original_result = NULL; - - /* Original detected!!! Store result pointing back */ - result = se_alloc0(sizeof(ULHARQResult)); - result->previousSet = TRUE; - result->previousFrameNum = lastData->framenum; - result->timeSincePreviousFrame = total_gap; - g_hash_table_insert(mac_lte_ul_harq_result_hash, GUINT_TO_POINTER(pinfo->fd->num), result); - - /* Now make previous frame point forward to here */ - original_result = g_hash_table_lookup(mac_lte_ul_harq_result_hash, GUINT_TO_POINTER(lastData->framenum)); - - if (original_result == NULL) { - original_result = se_alloc0(sizeof(ULHARQResult)); - g_hash_table_insert(mac_lte_ul_harq_result_hash, GUINT_TO_POINTER(lastData->framenum), original_result); - } - - original_result->nextSet = TRUE; - original_result->nextFrameNum = pinfo->fd->num; - original_result->timeToNextFrame = total_gap; - } - } - } - } - } else { - /* Allocate entry in table for this UE/RNTI */ - ueData = se_alloc0(sizeof(ULHarqBuffers)); - g_hash_table_insert(mac_lte_ul_harq_hash, GUINT_TO_POINTER((guint)p_mac_lte_info->rnti), ueData); - } - - /* Store this frame's details in table */ - thisData = &(ueData->harqid[p_mac_lte_info->detailed_phy_info.ul_info.harq_id]); - thisData->inUse = TRUE; - thisData->length = tvb_length_remaining(tvb, offset); - tvb_memcpy(tvb, thisData->data, offset, MIN(thisData->length, MAX_EXPECTED_PDU_LENGTH)); - thisData->ndi = p_mac_lte_info->detailed_phy_info.ul_info.ndi; - thisData->framenum = pinfo->fd->num; - thisData->received_time = pinfo->fd->abs_ts; - } else { - /* Not first time, so just get whats already stored in result */ - result = g_hash_table_lookup(mac_lte_ul_harq_result_hash, GUINT_TO_POINTER(pinfo->fd->num)); - } - - /* Show any link back to previous Tx */ - if (retx_ti != NULL) { - if (result != NULL) { - if (result->previousSet) { - proto_item *original_ti, *gap_ti; - - original_ti = proto_tree_add_uint(tree, hf_mac_lte_ul_harq_resend_original_frame, - tvb, 0, 0, result->previousFrameNum); - PROTO_ITEM_SET_GENERATED(original_ti); - - gap_ti = proto_tree_add_uint(tree, hf_mac_lte_ul_harq_resend_time_since_previous_frame, - tvb, 0, 0, result->timeSincePreviousFrame); - PROTO_ITEM_SET_GENERATED(gap_ti); - } - } else { - expert_add_info_format(pinfo, retx_ti, PI_SEQUENCE, PI_ERROR, - "Original Tx of UL frame not found (UE %u) !!", p_mac_lte_info->ueid); - } - } - - /* Show link forward to any known next Tx */ - if ((result != NULL) && result->nextSet) { - proto_item *next_ti, *gap_ti; - - next_ti = proto_tree_add_uint(tree, hf_mac_lte_ul_harq_resend_next_frame, - tvb, 0, 0, result->nextFrameNum); - expert_add_info_format(pinfo, next_ti, PI_SEQUENCE, PI_WARN, - "UL MAC PDU (UE %u) needed to be retransmitted", p_mac_lte_info->ueid); - - PROTO_ITEM_SET_GENERATED(next_ti); - - gap_ti = proto_tree_add_uint(tree, hf_mac_lte_ul_harq_resend_time_until_next_frame, - tvb, 0, 0, result->timeToNextFrame); - PROTO_ITEM_SET_GENERATED(gap_ti); - } -} - - -/* Look up SRResult associated with a given frame. Will create one if necessary - if can_create is set */ -static SRResult *GetSRResult(guint32 frameNum, gboolean can_create) -{ - SRResult *result; - result = g_hash_table_lookup(mac_lte_sr_request_hash, GUINT_TO_POINTER(frameNum)); - - if ((result == NULL) && can_create) { - result = se_alloc0(sizeof(SRResult)); - g_hash_table_insert(mac_lte_sr_request_hash, GUINT_TO_POINTER((guint)frameNum), result); - } - - return result; -} - - -/* Keep track of SR requests, failures and related grants, in order to show them - as generated fields in these frames */ -static void TrackSRInfo(SREvent event, packet_info *pinfo, proto_tree *tree, - tvbuff_t *tvb, mac_lte_info *p_mac_lte_info, gint idx, proto_item *event_ti) -{ - SRResult *result = NULL; - SRState *state; - SRResult *resultForSRFrame = NULL; - - guint16 rnti; - guint16 ueid; - proto_item *ti; - - /* Get appropriate identifiers */ - if (event == SR_Request) { - rnti = p_mac_lte_info->oob_rnti[idx]; - ueid = p_mac_lte_info->oob_ueid[idx]; - } else { - rnti = p_mac_lte_info->rnti; - ueid = p_mac_lte_info->ueid; - } - - /* Create state for this RNTI if necessary */ - state = g_hash_table_lookup(mac_lte_ue_sr_state, GUINT_TO_POINTER((guint)rnti)); - - if (state == NULL) { - /* Allocate status for this RNTI */ - state = se_alloc(sizeof(SRState)); - state->status = None; - g_hash_table_insert(mac_lte_ue_sr_state, GUINT_TO_POINTER((guint)rnti), state); - } - - /* First time through - update state with new info */ - if (!pinfo->fd->flags.visited) { - guint32 timeSinceRequest; - - /* Store time of request */ - if (event == SR_Request) { - state->requestTime = pinfo->fd->abs_ts; - } - - switch (state->status) { - case None: - switch (event) { - case SR_Grant: - /* Got another grant - fine */ - - /* update state */ - state->lastGrantFramenum = pinfo->fd->num; - break; - - case SR_Request: - /* Sent an SR - fine */ - - /* Update state */ - state->status = SR_Outstanding; - state->lastSRFramenum = pinfo->fd->num; - break; - - case SR_Failure: - /* This is an error, since we hadn't send an SR... */ - result = GetSRResult(pinfo->fd->num, TRUE); - result->type = InvalidSREvent; - result->status = None; - result->event = SR_Failure; - break; - } - - break; - - case SR_Outstanding: - timeSinceRequest = (guint32)(((pinfo->fd->abs_ts.secs - state->requestTime.secs) * 1000) + - ((pinfo->fd->abs_ts.nsecs - state->requestTime.nsecs) / 1000000)); - - switch (event) { - case SR_Grant: - /* Got grant we were waiting for, so state goes to None */ - - /* Update state */ - state->status = None; - - /* Set result info */ - result = GetSRResult(pinfo->fd->num, TRUE); - result->type = GrantAnsweringSR; - result->frameNum = state->lastSRFramenum; - result->timeDifference = timeSinceRequest; - - /* Also set forward link for SR */ - resultForSRFrame = GetSRResult(state->lastSRFramenum, TRUE); - resultForSRFrame->type = SRLeadingToGrant; - resultForSRFrame->frameNum = pinfo->fd->num; - resultForSRFrame->timeDifference = timeSinceRequest; - break; - - case SR_Request: - /* Another request when already have one pending */ - result = GetSRResult(pinfo->fd->num, TRUE); - result->type = InvalidSREvent; - result->status = SR_Outstanding; - result->event = SR_Request; - break; - - case SR_Failure: - /* We sent an SR but it failed */ - - /* Update state */ - state->status = SR_Failed; - - /* Set result info for failure frame */ - result = GetSRResult(pinfo->fd->num, TRUE); - result->type = FailureAnsweringSR; - result->frameNum = state->lastSRFramenum; - result->timeDifference = timeSinceRequest; - - /* Also set forward link for SR */ - resultForSRFrame = GetSRResult(state->lastSRFramenum, TRUE); - resultForSRFrame->type = SRLeadingToFailure; - resultForSRFrame->frameNum = pinfo->fd->num; - resultForSRFrame->timeDifference = timeSinceRequest; - break; - } - - break; - - case SR_Failed: - switch (event) { - case SR_Grant: - /* Got a grant, presumably after a subsequent RACH - fine */ - - /* Update state */ - state->status = None; - break; - - case SR_Request: - /* Tried another SR after previous one failed. - Presumably a subsequent RACH was tried in-between... */ - - state->status = SR_Outstanding; - - result = GetSRResult(pinfo->fd->num, TRUE); - result->status = SR_Outstanding; - result->event = SR_Request; - break; - - case SR_Failure: - /* 2 failures in a row.... */ - result = GetSRResult(pinfo->fd->num, TRUE); - result->type = InvalidSREvent; - result->status = SR_Failed; - result->event = SR_Failure; - break; - } - - break; - } - } - - /* Get stored result for this frame */ - result = GetSRResult(pinfo->fd->num, FALSE); - - if (result == NULL) { - /* For an SR frame, there should always be either a PDCCH grant or indication - that the SR has failed */ - if (event == SR_Request) { - expert_add_info_format(pinfo, event_ti, PI_SEQUENCE, PI_ERROR, - "UE %u: SR results in neither a grant nor a failure indication", - ueid); - } - - return; - } - - - /* Show result info */ - switch (result->type) { - case GrantAnsweringSR: - ti = proto_tree_add_uint(tree, hf_mac_lte_grant_answering_sr, - tvb, 0, 0, result->frameNum); - PROTO_ITEM_SET_GENERATED(ti); - ti = proto_tree_add_uint(tree, hf_mac_lte_sr_time_since_request, - tvb, 0, 0, result->timeDifference); - PROTO_ITEM_SET_GENERATED(ti); - break; - - case FailureAnsweringSR: - ti = proto_tree_add_uint(tree, hf_mac_lte_failure_answering_sr, - tvb, 0, 0, result->frameNum); - PROTO_ITEM_SET_GENERATED(ti); - ti = proto_tree_add_uint(tree, hf_mac_lte_sr_time_since_request, - tvb, 0, 0, result->timeDifference); - PROTO_ITEM_SET_GENERATED(ti); - break; - - case SRLeadingToGrant: - ti = proto_tree_add_uint(tree, hf_mac_lte_sr_leading_to_grant, - tvb, 0, 0, result->frameNum); - PROTO_ITEM_SET_GENERATED(ti); - ti = proto_tree_add_uint(tree, hf_mac_lte_sr_time_until_answer, - tvb, 0, 0, result->timeDifference); - PROTO_ITEM_SET_GENERATED(ti); - - break; - - case SRLeadingToFailure: - ti = proto_tree_add_uint(tree, hf_mac_lte_sr_leading_to_failure, - tvb, 0, 0, result->frameNum); - PROTO_ITEM_SET_GENERATED(ti); - ti = proto_tree_add_uint(tree, hf_mac_lte_sr_time_until_answer, - tvb, 0, 0, result->timeDifference); - PROTO_ITEM_SET_GENERATED(ti); - break; - - case InvalidSREvent: - ti = proto_tree_add_none_format(tree, hf_mac_lte_sr_invalid_event, - tvb, 0, 0, "UE %u: Invalid SR event - state=%s, event=%s", - ueid, - val_to_str_const(result->status, sr_status_vals, "Unknown"), - val_to_str_const(result->event, sr_event_vals, "Unknown")); - PROTO_ITEM_SET_GENERATED(ti); - expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_ERROR, - "Invalid SR event for UE %u (C-RNTI %u) - state=%s, event=%s", - ueid, rnti, - val_to_str_const(result->status, sr_status_vals, "Unknown"), - val_to_str_const(result->event, sr_event_vals, "Unknown")); - break; - } -} - - -/********************************************************/ -/* Count number of UEs/TTI (in both directions) */ -/********************************************************/ - -/* For keeping track during first pass */ -typedef struct tti_info_t { - guint16 subframe; - nstime_t ttiStartTime; - guint ues_in_tti; -} tti_info_t; - -static tti_info_t UL_tti_info; -static tti_info_t DL_tti_info; - -/* For associating with frame and displaying */ -typedef struct TTIInfoResult_t { - guint ues_in_tti; -} TTIInfoResult_t; - -/* This table stores (FrameNumber -> *TTIInfoResult_t). It is assigned during the first - pass and used thereafter */ -static GHashTable *mac_lte_tti_info_result_hash = NULL; - - -/* Work out which UE this is within TTI (within direction). Return answer */ -static guint16 count_ues_tti(mac_lte_info *p_mac_lte_info, packet_info *pinfo) -{ - gboolean same_tti = FALSE; - tti_info_t *tti_info; - - /* Just return any previous result */ - TTIInfoResult_t *result = g_hash_table_lookup(mac_lte_tti_info_result_hash, GUINT_TO_POINTER(pinfo->fd->num)); - - if (result != NULL) { - return result->ues_in_tti; - } - - /* Set tti_info based upon direction */ - if (p_mac_lte_info->direction == DIRECTION_UPLINK) { - tti_info = &UL_tti_info; - } else { - tti_info = &DL_tti_info; - } - - /* Work out if we are still in the same tti as before */ - if (tti_info->subframe == p_mac_lte_info->subframeNumber) { - gint seconds_between_packets = (gint) - (pinfo->fd->abs_ts.secs - tti_info->ttiStartTime.secs); - gint nseconds_between_packets = - pinfo->fd->abs_ts.nsecs - tti_info->ttiStartTime.nsecs; - - /* Round difference to nearest microsecond */ - gint total_us_gap = (seconds_between_packets*1000000) + - ((nseconds_between_packets+500) / 1000); - - if (total_us_gap < 1000) { - same_tti = TRUE; - } - } - - /* Update global state */ - if (!same_tti) { - tti_info->subframe = p_mac_lte_info->subframeNumber; - tti_info->ttiStartTime = pinfo->fd->abs_ts; - tti_info->ues_in_tti = 1; - } else { - tti_info->ues_in_tti++; - } - - /* Set result state for this frame */ - result = se_alloc(sizeof(TTIInfoResult_t)); - result->ues_in_tti = tti_info->ues_in_tti; - g_hash_table_insert(mac_lte_tti_info_result_hash, - GUINT_TO_POINTER(pinfo->fd->num), result); - - return tti_info->ues_in_tti; -} - - -/* Show which UE this is (within direction) for this TTI */ -static void show_ues_tti(packet_info *pinfo, mac_lte_info *p_mac_lte_info, tvbuff_t *tvb, proto_tree *context_tree) -{ - /* Look up result */ - TTIInfoResult_t *result = g_hash_table_lookup(mac_lte_tti_info_result_hash, GUINT_TO_POINTER(pinfo->fd->num)); - - if (result != NULL) { - proto_item *ti = proto_tree_add_uint(context_tree, - (p_mac_lte_info->direction == DIRECTION_UPLINK) ? - hf_mac_lte_ues_ul_per_tti : - hf_mac_lte_ues_dl_per_tti, - tvb, 0, 0, result->ues_in_tti); - PROTO_ITEM_SET_GENERATED(ti); - } -} - - - -/* Lookup channel details for lcid */ -static void lookup_rlc_channel_from_lcid(guint8 lcid, - rlc_channel_type_t *rlc_channel_type, - guint8 *UM_seqnum_length, - gint *drb_id) -{ - /* Zero params (in case no match is found) */ - *rlc_channel_type = rlcRaw; - *UM_seqnum_length = 0; - *drb_id = 0; - - if (global_mac_lte_lcid_drb_source == (int)FromStaticTable) { - - /* Look up in static (UAT) table */ - guint m; - - for (m=0; m < num_lcid_drb_mappings; m++) { - if (lcid == lcid_drb_mappings[m].lcid) { - - *rlc_channel_type = lcid_drb_mappings[m].channel_type; - - /* Set UM_seqnum_length */ - switch (*rlc_channel_type) { - case rlcUM5: - *UM_seqnum_length = 5; - break; - - case rlcUM10: - *UM_seqnum_length = 10; - break; - - default: - break; - } - - /* Set drb_id */ - *drb_id = lcid_drb_mappings[m].drbid; - break; - } - } - } else { - /* Look up setting gleaned from configuration protocol */ - if (!dynamic_lcid_drb_mapping[lcid].valid) { - return; - } - - *rlc_channel_type = dynamic_lcid_drb_mapping[lcid].channel_type; - - /* Set UM_seqnum_length */ - switch (*rlc_channel_type) { - case rlcUM5: - *UM_seqnum_length = 5; - break; - - case rlcUM10: - *UM_seqnum_length = 10; - break; - - default: - break; - } - - /* Set drb_id */ - *drb_id = dynamic_lcid_drb_mapping[lcid].drbid; - } -} - - - -#define MAX_HEADERS_IN_PDU 1024 - -/* UL-SCH and DL-SCH formats have much in common, so handle them in a common - function */ -static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - proto_item *pdu_ti, - volatile guint32 offset, guint8 direction, - mac_lte_info *p_mac_lte_info, mac_lte_tap_info *tap_info, - proto_item *retx_ti, - proto_tree *context_tree) -{ - guint8 extension; - volatile guint16 n; - proto_item *truncated_ti; - proto_item *padding_length_ti; - proto_item *hidden_root_ti; - - /* Keep track of LCIDs and lengths as we dissect the header */ - volatile guint16 number_of_headers = 0; - guint8 lcids[MAX_HEADERS_IN_PDU]; - gint16 pdu_lengths[MAX_HEADERS_IN_PDU]; - - proto_item *pdu_header_ti; - proto_tree *pdu_header_tree; - - gboolean have_seen_data_header = FALSE; - guint8 number_of_padding_subheaders = 0; - gboolean have_seen_non_padding_control = FALSE; - gboolean have_seen_bsr = FALSE; - gboolean expecting_body_data = FALSE; - volatile guint32 is_truncated = FALSE; - - /* Maintain/show UEs/TTI count */ - tap_info->ueInTTI = count_ues_tti(p_mac_lte_info, pinfo); - show_ues_tti(pinfo, p_mac_lte_info, tvb, context_tree); - - write_pdu_label_and_info(pdu_ti, NULL, pinfo, - "%s: (SF=%u) UEId=%-3u ", - (direction == DIRECTION_UPLINK) ? "UL-SCH" : "DL-SCH", - p_mac_lte_info->subframeNumber, - p_mac_lte_info->ueid); - - tap_info->raw_length = p_mac_lte_info->length; - - /* For uplink frames, if this is logged as a resend, look for original tx */ - if (direction == DIRECTION_UPLINK) { - TrackReportedULHARQResend(pinfo, tvb, offset, tree, p_mac_lte_info, retx_ti); - } - - /* For uplink grants, update SR status. N.B. only newTx grant should stop SR */ - if ((direction == DIRECTION_UPLINK) && (p_mac_lte_info->reTxCount == 0) && - global_mac_lte_track_sr) { - - TrackSRInfo(SR_Grant, pinfo, tree, tvb, p_mac_lte_info, 0, NULL); - } - - /* Add hidden item to filter on */ - hidden_root_ti = proto_tree_add_string_format(tree, - (direction == DIRECTION_UPLINK) ? - hf_mac_lte_ulsch : - hf_mac_lte_dlsch, - tvb, offset, 0, - "", - "Hidden header"); - PROTO_ITEM_SET_HIDDEN(hidden_root_ti); - - /* Add PDU block header subtree */ - pdu_header_ti = proto_tree_add_string_format(tree, - (direction == DIRECTION_UPLINK) ? - hf_mac_lte_ulsch_header : - hf_mac_lte_dlsch_header, - tvb, offset, 0, - "", - "MAC PDU Header"); - pdu_header_tree = proto_item_add_subtree(pdu_header_ti, - (direction == DIRECTION_UPLINK) ? - ett_mac_lte_ulsch_header : - ett_mac_lte_dlsch_header); - - - /************************************************************************/ - /* Dissect each sub-header. */ - do { - guint8 reserved; - guint64 length = 0; - proto_item *pdu_subheader_ti; - proto_tree *pdu_subheader_tree; - proto_item *lcid_ti; - proto_item *ti; - gint offset_start_subheader = offset; - guint8 first_byte = tvb_get_guint8(tvb, offset); - - /* Add PDU block header subtree. - Default with length of 1 byte. */ - pdu_subheader_ti = proto_tree_add_string_format(pdu_header_tree, - hf_mac_lte_sch_subheader, - tvb, offset, 1, - "", - "Sub-header"); - pdu_subheader_tree = proto_item_add_subtree(pdu_subheader_ti, - ett_mac_lte_sch_subheader); - - /* Check 1st 2 reserved bits */ - reserved = (first_byte & 0xc0) >> 6; - ti = proto_tree_add_item(pdu_subheader_tree, hf_mac_lte_sch_reserved, - tvb, offset, 1, ENC_BIG_ENDIAN); - - if (reserved != 0) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "%cL-SCH header Reserved bits not zero", - (p_mac_lte_info->direction == DIRECTION_UPLINK) ? 'U' : 'D'); - } - - /* Extended bit */ - extension = (first_byte & 0x20) >> 5; - proto_tree_add_item(pdu_subheader_tree, hf_mac_lte_sch_extended, - tvb, offset, 1, ENC_BIG_ENDIAN); - - /* LCID. Has different meaning depending upon direction. */ - lcids[number_of_headers] = first_byte & 0x1f; - - if (direction == DIRECTION_UPLINK) { - - lcid_ti = proto_tree_add_item(pdu_subheader_tree, hf_mac_lte_ulsch_lcid, - tvb, offset, 1, ENC_BIG_ENDIAN); - write_pdu_label_and_info(pdu_ti, NULL, pinfo, - "(%s", - val_to_str_const(lcids[number_of_headers], - ulsch_lcid_vals, "(Unknown LCID)")); - } else { - /* Downlink */ - lcid_ti = proto_tree_add_item(pdu_subheader_tree, hf_mac_lte_dlsch_lcid, - tvb, offset, 1, ENC_BIG_ENDIAN); - write_pdu_label_and_info(pdu_ti, NULL, pinfo, - "(%s", - val_to_str_const(lcids[number_of_headers], - dlsch_lcid_vals, "(Unknown LCID)")); - - if (lcids[number_of_headers] == DRX_COMMAND_LCID) { - expert_add_info_format(pinfo, lcid_ti, PI_SEQUENCE, PI_NOTE, - "DRX command received for UE %u (RNTI %u)", - p_mac_lte_info->ueid, p_mac_lte_info->rnti); - } - } - - offset++; - - /* Remember if we've seen a data subheader */ - if (lcids[number_of_headers] <= 10) { - have_seen_data_header = TRUE; - expecting_body_data = TRUE; - } - - /* Show an expert item if a contol subheader (except Padding) appears - *after* a data PDU */ - if (have_seen_data_header && - (lcids[number_of_headers] > 10) && (lcids[number_of_headers] != PADDING_LCID)) { - expert_add_info_format(pinfo, lcid_ti, PI_MALFORMED, PI_ERROR, - "%cL-SCH Control subheaders should not appear after data subheaders", - (p_mac_lte_info->direction == DIRECTION_UPLINK) ? 'U' : 'D'); - return; - } - - /* Show an expert item if we're seeing more then one BSR in a frame */ - if ((direction == DIRECTION_UPLINK) && is_bsr_lcid(lcids[number_of_headers])) { - if (have_seen_bsr) { - expert_add_info_format(pinfo, lcid_ti, PI_MALFORMED, PI_ERROR, - "There shouldn't be > 1 BSR in a frame"); - return; - } - - have_seen_bsr = TRUE; - } - - /* Should not see padding after non-padding control... */ - if ((lcids[number_of_headers] > 10) && - (lcids[number_of_headers] == PADDING_LCID) && - extension) { - number_of_padding_subheaders++; - - if (number_of_padding_subheaders > 2) { - expert_add_info_format(pinfo, lcid_ti, PI_MALFORMED, PI_WARN, - "Should not see more than 2 padding subheaders in one frame"); - } - - if (have_seen_non_padding_control) { - expert_add_info_format(pinfo, lcid_ti, PI_MALFORMED, PI_ERROR, - "Padding should come before other control subheaders!"); - } - } - - /* Remember that we've seen non-padding control */ - if ((lcids[number_of_headers] > 10) && - (lcids[number_of_headers] != PADDING_LCID)) { - have_seen_non_padding_control = TRUE; - } - - - - /********************************************************************/ - /* Length field follows if not the last header or for a fixed-sized - control element */ - if (!extension) { - /* Last one... */ - if (is_fixed_sized_control_element(lcids[number_of_headers], direction)) { - pdu_lengths[number_of_headers] = 0; - } else { - pdu_lengths[number_of_headers] = -1; - } - } else { - /* Not the last one */ - if (!is_fixed_sized_control_element(lcids[number_of_headers], direction) && - (lcids[number_of_headers] != PADDING_LCID)) { - - guint8 format; - - /* F(ormat) bit tells us how long the length field is */ - format = (tvb_get_guint8(tvb, offset) & 0x80) >> 7; - proto_tree_add_item(pdu_subheader_tree, hf_mac_lte_sch_format, - tvb, offset, 1, ENC_BIG_ENDIAN); - - /* Now read length field itself */ - if (format) { - /* >= 128 - use 15 bits */ - proto_tree_add_bits_ret_val(pdu_subheader_tree, hf_mac_lte_sch_length, - tvb, offset*8 + 1, 15, &length, ENC_BIG_ENDIAN); - - offset += 2; - } else { - /* Less than 128 - only 7 bits */ - proto_tree_add_bits_ret_val(pdu_subheader_tree, hf_mac_lte_sch_length, - tvb, offset*8 + 1, 7, &length, ENC_BIG_ENDIAN); - offset++; - } - - pdu_lengths[number_of_headers] = (gint16)length; - } else { - pdu_lengths[number_of_headers] = 0; - } - } - - - /* Close off description in info column */ - switch (pdu_lengths[number_of_headers]) { - case 0: - write_pdu_label_and_info(pdu_ti, NULL, pinfo, ") "); - break; - - case -1: - write_pdu_label_and_info(pdu_ti, NULL, pinfo, ":remainder) "); - break; - - default: - write_pdu_label_and_info(pdu_ti, NULL, pinfo, ":%u bytes) ", - pdu_lengths[number_of_headers]); - break; - } - - /* Append summary to subheader root */ - proto_item_append_text(pdu_subheader_ti, " (lcid=%s", - val_to_str_const(lcids[number_of_headers], - (direction == DIRECTION_UPLINK) ? - ulsch_lcid_vals : - dlsch_lcid_vals, - "Unknown")); - - switch (pdu_lengths[number_of_headers]) { - case -1: - proto_item_append_text(pdu_subheader_ti, ", length is remainder)"); - proto_item_append_text(pdu_header_ti, " (%s:remainder)", - val_to_str_const(lcids[number_of_headers], - (direction == DIRECTION_UPLINK) ? ulsch_lcid_vals : dlsch_lcid_vals, - "Unknown")); - break; - - case 0: - proto_item_append_text(pdu_subheader_ti, ")"); - proto_item_append_text(pdu_header_ti, " (%s)", - val_to_str_const(lcids[number_of_headers], - (direction == DIRECTION_UPLINK) ? ulsch_lcid_vals : dlsch_lcid_vals, - "Unknown")); - break; - - default: - proto_item_append_text(pdu_subheader_ti, ", length=%u)", - pdu_lengths[number_of_headers]); - proto_item_append_text(pdu_header_ti, " (%s:%u)", - val_to_str_const(lcids[number_of_headers], - (direction == DIRECTION_UPLINK) ? ulsch_lcid_vals : dlsch_lcid_vals, - "Unknown"), - pdu_lengths[number_of_headers]); - break; - } - - - /* Flag unknown lcid values in expert info */ - if (match_strval(lcids[number_of_headers], - (direction == DIRECTION_UPLINK) ? ulsch_lcid_vals : dlsch_lcid_vals) == NULL) { - expert_add_info_format(pinfo, pdu_subheader_ti, PI_MALFORMED, PI_ERROR, - "%cL-SCH: Unexpected LCID received (%u)", - (p_mac_lte_info->direction == DIRECTION_UPLINK) ? 'U' : 'D', - lcids[number_of_headers]); - } - - /* Set length of this subheader */ - proto_item_set_len(pdu_subheader_ti, offset - offset_start_subheader); - - number_of_headers++; - } while ((number_of_headers < MAX_HEADERS_IN_PDU) && extension); - - /* Check that we didn't reach the end of the subheader array... */ - if (number_of_headers >= MAX_HEADERS_IN_PDU) { - proto_item *ti = proto_tree_add_text(tree, tvb, offset, 1, - "Reached %u subheaders - frame obviously malformed", - MAX_HEADERS_IN_PDU); - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "Reached %u subheaders - frame obviously malformed", - MAX_HEADERS_IN_PDU); - return; - } - - - /* Append summary to overall PDU header root */ - proto_item_append_text(pdu_header_ti, " [%u subheaders]", - number_of_headers); - - /* And set its length to offset */ - proto_item_set_len(pdu_header_ti, offset); - - - /* For DL, see if this is a retx. Use whole PDU present (i.e. ignore padding if not logged) */ - if (direction == DIRECTION_DOWNLINK) { - /* Result will be added to context tree */ - TrackReportedDLHARQResend(pinfo, tvb, tvb_length_remaining(tvb, 0), context_tree, p_mac_lte_info); - - tap_info->isPHYRetx = (p_mac_lte_info->dl_retx == dl_retx_yes); - } - - - /************************************************************************/ - /* Dissect SDUs / control elements / padding. */ - /************************************************************************/ - - /* Dissect control element bodies first */ - - for (n=0; n < number_of_headers; n++) { - /* Get out of loop once see any data SDU subheaders */ - if (lcids[n] <= 10) { - break; - } - - /* Process what should be a valid control PDU type */ - if (direction == DIRECTION_DOWNLINK) { - - /****************************/ - /* DL-SCH Control PDUs */ - switch (lcids[n]) { - case ACTIVATION_DEACTIVATION_LCID: { - proto_item *ad_ti; - proto_tree *ad_tree; - proto_item *ti; - guint8 reserved; - - /* Create AD root */ - ad_ti = proto_tree_add_string_format(tree, - hf_mac_lte_control_activation_deactivation, - tvb, offset, 1, - "", - "Activation/Deactivation"); - ad_tree = proto_item_add_subtree(ad_ti, ett_mac_lte_activation_deactivation); - - proto_tree_add_item(ad_tree, hf_mac_lte_control_activation_deactivation_c7, - tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(ad_tree, hf_mac_lte_control_activation_deactivation_c6, - tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(ad_tree, hf_mac_lte_control_activation_deactivation_c5, - tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(ad_tree, hf_mac_lte_control_activation_deactivation_c4, - tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(ad_tree, hf_mac_lte_control_activation_deactivation_c3, - tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(ad_tree, hf_mac_lte_control_activation_deactivation_c2, - tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(ad_tree, hf_mac_lte_control_activation_deactivation_c1, - tvb, offset, 1, ENC_BIG_ENDIAN); - ti = proto_tree_add_item(ad_tree, hf_mac_lte_control_activation_deactivation_reserved, - tvb, offset, 1, ENC_BIG_ENDIAN); - reserved = tvb_get_guint8(tvb, offset) & 0x01; - - if (reserved != 0) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "Activation/Deactivation Reserved bit not zero"); - } - - offset++; - } - break; - - case UE_CONTENTION_RESOLUTION_IDENTITY_LCID: { - proto_item *cr_ti; - proto_tree *cr_tree; - proto_item *ti; - ContentionResolutionResult *crResult; - - /* Create CR root */ - cr_ti = proto_tree_add_string_format(tree, - hf_mac_lte_control_ue_contention_resolution, - tvb, offset, 6, - "", - "Contention Resolution"); - cr_tree = proto_item_add_subtree(cr_ti, ett_mac_lte_contention_resolution); - - - proto_tree_add_item(cr_tree, hf_mac_lte_control_ue_contention_resolution_identity, - tvb, offset, 6, ENC_NA); - - /* Get pointer to result struct for this frame */ - crResult = g_hash_table_lookup(mac_lte_cr_result_hash, GUINT_TO_POINTER(pinfo->fd->num)); - - if (crResult == NULL) { - - /* Need to set result by looking for and comparing with Msg3 */ - Msg3Data *msg3Data; - guint msg3Key = p_mac_lte_info->rnti; - - /* Allocate result and add it to the table */ - crResult = se_alloc(sizeof(ContentionResolutionResult)); - g_hash_table_insert(mac_lte_cr_result_hash, GUINT_TO_POINTER(pinfo->fd->num), crResult); - - /* Look for Msg3 */ - msg3Data = g_hash_table_lookup(mac_lte_msg3_hash, GUINT_TO_POINTER(msg3Key)); - - /* Compare CCCH bytes */ - if (msg3Data != NULL) { - crResult->msSinceMsg3 = (guint32)(((pinfo->fd->abs_ts.secs - msg3Data->msg3Time.secs) * 1000) + - ((pinfo->fd->abs_ts.nsecs - msg3Data->msg3Time.nsecs) / 1000000)); - crResult->msg3FrameNum = msg3Data->framenum; - - /* Compare the 6 bytes */ - if (tvb_memeql(tvb, offset, msg3Data->data, 6) == 0) { - crResult->status = Msg3Match; - } else { - crResult->status = Msg3NoMatch; - } - } else { - crResult->status = NoMsg3; - } - } - - /* Now show CR result in tree */ - switch (crResult->status) { - case NoMsg3: - proto_item_append_text(cr_ti, " (no corresponding Msg3 found!)"); - break; - - case Msg3Match: - ti = proto_tree_add_uint(cr_tree, hf_mac_lte_control_ue_contention_resolution_msg3, - tvb, 0, 0, crResult->msg3FrameNum); - PROTO_ITEM_SET_GENERATED(ti); - ti = proto_tree_add_uint(cr_tree, hf_mac_lte_control_ue_contention_resolution_time_since_msg3, - tvb, 0, 0, crResult->msSinceMsg3); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_boolean(cr_tree, hf_mac_lte_control_ue_contention_resolution_msg3_matched, - tvb, 0, 0, TRUE); - PROTO_ITEM_SET_GENERATED(ti); - proto_item_append_text(cr_ti, " (matches Msg3 from frame %u, %ums ago)", - crResult->msg3FrameNum, crResult->msSinceMsg3); - break; - - case Msg3NoMatch: - ti = proto_tree_add_uint(cr_tree, hf_mac_lte_control_ue_contention_resolution_msg3, - tvb, 0, 0, crResult->msg3FrameNum); - PROTO_ITEM_SET_GENERATED(ti); - ti = proto_tree_add_uint(cr_tree, hf_mac_lte_control_ue_contention_resolution_time_since_msg3, - tvb, 0, 0, crResult->msSinceMsg3); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_boolean(cr_tree, hf_mac_lte_control_ue_contention_resolution_msg3_matched, - tvb, 0, 0, FALSE); - expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_WARN, - "CR body in Msg4 doesn't match Msg3 CCCH in frame %u", - crResult->msg3FrameNum); - PROTO_ITEM_SET_GENERATED(ti); - proto_item_append_text(cr_ti, " (doesn't match Msg3 from frame %u, %u ago)", - crResult->msg3FrameNum, crResult->msSinceMsg3); - break; - }; - - offset += 6; - } - break; - - case TIMING_ADVANCE_LCID: { - proto_item *ta_ti; - proto_item *reserved_ti; - guint8 reserved; - guint8 ta_value; - - /* Check 2 reserved bits */ - reserved = (tvb_get_guint8(tvb, offset) & 0xc0) >> 6; - reserved_ti = proto_tree_add_item(tree, hf_mac_lte_control_timing_advance_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); - - if (reserved != 0) { - expert_add_info_format(pinfo, reserved_ti, PI_MALFORMED, PI_ERROR, - "Timing Advance Reserved bits not zero (found 0x%x)", reserved); - } - - /* TA value */ - ta_value = tvb_get_guint8(tvb, offset) & 0x3f; - ta_ti = proto_tree_add_item(tree, hf_mac_lte_control_timing_advance, - tvb, offset, 1, ENC_BIG_ENDIAN); - - if (ta_value == 31) { - expert_add_info_format(pinfo, ta_ti, PI_SEQUENCE, - PI_NOTE, - "Timing Advance control element received (no correction needed)"); - } else { - expert_add_info_format(pinfo, ta_ti, PI_SEQUENCE, - PI_WARN, - "Timing Advance control element received (%u) %s correction needed", - ta_value, - (ta_value < 31) ? "-ve" : "+ve"); - } - - offset++; - } - break; - - case DRX_COMMAND_LCID: - /* No payload */ - break; - - case PADDING_LCID: - /* No payload (in this position) */ - tap_info->padding_bytes++; - break; - - default: - break; - } - } else { - - /**********************************/ - /* UL-SCH Control PDUs */ - switch (lcids[n]) { - case EXTENDED_POWER_HEADROOM_REPORT_LCID: { - proto_item *ephr_ti; - proto_tree *ephr_tree; - proto_item *ti; - proto_tree *ephr_cell_tree; - proto_item *ephr_cell_ti; - guint8 scell_bitmap; - guint8 scell_count; - guint8 byte; - guint i; - guint32 curr_offset = offset; - guint32 computed_header_offset; - - if (pdu_lengths[n] == -1) { - /* Control Element size is the remaining PDU */ - pdu_lengths[n] = (gint16)tvb_length_remaining(tvb, curr_offset); - } - - /* Create EPHR root */ - ephr_ti = proto_tree_add_string_format(tree, - hf_mac_lte_control_ext_power_headroom, - tvb, curr_offset, pdu_lengths[n], - "", - "Extended Power Headroom"); - ephr_tree = proto_item_add_subtree(ephr_ti, ett_mac_lte_extended_power_headroom); - - scell_bitmap = tvb_get_guint8(tvb, curr_offset); - proto_tree_add_item(ephr_tree, hf_mac_lte_control_ext_power_headroom_c7, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(ephr_tree, hf_mac_lte_control_ext_power_headroom_c6, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(ephr_tree, hf_mac_lte_control_ext_power_headroom_c5, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(ephr_tree, hf_mac_lte_control_ext_power_headroom_c4, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(ephr_tree, hf_mac_lte_control_ext_power_headroom_c3, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(ephr_tree, hf_mac_lte_control_ext_power_headroom_c2, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(ephr_tree, hf_mac_lte_control_ext_power_headroom_c1, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - /* Check Reserved bit */ - ti = proto_tree_add_item(ephr_tree, hf_mac_lte_control_ext_power_headroom_reserved, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - - if (scell_bitmap & 0x01) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "Extended Power Headroom Reserved bit not zero"); - } - - curr_offset++; - - /* Compute expected header size to deduce if PH Type 2 report is present or not */ - /* First count the number of SCells */ - for (i = 0, scell_count = 0; i < 7; i++) { - if (scell_bitmap & (0x80>>i)) { - scell_count++; - } - } - - /* Now quickly parse the header */ - computed_header_offset = curr_offset; - - for (i = 0; i < scell_count; i++) { - if (tvb_get_guint8(tvb, computed_header_offset) & 0x80) { - computed_header_offset++; - } - - computed_header_offset++; - } - - if ((gint16)(computed_header_offset + 1 - curr_offset) != pdu_lengths[n]) { - /* PH Type 2 is present */ - if (tvb_get_guint8(tvb, computed_header_offset) & 0x80) { - computed_header_offset++; - } - - computed_header_offset++; - - if ((gint16)(computed_header_offset + 1 - curr_offset) != pdu_lengths[n]) { - expert_add_info_format(pinfo, ephr_ti, PI_MALFORMED, PI_ERROR, - "Control Element has an unexpected size (computed=%d, actual=%d)", - computed_header_offset + 1 - curr_offset, pdu_lengths[n]); - offset += pdu_lengths[n]; - break; - } - - byte = tvb_get_guint8(tvb, curr_offset); - ephr_cell_ti = proto_tree_add_text(ephr_tree, tvb, curr_offset, ((byte&0x80)?2:1), "PCell"); - ephr_cell_tree = proto_item_add_subtree(ephr_cell_ti, ett_mac_lte_extended_power_headroom_cell); - proto_tree_add_item(ephr_cell_tree, hf_mac_lte_control_ext_power_headroom_power_backoff, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(ephr_cell_tree, hf_mac_lte_control_ext_power_headroom_value, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(ephr_cell_tree, hf_mac_lte_control_ext_power_headroom_level, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(ephr_cell_ti, " (%s)", - val_to_str_ext_const((byte&0x3f), &power_headroom_vals_ext, "Unknown")); - curr_offset++; - - if (byte & 0x80) { - /* Pcmax,c field is present */ - byte = tvb_get_guint8(tvb, curr_offset); - /* Check 2 Reserved bits */ - ti = proto_tree_add_item(ephr_cell_tree, hf_mac_lte_control_ext_power_headroom_reserved2, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - - if (byte & 0xc0) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "Extended Power Headroom Reserved bits not zero (found 0x%x)", - (byte & 0xc0) >> 6); - } - - proto_tree_add_item(ephr_cell_tree, hf_mac_lte_control_ext_power_headroom_pcmaxc, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(ephr_cell_ti, " (%s)", - val_to_str_ext_const((byte&0x3f), &pcmaxc_vals_ext, "Unknown")); - curr_offset++; - } - } else { - if ((gint16)(computed_header_offset + 1 - curr_offset) != pdu_lengths[n]) { - expert_add_info_format(pinfo, ephr_ti, PI_MALFORMED, PI_ERROR, - "Control Element has an unexpected size (computed=%d, actual=%d)", - computed_header_offset + 1 - curr_offset, pdu_lengths[n]); - offset += pdu_lengths[n]; - break; - } - } - - for (i = 1, scell_bitmap>>=1; i <= 7; i++, scell_bitmap>>=1) { - if (scell_bitmap & 0x01) { - byte = tvb_get_guint8(tvb, curr_offset); - ephr_cell_ti = proto_tree_add_text(ephr_tree, tvb, curr_offset, ((byte&0x80)?2:1), "SCell Index %u", i); - ephr_cell_tree = proto_item_add_subtree(ephr_cell_ti, ett_mac_lte_extended_power_headroom_cell); - proto_tree_add_item(ephr_cell_tree, hf_mac_lte_control_ext_power_headroom_power_backoff, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(ephr_cell_tree, hf_mac_lte_control_ext_power_headroom_value, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(ephr_cell_tree, hf_mac_lte_control_ext_power_headroom_level, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(ephr_cell_ti, " (%s)", - val_to_str_ext_const((byte&0x3f), &power_headroom_vals_ext, "Unknown")); - curr_offset++; - - if (byte & 0x80) { - /* Pcmax,c field is present */ - byte = tvb_get_guint8(tvb, curr_offset); - /* Check 2 Reserved bits */ - ti = proto_tree_add_item(ephr_cell_tree, hf_mac_lte_control_ext_power_headroom_reserved2, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - - if (byte & 0xc0) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "Extended Power Headroom Reserved bits not zero (found 0x%x)", - (byte & 0xc0) >> 6); - } - - proto_tree_add_item(ephr_cell_tree, hf_mac_lte_control_ext_power_headroom_pcmaxc, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(ephr_cell_ti, " (%s)", - val_to_str_ext_const((byte&0x3f), &pcmaxc_vals_ext, "Unknown")); - curr_offset++; - } - } - } - - offset += pdu_lengths[n]; - } - break; - - case POWER_HEADROOM_REPORT_LCID: { - proto_item *phr_ti; - proto_tree *phr_tree; - proto_item *ti; - guint8 reserved; - guint8 level; - - /* Create PHR root */ - phr_ti = proto_tree_add_string_format(tree, - hf_mac_lte_control_power_headroom, - tvb, offset, 1, - "", - "Power Headroom"); - phr_tree = proto_item_add_subtree(phr_ti, ett_mac_lte_power_headroom); - - /* Check 2 Reserved bits */ - reserved = (tvb_get_guint8(tvb, offset) & 0xc0) >> 6; - ti = proto_tree_add_item(phr_tree, hf_mac_lte_control_power_headroom_reserved, - tvb, offset, 1, ENC_BIG_ENDIAN); - - if (reserved != 0) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "Power Headroom Reserved bits not zero (found 0x%x)", reserved); - } - - /* Level */ - level = tvb_get_guint8(tvb, offset) & 0x3f; - proto_tree_add_item(phr_tree, hf_mac_lte_control_power_headroom_level, - tvb, offset, 1, ENC_BIG_ENDIAN); - - /* Show value in root label */ - proto_item_append_text(phr_ti, " (%s)", - val_to_str_ext_const(level, &power_headroom_vals_ext, "Unknown")); - offset++; - } - - - break; - - case CRNTI_LCID: - proto_tree_add_item(tree, hf_mac_lte_control_crnti, - tvb, offset, 2, ENC_BIG_ENDIAN); - offset += 2; - break; - - case TRUNCATED_BSR_LCID: - case SHORT_BSR_LCID: { - proto_tree *bsr_tree; - proto_item *bsr_ti; - proto_item *buffer_size_ti; - guint8 lcgid; - guint8 buffer_size; - int hfindex; - value_string_ext *p_vs_ext; - - if (p_mac_lte_info->isExtendedBSRSizes) { - hfindex = hf_mac_lte_control_short_ext_bsr_buffer_size; - p_vs_ext = &ext_buffer_size_vals_ext; - } else { - hfindex = hf_mac_lte_control_short_bsr_buffer_size; - p_vs_ext = &buffer_size_vals_ext; - } - - bsr_ti = proto_tree_add_string_format(tree, - hf_mac_lte_control_bsr, - tvb, offset, 1, - "", - "Short BSR"); - bsr_tree = proto_item_add_subtree(bsr_ti, ett_mac_lte_bsr); - - /* LCG ID */ - lcgid = (tvb_get_guint8(tvb, offset) & 0xc0) >> 6; - proto_tree_add_item(bsr_tree, hf_mac_lte_control_bsr_lcg_id, - tvb, offset, 1, ENC_BIG_ENDIAN); - /* Buffer Size */ - buffer_size = tvb_get_guint8(tvb, offset) & 0x3f; - buffer_size_ti = proto_tree_add_item(bsr_tree, hfindex, - tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; - - if (buffer_size >= global_mac_lte_bsr_warn_threshold) { - expert_add_info_format(pinfo, buffer_size_ti, PI_SEQUENCE, PI_WARN, - "UE %u - BSR for LCG %u exceeds threshold: %u (%s)", - p_mac_lte_info->ueid, - lcgid, - buffer_size, - val_to_str_ext_const(buffer_size, p_vs_ext, "Unknown")); - } - - - proto_item_append_text(bsr_ti, " (lcgid=%u %s)", - lcgid, - val_to_str_ext_const(buffer_size, &buffer_size_vals_ext, "Unknown")); - } - break; - - case LONG_BSR_LCID: { - proto_tree *bsr_tree; - proto_item *bsr_ti; - proto_item *buffer_size_ti; - guint8 buffer_size[4]; - int hfindex[4]; - value_string_ext *p_vs_ext; - - if (p_mac_lte_info->isExtendedBSRSizes) { - hfindex[0] = hf_mac_lte_control_long_ext_bsr_buffer_size_0; - hfindex[1] = hf_mac_lte_control_long_ext_bsr_buffer_size_1; - hfindex[2] = hf_mac_lte_control_long_ext_bsr_buffer_size_2; - hfindex[3] = hf_mac_lte_control_long_ext_bsr_buffer_size_3; - p_vs_ext = &ext_buffer_size_vals_ext; - } else { - hfindex[0] = hf_mac_lte_control_long_bsr_buffer_size_0; - hfindex[1] = hf_mac_lte_control_long_bsr_buffer_size_1; - hfindex[2] = hf_mac_lte_control_long_bsr_buffer_size_2; - hfindex[3] = hf_mac_lte_control_long_bsr_buffer_size_3; - p_vs_ext = &buffer_size_vals_ext; - } - - bsr_ti = proto_tree_add_string_format(tree, - hf_mac_lte_control_bsr, - tvb, offset, 3, - "", - "Long BSR"); - bsr_tree = proto_item_add_subtree(bsr_ti, ett_mac_lte_bsr); - - /* LCID Group 0 */ - buffer_size_ti = proto_tree_add_item(bsr_tree, hfindex[0], - tvb, offset, 1, ENC_BIG_ENDIAN); - buffer_size[0] = (tvb_get_guint8(tvb, offset) & 0xfc) >> 2; - - if (buffer_size[0] >= global_mac_lte_bsr_warn_threshold) { - expert_add_info_format(pinfo, buffer_size_ti, PI_SEQUENCE, PI_WARN, - "UE %u - BSR for LCG 0 exceeds threshold: %u (%s)", - p_mac_lte_info->ueid, - buffer_size[0], - val_to_str_ext_const(buffer_size[0], p_vs_ext, "Unknown")); - } - - /* LCID Group 1 */ - buffer_size_ti = proto_tree_add_item(bsr_tree, hfindex[1], - tvb, offset, 2, ENC_BIG_ENDIAN); - buffer_size[1] = ((tvb_get_guint8(tvb, offset) & 0x03) << 4) | ((tvb_get_guint8(tvb, offset+1) & 0xf0) >> 4); - offset++; - - if (buffer_size[1] >= global_mac_lte_bsr_warn_threshold) { - expert_add_info_format(pinfo, buffer_size_ti, PI_SEQUENCE, PI_WARN, - "UE %u - BSR for LCG 1 exceeds threshold: %u (%s)", - p_mac_lte_info->ueid, - buffer_size[1], - val_to_str_ext_const(buffer_size[1], p_vs_ext, "Unknown")); - } - - /* LCID Group 2 */ - buffer_size_ti = proto_tree_add_item(bsr_tree, hfindex[2], - tvb, offset, 2, ENC_BIG_ENDIAN); - - buffer_size[2] = ((tvb_get_guint8(tvb, offset) & 0x0f) << 2) | ((tvb_get_guint8(tvb, offset+1) & 0xc0) >> 6); - offset++; - - if (buffer_size[2] >= global_mac_lte_bsr_warn_threshold) { - expert_add_info_format(pinfo, buffer_size_ti, PI_SEQUENCE, PI_WARN, - "UE %u - BSR for LCG 2 exceeds threshold: %u (%s)", - p_mac_lte_info->ueid, - buffer_size[2], - val_to_str_ext_const(buffer_size[2], p_vs_ext, "Unknown")); - } - - /* LCID Group 3 */ - buffer_size_ti = proto_tree_add_item(bsr_tree, hfindex[3], - tvb, offset, 1, ENC_BIG_ENDIAN); - buffer_size[3] = tvb_get_guint8(tvb, offset) & 0x3f; - offset++; - - if (buffer_size[3] >= global_mac_lte_bsr_warn_threshold) { - expert_add_info_format(pinfo, buffer_size_ti, PI_SEQUENCE, PI_WARN, - "UE %u - BSR for LCG 3 exceeds threshold: %u (%s)", - p_mac_lte_info->ueid, - buffer_size[3], - val_to_str_ext_const(buffer_size[3], p_vs_ext, "Unknown")); - } - - /* Append summary to parent */ - proto_item_append_text(bsr_ti, " 0:(%s) 1:(%s) 2:(%s) 3:(%s)", - val_to_str_ext_const(buffer_size[0], p_vs_ext, "Unknown"), - val_to_str_ext_const(buffer_size[1], p_vs_ext, "Unknown"), - val_to_str_ext_const(buffer_size[2], p_vs_ext, "Unknown"), - val_to_str_ext_const(buffer_size[3], p_vs_ext, "Unknown")); - } - break; - - case PADDING_LCID: - /* No payload, in this position */ - tap_info->padding_bytes++; - break; - - default: - break; - } - } - } - - /* There might not be any data, if only headers (plus control data) were logged */ - is_truncated = ((tvb_length_remaining(tvb, offset) == 0) && expecting_body_data); - truncated_ti = proto_tree_add_uint(tree, hf_mac_lte_sch_header_only, tvb, 0, 0, - is_truncated); - - if (is_truncated) { - PROTO_ITEM_SET_GENERATED(truncated_ti); - expert_add_info_format(pinfo, truncated_ti, PI_SEQUENCE, PI_NOTE, - "MAC PDU SDUs have been omitted"); - return; - } else { - PROTO_ITEM_SET_HIDDEN(truncated_ti); - } - - - /* Now process remaining bodies, which should all be data */ - for (; n < number_of_headers; n++) { - - /* Data SDUs treated identically for Uplink or downlink channels */ - proto_item *sdu_ti; - const guint8 *pdu_data; - volatile guint16 data_length; - int i; - char buff[64]; - - /* Break out if meet padding */ - if (lcids[n] == PADDING_LCID) { - break; - } - - /* Work out length */ - data_length = (pdu_lengths[n] == -1) ? - tvb_length_remaining(tvb, offset) : - pdu_lengths[n]; - - /* Dissect SDU as raw bytes */ - sdu_ti = proto_tree_add_bytes_format(tree, hf_mac_lte_sch_sdu, tvb, offset, pdu_lengths[n], - NULL, "SDU (%s, length=%u bytes): ", - val_to_str_const(lcids[n], - (direction == DIRECTION_UPLINK) ? - ulsch_lcid_vals : - dlsch_lcid_vals, - "Unknown"), - data_length); - /* Show bytes too. There must be a nicer way of doing this! */ - pdu_data = tvb_get_ptr(tvb, offset, pdu_lengths[n]); - - for (i=0; i < data_length; i++) { - g_snprintf(buff+(i*2), 3, "%02x", pdu_data[i]); - - if (i >= 30) { - g_snprintf(buff+(i*2), 4, "..."); - break; - } - } - - proto_item_append_text(sdu_ti, "%s", buff); - - - /* Look for Msg3 data so that it may be compared with later - Contention Resolution body */ - if ((lcids[n] == 0) && (direction == DIRECTION_UPLINK) && (data_length == 6)) { - if (!pinfo->fd->flags.visited) { - guint key = p_mac_lte_info->rnti; - Msg3Data *data = g_hash_table_lookup(mac_lte_msg3_hash, GUINT_TO_POINTER(key)); - - /* Look for previous entry for this UE */ - if (data == NULL) { - /* Allocate space for data and add to table */ - data = se_alloc(sizeof(Msg3Data)); - g_hash_table_insert(mac_lte_msg3_hash, GUINT_TO_POINTER(key), data); - } - - /* Fill in data details */ - data->framenum = pinfo->fd->num; - tvb_memcpy(tvb, data->data, offset, data_length); - data->msg3Time = pinfo->fd->abs_ts; - } - } - - /* CCCH frames can be dissected directly by LTE RRC... */ - if ((lcids[n] == 0) && global_mac_lte_attempt_rrc_decode) { - tvbuff_t *rrc_tvb = tvb_new_subset(tvb, offset, data_length, data_length); - - /* Get appropriate dissector handle */ - volatile dissector_handle_t protocol_handle = 0; - - if (p_mac_lte_info->direction == DIRECTION_UPLINK) { - protocol_handle = find_dissector("lte_rrc.ul_ccch"); - } else { - protocol_handle = find_dissector("lte_rrc.dl_ccch"); - } - - /* Hide raw view of bytes */ - PROTO_ITEM_SET_HIDDEN(sdu_ti); - - call_with_catch_all(protocol_handle, rrc_tvb, pinfo, tree); - } - - /* LCID 1 and 2 can be assumed to be srb1&2, so can dissect as RLC AM */ - else if ((lcids[n] == 1) || (lcids[n] == 2)) { - if (global_mac_lte_attempt_srb_decode) { - /* Call RLC dissector */ - call_rlc_dissector(tvb, pinfo, tree, pdu_ti, offset, data_length, - RLC_AM_MODE, direction, p_mac_lte_info->ueid, - CHANNEL_TYPE_SRB, lcids[n], 0, - get_mac_lte_channel_priority(p_mac_lte_info->ueid, - lcids[n], direction)); - - /* Hide raw view of bytes */ - PROTO_ITEM_SET_HIDDEN(sdu_ti); - } - } - - else if ((lcids[n] >= 2) && (lcids[n] <= 10)) { - - /* Look for mapping for this LCID to drb channel set by UAT table */ - rlc_channel_type_t rlc_channel_type; - guint8 UM_seqnum_length; - gint drb_id; - guint8 priority = get_mac_lte_channel_priority(p_mac_lte_info->ueid, - lcids[n], direction); - - lookup_rlc_channel_from_lcid(lcids[n], - &rlc_channel_type, - &UM_seqnum_length, - &drb_id); - - /* Dissect according to channel type */ - switch (rlc_channel_type) { - case rlcUM5: - call_rlc_dissector(tvb, pinfo, tree, pdu_ti, offset, data_length, - RLC_UM_MODE, direction, p_mac_lte_info->ueid, - CHANNEL_TYPE_DRB, (guint16)drb_id, UM_seqnum_length, - priority); - break; - - case rlcUM10: - call_rlc_dissector(tvb, pinfo, tree, pdu_ti, offset, data_length, - RLC_UM_MODE, direction, p_mac_lte_info->ueid, - CHANNEL_TYPE_DRB, (guint16)drb_id, UM_seqnum_length, - priority); - break; - - case rlcAM: - call_rlc_dissector(tvb, pinfo, tree, pdu_ti, offset, data_length, - RLC_AM_MODE, direction, p_mac_lte_info->ueid, - CHANNEL_TYPE_DRB, (guint16)drb_id, 0, - priority); - break; - - case rlcTM: - call_rlc_dissector(tvb, pinfo, tree, pdu_ti, offset, data_length, - RLC_TM_MODE, direction, p_mac_lte_info->ueid, - CHANNEL_TYPE_DRB, (guint16)drb_id, 0, - priority); - break; - - case rlcRaw: - /* Nothing to do! */ - break; - } - - if (rlc_channel_type != rlcRaw) { - /* Hide raw view of bytes */ - PROTO_ITEM_SET_HIDDEN(sdu_ti); - } - - } - - offset += data_length; - - /* Update tap byte count for this channel */ - tap_info->bytes_for_lcid[lcids[n]] += data_length; - tap_info->sdus_for_lcid[lcids[n]]++; - } - - - /* Now padding, if present, extends to the end of the PDU */ - if (lcids[number_of_headers-1] == PADDING_LCID) { - if (tvb_length_remaining(tvb, offset) > 0) { - proto_tree_add_item(tree, hf_mac_lte_padding_data, - tvb, offset, -1, ENC_NA); - } - - padding_length_ti = proto_tree_add_int(tree, hf_mac_lte_padding_length, - tvb, offset, 0, - p_mac_lte_info->length - offset); - PROTO_ITEM_SET_GENERATED(padding_length_ti); - - /* Update padding bytes in stats */ - tap_info->padding_bytes += (p_mac_lte_info->length - offset); - - /* Make sure the PDU isn't bigger than reported! */ - if (offset > p_mac_lte_info->length) { - expert_add_info_format(pinfo, padding_length_ti, PI_MALFORMED, PI_ERROR, - "%s MAC PDU is longer than reported length (reported=%u, actual=%u)", - (direction == DIRECTION_UPLINK) ? "UL-SCH" : "DL-SCH", - p_mac_lte_info->length, offset); - } - } else { - /* There is no padding at the end of the frame */ - if (!is_truncated && (offset < p_mac_lte_info->length)) { - /* There is a problem if we haven't used all of the PDU */ - expert_add_info_format(pinfo, pdu_ti, PI_MALFORMED, PI_ERROR, - "%s PDU for UE %u is shorter than reported length (reported=%u, actual=%u)", - (direction == DIRECTION_UPLINK) ? "UL-SCH" : "DL-SCH", - p_mac_lte_info->ueid, p_mac_lte_info->length, offset); - } - - if (!is_truncated && (offset > p_mac_lte_info->length)) { - /* There is a problem if the PDU is longer than rpeported */ - expert_add_info_format(pinfo, pdu_ti, PI_MALFORMED, PI_ERROR, - "%s PDU for UE %u is longer than reported length (reported=%u, actual=%u)", - (direction == DIRECTION_UPLINK) ? "UL-SCH" : "DL-SCH", - p_mac_lte_info->ueid, p_mac_lte_info->length, offset); - } - } -} - -static void dissect_mch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *pdu_ti, - volatile guint32 offset, mac_lte_info *p_mac_lte_info) -{ - guint8 extension; - volatile guint16 n; - proto_item *truncated_ti; - proto_item *padding_length_ti; - proto_item *hidden_root_ti; - - /* Keep track of LCIDs and lengths as we dissect the header */ - volatile guint16 number_of_headers = 0; - guint8 lcids[MAX_HEADERS_IN_PDU]; - gint16 pdu_lengths[MAX_HEADERS_IN_PDU]; - - proto_item *pdu_header_ti; - proto_tree *pdu_header_tree; - - gboolean have_seen_data_header = FALSE; - guint8 number_of_padding_subheaders = 0; - gboolean have_seen_non_padding_control = FALSE; - gboolean expecting_body_data = FALSE; - volatile guint32 is_truncated = FALSE; - - write_pdu_label_and_info(pdu_ti, NULL, pinfo, - "MCH: ", - p_mac_lte_info->subframeNumber); - - /* Add hidden item to filter on */ - hidden_root_ti = proto_tree_add_string_format(tree, hf_mac_lte_mch, tvb, - offset, 0, "", "Hidden header"); - PROTO_ITEM_SET_HIDDEN(hidden_root_ti); - - /* Add PDU block header subtree */ - pdu_header_ti = proto_tree_add_string_format(tree, hf_mac_lte_mch_header, - tvb, offset, 0, - "", - "MAC PDU Header"); - pdu_header_tree = proto_item_add_subtree(pdu_header_ti, ett_mac_lte_mch_header); - - - /************************************************************************/ - /* Dissect each sub-header. */ - do { - guint8 reserved; - guint64 length = 0; - proto_item *pdu_subheader_ti; - proto_tree *pdu_subheader_tree; - proto_item *lcid_ti; - proto_item *ti; - gint offset_start_subheader = offset; - guint8 first_byte = tvb_get_guint8(tvb, offset); - - /* Add PDU block header subtree. - Default with length of 1 byte. */ - pdu_subheader_ti = proto_tree_add_string_format(pdu_header_tree, - hf_mac_lte_mch_subheader, - tvb, offset, 1, - "", - "Sub-header"); - pdu_subheader_tree = proto_item_add_subtree(pdu_subheader_ti, - ett_mac_lte_mch_subheader); - - /* Check 1st 2 reserved bits */ - reserved = (first_byte & 0xc0) >> 6; - ti = proto_tree_add_item(pdu_subheader_tree, hf_mac_lte_mch_reserved, - tvb, offset, 1, ENC_BIG_ENDIAN); - - if (reserved != 0) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "MCH header Reserved bits not zero"); - } - - /* Extended bit */ - extension = (first_byte & 0x20) >> 5; - proto_tree_add_item(pdu_subheader_tree, hf_mac_lte_mch_extended, - tvb, offset, 1, ENC_BIG_ENDIAN); - - /* LCID */ - lcids[number_of_headers] = first_byte & 0x1f; - lcid_ti = proto_tree_add_item(pdu_subheader_tree, hf_mac_lte_mch_lcid, - tvb, offset, 1, ENC_BIG_ENDIAN); - write_pdu_label_and_info(pdu_ti, NULL, pinfo, - "(%s", - val_to_str_const(lcids[number_of_headers], - mch_lcid_vals, "(Unknown LCID)")); - offset++; - - /* Remember if we've seen a data subheader */ - if (lcids[number_of_headers] <= 28) { - have_seen_data_header = TRUE; - expecting_body_data = TRUE; - } - - /* Show an expert item if a contol subheader (except Padding) appears - *after* a data PDU */ - if (have_seen_data_header && - (lcids[number_of_headers] > 28) && (lcids[number_of_headers] != PADDING_LCID)) { - expert_add_info_format(pinfo, lcid_ti, PI_MALFORMED, PI_ERROR, - "MCH Control subheaders should not appear after data subheaders"); - return; - } - - /* Should not see padding after non-padding control... */ - if ((lcids[number_of_headers] > 28) && - (lcids[number_of_headers] == PADDING_LCID) && - extension) { - number_of_padding_subheaders++; - - if (number_of_padding_subheaders > 2) { - expert_add_info_format(pinfo, lcid_ti, PI_MALFORMED, PI_WARN, - "Should not see more than 2 padding subheaders in one frame"); - } - - if (have_seen_non_padding_control) { - expert_add_info_format(pinfo, lcid_ti, PI_MALFORMED, PI_ERROR, - "Padding should come before other control subheaders!"); - } - } - - /* Remember that we've seen non-padding control */ - if ((lcids[number_of_headers] > 28) && - (lcids[number_of_headers] != PADDING_LCID)) { - have_seen_non_padding_control = TRUE; - } - - - - /********************************************************************/ - /* Length field follows if not the last header or for a fixed-sized - control element */ - if (!extension) { - /* Last one... */ - pdu_lengths[number_of_headers] = -1; - } else { - /* Not the last one */ - if (lcids[number_of_headers] != PADDING_LCID) { - - guint8 format; - - /* F(ormat) bit tells us how long the length field is */ - format = (tvb_get_guint8(tvb, offset) & 0x80) >> 7; - proto_tree_add_item(pdu_subheader_tree, hf_mac_lte_mch_format, - tvb, offset, 1, ENC_BIG_ENDIAN); - - /* Now read length field itself */ - if (format) { - /* >= 128 - use 15 bits */ - proto_tree_add_bits_ret_val(pdu_subheader_tree, hf_mac_lte_mch_length, - tvb, offset*8 + 1, 15, &length, ENC_BIG_ENDIAN); - - offset += 2; - } else { - /* Less than 128 - only 7 bits */ - proto_tree_add_bits_ret_val(pdu_subheader_tree, hf_mac_lte_mch_length, - tvb, offset*8 + 1, 7, &length, ENC_BIG_ENDIAN); - offset++; - } - - if ((lcids[number_of_headers] == MCH_SCHEDULING_INFO_LCID) && (length & 0x01)) { - expert_add_info_format(pinfo, lcid_ti, PI_MALFORMED, PI_WARN, - "MCH Scheduling Information MAC Control Element should have an even size"); - } - - pdu_lengths[number_of_headers] = (gint16)length; - } else { - pdu_lengths[number_of_headers] = 0; - } - } - - - /* Close off description in info column */ - switch (pdu_lengths[number_of_headers]) { - case 0: - write_pdu_label_and_info(pdu_ti, NULL, pinfo, ") "); - break; - - case -1: - write_pdu_label_and_info(pdu_ti, NULL, pinfo, ":remainder) "); - break; - - default: - write_pdu_label_and_info(pdu_ti, NULL, pinfo, ":%u bytes) ", - pdu_lengths[number_of_headers]); - break; - } - - /* Append summary to subheader root */ - proto_item_append_text(pdu_subheader_ti, " (lcid=%s", - val_to_str_const(lcids[number_of_headers], - mch_lcid_vals, "Unknown")); - - switch (pdu_lengths[number_of_headers]) { - case -1: - proto_item_append_text(pdu_subheader_ti, ", length is remainder)"); - proto_item_append_text(pdu_header_ti, " (%s:remainder)", - val_to_str_const(lcids[number_of_headers], - mch_lcid_vals, - "Unknown")); - break; - - case 0: - proto_item_append_text(pdu_subheader_ti, ")"); - proto_item_append_text(pdu_header_ti, " (%s)", - val_to_str_const(lcids[number_of_headers], - mch_lcid_vals, - "Unknown")); - break; - - default: - proto_item_append_text(pdu_subheader_ti, ", length=%u)", - pdu_lengths[number_of_headers]); - proto_item_append_text(pdu_header_ti, " (%s:%u)", - val_to_str_const(lcids[number_of_headers], - mch_lcid_vals, - "Unknown"), - pdu_lengths[number_of_headers]); - break; - } - - - /* Flag unknown lcid values in expert info */ - if (match_strval(lcids[number_of_headers],mch_lcid_vals) == NULL) { - expert_add_info_format(pinfo, pdu_subheader_ti, PI_MALFORMED, PI_ERROR, - "MCH: Unexpected LCID received (%u)", - lcids[number_of_headers]); - } - - /* Set length of this subheader */ - proto_item_set_len(pdu_subheader_ti, offset - offset_start_subheader); - - number_of_headers++; - } while ((number_of_headers < MAX_HEADERS_IN_PDU) && extension); - - /* Check that we didn't reach the end of the subheader array... */ - if (number_of_headers >= MAX_HEADERS_IN_PDU) { - proto_item *ti = proto_tree_add_text(tree, tvb, offset, 1, - "Reached %u subheaders - frame obviously malformed", - MAX_HEADERS_IN_PDU); - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "Reached %u subheaders - frame obviously malformed", - MAX_HEADERS_IN_PDU); - return; - } - - - /* Append summary to overall PDU header root */ - proto_item_append_text(pdu_header_ti, " (%u subheaders)", - number_of_headers); - - /* And set its length to offset */ - proto_item_set_len(pdu_header_ti, offset); - - - /************************************************************************/ - /* Dissect SDUs / control elements / padding. */ - /************************************************************************/ - - /* Dissect control element bodies first */ - - for (n=0; n < number_of_headers; n++) { - /* Get out of loop once see any data SDU subheaders */ - if (lcids[n] <= 28) { - break; - } - - /* Process what should be a valid control PDU type */ - switch (lcids[n]) { - case MCH_SCHEDULING_INFO_LCID: { - guint32 curr_offset = offset; - gint16 i; - guint16 stop_mtch_val; - proto_item *mch_sched_info_ti, *ti; - proto_tree *mch_sched_info_tree; - - mch_sched_info_ti = proto_tree_add_string_format(tree, - hf_mac_lte_control_mch_scheduling_info, - tvb, curr_offset, pdu_lengths[n], - "", - "MCH Scheduling Information"); - mch_sched_info_tree = proto_item_add_subtree(mch_sched_info_ti, ett_mac_lte_mch_scheduling_info); - - for (i=0; i<(pdu_lengths[n]/2); i++) { - proto_tree_add_item(mch_sched_info_tree, hf_mac_lte_control_mch_scheduling_info_lcid, - tvb, curr_offset, 1, ENC_BIG_ENDIAN); - stop_mtch_val = tvb_get_ntohs(tvb, curr_offset) & 0x7ff; - ti = proto_tree_add_item(mch_sched_info_tree, hf_mac_lte_control_mch_scheduling_info_stop_mtch, - tvb, curr_offset, 2, ENC_BIG_ENDIAN); - - if ((stop_mtch_val >= 2043) && (stop_mtch_val <= 2046)) { - proto_item_append_text(ti, " (reserved)"); - } else if (stop_mtch_val == 2047) { - proto_item_append_text(ti, " (MTCH is not scheduled)"); - } - - curr_offset += 2; - } - - offset += pdu_lengths[n]; - } - break; - - case PADDING_LCID: - /* No payload (in this position) */ - break; - - default: - break; - } - } - - - /* There might not be any data, if only headers (plus control data) were logged */ - is_truncated = ((tvb_length_remaining(tvb, offset) == 0) && expecting_body_data); - truncated_ti = proto_tree_add_uint(tree, hf_mac_lte_mch_header_only, tvb, 0, 0, - is_truncated); - - if (is_truncated) { - PROTO_ITEM_SET_GENERATED(truncated_ti); - expert_add_info_format(pinfo, truncated_ti, PI_SEQUENCE, PI_NOTE, - "MAC PDU SDUs have been omitted"); - return; - } else { - PROTO_ITEM_SET_HIDDEN(truncated_ti); - } - - - /* Now process remaining bodies, which should all be data */ - for (; n < number_of_headers; n++) { - - proto_item *sdu_ti; - const guint8 *pdu_data; - volatile guint16 data_length; - int i; - char buff[64]; - - /* Break out if meet padding */ - if (lcids[n] == PADDING_LCID) { - break; - } - - /* Work out length */ - data_length = (pdu_lengths[n] == -1) ? - tvb_length_remaining(tvb, offset) : - pdu_lengths[n]; - - /* Dissect SDU as raw bytes */ - sdu_ti = proto_tree_add_bytes_format(tree, hf_mac_lte_mch_sdu, tvb, offset, pdu_lengths[n], - NULL, "SDU (%s, length=%u bytes): ", - val_to_str_const(lcids[n], mch_lcid_vals, "Unknown"), - data_length); - /* Show bytes too. There must be a nicer way of doing this! */ - pdu_data = tvb_get_ptr(tvb, offset, pdu_lengths[n]); - - for (i=0; i < data_length; i++) { - g_snprintf(buff+(i*2), 3, "%02x", pdu_data[i]); - - if (i >= 30) { - g_snprintf(buff+(i*2), 4, "..."); - break; - } - } - - proto_item_append_text(sdu_ti, "%s", buff); - - offset += data_length; - } - - /* Now padding, if present, extends to the end of the PDU */ - if (lcids[number_of_headers-1] == PADDING_LCID) { - if (tvb_length_remaining(tvb, offset) > 0) { - proto_tree_add_item(tree, hf_mac_lte_padding_data, - tvb, offset, -1, ENC_NA); - } - - padding_length_ti = proto_tree_add_int(tree, hf_mac_lte_padding_length, - tvb, offset, 0, - p_mac_lte_info->length - offset); - PROTO_ITEM_SET_GENERATED(padding_length_ti); - - /* Make sure the PDU isn't bigger than reported! */ - if (offset > p_mac_lte_info->length) { - expert_add_info_format(pinfo, padding_length_ti, PI_MALFORMED, PI_ERROR, - "MAC PDU is longer than reported length (reported=%u, actual=%u)", - p_mac_lte_info->length, offset); - } - } else { - /* There is no padding at the end of the frame */ - if (!is_truncated && (offset < p_mac_lte_info->length)) { - /* There is a problem if we haven't used all of the PDU */ - expert_add_info_format(pinfo, pdu_ti, PI_MALFORMED, PI_ERROR, - "PDU is shorter than reported length (reported=%u, actual=%u)", - p_mac_lte_info->length, offset); - } - - if (!is_truncated && (offset > p_mac_lte_info->length)) { - /* There is a problem if the PDU is longer than rpeported */ - expert_add_info_format(pinfo, pdu_ti, PI_MALFORMED, PI_ERROR, - "PDU is longer than reported length (reported=%u, actual=%u)", - p_mac_lte_info->length, offset); - } - } -} - - -/*****************************/ -/* Main dissection function. */ -void dissect_mac_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) -{ - proto_tree *mac_lte_tree; - proto_item *pdu_ti; - proto_tree *context_tree; - proto_item *context_ti; - proto_item *retx_ti = NULL; - proto_item *ti; - gint offset = 0; - struct mac_lte_info *p_mac_lte_info = NULL; - gint n; - - /* Allocate and zero tap struct */ - mac_lte_tap_info *tap_info = ep_alloc0(sizeof(mac_lte_tap_info)); - - /* Set protocol name */ - col_set_str(pinfo->cinfo, COL_PROTOCOL, "MAC-LTE"); - - /* Create protocol tree. */ - pdu_ti = proto_tree_add_item(tree, proto_mac_lte, tvb, offset, -1, ENC_NA); - proto_item_append_text(pdu_ti, " "); - mac_lte_tree = proto_item_add_subtree(pdu_ti, ett_mac_lte); - - - /* Look for packet info! */ - p_mac_lte_info = p_get_proto_data(pinfo->fd, proto_mac_lte); - - /* Can't dissect anything without it... */ - if (p_mac_lte_info == NULL) { - proto_item *tii = - proto_tree_add_text(mac_lte_tree, tvb, offset, -1, - "Can't dissect LTE MAC frame because no per-frame info was attached!"); - PROTO_ITEM_SET_GENERATED(tii); - return; - } - - /* Clear info column */ - col_clear(pinfo->cinfo, COL_INFO); - - - /*****************************************/ - /* Show context information */ - - /* Create context root */ - context_ti = proto_tree_add_string_format(mac_lte_tree, hf_mac_lte_context, - tvb, offset, 0, "", "Context"); - context_tree = proto_item_add_subtree(context_ti, ett_mac_lte_context); - PROTO_ITEM_SET_GENERATED(context_ti); - - ti = proto_tree_add_uint(context_tree, hf_mac_lte_context_radio_type, - tvb, 0, 0, p_mac_lte_info->radioType); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_uint(context_tree, hf_mac_lte_context_direction, - tvb, 0, 0, p_mac_lte_info->direction); - PROTO_ITEM_SET_GENERATED(ti); - - if (p_mac_lte_info->ueid != 0) { - ti = proto_tree_add_uint(context_tree, hf_mac_lte_context_ueid, - tvb, 0, 0, p_mac_lte_info->ueid); - PROTO_ITEM_SET_GENERATED(ti); - } - - /* There are several out-of-band MAC events that may be indicated in the context info. */ - /* Handle them here */ - if (p_mac_lte_info->length == 0) { - proto_item *preamble_ti; - proto_tree *preamble_tree; - - switch (p_mac_lte_info->oob_event) { - case ltemac_send_preamble: - preamble_ti = proto_tree_add_item(mac_lte_tree, hf_mac_lte_oob_send_preamble, - tvb, 0, 0, ENC_ASCII|ENC_NA); - preamble_tree = proto_item_add_subtree(preamble_ti, ett_mac_lte_oob); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_uint(preamble_tree, hf_mac_lte_context_rapid, - tvb, 0, 0, p_mac_lte_info->rapid); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_uint(preamble_tree, hf_mac_lte_context_rach_attempt_number, - tvb, 0, 0, p_mac_lte_info->rach_attempt_number); - PROTO_ITEM_SET_GENERATED(ti); - - /* Info column */ - write_pdu_label_and_info(pdu_ti, preamble_ti, pinfo, - "RACH Preamble sent for UE %u (RAPID=%u, attempt=%u)", - p_mac_lte_info->ueid, p_mac_lte_info->rapid, p_mac_lte_info->rach_attempt_number); - - /* Add expert info (a note, unless attempt > 1) */ - expert_add_info_format(pinfo, ti, PI_SEQUENCE, - (p_mac_lte_info->rach_attempt_number > 1) ? PI_WARN : PI_NOTE, - "RACH Preamble sent for UE %u (RAPID=%u, attempt=%u)", - p_mac_lte_info->ueid, p_mac_lte_info->rapid, - p_mac_lte_info->rach_attempt_number); - break; - - case ltemac_send_sr: - /* Count of SRs */ - ti = proto_tree_add_uint(mac_lte_tree, hf_mac_lte_number_of_srs, - tvb, 0, 0, p_mac_lte_info->number_of_srs); - PROTO_ITEM_SET_GENERATED(ti); - - - for (n=0; n < p_mac_lte_info->number_of_srs; n++) { - proto_item *sr_ti; - proto_tree *sr_tree; - - /* SR event is subtree */ - sr_ti = proto_tree_add_item(mac_lte_tree, hf_mac_lte_oob_send_sr, - tvb, 0, 0, ENC_NA); - sr_tree = proto_item_add_subtree(sr_ti, ett_mac_lte_oob); - PROTO_ITEM_SET_GENERATED(sr_ti); - - - /* RNTI */ - ti = proto_tree_add_uint(sr_tree, hf_mac_lte_context_rnti, - tvb, 0, 0, p_mac_lte_info->oob_rnti[n]); - PROTO_ITEM_SET_GENERATED(ti); - - /* UEID */ - ti = proto_tree_add_uint(sr_tree, hf_mac_lte_context_ueid, - tvb, 0, 0, p_mac_lte_info->oob_ueid[n]); - PROTO_ITEM_SET_GENERATED(ti); - - /* Add summary to root. */ - proto_item_append_text(sr_ti, " (UE=%u C-RNTI=%u)", - p_mac_lte_info->oob_ueid[n], - p_mac_lte_info->oob_rnti[n]); - - /* Info column */ - if (n == 0) { - write_pdu_label_and_info(pdu_ti, NULL, pinfo, - "Scheduling Requests (%u) sent: (UE=%u C-RNTI=%u)", - p_mac_lte_info->number_of_srs, - p_mac_lte_info->oob_ueid[n], - p_mac_lte_info->oob_rnti[n]); - } else { - write_pdu_label_and_info(pdu_ti, NULL, pinfo, - " (UE=%u C-RNTI=%u)", - p_mac_lte_info->oob_ueid[n], - p_mac_lte_info->oob_rnti[n]); - } - - /* Add expert info (a note) */ - expert_add_info_format(pinfo, sr_ti, PI_SEQUENCE, PI_NOTE, - "Scheduling Request sent for UE %u (RNTI %u)", - p_mac_lte_info->oob_ueid[n], - p_mac_lte_info->oob_rnti[n]); - - /* Update SR status for this UE */ - if (global_mac_lte_track_sr) { - TrackSRInfo(SR_Request, pinfo, mac_lte_tree, tvb, p_mac_lte_info, n, sr_ti); - } - } - - break; - - case ltemac_sr_failure: - ti = proto_tree_add_uint(context_tree, hf_mac_lte_context_rnti, - tvb, 0, 0, p_mac_lte_info->rnti); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_item(mac_lte_tree, hf_mac_lte_oob_sr_failure, - tvb, 0, 0, ENC_NA); - PROTO_ITEM_SET_GENERATED(ti); - - /* Info column */ - write_pdu_label_and_info(pdu_ti, NULL, pinfo, - "Scheduling Request FAILED for UE %u (C-RNTI=%u)", - p_mac_lte_info->ueid, - p_mac_lte_info->rnti); - - /* Add expert info (an error) */ - expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_ERROR, - "Scheduling Request failed for UE %u (RNTI %u)", - p_mac_lte_info->ueid, - p_mac_lte_info->rnti); - - /* Update SR status */ - if (global_mac_lte_track_sr) { - TrackSRInfo(SR_Failure, pinfo, mac_lte_tree, tvb, p_mac_lte_info, 0, ti); - } - - break; - } - - /* Our work here is done */ - return; - } - - ti = proto_tree_add_uint(context_tree, hf_mac_lte_context_sysframe_number, - tvb, 0, 0, p_mac_lte_info->sysframeNumber); - PROTO_ITEM_SET_GENERATED(ti); - - ti = proto_tree_add_uint(context_tree, hf_mac_lte_context_subframe_number, - tvb, 0, 0, p_mac_lte_info->subframeNumber); - PROTO_ITEM_SET_GENERATED(ti); - - if (p_mac_lte_info->subframeNumber > 9) { - /* N.B. if we set it to valid value, it won't trigger when we rescan - (at least with DCT2000 files where the context struct isn't re-read). */ - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "Subframe number (%u) was out of range - valid range is 0-9", - p_mac_lte_info->subframeNumber); - } - - if (p_mac_lte_info->subframeNumberOfGrantPresent) { - ti = proto_tree_add_uint(context_tree, hf_mac_lte_context_grant_subframe_number, - tvb, 0, 0, p_mac_lte_info->subframeNumberOfGrant); - PROTO_ITEM_SET_GENERATED(ti); - } - - if (p_mac_lte_info->rntiType != NO_RNTI) { - ti = proto_tree_add_uint(context_tree, hf_mac_lte_context_rnti, - tvb, 0, 0, p_mac_lte_info->rnti); - PROTO_ITEM_SET_GENERATED(ti); - } - - ti = proto_tree_add_uint(context_tree, hf_mac_lte_context_rnti_type, - tvb, 0, 0, p_mac_lte_info->rntiType); - PROTO_ITEM_SET_GENERATED(ti); - - /* Check that RNTI value is consistent with given RNTI type */ - switch (p_mac_lte_info->rntiType) { - case M_RNTI: - if (p_mac_lte_info->rnti != 0xFFFD) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "M-RNTI indicated, but value is %u (0x%x) (must be 0x%x)", - p_mac_lte_info->rnti, p_mac_lte_info->rnti, 0xFFFD); - return; - } - - break; - - case P_RNTI: - if (p_mac_lte_info->rnti != 0xFFFE) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "P-RNTI indicated, but value is %u (0x%x) (must be 0x%x)", - p_mac_lte_info->rnti, p_mac_lte_info->rnti, 0xFFFE); - return; - } - - break; - - case SI_RNTI: - if (p_mac_lte_info->rnti != 0xFFFF) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "SI-RNTI indicated, but value is %u (0x%x) (must be 0x%x)", - p_mac_lte_info->rnti, p_mac_lte_info->rnti, 0xFFFE); - return; - } - - break; - - case RA_RNTI: - if ((p_mac_lte_info->rnti < 0x0001) || (p_mac_lte_info->rnti > 0x003C)) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "RA_RNTI indicated, but given value %u (0x%x)is out of range", - p_mac_lte_info->rnti, p_mac_lte_info->rnti); - return; - } - - break; - - case C_RNTI: - case SPS_RNTI: - if ((p_mac_lte_info->rnti < 0x0001) || (p_mac_lte_info->rnti > 0xFFF3)) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "%s indicated, but given value %u (0x%x)is out of range", - val_to_str_const(p_mac_lte_info->rntiType, rnti_type_vals, "Unknown"), - p_mac_lte_info->rnti, p_mac_lte_info->rnti); - return; - } - - break; - - default: - break; - } - - ti = proto_tree_add_uint(context_tree, hf_mac_lte_context_predefined_frame, - tvb, 0, 0, p_mac_lte_info->isPredefinedData); - - if (p_mac_lte_info->isPredefinedData) { - PROTO_ITEM_SET_GENERATED(ti); - } else { - PROTO_ITEM_SET_HIDDEN(ti); - } - - ti = proto_tree_add_uint(context_tree, hf_mac_lte_context_length, - tvb, 0, 0, p_mac_lte_info->length); - PROTO_ITEM_SET_GENERATED(ti); - - /* Infer uplink grant size */ - if (p_mac_lte_info->direction == DIRECTION_UPLINK) { - ti = proto_tree_add_uint(context_tree, hf_mac_lte_context_ul_grant_size, - tvb, 0, 0, p_mac_lte_info->length); - PROTO_ITEM_SET_GENERATED(ti); - } - - /* Retx count goes in top-level tree to make it more visible */ - if (p_mac_lte_info->reTxCount) { - proto_item *retx_reason_ti; - retx_ti = proto_tree_add_uint(mac_lte_tree, hf_mac_lte_context_retx_count, - tvb, 0, 0, p_mac_lte_info->reTxCount); - PROTO_ITEM_SET_GENERATED(retx_ti); - - if (p_mac_lte_info->reTxCount >= global_mac_lte_retx_counter_trigger) { - expert_add_info_format(pinfo, retx_ti, PI_SEQUENCE, PI_WARN, - "UE %u: UL MAC frame ReTX no. %u", - p_mac_lte_info->ueid, p_mac_lte_info->reTxCount); - } - - retx_reason_ti = proto_tree_add_uint(mac_lte_tree, hf_mac_lte_context_retx_reason, - tvb, 0, 0, p_mac_lte_info->isPHICHNACK); - PROTO_ITEM_SET_GENERATED(retx_reason_ti); - } - - if (p_mac_lte_info->crcStatusValid) { - /* Set status */ - ti = proto_tree_add_uint(context_tree, hf_mac_lte_context_crc_status, - tvb, 0, 0, p_mac_lte_info->detailed_phy_info.dl_info.crc_status); - PROTO_ITEM_SET_GENERATED(ti); - - /* Report non-success */ - if (p_mac_lte_info->detailed_phy_info.dl_info.crc_status != crc_success) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "%s Frame has CRC error problem (%s)", - (p_mac_lte_info->direction == DIRECTION_UPLINK) ? "UL" : "DL", - val_to_str_const(p_mac_lte_info->detailed_phy_info.dl_info.crc_status, - crc_status_vals, - "Unknown")); - write_pdu_label_and_info(pdu_ti, NULL, pinfo, - "%s: <CRC %s> UEId=%u %s=%u ", - (p_mac_lte_info->direction == DIRECTION_UPLINK) ? "UL" : "DL", - val_to_str_const(p_mac_lte_info->detailed_phy_info.dl_info.crc_status, - crc_status_vals, - "Unknown"), - p_mac_lte_info->ueid, - val_to_str_const(p_mac_lte_info->rntiType, rnti_type_vals, - "Unknown RNTI type"), - p_mac_lte_info->rnti); - } - } - - /* May also have extra Physical layer attributes set for this frame */ - show_extra_phy_parameters(pinfo, tvb, mac_lte_tree, p_mac_lte_info); - - /* Set context-info parts of tap struct */ - tap_info->rnti = p_mac_lte_info->rnti; - tap_info->ueid = p_mac_lte_info->ueid; - tap_info->rntiType = p_mac_lte_info->rntiType; - tap_info->isPredefinedData = p_mac_lte_info->isPredefinedData; - tap_info->isPHYRetx = (p_mac_lte_info->reTxCount >= 1); - tap_info->crcStatusValid = p_mac_lte_info->crcStatusValid; - tap_info->crcStatus = p_mac_lte_info->detailed_phy_info.dl_info.crc_status; - tap_info->direction = p_mac_lte_info->direction; - - tap_info->time = pinfo->fd->abs_ts; - - /* Also set total number of bytes (won't be used for UL/DL-SCH) */ - tap_info->single_number_of_bytes = tvb_length_remaining(tvb, offset); - - /* If we know its predefined data, don't try to decode any further */ - if (p_mac_lte_info->isPredefinedData) { - proto_tree_add_item(mac_lte_tree, hf_mac_lte_predefined_pdu, tvb, offset, -1, ENC_NA); - write_pdu_label_and_info(pdu_ti, NULL, pinfo, - "Predefined data (%u bytes%s)", - p_mac_lte_info->length, - (p_mac_lte_info->length > tvb_length_remaining(tvb, offset) ? - " - truncated" : - "")); - - /* Queue tap info */ - if (!pinfo->flags.in_error_pkt) { - tap_queue_packet(mac_lte_tap, pinfo, tap_info); - } - - return; - } - - /* IF CRC status failed, just do decode as raw bytes */ - if (!global_mac_lte_dissect_crc_failures && - (p_mac_lte_info->crcStatusValid && - (p_mac_lte_info->detailed_phy_info.dl_info.crc_status != crc_success))) { - - proto_tree_add_item(mac_lte_tree, hf_mac_lte_raw_pdu, tvb, offset, -1, ENC_NA); - write_pdu_label_and_info(pdu_ti, NULL, pinfo, "Raw data (%u bytes)", tvb_length_remaining(tvb, offset)); - - /* Queue tap info. - TODO: unfortunately DL retx detection won't get done if we return here... */ - if (!pinfo->flags.in_error_pkt) { - tap_queue_packet(mac_lte_tap, pinfo, tap_info); - } - - return; - } - - /* Reset this counter */ - s_number_of_rlc_pdus_shown = 0; - - /* Dissect the MAC PDU itself. Format depends upon RNTI type. */ - switch (p_mac_lte_info->rntiType) { - - case P_RNTI: - /* PCH PDU */ - dissect_pch(tvb, pinfo, mac_lte_tree, pdu_ti, offset, p_mac_lte_info->direction); - break; - - case RA_RNTI: - /* RAR PDU */ - dissect_rar(tvb, pinfo, mac_lte_tree, pdu_ti, offset, p_mac_lte_info, tap_info); - break; - - case C_RNTI: - case SPS_RNTI: - /* Can be UL-SCH or DL-SCH */ - dissect_ulsch_or_dlsch(tvb, pinfo, mac_lte_tree, pdu_ti, offset, - p_mac_lte_info->direction, p_mac_lte_info, tap_info, - retx_ti, context_tree); - break; - - case SI_RNTI: - /* BCH over DL-SCH */ - dissect_bch(tvb, pinfo, mac_lte_tree, pdu_ti, offset, p_mac_lte_info); - break; - - case M_RNTI: - /* MCH PDU */ - dissect_mch(tvb, pinfo, mac_lte_tree, pdu_ti, offset, p_mac_lte_info); - break; - - case NO_RNTI: - /* Must be BCH over BCH... */ - dissect_bch(tvb, pinfo, mac_lte_tree, pdu_ti, offset, p_mac_lte_info); - break; - - - default: - break; - } - - /* Queue tap info */ - tap_queue_packet(mac_lte_tap, pinfo, tap_info); -} - - - - -/* Initializes the hash tables each time a new - * file is loaded or re-loaded in wireshark */ -static void mac_lte_init_protocol(void) -{ - /* Destroy any existing tables. */ - if (mac_lte_msg3_hash) { - g_hash_table_destroy(mac_lte_msg3_hash); - } - - if (mac_lte_cr_result_hash) { - g_hash_table_destroy(mac_lte_cr_result_hash); - } - - if (mac_lte_dl_harq_hash) { - g_hash_table_destroy(mac_lte_dl_harq_hash); - } - - if (mac_lte_dl_harq_result_hash) { - g_hash_table_destroy(mac_lte_dl_harq_result_hash); - } - - if (mac_lte_ul_harq_hash) { - g_hash_table_destroy(mac_lte_ul_harq_hash); - } - - if (mac_lte_ul_harq_result_hash) { - g_hash_table_destroy(mac_lte_ul_harq_result_hash); - } - - if (mac_lte_ue_sr_state) { - g_hash_table_destroy(mac_lte_ue_sr_state); - } - - if (mac_lte_sr_request_hash) { - g_hash_table_destroy(mac_lte_sr_request_hash); - } - - if (mac_lte_tti_info_result_hash) { - g_hash_table_destroy(mac_lte_tti_info_result_hash); - } - - /* Reset structs */ - memset(&UL_tti_info, 0, sizeof(UL_tti_info)); - UL_tti_info.subframe = 0xff; /* Invalid value */ - memset(&DL_tti_info, 0, sizeof(DL_tti_info)); - DL_tti_info.subframe = 0xff; /* Invalid value */ - - /* Now create them over */ - mac_lte_msg3_hash = g_hash_table_new(mac_lte_rnti_hash_func, mac_lte_rnti_hash_equal); - mac_lte_cr_result_hash = g_hash_table_new(mac_lte_framenum_hash_func, mac_lte_framenum_hash_equal); - - mac_lte_dl_harq_hash = g_hash_table_new(mac_lte_rnti_hash_func, mac_lte_rnti_hash_equal); - mac_lte_dl_harq_result_hash = g_hash_table_new(mac_lte_framenum_hash_func, mac_lte_framenum_hash_equal); - - mac_lte_ul_harq_hash = g_hash_table_new(mac_lte_rnti_hash_func, mac_lte_rnti_hash_equal); - mac_lte_ul_harq_result_hash = g_hash_table_new(mac_lte_framenum_hash_func, mac_lte_framenum_hash_equal); - - mac_lte_ue_sr_state = g_hash_table_new(mac_lte_rnti_hash_func, mac_lte_rnti_hash_equal); - mac_lte_sr_request_hash = g_hash_table_new(mac_lte_framenum_hash_func, mac_lte_framenum_hash_equal); - - mac_lte_tti_info_result_hash = g_hash_table_new(mac_lte_framenum_hash_func, mac_lte_framenum_hash_equal); -} - - -static void* lcid_drb_mapping_copy_cb(void* dest, const void* orig, size_t len _U_) -{ - const lcid_drb_mapping_t *o = orig; - lcid_drb_mapping_t *d = dest; - - /* Copy all items over */ - d->lcid = o->lcid; - d->drbid = o->drbid; - d->channel_type = o->channel_type; - - return d; -} - - - -void proto_register_mac_lte(void) -{ - static hf_register_info hf[] = { - /**********************************/ - /* Items for decoding context */ - { - &hf_mac_lte_context, - { - "Context", - "mac-lte.context", FT_STRING, BASE_NONE, NULL, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_context_radio_type, - { - "Radio Type", - "mac-lte.radio-type", FT_UINT8, BASE_DEC, VALS(radio_type_vals), 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_context_direction, - { - "Direction", - "mac-lte.direction", FT_UINT8, BASE_DEC, VALS(direction_vals), 0x0, - "Direction of message", HFILL - } - }, - { - &hf_mac_lte_context_rnti, - { - "RNTI", - "mac-lte.rnti", FT_UINT16, BASE_DEC, 0, 0x0, - "RNTI associated with message", HFILL - } - }, - { - &hf_mac_lte_context_rnti_type, - { - "RNTI Type", - "mac-lte.rnti-type", FT_UINT8, BASE_DEC, VALS(rnti_type_vals), 0x0, - "Type of RNTI associated with message", HFILL - } - }, - { - &hf_mac_lte_context_ueid, - { - "UEId", - "mac-lte.ueid", FT_UINT16, BASE_DEC, 0, 0x0, - "User Equipment Identifier associated with message", HFILL - } - }, - { - &hf_mac_lte_context_sysframe_number, - { - "System Frame Number", - "mac-lte.sfn", FT_UINT16, BASE_DEC, 0, 0x0, - "System Frame Number associated with message", HFILL - } - }, - { - &hf_mac_lte_context_subframe_number, - { - "Subframe", - "mac-lte.subframe", FT_UINT16, BASE_DEC, 0, 0x0, - "Subframe number associated with message", HFILL - } - }, - { - &hf_mac_lte_context_grant_subframe_number, - { - "Grant Subframe", - "mac-lte.grant-subframe", FT_UINT16, BASE_DEC, 0, 0x0, - "Subframe when grant for this PDU was received", HFILL - } - }, - { - &hf_mac_lte_context_predefined_frame, - { - "Predefined frame", - "mac-lte.is-predefined-frame", FT_UINT8, BASE_DEC, VALS(predefined_frame_vals), 0x0, - "Predefined test frame (or real MAC PDU)", HFILL - } - }, - { - &hf_mac_lte_context_length, - { - "Length of frame", - "mac-lte.length", FT_UINT8, BASE_DEC, 0, 0x0, - "Original length of frame (including SDUs and padding)", HFILL - } - }, - { - &hf_mac_lte_context_ul_grant_size, - { - "Uplink grant size", - "mac-lte.ul-grant-size", FT_UINT8, BASE_DEC, 0, 0x0, - "Uplink grant size (in bytes)", HFILL - } - }, - { - &hf_mac_lte_context_bch_transport_channel, - { - "Transport channel", - "mac-lte.bch-transport-channel", FT_UINT8, BASE_DEC, VALS(bch_transport_channel_vals), 0x0, - "Transport channel BCH data was carried on", HFILL - } - }, - { - &hf_mac_lte_context_retx_count, - { - "ReTX count", - "mac-lte.retx-count", FT_UINT8, BASE_DEC, 0, 0x0, - "Number of times this PDU has been retransmitted", HFILL - } - }, - { - &hf_mac_lte_context_retx_reason, - { - "ReTX reason", - "mac-lte.retx-reason", FT_UINT8, BASE_DEC, VALS(ul_retx_grant_vals), 0x0, - "Type of UL ReTx grant", HFILL - } - }, - { - &hf_mac_lte_context_crc_status, - { - "CRC Status", - "mac-lte.crc-status", FT_UINT8, BASE_DEC, VALS(crc_status_vals), 0x0, - "CRC Status as reported by PHY", HFILL - } - }, - { - &hf_mac_lte_context_rapid, - { - "RAPID", - "mac-lte.preamble-sent.rapid", FT_UINT8, BASE_DEC, 0, 0x0, - "RAPID sent in RACH preamble", HFILL - } - }, - { - &hf_mac_lte_context_rach_attempt_number, - { - "RACH Attempt Number", - "mac-lte.preamble-sent.attempt", FT_UINT8, BASE_DEC, 0, 0x0, - NULL, HFILL - } - }, - - { - &hf_mac_lte_ues_ul_per_tti, - { - "UL UE in TTI", - "mac-lte.ul-tti-count", FT_UINT8, BASE_DEC, 0, 0x0, - "In this TTI, this is the nth UL grant", HFILL - } - }, - { - &hf_mac_lte_ues_dl_per_tti, - { - "DL UE in TTI", - "mac-lte.dl-tti-count", FT_UINT8, BASE_DEC, 0, 0x0, - "In this TTI, this is the nth DL PDU", HFILL - } - }, - - - /* Extra PHY context */ - { - &hf_mac_lte_context_phy_ul, - { - "UL PHY attributes", - "mac-lte.ul-phy", FT_STRING, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_context_phy_ul_modulation_type, - { - "Modulation type", - "mac-lte.ul-phy.modulation-type", FT_UINT8, BASE_DEC, VALS(modulation_type_vals), 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_context_phy_ul_tbs_index, - { - "TBs Index", - "mac-lte.ul-phy.tbs-index", FT_UINT8, BASE_DEC, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_context_phy_ul_resource_block_length, - { - "Resource Block Length", - "mac-lte.ul-phy.resource-block-length", FT_UINT8, BASE_DEC, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_context_phy_ul_resource_block_start, - { - "Resource Block Start", - "mac-lte.ul-phy.resource-block-start", FT_UINT8, BASE_DEC, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_context_phy_ul_harq_id, - { - "HARQ Id", - "mac-lte.ul-phy.harq-id", FT_UINT8, BASE_DEC, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_context_phy_ul_ndi, - { - "NDI", - "mac-lte.ul-phy.ndi", FT_UINT8, BASE_DEC, 0, 0x0, - "UL New Data Indicator", HFILL - } - }, - - { - &hf_mac_lte_context_phy_dl, - { - "DL PHY attributes", - "mac-lte.dl-phy", FT_STRING, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_context_phy_dl_dci_format, - { - "DCI format", - "mac-lte.dl-phy.dci-format", FT_UINT8, BASE_DEC, VALS(dci_format_vals), 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_context_phy_dl_resource_allocation_type, - { - "Resource Allocation Type", - "mac-lte.dl-phy.resource-allocation-type", FT_UINT8, BASE_DEC, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_context_phy_dl_aggregation_level, - { - "Aggregation Level", - "mac-lte.dl-phy.aggregation-level", FT_UINT8, BASE_DEC, VALS(aggregation_level_vals), 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_context_phy_dl_mcs_index, - { - "MCS Index", - "mac-lte.dl-phy.mcs-index", FT_UINT8, BASE_DEC, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_context_phy_dl_redundancy_version_index, - { - "RV Index", - "mac-lte.dl-phy.rv-index", FT_UINT8, BASE_DEC, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_context_phy_dl_retx, - { - "DL Retx", - "mac-lte.dl-phy.dl-retx", FT_BOOLEAN, BASE_NONE, NULL, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_context_phy_dl_resource_block_length, - { - "RB Length", - "mac-lte.dl-phy.rb-length", FT_UINT8, BASE_DEC, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_context_phy_dl_crc_status, - { - "CRC Status", - "mac-lte.dl-phy.crc-status", FT_UINT8, BASE_DEC, VALS(crc_status_vals), 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_context_phy_dl_harq_id, - { - "HARQ Id", - "mac-lte.dl-phy.harq-id", FT_UINT8, BASE_DEC, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_context_phy_dl_ndi, - { - "NDI", - "mac-lte.dl-phy.ndi", FT_UINT8, BASE_DEC, 0, 0x0, - "New Data Indicator", HFILL - } - }, - { - &hf_mac_lte_context_phy_dl_tb, - { - "TB", - "mac-lte.dl-phy.tb", FT_UINT8, BASE_DEC, 0, 0x0, - "Transport Block (antenna #)", HFILL - } - }, - - /* Out-of-band events */ - { - &hf_mac_lte_oob_send_preamble, - { - "PRACH", - "mac-lte.preamble-sent", FT_STRING, BASE_NONE, NULL, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_oob_send_sr, - { - "Scheduling Request sent", - "mac-lte.sr-req", FT_NONE, BASE_NONE, NULL, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_number_of_srs, - { - "Number of SRs", - "mac-lte.sr-req.count", FT_UINT32, BASE_DEC, 0, 0x0, - "Number of UEs doing SR in this frame", HFILL - } - }, - { - &hf_mac_lte_oob_sr_failure, - { - "Scheduling Request failure", - "mac-lte.sr-failure", FT_NONE, BASE_NONE, NULL, 0x0, - NULL, HFILL - } - }, - - /*******************************************/ - /* MAC shared channel header fields */ - { - &hf_mac_lte_ulsch, - { - "UL-SCH", - "mac-lte.ulsch", FT_STRING, BASE_NONE, NULL, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_ulsch_header, - { - "UL-SCH Header", - "mac-lte.ulsch.header", FT_STRING, BASE_NONE, NULL, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_dlsch_header, - { - "DL-SCH Header", - "mac-lte.dlsch.header", FT_STRING, BASE_NONE, NULL, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_dlsch, - { - "DL-SCH", - "mac-lte.dlsch", FT_STRING, BASE_NONE, NULL, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_sch_subheader, - { - "SCH sub-header", - "mac-lte.sch.subheader", FT_STRING, BASE_NONE, NULL, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_mch, - { - "MCH", - "mac-lte.mch", FT_STRING, BASE_NONE, NULL, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_mch_header, - { - "MCH Header", - "mac-lte.mch.header", FT_STRING, BASE_NONE, NULL, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_mch_subheader, - { - "MCH sub-header", - "mac-lte.mch.subheader", FT_STRING, BASE_NONE, NULL, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_sch_reserved, - { - "SCH reserved bits", - "mac-lte.sch.reserved", FT_UINT8, BASE_HEX, NULL, 0xc0, - NULL, HFILL - } - }, - { - &hf_mac_lte_sch_extended, - { - "Extension", - "mac-lte.sch.extended", FT_UINT8, BASE_HEX, 0, 0x20, - "Extension - i.e. further headers after this one", HFILL - } - }, - { - &hf_mac_lte_dlsch_lcid, - { - "LCID", - "mac-lte.dlsch.lcid", FT_UINT8, BASE_HEX, VALS(dlsch_lcid_vals), 0x1f, - "DL-SCH Logical Channel Identifier", HFILL - } - }, - { - &hf_mac_lte_ulsch_lcid, - { - "LCID", - "mac-lte.ulsch.lcid", FT_UINT8, BASE_HEX, VALS(ulsch_lcid_vals), 0x1f, - "UL-SCH Logical Channel Identifier", HFILL - } - }, - { - &hf_mac_lte_sch_format, - { - "Format", - "mac-lte.sch.format", FT_UINT8, BASE_HEX, VALS(format_vals), 0x80, - NULL, HFILL - } - }, - { - &hf_mac_lte_sch_length, - { - "Length", - "mac-lte.sch.length", FT_UINT16, BASE_DEC, 0, 0x0, - "Length of MAC SDU or MAC control element", HFILL - } - }, - { - &hf_mac_lte_mch_reserved, - { - "MCH reserved bits", - "mac-lte.mch.reserved", FT_UINT8, BASE_HEX, NULL, 0xc0, - NULL, HFILL - } - }, - { - &hf_mac_lte_mch_extended, - { - "Extension", - "mac-lte.mch.extended", FT_UINT8, BASE_HEX, 0, 0x20, - "Extension - i.e. further headers after this one", HFILL - } - }, - { - &hf_mac_lte_mch_lcid, - { - "LCID", - "mac-lte.mch.lcid", FT_UINT8, BASE_HEX, VALS(mch_lcid_vals), 0x1f, - "MCH Logical Channel Identifier", HFILL - } - }, - { - &hf_mac_lte_mch_format, - { - "Format", - "mac-lte.mch.format", FT_UINT8, BASE_HEX, VALS(format_vals), 0x80, - NULL, HFILL - } - }, - { - &hf_mac_lte_mch_length, - { - "Length", - "mac-lte.mch.length", FT_UINT16, BASE_DEC, 0, 0x0, - "Length of MAC SDU or MAC control element", HFILL - } - }, - { - &hf_mac_lte_sch_header_only, - { - "MAC PDU Header only", - "mac-lte.sch.header-only", FT_UINT8, BASE_DEC, VALS(header_only_vals), 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_mch_header_only, - { - "MAC PDU Header only", - "mac-lte.mch.header-only", FT_UINT8, BASE_DEC, VALS(header_only_vals), 0x0, - NULL, HFILL - } - }, - - /********************************/ - /* Data */ - { - &hf_mac_lte_sch_sdu, - { - "SDU", - "mac-lte.sch.sdu", FT_BYTES, BASE_NONE, 0, 0x0, - "Shared channel SDU", HFILL - } - }, - { - &hf_mac_lte_mch_sdu, - { - "SDU", - "mac-lte.mch.sdu", FT_BYTES, BASE_NONE, 0, 0x0, - "Multicast channel SDU", HFILL - } - }, - { - &hf_mac_lte_bch_pdu, - { - "BCH PDU", - "mac-lte.bch.pdu", FT_BYTES, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_pch_pdu, - { - "PCH PDU", - "mac-lte.pch.pdu", FT_BYTES, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_predefined_pdu, - { - "Predefined data", - "mac-lte.predefined-data", FT_BYTES, BASE_NONE, 0, 0x0, - "Predefined test data", HFILL - } - }, - { - &hf_mac_lte_raw_pdu, - { - "Raw data", - "mac-lte.raw-data", FT_BYTES, BASE_NONE, 0, 0x0, - "Raw bytes of PDU (e.g. if CRC error)", HFILL - } - }, - { - &hf_mac_lte_padding_data, - { - "Padding data", - "mac-lte.padding-data", FT_BYTES, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_padding_length, - { - "Padding length", - "mac-lte.padding-length", FT_INT32, BASE_DEC, 0, 0x0, - "Length of padding data not included at end of frame", HFILL - } - }, - - - - /*********************************/ - /* RAR fields */ - { - &hf_mac_lte_rar, - { - "RAR", - "mac-lte.rar", FT_NONE, BASE_NONE, NULL, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_rar_headers, - { - "RAR Headers", - "mac-lte.rar.headers", FT_STRING, BASE_NONE, NULL, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_rar_header, - { - "RAR Header", - "mac-lte.rar.header", FT_STRING, BASE_NONE, NULL, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_rar_extension, - { - "Extension", - "mac-lte.rar.e", FT_UINT8, BASE_HEX, 0, 0x80, - "Extension - i.e. further RAR headers after this one", HFILL - } - }, - { - &hf_mac_lte_rar_t, - { - "Type", - "mac-lte.rar.t", FT_UINT8, BASE_HEX, VALS(rar_type_vals), 0x40, - "Type field indicating whether the payload is RAPID or BI", HFILL - } - }, - { - &hf_mac_lte_rar_bi, - { - "BI", - "mac-lte.rar.bi", FT_UINT8, BASE_HEX, VALS(rar_bi_vals), 0x0f, - "Backoff Indicator (ms)", HFILL - } - }, - { - &hf_mac_lte_rar_rapid, - { - "RAPID", - "mac-lte.rar.rapid", FT_UINT8, BASE_HEX_DEC, 0, 0x3f, - "Random Access Preamble IDentifier", HFILL - } - }, - { - &hf_mac_lte_rar_reserved, - { - "Reserved", - "mac-lte.rar.reserved", FT_UINT8, BASE_HEX, 0, 0x30, - "Reserved bits in RAR header - should be 0", HFILL - } - }, - - { - &hf_mac_lte_rar_body, - { - "RAR Body", - "mac-lte.rar.body", FT_STRING, BASE_NONE, NULL, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_rar_reserved2, - { - "Reserved", - "mac-lte.rar.reserved2", FT_UINT8, BASE_HEX, 0, 0x80, - "Reserved bit in RAR body - should be 0", HFILL - } - }, - { - &hf_mac_lte_rar_ta, - { - "Timing Advance", - "mac-lte.rar.ta", FT_UINT16, BASE_DEC, 0, 0x7ff0, - "Required adjustment to uplink transmission timing", HFILL - } - }, - { - &hf_mac_lte_rar_ul_grant, - { - "UL Grant", - "mac-lte.rar.ul-grant", FT_UINT24, BASE_DEC, 0, 0x0fffff, - "Size of UL Grant", HFILL - } - }, - { - &hf_mac_lte_rar_ul_grant_hopping, - { - "Hopping Flag", - "mac-lte.rar.ul-grant.hopping", FT_UINT8, BASE_DEC, 0, 0x08, - NULL, HFILL - } - }, - { - &hf_mac_lte_rar_ul_grant_fsrba, - { - "Fixed sized resource block assignment", - "mac-lte.rar.ul-grant.fsrba", FT_UINT16, BASE_DEC, 0, 0x07fe, - NULL, HFILL - } - }, - { - &hf_mac_lte_rar_ul_grant_tmcs, - { - "Truncated Modulation and coding scheme", - "mac-lte.rar.ul-grant.tmcs", FT_UINT16, BASE_DEC, 0, 0x01e0, - NULL, HFILL - } - }, - { - &hf_mac_lte_rar_ul_grant_tcsp, - { - "TPC command for scheduled PUSCH", - "mac-lte.rar.ul-grant.tcsp", FT_UINT8, BASE_DEC, 0, 0x01c, - NULL, HFILL - } - }, - { - &hf_mac_lte_rar_ul_grant_ul_delay, - { - "UL Delay", - "mac-lte.rar.ul-grant.ul-delay", FT_UINT8, BASE_DEC, 0, 0x02, - NULL, HFILL - } - }, - { - &hf_mac_lte_rar_ul_grant_cqi_request, - { - "CQI Request", - "mac-lte.rar.ul-grant.cqi-request", FT_UINT8, BASE_DEC, 0, 0x01, - NULL, HFILL - } - }, - { - &hf_mac_lte_rar_temporary_crnti, - { - "Temporary C-RNTI", - "mac-lte.rar.temporary-crnti", FT_UINT16, BASE_DEC, 0, 0x0, - NULL, HFILL - } - }, - - /**********************/ - /* Control PDU fields */ - { - &hf_mac_lte_control_bsr, - { - "BSR", - "mac-lte.control.bsr", FT_STRING, BASE_NONE, 0, 0x0, - "Buffer Status Report", HFILL - } - }, - { - &hf_mac_lte_control_bsr_lcg_id, - { - "Logical Channel Group ID", - "mac-lte.control.bsr.lcg-id", FT_UINT8, BASE_DEC, 0, 0xc0, - NULL, HFILL - } - }, - { - &hf_mac_lte_control_short_bsr_buffer_size, - { - "Buffer Size", - "mac-lte.control.bsr.buffer-size", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_vals_ext, 0x3f, - "Buffer Size available in all channels in group", HFILL - } - }, - { - &hf_mac_lte_control_long_bsr_buffer_size_0, - { - "Buffer Size 0", - "mac-lte.control.bsr.buffer-size-0", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_vals_ext, 0xfc, - "Buffer Size available in logical channel group 0", HFILL - } - }, - { - &hf_mac_lte_control_long_bsr_buffer_size_1, - { - "Buffer Size 1", - "mac-lte.control.bsr.buffer-size-1", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &buffer_size_vals_ext, 0x03f0, - "Buffer Size available in logical channel group 1", HFILL - } - }, - { - &hf_mac_lte_control_long_bsr_buffer_size_2, - { - "Buffer Size 2", - "mac-lte.control.bsr.buffer-size-2", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &buffer_size_vals_ext, 0x0fc0, - "Buffer Size available in logical channel group 2", HFILL - } - }, - { - &hf_mac_lte_control_long_bsr_buffer_size_3, - { - "Buffer Size 3", - "mac-lte.control.bsr.buffer-size-3", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &buffer_size_vals_ext, 0x3f, - "Buffer Size available in logical channel group 3", HFILL - } - }, - { - &hf_mac_lte_control_short_ext_bsr_buffer_size, - { - "Buffer Size", - "mac-lte.control.bsr.buffer-size", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &ext_buffer_size_vals_ext, 0x3f, - "Buffer Size available in all channels in group", HFILL - } - }, - { - &hf_mac_lte_control_long_ext_bsr_buffer_size_0, - { - "Buffer Size 0", - "mac-lte.control.bsr.buffer-size-0", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &ext_buffer_size_vals_ext, 0xfc, - "Buffer Size available in logical channel group 0", HFILL - } - }, - { - &hf_mac_lte_control_long_ext_bsr_buffer_size_1, - { - "Buffer Size 1", - "mac-lte.control.bsr.buffer-size-1", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &ext_buffer_size_vals_ext, 0x03f0, - "Buffer Size available in logical channel group 1", HFILL - } - }, - { - &hf_mac_lte_control_long_ext_bsr_buffer_size_2, - { - "Buffer Size 2", - "mac-lte.control.bsr.buffer-size-2", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &ext_buffer_size_vals_ext, 0x0fc0, - "Buffer Size available in logical channel group 2", HFILL - } - }, - { - &hf_mac_lte_control_long_ext_bsr_buffer_size_3, - { - "Buffer Size 3", - "mac-lte.control.bsr.buffer-size-3", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &ext_buffer_size_vals_ext, 0x3f, - "Buffer Size available in logical channel group 3", HFILL - } - }, - { - &hf_mac_lte_control_crnti, - { - "C-RNTI", - "mac-lte.control.crnti", FT_UINT16, BASE_DEC, 0, 0x0, - "C-RNTI for the UE", HFILL - } - }, - { - &hf_mac_lte_control_timing_advance, - { - "Timing Advance", - "mac-lte.control.timing-advance", FT_UINT8, BASE_DEC, 0, 0x3f, - "Timing Advance (0-1282 - see 36.213, 4.2.3)", HFILL - } - }, - { - &hf_mac_lte_control_timing_advance_reserved, - { - "Reserved", - "mac-lte.control.timing-advance.reserved", FT_UINT8, BASE_HEX, 0, 0xc0, - "Reserved bits", HFILL - } - }, - { - &hf_mac_lte_control_ue_contention_resolution, - { - "UE Contention Resolution", - "mac-lte.control.ue-contention-resolution", FT_STRING, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_control_ue_contention_resolution_identity, - { - "UE Contention Resolution Identity", - "mac-lte.control.ue-contention-resolution.identity", FT_BYTES, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_control_ue_contention_resolution_msg3, - { - "Msg3", - "mac-lte.control.ue-contention-resolution.msg3", FT_FRAMENUM, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_control_ue_contention_resolution_msg3_matched, - { - "UE Contention Resolution Matches Msg3", - "mac-lte.control.ue-contention-resolution.matches-msg3", FT_BOOLEAN, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_control_ue_contention_resolution_time_since_msg3, - { - "Time since Msg3", - "mac-lte.control.ue-contention-resolution.time-since-msg3", FT_UINT32, BASE_DEC, 0, 0x0, - "Time in ms since corresponding Msg3", HFILL - } - }, - - { - &hf_mac_lte_control_power_headroom, - { - "Power Headroom", - "mac-lte.control.power-headroom", FT_STRING, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_control_power_headroom_reserved, - { - "Reserved", - "mac-lte.control.power-headroom.reserved", FT_UINT8, BASE_DEC, 0, 0xc0, - "Reserved bits, should be 0", HFILL - } - }, - { - &hf_mac_lte_control_power_headroom_level, - { - "Power Headroom Level", - "mac-lte.control.power-headroom.level", FT_UINT8, BASE_DEC|BASE_EXT_STRING, - &power_headroom_vals_ext, 0x3f, "Power Headroom Level in dB", HFILL - } - }, - - { - &hf_mac_lte_control_ext_power_headroom, - { - "Extended Power Headroom", - "mac-lte.control.ext-power-headroom", FT_STRING, BASE_NONE, - 0, 0x0, NULL, HFILL - } - }, - { - &hf_mac_lte_control_ext_power_headroom_c7, - { - "SCell Index 7 Power Headroom", - "mac-lte.control.ext-power-headroom.c7", FT_BOOLEAN, 8, - TFS(&mac_lte_scell_ph_vals), 0x80, NULL, HFILL - } - }, - { - &hf_mac_lte_control_ext_power_headroom_c6, - { - "SCell Index 6 Power Headroom", - "mac-lte.control.ext-power-headroom.c6", FT_BOOLEAN, 8, - TFS(&mac_lte_scell_ph_vals), 0x40, NULL, HFILL - } - }, - { - &hf_mac_lte_control_ext_power_headroom_c5, - { - "SCell Index 5 Power Headroom", - "mac-lte.control.ext-power-headroom.c5", FT_BOOLEAN, 8, - TFS(&mac_lte_scell_ph_vals), 0x20, NULL, HFILL - } - }, - { - &hf_mac_lte_control_ext_power_headroom_c4, - { - "SCell Index 4 Power Headroom", - "mac-lte.control.ext-power-headroom.c4", FT_BOOLEAN, 8, - TFS(&mac_lte_scell_ph_vals), 0x10, NULL, HFILL - } - }, - { - &hf_mac_lte_control_ext_power_headroom_c3, - { - "SCell Index 3 Power Headroom", - "mac-lte.control.ext-power-headroom.c3", FT_BOOLEAN, 8, - TFS(&mac_lte_scell_ph_vals), 0x08, NULL, HFILL - } - }, - { - &hf_mac_lte_control_ext_power_headroom_c2, - { - "SCell Index 2 Power Headroom", - "mac-lte.control.ext-power-headroom.c2", FT_BOOLEAN, 8, - TFS(&mac_lte_scell_ph_vals), 0x04, NULL, HFILL - } - }, - { - &hf_mac_lte_control_ext_power_headroom_c1, - { - "SCell Index 1 Power Headroom", - "mac-lte.control.ext-power-headroom.c1", FT_BOOLEAN, 8, - TFS(&mac_lte_scell_ph_vals), 0x02, NULL, HFILL - } - }, - { - &hf_mac_lte_control_ext_power_headroom_reserved, - { - "Reserved", - "mac-lte.control.ext-power-headroom.reserved", FT_UINT8, BASE_DEC, - 0, 0x01, "Reserved bit, should be 0", HFILL - } - }, - { - &hf_mac_lte_control_ext_power_headroom_power_backoff, - { - "Power Backoff", - "mac-lte.control.ext-power-headroom.power-backoff", FT_BOOLEAN, 8, - TFS(&mac_lte_power_backoff_vals), 0x80, NULL, HFILL - } - }, - { - &hf_mac_lte_control_ext_power_headroom_value, - { - "Power Headroom Value", - "mac-lte.control.ext-power-headroom.power-headroom-value", FT_BOOLEAN, 8, - TFS(&mac_lte_ph_value_vals), 0x40, NULL, HFILL - } - }, - { - &hf_mac_lte_control_ext_power_headroom_level, - { - "Power Headroom Level", - "mac-lte.control.ext-power-headroom.level", FT_UINT8, BASE_DEC|BASE_EXT_STRING, - &power_headroom_vals_ext, 0x3f, "Power Headroom Level in dB", HFILL - } - }, - { - &hf_mac_lte_control_ext_power_headroom_reserved2, - { - "Reserved", - "mac-lte.control.ext-power-headroom.reserved2", FT_UINT8, BASE_DEC, - 0, 0xc0, "Reserved bits, should be 0", HFILL - } - }, - { - &hf_mac_lte_control_ext_power_headroom_pcmaxc, - { - "Configured UE Transmit Power", - "mac-lte.control.ext-power-headroom.pcmaxc", FT_UINT8, BASE_DEC|BASE_EXT_STRING, - &pcmaxc_vals_ext, 0x3f, "Pcmax,c in dBm", HFILL - } - }, - - { - &hf_mac_lte_control_activation_deactivation, - { - "Activation/Deactivation", - "mac-lte.control.activation-deactivation", FT_STRING, BASE_NONE, - 0, 0x0, NULL, HFILL - } - }, - { - &hf_mac_lte_control_activation_deactivation_c7, - { - "SCell Index 7 Status", - "mac-lte.control.activation-deactivation.c7", FT_BOOLEAN, 8, - TFS(&mac_lte_scell_status_vals), 0x80, NULL, HFILL - } - }, - { - &hf_mac_lte_control_activation_deactivation_c6, - { - "SCell Index 6 Status", - "mac-lte.control.activation-deactivation.c6", FT_BOOLEAN, 8, - TFS(&mac_lte_scell_status_vals), 0x40, NULL, HFILL - } - }, - { - &hf_mac_lte_control_activation_deactivation_c5, - { - "SCell Index 5 Status", - "mac-lte.control.activation-deactivation.c5", FT_BOOLEAN, 8, - TFS(&mac_lte_scell_status_vals), 0x20, NULL, HFILL - } - }, - { - &hf_mac_lte_control_activation_deactivation_c4, - { - "SCell Index 4 Status", - "mac-lte.control.activation-deactivation.c4", FT_BOOLEAN, 8, - TFS(&mac_lte_scell_status_vals), 0x10, NULL, HFILL - } - }, - { - &hf_mac_lte_control_activation_deactivation_c3, - { - "SCell Index 3 Status", - "mac-lte.control.activation-deactivation.c3", FT_BOOLEAN, 8, - TFS(&mac_lte_scell_status_vals), 0x08, NULL, HFILL - } - }, - { - &hf_mac_lte_control_activation_deactivation_c2, - { - "SCell Index 2 Status", - "mac-lte.control.activation-deactivation.c2", FT_BOOLEAN, 8, - TFS(&mac_lte_scell_status_vals), 0x04, NULL, HFILL - } - }, - { - &hf_mac_lte_control_activation_deactivation_c1, - { - "SCell Index 1 Status", - "mac-lte.control.activation-deactivation.c1", FT_BOOLEAN, 8, - TFS(&mac_lte_scell_status_vals), 0x02, NULL, HFILL - } - }, - { - &hf_mac_lte_control_activation_deactivation_reserved, - { - "Reserved", - "mac-lte.control.activation-deactivation.reserved", FT_UINT8, BASE_DEC, - 0, 0x01, "Reserved bit, should be 0", HFILL - } - }, - - { - &hf_mac_lte_control_mch_scheduling_info, - { - "MCH Scheduling Information", - "mac-lte.control.mch_scheduling_info", FT_STRING, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_control_mch_scheduling_info_lcid, - { - "LCID", - "mac-lte.control.mch_scheduling_info.lcid", FT_UINT8, BASE_HEX, VALS(mch_lcid_vals), 0xf8, - "Logical Channel ID of the MTCH", HFILL - } - }, - { - &hf_mac_lte_control_mch_scheduling_info_stop_mtch, - { - "Stop MTCH", - "mac-lte.control.mch_scheduling_info.stop_mtch", FT_UINT16, BASE_DEC, 0, 0x07ff, - "Ordinal number of the subframe where the corresponding MTCH stops", HFILL - } - }, - - /* Generated fields */ - { - &hf_mac_lte_dl_harq_resend_original_frame, - { - "Frame with previous tx", - "mac-lte.dlsch.retx.original-frame", FT_FRAMENUM, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_dl_harq_resend_time_since_previous_frame, - { - "Time since previous tx (ms)", - "mac-lte.dlsch.retx.time-since-previous", FT_UINT16, BASE_DEC, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_dl_harq_resend_next_frame, - { - "Frame with next tx", - "mac-lte.dlsch.retx.next-frame", FT_FRAMENUM, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_dl_harq_resend_time_until_next_frame, - { - "Time until next tx (ms)", - "mac-lte.dlsch.retx.time-until-next", FT_UINT16, BASE_DEC, 0, 0x0, - NULL, HFILL - } - }, - - { - &hf_mac_lte_ul_harq_resend_original_frame, - { - "Frame with previous tx", - "mac-lte.ulsch.retx.original-frame", FT_FRAMENUM, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_ul_harq_resend_time_since_previous_frame, - { - "Time since previous tx (ms)", - "mac-lte.ulsch.retx.time-since-previous", FT_UINT16, BASE_DEC, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_ul_harq_resend_next_frame, - { - "Frame with next tx", - "mac-lte.ulsch.retx.next-frame", FT_FRAMENUM, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_ul_harq_resend_time_until_next_frame, - { - "Time until next tx (ms)", - "mac-lte.ulsch.retx.time-until-next", FT_UINT16, BASE_DEC, 0, 0x0, - NULL, HFILL - } - }, - - { - &hf_mac_lte_grant_answering_sr, - { - "First Grant Following SR from", - "mac-lte.ulsch.grant-answering-sr", FT_FRAMENUM, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_failure_answering_sr, - { - "SR which failed", - "mac-lte.ulsch.failure-answering-sr", FT_FRAMENUM, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_sr_leading_to_failure, - { - "This SR fails", - "mac-lte.ulsch.failure-answering-sr-frame", FT_FRAMENUM, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_sr_leading_to_grant, - { - "This SR results in a grant here", - "mac-lte.ulsch.grant-answering-sr-frame", FT_FRAMENUM, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_sr_invalid_event, - { - "Invalid event", - "mac-lte.ulsch.sr-invalid-event", FT_NONE, BASE_NONE, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_sr_time_since_request, - { - "Time since SR (ms)", - "mac-lte.ulsch.time-since-sr", FT_UINT32, BASE_DEC, 0, 0x0, - NULL, HFILL - } - }, - { - &hf_mac_lte_sr_time_until_answer, - { - "Time until answer (ms)", - "mac-lte.ulsch.time-until-sr-answer", FT_UINT32, BASE_DEC, 0, 0x0, - NULL, HFILL - } - }, - - }; - - static gint *ett[] = { - &ett_mac_lte, - &ett_mac_lte_context, - &ett_mac_lte_phy_context, - &ett_mac_lte_rar_headers, - &ett_mac_lte_rar_header, - &ett_mac_lte_rar_body, - &ett_mac_lte_rar_ul_grant, - &ett_mac_lte_ulsch_header, - &ett_mac_lte_dlsch_header, - &ett_mac_lte_mch_header, - &ett_mac_lte_sch_subheader, - &ett_mac_lte_mch_subheader, - &ett_mac_lte_bch, - &ett_mac_lte_bsr, - &ett_mac_lte_pch, - &ett_mac_lte_activation_deactivation, - &ett_mac_lte_contention_resolution, - &ett_mac_lte_power_headroom, - &ett_mac_lte_extended_power_headroom, - &ett_mac_lte_extended_power_headroom_cell, - &ett_mac_lte_mch_scheduling_info, - &ett_mac_lte_oob - }; - - static enum_val_t show_info_col_vals[] = { - {"show-phy", "PHY Info", ShowPHYLayer}, - {"show-mac", "MAC Info", ShowMACLayer}, - {"show-rlc", "RLC Info", ShowRLCLayer}, - {NULL, NULL, -1} - }; - - static enum_val_t lcid_drb_source_vals[] = { - {"from-static-stable", "From static table", FromStaticTable}, - {"from-configuration-protocol", "From configuration protocol", FromConfigurationProtocol}, - {NULL, NULL, -1} - }; - - - module_t *mac_lte_module; - - static uat_field_t lcid_drb_mapping_flds[] = { - UAT_FLD_VS(lcid_drb_mappings, lcid, "lcid", drb_lcid_vals, "The MAC LCID"), - UAT_FLD_DEC(lcid_drb_mappings, drbid,"drb id (1-32)", "Identifier of logical data channel"), - UAT_FLD_VS(lcid_drb_mappings, channel_type, "RLC Channel Type", rlc_channel_type_vals, "The MAC LCID"), - UAT_END_FIELDS - }; - - /* Register protocol. */ - proto_mac_lte = proto_register_protocol("MAC-LTE", "MAC-LTE", "mac-lte"); - proto_register_field_array(proto_mac_lte, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); - - /* Allow other dissectors to find this one by name. */ - register_dissector("mac-lte", dissect_mac_lte, proto_mac_lte); - - /* Register the tap name */ - mac_lte_tap = register_tap("mac-lte"); - - /* Preferences */ - mac_lte_module = prefs_register_protocol(proto_mac_lte, NULL); - - /* Obsolete preferences */ - prefs_register_obsolete_preference(mac_lte_module, "single_rar"); - prefs_register_obsolete_preference(mac_lte_module, "check_reserved_bits"); - prefs_register_obsolete_preference(mac_lte_module, "decode_rar_ul_grant"); - prefs_register_obsolete_preference(mac_lte_module, "show_rlc_info_column"); - prefs_register_obsolete_preference(mac_lte_module, "attempt_to_detect_dl_harq_resend"); - prefs_register_obsolete_preference(mac_lte_module, "attempt_to_track_ul_harq_resend"); - - prefs_register_uint_preference(mac_lte_module, "retx_count_warn", - "Number of Re-Transmits before expert warning triggered", - "Number of Re-Transmits before expert warning triggered", - 10, &global_mac_lte_retx_counter_trigger); - - prefs_register_bool_preference(mac_lte_module, "attempt_rrc_decode", - "Attempt to decode BCH, PCH and CCCH data using LTE RRC dissector", - "Attempt to decode BCH, PCH and CCCH data using LTE RRC dissector", - &global_mac_lte_attempt_rrc_decode); - - prefs_register_bool_preference(mac_lte_module, "attempt_to_dissect_crc_failures", - "Dissect frames that have failed CRC check", - "Attempt to dissect frames that have failed CRC check", - &global_mac_lte_dissect_crc_failures); - - prefs_register_bool_preference(mac_lte_module, "heuristic_mac_lte_over_udp", - "Try Heuristic LTE-MAC over UDP framing", - "When enabled, use heuristic dissector to find MAC-LTE frames sent with " - "UDP framing", - &global_mac_lte_heur); - - prefs_register_bool_preference(mac_lte_module, "attempt_to_dissect_srb_sdus", - "Attempt to dissect LCID 1&2 as srb1&2", - "Will call LTE RLC dissector with standard settings as per RRC spec", - &global_mac_lte_attempt_srb_decode); - - prefs_register_enum_preference(mac_lte_module, "lcid_to_drb_mapping_source", - "Source of LCID -> drb channel settings", - "Set whether LCID -> drb Table is taken from static table (below) or from " - "info learned from control protocol (e.g. RRC)", - &global_mac_lte_lcid_drb_source, lcid_drb_source_vals, FALSE); - - lcid_drb_mappings_uat = uat_new("Static LCID -> drb Table", - sizeof(lcid_drb_mapping_t), - "drb_logchans", - TRUE, - (void*) &lcid_drb_mappings, - &num_lcid_drb_mappings, - UAT_CAT_FFMT, - "", /* TODO: is this ref to help manual? */ - lcid_drb_mapping_copy_cb, - NULL, - NULL, - NULL, - lcid_drb_mapping_flds ); - - prefs_register_uat_preference(mac_lte_module, - "drb_table", - "LCID -> DRB Mappings Table", - "A table that maps from configurable lcids -> RLC logical channels", - lcid_drb_mappings_uat); - - prefs_register_uint_preference(mac_lte_module, "bsr_warn_threshold", - "BSR size when warning should be issued (0 - 63)", - "If any BSR report is >= this number, an expert warning will be added", - 10, &global_mac_lte_bsr_warn_threshold); - - prefs_register_bool_preference(mac_lte_module, "track_sr", - "Track status of SRs within UEs", - "Track status of SRs, providing links between requests, failure indications and grants", - &global_mac_lte_track_sr); - - prefs_register_enum_preference(mac_lte_module, "layer_to_show", - "Which layer info to show in Info column", - "Can show PHY, MAC or RLC layer info in Info column", - &global_mac_lte_layer_to_show, show_info_col_vals, FALSE); - - register_init_routine(&mac_lte_init_protocol); -} - - -/* Set LCID -> RLC channel mappings from signalling protocol (i.e. RRC or similar). - TODO: not using UEID yet - assume all UEs configured identically... */ -void set_mac_lte_channel_mapping(guint16 ueid _U_, guint8 lcid, - guint8 srbid, guint8 drbid, - guint8 rlcMode, guint8 um_sn_length, - guint8 ul_priority) -{ - /* Don't bother setting srb details - we just assume AM */ - if (srbid != 0) { - return; - } - - /* Ignore if LCID is out of range */ - if ((lcid < 3) || (lcid > 10)) { - return; - } - - /* Set array entry */ - dynamic_lcid_drb_mapping[lcid].valid = TRUE; - dynamic_lcid_drb_mapping[lcid].drbid = drbid; - dynamic_lcid_drb_mapping[lcid].ul_priority = ul_priority; - - switch (rlcMode) { - case RLC_AM_MODE: - dynamic_lcid_drb_mapping[lcid].channel_type = rlcAM; - break; - - case RLC_UM_MODE: - if (um_sn_length == 5) { - dynamic_lcid_drb_mapping[lcid].channel_type = rlcUM5; - } else { - dynamic_lcid_drb_mapping[lcid].channel_type = rlcUM10; - } - - break; - - default: - break; - } -} - -/* Return the configured UL priority for the channel */ -static guint8 get_mac_lte_channel_priority(guint16 ueid _U_, guint8 lcid, - guint8 direction) -{ - /* Priority only affects UL */ - if (direction == DIRECTION_DOWNLINK) { - return 0; - } - - /* Won't report value if channel not configured */ - if (!dynamic_lcid_drb_mapping[lcid].valid) { - return 0; - } else { - return dynamic_lcid_drb_mapping[lcid].ul_priority; - } -} - -/* Function to be called from outside this module (e.g. in a plugin) to get per-packet data */ -mac_lte_info *get_mac_lte_proto_data(packet_info *pinfo) -{ - return p_get_proto_data(pinfo->fd, proto_mac_lte); -} - -/* Function to be called from outside this module (e.g. in a plugin) to set per-packet data */ -void set_mac_lte_proto_data(packet_info *pinfo, mac_lte_info *p_mac_lte_info) -{ - p_add_proto_data(pinfo->fd, proto_mac_lte, p_mac_lte_info); -} - -void proto_reg_handoff_mac_lte(void) -{ - static dissector_handle_t mac_lte_handle; - - if (!mac_lte_handle) { - mac_lte_handle = find_dissector("mac-lte"); - - /* Add as a heuristic UDP dissector */ - heur_dissector_add("udp", dissect_mac_lte_heur, proto_mac_lte); - } -} - diff --git a/openair2/UTIL/OPT/packet-mac-lte.h b/openair2/UTIL/OPT/packet-mac-lte.h index d9c31052008..84c6254d9f6 100644 --- a/openair2/UTIL/OPT/packet-mac-lte.h +++ b/openair2/UTIL/OPT/packet-mac-lte.h @@ -7,20 +7,6 @@ * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * * This header file may also be distributed under * the terms of the BSD Licence as follows: * diff --git a/openair2/UTIL/OPT/packet-rlc-lte.h b/openair2/UTIL/OPT/packet-rlc-lte.h deleted file mode 100755 index d31d015662c..00000000000 --- a/openair2/UTIL/OPT/packet-rlc-lte.h +++ /dev/null @@ -1,150 +0,0 @@ -/* packet-rlc-lte.h - * - * Martin Mathieson - * $Id$ - * - * Wireshark - Network traffic analyzer - * By Gerald Combs <gerald@wireshark.org> - * Copyright 1998 Gerald Combs - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* rlcMode */ -#define RLC_TM_MODE 1 -#define RLC_UM_MODE 2 -#define RLC_AM_MODE 4 -#define RLC_PREDEF 8 - -/* direction */ -#define DIRECTION_UPLINK 0 -#define DIRECTION_DOWNLINK 1 - -/* priority ? */ - -/* channelType */ -#define CHANNEL_TYPE_CCCH 1 -#define CHANNEL_TYPE_BCCH_BCH 2 -#define CHANNEL_TYPE_PCCH 3 -#define CHANNEL_TYPE_SRB 4 -#define CHANNEL_TYPE_DRB 5 -#define CHANNEL_TYPE_BCCH_DL_SCH 6 - -/* UMSequenceNumberLength */ -#define UM_SN_LENGTH_5_BITS 5 -#define UM_SN_LENGTH_10_BITS 10 - -/* Info attached to each LTE RLC frame */ -typedef struct rlc_lte_info { - guint8 rlcMode; - guint8 direction; - guint8 priority; - guint16 ueid; - guint16 channelType; - guint16 channelId; - guint16 pduLength; - guint8 UMSequenceNumberLength; -} rlc_lte_info; - - -typedef struct rlc_lte_tap_info { - /* Info from context */ - guint8 rlcMode; - guint8 direction; - guint8 priority; - guint16 ueid; - guint16 channelType; - guint16 channelId; - guint16 pduLength; - guint8 UMSequenceNumberLength; - - nstime_t time; - guint8 loggedInMACFrame; - guint16 sequenceNumber; - guint8 isResegmented; - guint8 isControlPDU; - guint16 ACKNo; -#define MAX_NACKs 128 - guint16 noOfNACKs; - guint16 NACKs[MAX_NACKs]; - - guint16 missingSNs; -} rlc_lte_tap_info; - - -/* Configure number of PDCP SN bits to use for DRB channels. */ -void set_rlc_lte_drb_pdcp_seqnum_length(guint16 ueid, guint8 drbid, guint8 userplane_seqnum_length); - - -/*****************************************************************/ -/* UDP framing format */ -/* ----------------------- */ -/* Several people have asked about dissecting RLC by framing */ -/* PDUs over IP. A suggested format over UDP has been defined */ -/* and implemented by this dissector, using the definitions */ -/* below. A link to an example program showing you how to encode */ -/* these headers and send LTE RLC PDUs on a UDP socket is */ -/* provided at http://wiki.wireshark.org/RLC-LTE */ -/* */ -/* A heuristic dissecter (enabled by a preference) will */ -/* recognise a signature at the beginning of these frames. */ -/* Until someone is using this format, suggestions for changes */ -/* are welcome. */ -/*****************************************************************/ - - -/* Signature. Rather than try to define a port for this, or make the - * port number a preference, frames will start with this string (with no - * terminating NULL */ -#define RLC_LTE_START_STRING "rlc-lte" - -/* Fixed field. This is followed by the following 1 mandatory field: - * - rlcMode (1 byte) - * (where the allowed values are defined above */ - -/* Conditional field. This field is mandatory in case of RLC Unacknowledged mode. - * The format is to have the tag, followed by the value (there is no length field, - * its implicit from the tag). The allowed values are defined above. */ - -#define RLC_LTE_UM_SN_LENGTH_TAG 0x02 -/* 1 byte */ - -/* Optional fields. Attaching this info to frames will allow you - * to show you display/filter/plot/add-custom-columns on these fields, so should - * be added if available. - * The format is to have the tag, followed by the value (there is no length field, - * its implicit from the tag) */ - -#define RLC_LTE_DIRECTION_TAG 0x03 -/* 1 byte */ - -#define RLC_LTE_PRIORITY_TAG 0x04 -/* 1 byte */ - -#define RLC_LTE_UEID_TAG 0x05 -/* 2 bytes, network order */ - -#define RLC_LTE_CHANNEL_TYPE_TAG 0x06 -/* 2 bytes, network order */ - -#define RLC_LTE_CHANNEL_ID_TAG 0x07 -/* 2 bytes, network order */ - - -/* RLC PDU. Following this tag comes the actual RLC PDU (there is no length, the PDU - * continues until the end of the frame) */ -#define RLC_LTE_PAYLOAD_TAG 0x01 - - diff --git a/openair2/UTIL/OPT/probe.c b/openair2/UTIL/OPT/probe.c index eef98ae7297..8f02c434567 100644 --- a/openair2/UTIL/OPT/probe.c +++ b/openair2/UTIL/OPT/probe.c @@ -29,36 +29,6 @@ * SUCH DAMAGE */ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ - - /*! \file probe.c * \brief * \author navid nikaein diff --git a/openair2/UTIL/OPT/socket_sender.c b/openair2/UTIL/OPT/socket_sender.c deleted file mode 100644 index f4f8a2eaae5..00000000000 --- a/openair2/UTIL/OPT/socket_sender.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.0 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - diff --git a/openair3/NAS/TEST/MSC/mscgen b/openair3/NAS/TEST/MSC/mscgen deleted file mode 100755 index 7a146811c77e7c0256a4bea0078cae6f1cc802d1..0000000000000000000000000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NAgORI>JMsP>Ke3qO diff --git a/openair3/TEST/test_util.c b/openair3/TEST/test_util.c deleted file mode 100644 index 87fd2428f04..00000000000 --- a/openair3/TEST/test_util.c +++ /dev/null @@ -1,287 +0,0 @@ -/* - * Copyright (C) 2004-2012 Free Software Foundation, Inc. - * - * Author: Simon Josefsson - * - * This file is part of GnuTLS. - * - * GnuTLS is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * GnuTLS is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GnuTLS; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> -#include <stdarg.h> -#include <ctype.h> - -#include "test_util.h" - -int debug = 0; -int error_count = 0; -int break_on_error = 0; - -/* -1 means invalid */ -static const signed char hex_digits[0x100] = { - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1, - -1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 -}; - -void -fail (const char *format, ...) -{ - char str[1024]; - va_list arg_ptr; - - va_start (arg_ptr, format); - vsnprintf ( str, sizeof(str), format, arg_ptr); - va_end (arg_ptr); - fputs(str, stderr); - error_count++; - - if (break_on_error) - exit (1); -} - -void -success (const char *format, ...) -{ - char str[1024]; - va_list arg_ptr; - - va_start (arg_ptr, format); - vsnprintf ( str, sizeof(str), format, arg_ptr); - va_end (arg_ptr); - fputs(str, stderr); -} - -void -escapeprint (const char *str, size_t len) -{ - size_t i; - - printf (" (length %d bytes):\n\t", (int) len); - - for (i = 0; i < len; i++) { - if (((str[i] & 0xFF) >= 'A' && (str[i] & 0xFF) <= 'Z') || - ((str[i] & 0xFF) >= 'a' && (str[i] & 0xFF) <= 'z') || - ((str[i] & 0xFF) >= '0' && (str[i] & 0xFF) <= '9') - || (str[i] & 0xFF) == ' ' || (str[i] & 0xFF) == '.') - printf ("%c", (str[i] & 0xFF)); - else - printf ("\\x%02X", (str[i] & 0xFF)); - - if ((i + 1) % 16 == 0 && (i + 1) < len) - printf ("'\n\t'"); - } - - printf ("\n"); -} - -void -hexprint (const void *_str, size_t len) -{ - size_t i; - const char* str = _str; - - printf ("\t;; "); - - for (i = 0; i < len; i++) { - printf ("%02x ", (str[i] & 0xFF)); - - if ((i + 1) % 8 == 0) - printf (" "); - - if ((i + 1) % 16 == 0 && i + 1 < len) - printf ("\n\t;; "); - } - - printf ("\n"); -} - -void -binprint (const void *_str, size_t len) -{ - size_t i; - const char* str = _str; - - printf ("\t;; "); - - for (i = 0; i < len; i++) { - printf ("%d%d%d%d%d%d%d%d ", - (str[i] & 0xFF) & 0x80 ? 1 : 0, - (str[i] & 0xFF) & 0x40 ? 1 : 0, - (str[i] & 0xFF) & 0x20 ? 1 : 0, - (str[i] & 0xFF) & 0x10 ? 1 : 0, - (str[i] & 0xFF) & 0x08 ? 1 : 0, - (str[i] & 0xFF) & 0x04 ? 1 : 0, - (str[i] & 0xFF) & 0x02 ? 1 : 0, (str[i] & 0xFF) & 0x01 ? 1 : 0); - - if ((i + 1) % 3 == 0) - printf (" "); - - if ((i + 1) % 6 == 0 && i + 1 < len) - printf ("\n\t;; "); - } - - printf ("\n"); -} - -int -compare_buffer(const uint8_t *buffer, const uint32_t length_buffer, - const uint8_t *pattern, const uint32_t length_pattern) -{ - int i; - - if (length_buffer != length_pattern) { - printf("Length mismatch, expecting %d bytes, got %d bytes\n", length_pattern, - length_buffer); - hexprint(buffer, length_buffer); - return -1; - } - - for (i = 0; i < length_buffer; i++) { - if (pattern[i] != buffer[i]) { - printf("Expecting:\n"); - hexprint(pattern, length_pattern); - printf("Received:\n"); - hexprint(buffer, length_buffer); - printf("Mismatch fount in byte %d\nExpecting 0x%02x, got 0x%02x\n", - i, pattern[i], buffer[i]); - return -1; - } - } - - return 0; -} - -unsigned -decode_hex_length(const char *h) -{ - const unsigned char *hex = (const unsigned char *) h; - unsigned count; - unsigned i; - - for (count = i = 0; hex[i]; i++) { - if (isspace(hex[i])) - continue; - - if (hex_digits[hex[i]] < 0) - abort(); - - count++; - } - - if (count % 2) - abort(); - - return count / 2; -} - -int -decode_hex(uint8_t *dst, const char *h) -{ - const unsigned char *hex = (const unsigned char *) h; - unsigned i = 0; - - for (;;) { - int high, low; - - while (*hex && isspace(*hex)) - hex++; - - if (!*hex) - return 1; - - high = hex_digits[*hex++]; - - if (high < 0) - return 0; - - while (*hex && isspace(*hex)) - hex++; - - if (!*hex) - return 0; - - low = hex_digits[*hex++]; - - if (low < 0) - return 0; - - dst[i++] = (high << 4) | low; - } -} - -uint8_t * -decode_hex_dup(const char *hex) -{ - uint8_t *p; - unsigned length = decode_hex_length(hex); - - p = malloc(length * sizeof(uint8_t)); - - if (decode_hex(p, hex)) - return p; - else { - free(p); - return NULL; - } -} - -int -main (int argc, char *argv[]) -{ - do - if (strcmp (argv[argc - 1], "-v") == 0 || - strcmp (argv[argc - 1], "--verbose") == 0) - debug = 1; - else if (strcmp (argv[argc - 1], "-b") == 0 || - strcmp (argv[argc - 1], "--break-on-error") == 0) - break_on_error = 1; - else if (strcmp (argv[argc - 1], "-h") == 0 || - strcmp (argv[argc - 1], "-?") == 0 || - strcmp (argv[argc - 1], "--help") == 0) { - printf ("Usage: %s [-vbh?] [--verbose] [--break-on-error] [--help]\n", - argv[0]); - return 1; - } - - while (argc-- > 1); - - doit (); - - if (debug || error_count > 0) - printf ("Self test `%s' finished with %d errors\n", argv[0], error_count); - - return error_count ? 1 : 0; -} diff --git a/openair3/TEST/test_util.h b/openair3/TEST/test_util.h deleted file mode 100644 index 541f41e1e08..00000000000 --- a/openair3/TEST/test_util.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2004-2012 Free Software Foundation, Inc. - * - * Author: Simon Josefsson - * - * This file is part of GnuTLS. - * - * GnuTLS is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * GnuTLS is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GnuTLS; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef TEST_UTIL_H -#define TEST_UTIL_H - -#include <string.h> -#include <stdarg.h> - -#ifndef __attribute__ -#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) -#define __attribute__(Spec) /* empty */ -#endif -#endif - -extern int debug; -extern int error_count; -extern int break_on_error; - -extern void fail (const char *format, ...) -__attribute__ ((format (printf, 1, 2))); -extern void success (const char *format, ...) -__attribute__ ((format (printf, 1, 2))); - -extern void escapeprint (const char *str, size_t len); -extern void hexprint (const void *str, size_t len); -extern void binprint (const void *str, size_t len); - -extern uint8_t * decode_hex_dup(const char *hex); -extern int decode_hex(uint8_t *dst, const char *h); -extern unsigned decode_hex_length(const char *h); - -#define H(x) decode_hex_dup(x) -#define HL(x) decode_hex_dup(x), decode_hex_length(x) - -extern int -compare_buffer(const uint8_t *buffer, const uint32_t length_buffer, - const uint8_t *pattern, const uint32_t length_pattern); - -/* This must be implemented elsewhere. */ -extern void doit (void); - -#endif /* TEST_UTIL_H_ */ diff --git a/openair3/UDP/COPYING b/openair3/UDP/COPYING deleted file mode 100644 index 94a9ed024d3..00000000000 --- a/openair3/UDP/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/targets/SCRIPTS/PROFILING/gprof2dot.py b/targets/SCRIPTS/PROFILING/gprof2dot.py deleted file mode 100755 index 62b22762fb2..00000000000 --- a/targets/SCRIPTS/PROFILING/gprof2dot.py +++ /dev/null @@ -1,2780 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2008-2009 Jose Fonseca -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# - -"""Generate a dot graph from the output of several profilers.""" - -__author__ = "Jose Fonseca" - -__version__ = "1.0" - - -import sys -import math -import os.path -import re -import textwrap -import optparse -import xml.parsers.expat - - -try: - # Debugging helper module - import debug -except ImportError: - pass - - -def times(x): - return u"%u\xd7" % (x,) - -def percentage(p): - return "%.02f%%" % (p*100.0,) - -def add(a, b): - return a + b - -def equal(a, b): - if a == b: - return a - else: - return None - -def fail(a, b): - assert False - - -tol = 2 ** -23 - -def ratio(numerator, denominator): - try: - ratio = float(numerator)/float(denominator) - except ZeroDivisionError: - # 0/0 is undefined, but 1.0 yields more useful results - return 1.0 - if ratio < 0.0: - if ratio < -tol: - sys.stderr.write('warning: negative ratio (%s/%s)\n' % (numerator, denominator)) - return 0.0 - if ratio > 1.0: - if ratio > 1.0 + tol: - sys.stderr.write('warning: ratio greater than one (%s/%s)\n' % (numerator, denominator)) - return 1.0 - return ratio - - -class UndefinedEvent(Exception): - """Raised when attempting to get an event which is undefined.""" - - def __init__(self, event): - Exception.__init__(self) - self.event = event - - def __str__(self): - return 'unspecified event %s' % self.event.name - - -class Event(object): - """Describe a kind of event, and its basic operations.""" - - def __init__(self, name, null, aggregator, formatter = str): - self.name = name - self._null = null - self._aggregator = aggregator - self._formatter = formatter - - def __eq__(self, other): - return self is other - - def __hash__(self): - return id(self) - - def null(self): - return self._null - - def aggregate(self, val1, val2): - """Aggregate two event values.""" - assert val1 is not None - assert val2 is not None - return self._aggregator(val1, val2) - - def format(self, val): - """Format an event value.""" - assert val is not None - return self._formatter(val) - - -CALLS = Event("Calls", 0, add, times) -SAMPLES = Event("Samples", 0, add) -SAMPLES2 = Event("Samples", 0, add) - -TIME = Event("Time", 0.0, add, lambda x: '(' + str(x) + ')') -TIME_RATIO = Event("Time ratio", 0.0, add, lambda x: '(' + percentage(x) + ')') -TOTAL_TIME = Event("Total time", 0.0, fail) -TOTAL_TIME_RATIO = Event("Total time ratio", 0.0, fail, percentage) - - -class Object(object): - """Base class for all objects in profile which can store events.""" - - def __init__(self, events=None): - if events is None: - self.events = {} - else: - self.events = events - - def __hash__(self): - return id(self) - - def __eq__(self, other): - return self is other - - def __contains__(self, event): - return event in self.events - - def __getitem__(self, event): - try: - return self.events[event] - except KeyError: - raise UndefinedEvent(event) - - def __setitem__(self, event, value): - if value is None: - if event in self.events: - del self.events[event] - else: - self.events[event] = value - - -class Call(Object): - """A call between functions. - - There should be at most one call object for every pair of functions. - """ - - def __init__(self, callee_id): - Object.__init__(self) - self.callee_id = callee_id - self.ratio = None - self.weight = None - - -class Function(Object): - """A function.""" - - def __init__(self, id, name): - Object.__init__(self) - self.id = id - self.name = name - self.module = None - self.process = None - self.calls = {} - self.called = None - self.weight = None - self.cycle = None - - def add_call(self, call): - if call.callee_id in self.calls: - sys.stderr.write('warning: overwriting call from function %s to %s\n' % (str(self.id), str(call.callee_id))) - self.calls[call.callee_id] = call - - def get_call(self, callee_id): - if not callee_id in self.calls: - call = Call(callee_id) - call[SAMPLES] = 0 - call[SAMPLES2] = 0 - call[CALLS] = 0 - self.calls[callee_id] = call - return self.calls[callee_id] - - # TODO: write utility functions - - def __repr__(self): - return self.name - - -class Cycle(Object): - """A cycle made from recursive function calls.""" - - def __init__(self): - Object.__init__(self) - # XXX: Do cycles need an id? - self.functions = set() - - def add_function(self, function): - assert function not in self.functions - self.functions.add(function) - # XXX: Aggregate events? - if function.cycle is not None: - for other in function.cycle.functions: - if function not in self.functions: - self.add_function(other) - function.cycle = self - - -class Profile(Object): - """The whole profile.""" - - def __init__(self): - Object.__init__(self) - self.functions = {} - self.cycles = [] - - def add_function(self, function): - if function.id in self.functions: - sys.stderr.write('warning: overwriting function %s (id %s)\n' % (function.name, str(function.id))) - self.functions[function.id] = function - - def add_cycle(self, cycle): - self.cycles.append(cycle) - - def validate(self): - """Validate the edges.""" - - for function in self.functions.itervalues(): - for callee_id in function.calls.keys(): - assert function.calls[callee_id].callee_id == callee_id - if callee_id not in self.functions: - sys.stderr.write('warning: call to undefined function %s from function %s\n' % (str(callee_id), function.name)) - del function.calls[callee_id] - - def find_cycles(self): - """Find cycles using Tarjan's strongly connected components algorithm.""" - - # Apply the Tarjan's algorithm successively until all functions are visited - visited = set() - for function in self.functions.itervalues(): - if function not in visited: - self._tarjan(function, 0, [], {}, {}, visited) - cycles = [] - for function in self.functions.itervalues(): - if function.cycle is not None and function.cycle not in cycles: - cycles.append(function.cycle) - self.cycles = cycles - if 0: - for cycle in cycles: - sys.stderr.write("Cycle:\n") - for member in cycle.functions: - sys.stderr.write("\tFunction %s\n" % member.name) - - def _tarjan(self, function, order, stack, orders, lowlinks, visited): - """Tarjan's strongly connected components algorithm. - - See also: - - http://en.wikipedia.org/wiki/Tarjan's_strongly_connected_components_algorithm - """ - - visited.add(function) - orders[function] = order - lowlinks[function] = order - order += 1 - pos = len(stack) - stack.append(function) - for call in function.calls.itervalues(): - callee = self.functions[call.callee_id] - # TODO: use a set to optimize lookup - if callee not in orders: - order = self._tarjan(callee, order, stack, orders, lowlinks, visited) - lowlinks[function] = min(lowlinks[function], lowlinks[callee]) - elif callee in stack: - lowlinks[function] = min(lowlinks[function], orders[callee]) - if lowlinks[function] == orders[function]: - # Strongly connected component found - members = stack[pos:] - del stack[pos:] - if len(members) > 1: - cycle = Cycle() - for member in members: - cycle.add_function(member) - return order - - def call_ratios(self, event): - # Aggregate for incoming calls - cycle_totals = {} - for cycle in self.cycles: - cycle_totals[cycle] = 0.0 - function_totals = {} - for function in self.functions.itervalues(): - function_totals[function] = 0.0 - for function in self.functions.itervalues(): - for call in function.calls.itervalues(): - if call.callee_id != function.id: - callee = self.functions[call.callee_id] - function_totals[callee] += call[event] - if callee.cycle is not None and callee.cycle is not function.cycle: - cycle_totals[callee.cycle] += call[event] - - # Compute the ratios - for function in self.functions.itervalues(): - for call in function.calls.itervalues(): - assert call.ratio is None - if call.callee_id != function.id: - callee = self.functions[call.callee_id] - if callee.cycle is not None and callee.cycle is not function.cycle: - total = cycle_totals[callee.cycle] - else: - total = function_totals[callee] - call.ratio = ratio(call[event], total) - - def integrate(self, outevent, inevent): - """Propagate function time ratio allong the function calls. - - Must be called after finding the cycles. - - See also: - - http://citeseer.ist.psu.edu/graham82gprof.html - """ - - # Sanity checking - assert outevent not in self - for function in self.functions.itervalues(): - assert outevent not in function - assert inevent in function - for call in function.calls.itervalues(): - assert outevent not in call - if call.callee_id != function.id: - assert call.ratio is not None - - # Aggregate the input for each cycle - for cycle in self.cycles: - total = inevent.null() - for function in self.functions.itervalues(): - total = inevent.aggregate(total, function[inevent]) - self[inevent] = total - - # Integrate along the edges - total = inevent.null() - for function in self.functions.itervalues(): - total = inevent.aggregate(total, function[inevent]) - self._integrate_function(function, outevent, inevent) - self[outevent] = total - - def _integrate_function(self, function, outevent, inevent): - if function.cycle is not None: - return self._integrate_cycle(function.cycle, outevent, inevent) - else: - if outevent not in function: - total = function[inevent] - for call in function.calls.itervalues(): - if call.callee_id != function.id: - total += self._integrate_call(call, outevent, inevent) - function[outevent] = total - return function[outevent] - - def _integrate_call(self, call, outevent, inevent): - assert outevent not in call - assert call.ratio is not None - callee = self.functions[call.callee_id] - subtotal = call.ratio *self._integrate_function(callee, outevent, inevent) - call[outevent] = subtotal - return subtotal - - def _integrate_cycle(self, cycle, outevent, inevent): - if outevent not in cycle: - - # Compute the outevent for the whole cycle - total = inevent.null() - for member in cycle.functions: - subtotal = member[inevent] - for call in member.calls.itervalues(): - callee = self.functions[call.callee_id] - if callee.cycle is not cycle: - subtotal += self._integrate_call(call, outevent, inevent) - total += subtotal - cycle[outevent] = total - - # Compute the time propagated to callers of this cycle - callees = {} - for function in self.functions.itervalues(): - if function.cycle is not cycle: - for call in function.calls.itervalues(): - callee = self.functions[call.callee_id] - if callee.cycle is cycle: - try: - callees[callee] += call.ratio - except KeyError: - callees[callee] = call.ratio - - for member in cycle.functions: - member[outevent] = outevent.null() - - for callee, call_ratio in callees.iteritems(): - ranks = {} - call_ratios = {} - partials = {} - self._rank_cycle_function(cycle, callee, 0, ranks) - self._call_ratios_cycle(cycle, callee, ranks, call_ratios, set()) - partial = self._integrate_cycle_function(cycle, callee, call_ratio, partials, ranks, call_ratios, outevent, inevent) - assert partial == max(partials.values()) - assert not total or abs(1.0 - partial/(call_ratio*total)) <= 0.001 - - return cycle[outevent] - - def _rank_cycle_function(self, cycle, function, rank, ranks): - if function not in ranks or ranks[function] > rank: - ranks[function] = rank - for call in function.calls.itervalues(): - if call.callee_id != function.id: - callee = self.functions[call.callee_id] - if callee.cycle is cycle: - self._rank_cycle_function(cycle, callee, rank + 1, ranks) - - def _call_ratios_cycle(self, cycle, function, ranks, call_ratios, visited): - if function not in visited: - visited.add(function) - for call in function.calls.itervalues(): - if call.callee_id != function.id: - callee = self.functions[call.callee_id] - if callee.cycle is cycle: - if ranks[callee] > ranks[function]: - call_ratios[callee] = call_ratios.get(callee, 0.0) + call.ratio - self._call_ratios_cycle(cycle, callee, ranks, call_ratios, visited) - - def _integrate_cycle_function(self, cycle, function, partial_ratio, partials, ranks, call_ratios, outevent, inevent): - if function not in partials: - partial = partial_ratio*function[inevent] - for call in function.calls.itervalues(): - if call.callee_id != function.id: - callee = self.functions[call.callee_id] - if callee.cycle is not cycle: - assert outevent in call - partial += partial_ratio*call[outevent] - else: - if ranks[callee] > ranks[function]: - callee_partial = self._integrate_cycle_function(cycle, callee, partial_ratio, partials, ranks, call_ratios, outevent, inevent) - call_ratio = ratio(call.ratio, call_ratios[callee]) - call_partial = call_ratio*callee_partial - try: - call[outevent] += call_partial - except UndefinedEvent: - call[outevent] = call_partial - partial += call_partial - partials[function] = partial - try: - function[outevent] += partial - except UndefinedEvent: - function[outevent] = partial - return partials[function] - - def aggregate(self, event): - """Aggregate an event for the whole profile.""" - - total = event.null() - for function in self.functions.itervalues(): - try: - total = event.aggregate(total, function[event]) - except UndefinedEvent: - return - self[event] = total - - def ratio(self, outevent, inevent): - assert outevent not in self - assert inevent in self - for function in self.functions.itervalues(): - assert outevent not in function - assert inevent in function - function[outevent] = ratio(function[inevent], self[inevent]) - for call in function.calls.itervalues(): - assert outevent not in call - if inevent in call: - call[outevent] = ratio(call[inevent], self[inevent]) - self[outevent] = 1.0 - - def prune(self, node_thres, edge_thres): - """Prune the profile""" - - # compute the prune ratios - for function in self.functions.itervalues(): - try: - function.weight = function[TOTAL_TIME_RATIO] - except UndefinedEvent: - pass - - for call in function.calls.itervalues(): - callee = self.functions[call.callee_id] - - if TOTAL_TIME_RATIO in call: - # handle exact cases first - call.weight = call[TOTAL_TIME_RATIO] - else: - try: - # make a safe estimate - call.weight = min(function[TOTAL_TIME_RATIO], callee[TOTAL_TIME_RATIO]) - except UndefinedEvent: - pass - - # prune the nodes - for function_id in self.functions.keys(): - function = self.functions[function_id] - if function.weight is not None: - if function.weight < node_thres: - del self.functions[function_id] - - # prune the egdes - for function in self.functions.itervalues(): - for callee_id in function.calls.keys(): - call = function.calls[callee_id] - if callee_id not in self.functions or call.weight is not None and call.weight < edge_thres: - del function.calls[callee_id] - - def dump(self): - for function in self.functions.itervalues(): - sys.stderr.write('Function %s:\n' % (function.name,)) - self._dump_events(function.events) - for call in function.calls.itervalues(): - callee = self.functions[call.callee_id] - sys.stderr.write(' Call %s:\n' % (callee.name,)) - self._dump_events(call.events) - for cycle in self.cycles: - sys.stderr.write('Cycle:\n') - self._dump_events(cycle.events) - for function in cycle.functions: - sys.stderr.write(' Function %s\n' % (function.name,)) - - def _dump_events(self, events): - for event, value in events.iteritems(): - sys.stderr.write(' %s: %s\n' % (event.name, event.format(value))) - - -class Struct: - """Masquerade a dictionary with a structure-like behavior.""" - - def __init__(self, attrs = None): - if attrs is None: - attrs = {} - self.__dict__['_attrs'] = attrs - - def __getattr__(self, name): - try: - return self._attrs[name] - except KeyError: - raise AttributeError(name) - - def __setattr__(self, name, value): - self._attrs[name] = value - - def __str__(self): - return str(self._attrs) - - def __repr__(self): - return repr(self._attrs) - - -class ParseError(Exception): - """Raised when parsing to signal mismatches.""" - - def __init__(self, msg, line): - self.msg = msg - # TODO: store more source line information - self.line = line - - def __str__(self): - return '%s: %r' % (self.msg, self.line) - - -class Parser: - """Parser interface.""" - - def __init__(self): - pass - - def parse(self): - raise NotImplementedError - - -class LineParser(Parser): - """Base class for parsers that read line-based formats.""" - - def __init__(self, file): - Parser.__init__(self) - self._file = file - self.__line = None - self.__eof = False - self.line_no = 0 - - def readline(self): - line = self._file.readline() - if not line: - self.__line = '' - self.__eof = True - else: - self.line_no += 1 - self.__line = line.rstrip('\r\n') - - def lookahead(self): - assert self.__line is not None - return self.__line - - def consume(self): - assert self.__line is not None - line = self.__line - self.readline() - return line - - def eof(self): - assert self.__line is not None - return self.__eof - - -XML_ELEMENT_START, XML_ELEMENT_END, XML_CHARACTER_DATA, XML_EOF = range(4) - - -class XmlToken: - - def __init__(self, type, name_or_data, attrs = None, line = None, column = None): - assert type in (XML_ELEMENT_START, XML_ELEMENT_END, XML_CHARACTER_DATA, XML_EOF) - self.type = type - self.name_or_data = name_or_data - self.attrs = attrs - self.line = line - self.column = column - - def __str__(self): - if self.type == XML_ELEMENT_START: - return '<' + self.name_or_data + ' ...>' - if self.type == XML_ELEMENT_END: - return '</' + self.name_or_data + '>' - if self.type == XML_CHARACTER_DATA: - return self.name_or_data - if self.type == XML_EOF: - return 'end of file' - assert 0 - - -class XmlTokenizer: - """Expat based XML tokenizer.""" - - def __init__(self, fp, skip_ws = True): - self.fp = fp - self.tokens = [] - self.index = 0 - self.final = False - self.skip_ws = skip_ws - - self.character_pos = 0, 0 - self.character_data = '' - - self.parser = xml.parsers.expat.ParserCreate() - self.parser.StartElementHandler = self.handle_element_start - self.parser.EndElementHandler = self.handle_element_end - self.parser.CharacterDataHandler = self.handle_character_data - - def handle_element_start(self, name, attributes): - self.finish_character_data() - line, column = self.pos() - token = XmlToken(XML_ELEMENT_START, name, attributes, line, column) - self.tokens.append(token) - - def handle_element_end(self, name): - self.finish_character_data() - line, column = self.pos() - token = XmlToken(XML_ELEMENT_END, name, None, line, column) - self.tokens.append(token) - - def handle_character_data(self, data): - if not self.character_data: - self.character_pos = self.pos() - self.character_data += data - - def finish_character_data(self): - if self.character_data: - if not self.skip_ws or not self.character_data.isspace(): - line, column = self.character_pos - token = XmlToken(XML_CHARACTER_DATA, self.character_data, None, line, column) - self.tokens.append(token) - self.character_data = '' - - def next(self): - size = 16*1024 - while self.index >= len(self.tokens) and not self.final: - self.tokens = [] - self.index = 0 - data = self.fp.read(size) - self.final = len(data) < size - try: - self.parser.Parse(data, self.final) - except xml.parsers.expat.ExpatError, e: - #if e.code == xml.parsers.expat.errors.XML_ERROR_NO_ELEMENTS: - if e.code == 3: - pass - else: - raise e - if self.index >= len(self.tokens): - line, column = self.pos() - token = XmlToken(XML_EOF, None, None, line, column) - else: - token = self.tokens[self.index] - self.index += 1 - return token - - def pos(self): - return self.parser.CurrentLineNumber, self.parser.CurrentColumnNumber - - -class XmlTokenMismatch(Exception): - - def __init__(self, expected, found): - self.expected = expected - self.found = found - - def __str__(self): - return '%u:%u: %s expected, %s found' % (self.found.line, self.found.column, str(self.expected), str(self.found)) - - -class XmlParser(Parser): - """Base XML document parser.""" - - def __init__(self, fp): - Parser.__init__(self) - self.tokenizer = XmlTokenizer(fp) - self.consume() - - def consume(self): - self.token = self.tokenizer.next() - - def match_element_start(self, name): - return self.token.type == XML_ELEMENT_START and self.token.name_or_data == name - - def match_element_end(self, name): - return self.token.type == XML_ELEMENT_END and self.token.name_or_data == name - - def element_start(self, name): - while self.token.type == XML_CHARACTER_DATA: - self.consume() - if self.token.type != XML_ELEMENT_START: - raise XmlTokenMismatch(XmlToken(XML_ELEMENT_START, name), self.token) - if self.token.name_or_data != name: - raise XmlTokenMismatch(XmlToken(XML_ELEMENT_START, name), self.token) - attrs = self.token.attrs - self.consume() - return attrs - - def element_end(self, name): - while self.token.type == XML_CHARACTER_DATA: - self.consume() - if self.token.type != XML_ELEMENT_END: - raise XmlTokenMismatch(XmlToken(XML_ELEMENT_END, name), self.token) - if self.token.name_or_data != name: - raise XmlTokenMismatch(XmlToken(XML_ELEMENT_END, name), self.token) - self.consume() - - def character_data(self, strip = True): - data = '' - while self.token.type == XML_CHARACTER_DATA: - data += self.token.name_or_data - self.consume() - if strip: - data = data.strip() - return data - - -class GprofParser(Parser): - """Parser for GNU gprof output. - - See also: - - Chapter "Interpreting gprof's Output" from the GNU gprof manual - http://sourceware.org/binutils/docs-2.18/gprof/Call-Graph.html#Call-Graph - - File "cg_print.c" from the GNU gprof source code - http://sourceware.org/cgi-bin/cvsweb.cgi/~checkout~/src/gprof/cg_print.c?rev=1.12&cvsroot=src - """ - - def __init__(self, fp): - Parser.__init__(self) - self.fp = fp - self.functions = {} - self.cycles = {} - - def readline(self): - line = self.fp.readline() - if not line: - sys.stderr.write('error: unexpected end of file\n') - sys.exit(1) - line = line.rstrip('\r\n') - return line - - _int_re = re.compile(r'^\d+$') - _float_re = re.compile(r'^\d+\.\d+$') - - def translate(self, mo): - """Extract a structure from a match object, while translating the types in the process.""" - attrs = {} - groupdict = mo.groupdict() - for name, value in groupdict.iteritems(): - if value is None: - value = None - elif self._int_re.match(value): - value = int(value) - elif self._float_re.match(value): - value = float(value) - attrs[name] = (value) - return Struct(attrs) - - _cg_header_re = re.compile( - # original gprof header - r'^\s+called/total\s+parents\s*$|' + - r'^index\s+%time\s+self\s+descendents\s+called\+self\s+name\s+index\s*$|' + - r'^\s+called/total\s+children\s*$|' + - # GNU gprof header - r'^index\s+%\s+time\s+self\s+children\s+called\s+name\s*$' - ) - - _cg_ignore_re = re.compile( - # spontaneous - r'^\s+<spontaneous>\s*$|' - # internal calls (such as "mcount") - r'^.*\((\d+)\)$' - ) - - _cg_primary_re = re.compile( - r'^\[(?P<index>\d+)\]?' + - r'\s+(?P<percentage_time>\d+\.\d+)' + - r'\s+(?P<self>\d+\.\d+)' + - r'\s+(?P<descendants>\d+\.\d+)' + - r'\s+(?:(?P<called>\d+)(?:\+(?P<called_self>\d+))?)?' + - r'\s+(?P<name>\S.*?)' + - r'(?:\s+<cycle\s(?P<cycle>\d+)>)?' + - r'\s\[(\d+)\]$' - ) - - _cg_parent_re = re.compile( - r'^\s+(?P<self>\d+\.\d+)?' + - r'\s+(?P<descendants>\d+\.\d+)?' + - r'\s+(?P<called>\d+)(?:/(?P<called_total>\d+))?' + - r'\s+(?P<name>\S.*?)' + - r'(?:\s+<cycle\s(?P<cycle>\d+)>)?' + - r'\s\[(?P<index>\d+)\]$' - ) - - _cg_child_re = _cg_parent_re - - _cg_cycle_header_re = re.compile( - r'^\[(?P<index>\d+)\]?' + - r'\s+(?P<percentage_time>\d+\.\d+)' + - r'\s+(?P<self>\d+\.\d+)' + - r'\s+(?P<descendants>\d+\.\d+)' + - r'\s+(?:(?P<called>\d+)(?:\+(?P<called_self>\d+))?)?' + - r'\s+<cycle\s(?P<cycle>\d+)\sas\sa\swhole>' + - r'\s\[(\d+)\]$' - ) - - _cg_cycle_member_re = re.compile( - r'^\s+(?P<self>\d+\.\d+)?' + - r'\s+(?P<descendants>\d+\.\d+)?' + - r'\s+(?P<called>\d+)(?:\+(?P<called_self>\d+))?' + - r'\s+(?P<name>\S.*?)' + - r'(?:\s+<cycle\s(?P<cycle>\d+)>)?' + - r'\s\[(?P<index>\d+)\]$' - ) - - _cg_sep_re = re.compile(r'^--+$') - - def parse_function_entry(self, lines): - parents = [] - children = [] - - while True: - if not lines: - sys.stderr.write('warning: unexpected end of entry\n') - line = lines.pop(0) - if line.startswith('['): - break - - # read function parent line - mo = self._cg_parent_re.match(line) - if not mo: - if self._cg_ignore_re.match(line): - continue - sys.stderr.write('warning: unrecognized call graph entry: %r\n' % line) - else: - parent = self.translate(mo) - parents.append(parent) - - # read primary line - mo = self._cg_primary_re.match(line) - if not mo: - sys.stderr.write('warning: unrecognized call graph entry: %r\n' % line) - return - else: - function = self.translate(mo) - - while lines: - line = lines.pop(0) - - # read function subroutine line - mo = self._cg_child_re.match(line) - if not mo: - if self._cg_ignore_re.match(line): - continue - sys.stderr.write('warning: unrecognized call graph entry: %r\n' % line) - else: - child = self.translate(mo) - children.append(child) - - function.parents = parents - function.children = children - - self.functions[function.index] = function - - def parse_cycle_entry(self, lines): - - # read cycle header line - line = lines[0] - mo = self._cg_cycle_header_re.match(line) - if not mo: - sys.stderr.write('warning: unrecognized call graph entry: %r\n' % line) - return - cycle = self.translate(mo) - - # read cycle member lines - cycle.functions = [] - for line in lines[1:]: - mo = self._cg_cycle_member_re.match(line) - if not mo: - sys.stderr.write('warning: unrecognized call graph entry: %r\n' % line) - continue - call = self.translate(mo) - cycle.functions.append(call) - - self.cycles[cycle.cycle] = cycle - - def parse_cg_entry(self, lines): - if lines[0].startswith("["): - self.parse_cycle_entry(lines) - else: - self.parse_function_entry(lines) - - def parse_cg(self): - """Parse the call graph.""" - - # skip call graph header - while not self._cg_header_re.match(self.readline()): - pass - line = self.readline() - while self._cg_header_re.match(line): - line = self.readline() - - # process call graph entries - entry_lines = [] - while line != '\014': # form feed - if line and not line.isspace(): - if self._cg_sep_re.match(line): - self.parse_cg_entry(entry_lines) - entry_lines = [] - else: - entry_lines.append(line) - line = self.readline() - - def parse(self): - self.parse_cg() - self.fp.close() - - profile = Profile() - profile[TIME] = 0.0 - - cycles = {} - for index in self.cycles.iterkeys(): - cycles[index] = Cycle() - - for entry in self.functions.itervalues(): - # populate the function - function = Function(entry.index, entry.name) - function[TIME] = entry.self - if entry.called is not None: - function.called = entry.called - if entry.called_self is not None: - call = Call(entry.index) - call[CALLS] = entry.called_self - function.called += entry.called_self - - # populate the function calls - for child in entry.children: - call = Call(child.index) - - assert child.called is not None - call[CALLS] = child.called - - if child.index not in self.functions: - # NOTE: functions that were never called but were discovered by gprof's - # static call graph analysis dont have a call graph entry so we need - # to add them here - missing = Function(child.index, child.name) - function[TIME] = 0.0 - function.called = 0 - profile.add_function(missing) - - function.add_call(call) - - profile.add_function(function) - - if entry.cycle is not None: - try: - cycle = cycles[entry.cycle] - except KeyError: - sys.stderr.write('warning: <cycle %u as a whole> entry missing\n' % entry.cycle) - cycle = Cycle() - cycles[entry.cycle] = cycle - cycle.add_function(function) - - profile[TIME] = profile[TIME] + function[TIME] - - for cycle in cycles.itervalues(): - profile.add_cycle(cycle) - - # Compute derived events - profile.validate() - profile.ratio(TIME_RATIO, TIME) - profile.call_ratios(CALLS) - profile.integrate(TOTAL_TIME, TIME) - profile.ratio(TOTAL_TIME_RATIO, TOTAL_TIME) - - return profile - - -class CallgrindParser(LineParser): - """Parser for valgrind's callgrind tool. - - See also: - - http://valgrind.org/docs/manual/cl-format.html - """ - - _call_re = re.compile('^calls=\s*(\d+)\s+((\d+|\+\d+|-\d+|\*)\s+)+$') - - def __init__(self, infile): - LineParser.__init__(self, infile) - - # Textual positions - self.position_ids = {} - self.positions = {} - - # Numeric positions - self.num_positions = 1 - self.cost_positions = ['line'] - self.last_positions = [0] - - # Events - self.num_events = 0 - self.cost_events = [] - - self.profile = Profile() - self.profile[SAMPLES] = 0 - - def parse(self): - # read lookahead - self.readline() - - self.parse_key('version') - self.parse_key('creator') - while self.parse_part(): - pass - if not self.eof(): - sys.stderr.write('warning: line %u: unexpected line\n' % self.line_no) - sys.stderr.write('%s\n' % self.lookahead()) - - # compute derived data - self.profile.validate() - self.profile.find_cycles() - self.profile.ratio(TIME_RATIO, SAMPLES) - self.profile.call_ratios(CALLS) - self.profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO) - - return self.profile - - def parse_part(self): - if not self.parse_header_line(): - return False - while self.parse_header_line(): - pass - if not self.parse_body_line(): - return False - while self.parse_body_line(): - pass - return True - - def parse_header_line(self): - return \ - self.parse_empty() or \ - self.parse_comment() or \ - self.parse_part_detail() or \ - self.parse_description() or \ - self.parse_event_specification() or \ - self.parse_cost_line_def() or \ - self.parse_cost_summary() - - _detail_keys = set(('cmd', 'pid', 'thread', 'part')) - - def parse_part_detail(self): - return self.parse_keys(self._detail_keys) - - def parse_description(self): - return self.parse_key('desc') is not None - - def parse_event_specification(self): - event = self.parse_key('event') - if event is None: - return False - return True - - def parse_cost_line_def(self): - pair = self.parse_keys(('events', 'positions')) - if pair is None: - return False - key, value = pair - items = value.split() - if key == 'events': - self.num_events = len(items) - self.cost_events = items - if key == 'positions': - self.num_positions = len(items) - self.cost_positions = items - self.last_positions = [0]*self.num_positions - return True - - def parse_cost_summary(self): - pair = self.parse_keys(('summary', 'totals')) - if pair is None: - return False - return True - - def parse_body_line(self): - return \ - self.parse_empty() or \ - self.parse_comment() or \ - self.parse_cost_line() or \ - self.parse_position_spec() or \ - self.parse_association_spec() - - __subpos_re = r'(0x[0-9a-fA-F]+|\d+|\+\d+|-\d+|\*)' - _cost_re = re.compile(r'^' + - __subpos_re + r'( +' + __subpos_re + r')*' + - r'( +\d+)*' + - '$') - - def parse_cost_line(self, calls=None): - line = self.lookahead().rstrip() - mo = self._cost_re.match(line) - if not mo: - return False - - function = self.get_function() - - values = line.split() - assert len(values) <= self.num_positions + self.num_events - - positions = values[0 : self.num_positions] - events = values[self.num_positions : ] - events += ['0']*(self.num_events - len(events)) - - for i in range(self.num_positions): - position = positions[i] - if position == '*': - position = self.last_positions[i] - elif position[0] in '-+': - position = self.last_positions[i] + int(position) - elif position.startswith('0x'): - position = int(position, 16) - else: - position = int(position) - self.last_positions[i] = position - - events = map(float, events) - - if calls is None: - function[SAMPLES] += events[0] - self.profile[SAMPLES] += events[0] - else: - callee = self.get_callee() - callee.called += calls - - try: - call = function.calls[callee.id] - except KeyError: - call = Call(callee.id) - call[CALLS] = calls - call[SAMPLES] = events[0] - function.add_call(call) - else: - call[CALLS] += calls - call[SAMPLES] += events[0] - - self.consume() - return True - - def parse_association_spec(self): - line = self.lookahead() - if not line.startswith('calls='): - return False - - _, values = line.split('=', 1) - values = values.strip().split() - calls = int(values[0]) - call_position = values[1:] - self.consume() - - self.parse_cost_line(calls) - - return True - - _position_re = re.compile('^(?P<position>[cj]?(?:ob|fl|fi|fe|fn))=\s*(?:\((?P<id>\d+)\))?(?:\s*(?P<name>.+))?') - - _position_table_map = { - 'ob': 'ob', - 'fl': 'fl', - 'fi': 'fl', - 'fe': 'fl', - 'fn': 'fn', - 'cob': 'ob', - 'cfl': 'fl', - 'cfi': 'fl', - 'cfe': 'fl', - 'cfn': 'fn', - 'jfi': 'fl', - } - - _position_map = { - 'ob': 'ob', - 'fl': 'fl', - 'fi': 'fl', - 'fe': 'fl', - 'fn': 'fn', - 'cob': 'cob', - 'cfl': 'cfl', - 'cfi': 'cfl', - 'cfe': 'cfl', - 'cfn': 'cfn', - 'jfi': 'jfi', - } - - def parse_position_spec(self): - line = self.lookahead() - - if line.startswith('jump=') or line.startswith('jcnd='): - self.consume() - return True - - mo = self._position_re.match(line) - if not mo: - return False - - position, id, name = mo.groups() - if id: - table = self._position_table_map[position] - if name: - self.position_ids[(table, id)] = name - else: - name = self.position_ids.get((table, id), '') - self.positions[self._position_map[position]] = name - - self.consume() - return True - - def parse_empty(self): - if self.eof(): - return False - line = self.lookahead() - if line.strip(): - return False - self.consume() - return True - - def parse_comment(self): - line = self.lookahead() - if not line.startswith('#'): - return False - self.consume() - return True - - _key_re = re.compile(r'^(\w+):') - - def parse_key(self, key): - pair = self.parse_keys((key,)) - if not pair: - return None - key, value = pair - return value - line = self.lookahead() - mo = self._key_re.match(line) - if not mo: - return None - key, value = line.split(':', 1) - if key not in keys: - return None - value = value.strip() - self.consume() - return key, value - - def parse_keys(self, keys): - line = self.lookahead() - mo = self._key_re.match(line) - if not mo: - return None - key, value = line.split(':', 1) - if key not in keys: - return None - value = value.strip() - self.consume() - return key, value - - def make_function(self, module, filename, name): - # FIXME: module and filename are not being tracked reliably - #id = '|'.join((module, filename, name)) - id = name - try: - function = self.profile.functions[id] - except KeyError: - function = Function(id, name) - if module: - function.module = os.path.basename(module) - function[SAMPLES] = 0 - function.called = 0 - self.profile.add_function(function) - return function - - def get_function(self): - module = self.positions.get('ob', '') - filename = self.positions.get('fl', '') - function = self.positions.get('fn', '') - return self.make_function(module, filename, function) - - def get_callee(self): - module = self.positions.get('cob', '') - filename = self.positions.get('cfi', '') - function = self.positions.get('cfn', '') - return self.make_function(module, filename, function) - - -class OprofileParser(LineParser): - """Parser for oprofile callgraph output. - - See also: - - http://oprofile.sourceforge.net/doc/opreport.html#opreport-callgraph - """ - - _fields_re = { - 'samples': r'(\d+)', - '%': r'(\S+)', - 'linenr info': r'(?P<source>\(no location information\)|\S+:\d+)', - 'image name': r'(?P<image>\S+(?:\s\(tgid:[^)]*\))?)', - 'app name': r'(?P<application>\S+)', - 'symbol name': r'(?P<symbol>\(no symbols\)|.+?)', - } - - def __init__(self, infile): - LineParser.__init__(self, infile) - self.entries = {} - self.entry_re = None - - def add_entry(self, callers, function, callees): - try: - entry = self.entries[function.id] - except KeyError: - self.entries[function.id] = (callers, function, callees) - else: - callers_total, function_total, callees_total = entry - self.update_subentries_dict(callers_total, callers) - function_total.samples += function.samples - self.update_subentries_dict(callees_total, callees) - - def update_subentries_dict(self, totals, partials): - for partial in partials.itervalues(): - try: - total = totals[partial.id] - except KeyError: - totals[partial.id] = partial - else: - total.samples += partial.samples - - def parse(self): - # read lookahead - self.readline() - - self.parse_header() - while self.lookahead(): - self.parse_entry() - - profile = Profile() - - reverse_call_samples = {} - - # populate the profile - profile[SAMPLES] = 0 - for _callers, _function, _callees in self.entries.itervalues(): - function = Function(_function.id, _function.name) - function[SAMPLES] = _function.samples - profile.add_function(function) - profile[SAMPLES] += _function.samples - - if _function.application: - function.process = os.path.basename(_function.application) - if _function.image: - function.module = os.path.basename(_function.image) - - total_callee_samples = 0 - for _callee in _callees.itervalues(): - total_callee_samples += _callee.samples - - for _callee in _callees.itervalues(): - if not _callee.self: - call = Call(_callee.id) - call[SAMPLES2] = _callee.samples - function.add_call(call) - - # compute derived data - profile.validate() - profile.find_cycles() - profile.ratio(TIME_RATIO, SAMPLES) - profile.call_ratios(SAMPLES2) - profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO) - - return profile - - def parse_header(self): - while not self.match_header(): - self.consume() - line = self.lookahead() - fields = re.split(r'\s\s+', line) - entry_re = r'^\s*' + r'\s+'.join([self._fields_re[field] for field in fields]) + r'(?P<self>\s+\[self\])?$' - self.entry_re = re.compile(entry_re) - self.skip_separator() - - def parse_entry(self): - callers = self.parse_subentries() - if self.match_primary(): - function = self.parse_subentry() - if function is not None: - callees = self.parse_subentries() - self.add_entry(callers, function, callees) - self.skip_separator() - - def parse_subentries(self): - subentries = {} - while self.match_secondary(): - subentry = self.parse_subentry() - subentries[subentry.id] = subentry - return subentries - - def parse_subentry(self): - entry = Struct() - line = self.consume() - mo = self.entry_re.match(line) - if not mo: - raise ParseError('failed to parse', line) - fields = mo.groupdict() - entry.samples = int(mo.group(1)) - if 'source' in fields and fields['source'] != '(no location information)': - source = fields['source'] - filename, lineno = source.split(':') - entry.filename = filename - entry.lineno = int(lineno) - else: - source = '' - entry.filename = None - entry.lineno = None - entry.image = fields.get('image', '') - entry.application = fields.get('application', '') - if 'symbol' in fields and fields['symbol'] != '(no symbols)': - entry.symbol = fields['symbol'] - else: - entry.symbol = '' - if entry.symbol.startswith('"') and entry.symbol.endswith('"'): - entry.symbol = entry.symbol[1:-1] - entry.id = ':'.join((entry.application, entry.image, source, entry.symbol)) - entry.self = fields.get('self', None) != None - if entry.self: - entry.id += ':self' - if entry.symbol: - entry.name = entry.symbol - else: - entry.name = entry.image - return entry - - def skip_separator(self): - while not self.match_separator(): - self.consume() - self.consume() - - def match_header(self): - line = self.lookahead() - return line.startswith('samples') - - def match_separator(self): - line = self.lookahead() - return line == '-'*len(line) - - def match_primary(self): - line = self.lookahead() - return not line[:1].isspace() - - def match_secondary(self): - line = self.lookahead() - return line[:1].isspace() - - -class HProfParser(LineParser): - """Parser for java hprof output - - See also: - - http://java.sun.com/developer/technicalArticles/Programming/HPROF.html - """ - - trace_re = re.compile(r'\t(.*)\((.*):(.*)\)') - trace_id_re = re.compile(r'^TRACE (\d+):$') - - def __init__(self, infile): - LineParser.__init__(self, infile) - self.traces = {} - self.samples = {} - - def parse(self): - # read lookahead - self.readline() - - while not self.lookahead().startswith('------'): self.consume() - while not self.lookahead().startswith('TRACE '): self.consume() - - self.parse_traces() - - while not self.lookahead().startswith('CPU'): - self.consume() - - self.parse_samples() - - # populate the profile - profile = Profile() - profile[SAMPLES] = 0 - - functions = {} - - # build up callgraph - for id, trace in self.traces.iteritems(): - if not id in self.samples: continue - mtime = self.samples[id][0] - last = None - - for func, file, line in trace: - if not func in functions: - function = Function(func, func) - function[SAMPLES] = 0 - profile.add_function(function) - functions[func] = function - - function = functions[func] - # allocate time to the deepest method in the trace - if not last: - function[SAMPLES] += mtime - profile[SAMPLES] += mtime - else: - c = function.get_call(last) - c[SAMPLES2] += mtime - - last = func - - # compute derived data - profile.validate() - profile.find_cycles() - profile.ratio(TIME_RATIO, SAMPLES) - profile.call_ratios(SAMPLES2) - profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO) - - return profile - - def parse_traces(self): - while self.lookahead().startswith('TRACE '): - self.parse_trace() - - def parse_trace(self): - l = self.consume() - mo = self.trace_id_re.match(l) - tid = mo.group(1) - last = None - trace = [] - - while self.lookahead().startswith('\t'): - l = self.consume() - match = self.trace_re.search(l) - if not match: - #sys.stderr.write('Invalid line: %s\n' % l) - break - else: - function_name, file, line = match.groups() - trace += [(function_name, file, line)] - - self.traces[int(tid)] = trace - - def parse_samples(self): - self.consume() - self.consume() - - while not self.lookahead().startswith('CPU'): - rank, percent_self, percent_accum, count, traceid, method = self.lookahead().split() - self.samples[int(traceid)] = (int(count), method) - self.consume() - - -class SysprofParser(XmlParser): - - def __init__(self, stream): - XmlParser.__init__(self, stream) - - def parse(self): - objects = {} - nodes = {} - - self.element_start('profile') - while self.token.type == XML_ELEMENT_START: - if self.token.name_or_data == 'objects': - assert not objects - objects = self.parse_items('objects') - elif self.token.name_or_data == 'nodes': - assert not nodes - nodes = self.parse_items('nodes') - else: - self.parse_value(self.token.name_or_data) - self.element_end('profile') - - return self.build_profile(objects, nodes) - - def parse_items(self, name): - assert name[-1] == 's' - items = {} - self.element_start(name) - while self.token.type == XML_ELEMENT_START: - id, values = self.parse_item(name[:-1]) - assert id not in items - items[id] = values - self.element_end(name) - return items - - def parse_item(self, name): - attrs = self.element_start(name) - id = int(attrs['id']) - values = self.parse_values() - self.element_end(name) - return id, values - - def parse_values(self): - values = {} - while self.token.type == XML_ELEMENT_START: - name = self.token.name_or_data - value = self.parse_value(name) - assert name not in values - values[name] = value - return values - - def parse_value(self, tag): - self.element_start(tag) - value = self.character_data() - self.element_end(tag) - if value.isdigit(): - return int(value) - if value.startswith('"') and value.endswith('"'): - return value[1:-1] - return value - - def build_profile(self, objects, nodes): - profile = Profile() - - profile[SAMPLES] = 0 - for id, object in objects.iteritems(): - # Ignore fake objects (process names, modules, "Everything", "kernel", etc.) - if object['self'] == 0: - continue - - function = Function(id, object['name']) - function[SAMPLES] = object['self'] - profile.add_function(function) - profile[SAMPLES] += function[SAMPLES] - - for id, node in nodes.iteritems(): - # Ignore fake calls - if node['self'] == 0: - continue - - # Find a non-ignored parent - parent_id = node['parent'] - while parent_id != 0: - parent = nodes[parent_id] - caller_id = parent['object'] - if objects[caller_id]['self'] != 0: - break - parent_id = parent['parent'] - if parent_id == 0: - continue - - callee_id = node['object'] - - assert objects[caller_id]['self'] - assert objects[callee_id]['self'] - - function = profile.functions[caller_id] - - samples = node['self'] - try: - call = function.calls[callee_id] - except KeyError: - call = Call(callee_id) - call[SAMPLES2] = samples - function.add_call(call) - else: - call[SAMPLES2] += samples - - # Compute derived events - profile.validate() - profile.find_cycles() - profile.ratio(TIME_RATIO, SAMPLES) - profile.call_ratios(SAMPLES2) - profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO) - - return profile - - -class SharkParser(LineParser): - """Parser for MacOSX Shark output. - - Author: tom@dbservice.com - """ - - def __init__(self, infile): - LineParser.__init__(self, infile) - self.stack = [] - self.entries = {} - - def add_entry(self, function): - try: - entry = self.entries[function.id] - except KeyError: - self.entries[function.id] = (function, { }) - else: - function_total, callees_total = entry - function_total.samples += function.samples - - def add_callee(self, function, callee): - func, callees = self.entries[function.id] - try: - entry = callees[callee.id] - except KeyError: - callees[callee.id] = callee - else: - entry.samples += callee.samples - - def parse(self): - self.readline() - self.readline() - self.readline() - self.readline() - - match = re.compile(r'(?P<prefix>[|+ ]*)(?P<samples>\d+), (?P<symbol>[^,]+), (?P<image>.*)') - - while self.lookahead(): - line = self.consume() - mo = match.match(line) - if not mo: - raise ParseError('failed to parse', line) - - fields = mo.groupdict() - prefix = len(fields.get('prefix', 0)) / 2 - 1 - - symbol = str(fields.get('symbol', 0)) - image = str(fields.get('image', 0)) - - entry = Struct() - entry.id = ':'.join([symbol, image]) - entry.samples = int(fields.get('samples', 0)) - - entry.name = symbol - entry.image = image - - # adjust the callstack - if prefix < len(self.stack): - del self.stack[prefix:] - - if prefix == len(self.stack): - self.stack.append(entry) - - # if the callstack has had an entry, it's this functions caller - if prefix > 0: - self.add_callee(self.stack[prefix - 1], entry) - - self.add_entry(entry) - - profile = Profile() - profile[SAMPLES] = 0 - for _function, _callees in self.entries.itervalues(): - function = Function(_function.id, _function.name) - function[SAMPLES] = _function.samples - profile.add_function(function) - profile[SAMPLES] += _function.samples - - if _function.image: - function.module = os.path.basename(_function.image) - - for _callee in _callees.itervalues(): - call = Call(_callee.id) - call[SAMPLES] = _callee.samples - function.add_call(call) - - # compute derived data - profile.validate() - profile.find_cycles() - profile.ratio(TIME_RATIO, SAMPLES) - profile.call_ratios(SAMPLES) - profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO) - - return profile - - -class XPerfParser(Parser): - """Parser for CSVs generted by XPerf, from Microsoft Windows Performance Tools. - """ - - def __init__(self, stream): - Parser.__init__(self) - self.stream = stream - self.profile = Profile() - self.profile[SAMPLES] = 0 - self.column = {} - - def parse(self): - import csv - reader = csv.reader( - self.stream, - delimiter = ',', - quotechar = None, - escapechar = None, - doublequote = False, - skipinitialspace = True, - lineterminator = '\r\n', - quoting = csv.QUOTE_NONE) - it = iter(reader) - row = reader.next() - self.parse_header(row) - for row in it: - self.parse_row(row) - - # compute derived data - self.profile.validate() - self.profile.find_cycles() - self.profile.ratio(TIME_RATIO, SAMPLES) - self.profile.call_ratios(SAMPLES2) - self.profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO) - - return self.profile - - def parse_header(self, row): - for column in range(len(row)): - name = row[column] - assert name not in self.column - self.column[name] = column - - def parse_row(self, row): - fields = {} - for name, column in self.column.iteritems(): - value = row[column] - for factory in int, float: - try: - value = factory(value) - except ValueError: - pass - else: - break - fields[name] = value - - process = fields['Process Name'] - symbol = fields['Module'] + '!' + fields['Function'] - weight = fields['Weight'] - count = fields['Count'] - - function = self.get_function(process, symbol) - function[SAMPLES] += weight * count - self.profile[SAMPLES] += weight * count - - stack = fields['Stack'] - if stack != '?': - stack = stack.split('/') - assert stack[0] == '[Root]' - if stack[-1] != symbol: - # XXX: some cases the sampled function does not appear in the stack - stack.append(symbol) - caller = None - for symbol in stack[1:]: - callee = self.get_function(process, symbol) - if caller is not None: - try: - call = caller.calls[callee.id] - except KeyError: - call = Call(callee.id) - call[SAMPLES2] = count - caller.add_call(call) - else: - call[SAMPLES2] += count - caller = callee - - def get_function(self, process, symbol): - function_id = process + '!' + symbol - - try: - function = self.profile.functions[function_id] - except KeyError: - module, name = symbol.split('!', 1) - function = Function(function_id, name) - function.process = process - function.module = module - function[SAMPLES] = 0 - self.profile.add_function(function) - - return function - - -class SleepyParser(Parser): - """Parser for GNU gprof output. - - See also: - - http://www.codersnotes.com/sleepy/ - - http://sleepygraph.sourceforge.net/ - """ - - def __init__(self, filename): - Parser.__init__(self) - - from zipfile import ZipFile - - self.database = ZipFile(filename) - - self.version_0_7 = 'Version 0.7 required' in self.database.namelist() - - self.symbols = {} - self.calls = {} - - self.profile = Profile() - - _symbol_re = re.compile( - r'^(?P<id>\w+)' + - r'\s+"(?P<module>[^"]*)"' + - r'\s+"(?P<procname>[^"]*)"' + - r'\s+"(?P<sourcefile>[^"]*)"' + - r'\s+(?P<sourceline>\d+)$' - ) - - def parse_symbols(self): - if self.version_0_7: - symbols_txt = 'Symbols.txt' - else: - symbols_txt = 'symbols.txt' - lines = self.database.read(symbols_txt).splitlines() - for line in lines: - mo = self._symbol_re.match(line) - if mo: - symbol_id, module, procname, sourcefile, sourceline = mo.groups() - - function_id = ':'.join([module, procname]) - - try: - function = self.profile.functions[function_id] - except KeyError: - function = Function(function_id, procname) - function.module = module - function[SAMPLES] = 0 - self.profile.add_function(function) - - self.symbols[symbol_id] = function - - def parse_callstacks(self): - if self.version_0_7: - callstacks_txt = 'Callstacks.txt' - else: - callstacks_txt = 'callstacks.txt' - lines = self.database.read(callstacks_txt).splitlines() - for line in lines: - fields = line.split() - samples = float(fields[0]) - callstack = fields[1:] - - callstack = [self.symbols[symbol_id] for symbol_id in callstack] - - callee = callstack[0] - - callee[SAMPLES] += samples - self.profile[SAMPLES] += samples - - for caller in callstack[1:]: - try: - call = caller.calls[callee.id] - except KeyError: - call = Call(callee.id) - call[SAMPLES2] = samples - caller.add_call(call) - else: - call[SAMPLES2] += samples - - callee = caller - - def parse(self): - profile = self.profile - profile[SAMPLES] = 0 - - self.parse_symbols() - self.parse_callstacks() - - # Compute derived events - profile.validate() - profile.find_cycles() - profile.ratio(TIME_RATIO, SAMPLES) - profile.call_ratios(SAMPLES2) - profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO) - - return profile - - -class AQtimeTable: - - def __init__(self, name, fields): - self.name = name - - self.fields = fields - self.field_column = {} - for column in range(len(fields)): - self.field_column[fields[column]] = column - self.rows = [] - - def __len__(self): - return len(self.rows) - - def __iter__(self): - for values, children in self.rows: - fields = {} - for name, value in zip(self.fields, values): - fields[name] = value - children = dict([(child.name, child) for child in children]) - yield fields, children - raise StopIteration - - def add_row(self, values, children=()): - self.rows.append((values, children)) - - -class AQtimeParser(XmlParser): - - def __init__(self, stream): - XmlParser.__init__(self, stream) - self.tables = {} - - def parse(self): - self.element_start('AQtime_Results') - self.parse_headers() - results = self.parse_results() - self.element_end('AQtime_Results') - return self.build_profile(results) - - def parse_headers(self): - self.element_start('HEADERS') - while self.token.type == XML_ELEMENT_START: - self.parse_table_header() - self.element_end('HEADERS') - - def parse_table_header(self): - attrs = self.element_start('TABLE_HEADER') - name = attrs['NAME'] - id = int(attrs['ID']) - field_types = [] - field_names = [] - while self.token.type == XML_ELEMENT_START: - field_type, field_name = self.parse_table_field() - field_types.append(field_type) - field_names.append(field_name) - self.element_end('TABLE_HEADER') - self.tables[id] = name, field_types, field_names - - def parse_table_field(self): - attrs = self.element_start('TABLE_FIELD') - type = attrs['TYPE'] - name = self.character_data() - self.element_end('TABLE_FIELD') - return type, name - - def parse_results(self): - self.element_start('RESULTS') - table = self.parse_data() - self.element_end('RESULTS') - return table - - def parse_data(self): - rows = [] - attrs = self.element_start('DATA') - table_id = int(attrs['TABLE_ID']) - table_name, field_types, field_names = self.tables[table_id] - table = AQtimeTable(table_name, field_names) - while self.token.type == XML_ELEMENT_START: - row, children = self.parse_row(field_types) - table.add_row(row, children) - self.element_end('DATA') - return table - - def parse_row(self, field_types): - row = [None]*len(field_types) - children = [] - self.element_start('ROW') - while self.token.type == XML_ELEMENT_START: - if self.token.name_or_data == 'FIELD': - field_id, field_value = self.parse_field(field_types) - row[field_id] = field_value - elif self.token.name_or_data == 'CHILDREN': - children = self.parse_children() - else: - raise XmlTokenMismatch("<FIELD ...> or <CHILDREN ...>", self.token) - self.element_end('ROW') - return row, children - - def parse_field(self, field_types): - attrs = self.element_start('FIELD') - id = int(attrs['ID']) - type = field_types[id] - value = self.character_data() - if type == 'Integer': - value = int(value) - elif type == 'Float': - value = float(value) - elif type == 'Address': - value = int(value) - elif type == 'String': - pass - else: - assert False - self.element_end('FIELD') - return id, value - - def parse_children(self): - children = [] - self.element_start('CHILDREN') - while self.token.type == XML_ELEMENT_START: - table = self.parse_data() - assert table.name not in children - children.append(table) - self.element_end('CHILDREN') - return children - - def build_profile(self, results): - assert results.name == 'Routines' - profile = Profile() - profile[TIME] = 0.0 - for fields, tables in results: - function = self.build_function(fields) - children = tables['Children'] - for fields, _ in children: - call = self.build_call(fields) - function.add_call(call) - profile.add_function(function) - profile[TIME] = profile[TIME] + function[TIME] - profile[TOTAL_TIME] = profile[TIME] - profile.ratio(TOTAL_TIME_RATIO, TOTAL_TIME) - return profile - - def build_function(self, fields): - function = Function(self.build_id(fields), self.build_name(fields)) - function[TIME] = fields['Time'] - function[TOTAL_TIME] = fields['Time with Children'] - #function[TIME_RATIO] = fields['% Time']/100.0 - #function[TOTAL_TIME_RATIO] = fields['% with Children']/100.0 - return function - - def build_call(self, fields): - call = Call(self.build_id(fields)) - call[TIME] = fields['Time'] - call[TOTAL_TIME] = fields['Time with Children'] - #call[TIME_RATIO] = fields['% Time']/100.0 - #call[TOTAL_TIME_RATIO] = fields['% with Children']/100.0 - return call - - def build_id(self, fields): - return ':'.join([fields['Module Name'], fields['Unit Name'], fields['Routine Name']]) - - def build_name(self, fields): - # TODO: use more fields - return fields['Routine Name'] - - -class PstatsParser: - """Parser python profiling statistics saved with te pstats module.""" - - def __init__(self, *filename): - import pstats - try: - self.stats = pstats.Stats(*filename) - except ValueError: - import hotshot.stats - self.stats = hotshot.stats.load(filename[0]) - self.profile = Profile() - self.function_ids = {} - - def get_function_name(self, (filename, line, name)): - module = os.path.splitext(filename)[0] - module = os.path.basename(module) - return "%s:%d:%s" % (module, line, name) - - def get_function(self, key): - try: - id = self.function_ids[key] - except KeyError: - id = len(self.function_ids) - name = self.get_function_name(key) - function = Function(id, name) - self.profile.functions[id] = function - self.function_ids[key] = id - else: - function = self.profile.functions[id] - return function - - def parse(self): - self.profile[TIME] = 0.0 - self.profile[TOTAL_TIME] = self.stats.total_tt - for fn, (cc, nc, tt, ct, callers) in self.stats.stats.iteritems(): - callee = self.get_function(fn) - callee.called = nc - callee[TOTAL_TIME] = ct - callee[TIME] = tt - self.profile[TIME] += tt - self.profile[TOTAL_TIME] = max(self.profile[TOTAL_TIME], ct) - for fn, value in callers.iteritems(): - caller = self.get_function(fn) - call = Call(callee.id) - if isinstance(value, tuple): - for i in xrange(0, len(value), 4): - nc, cc, tt, ct = value[i:i+4] - if CALLS in call: - call[CALLS] += cc - else: - call[CALLS] = cc - - if TOTAL_TIME in call: - call[TOTAL_TIME] += ct - else: - call[TOTAL_TIME] = ct - - else: - call[CALLS] = value - call[TOTAL_TIME] = ratio(value, nc)*ct - - caller.add_call(call) - #self.stats.print_stats() - #self.stats.print_callees() - - # Compute derived events - self.profile.validate() - self.profile.ratio(TIME_RATIO, TIME) - self.profile.ratio(TOTAL_TIME_RATIO, TOTAL_TIME) - - return self.profile - - -class Theme: - - def __init__(self, - bgcolor = (0.0, 0.0, 1.0), - mincolor = (0.0, 0.0, 0.0), - maxcolor = (0.0, 0.0, 1.0), - fontname = "Arial", - minfontsize = 10.0, - maxfontsize = 10.0, - minpenwidth = 0.5, - maxpenwidth = 4.0, - gamma = 2.2, - skew = 1.0): - self.bgcolor = bgcolor - self.mincolor = mincolor - self.maxcolor = maxcolor - self.fontname = fontname - self.minfontsize = minfontsize - self.maxfontsize = maxfontsize - self.minpenwidth = minpenwidth - self.maxpenwidth = maxpenwidth - self.gamma = gamma - self.skew = skew - - def graph_bgcolor(self): - return self.hsl_to_rgb(*self.bgcolor) - - def graph_fontname(self): - return self.fontname - - def graph_fontsize(self): - return self.minfontsize - - def node_bgcolor(self, weight): - return self.color(weight) - - def node_fgcolor(self, weight): - return self.graph_bgcolor() - - def node_fontsize(self, weight): - return self.fontsize(weight) - - def edge_color(self, weight): - return self.color(weight) - - def edge_fontsize(self, weight): - return self.fontsize(weight) - - def edge_penwidth(self, weight): - return max(weight*self.maxpenwidth, self.minpenwidth) - - def edge_arrowsize(self, weight): - return 0.5 * math.sqrt(self.edge_penwidth(weight)) - - def fontsize(self, weight): - return max(weight**2 * self.maxfontsize, self.minfontsize) - - def color(self, weight): - weight = min(max(weight, 0.0), 1.0) - - hmin, smin, lmin = self.mincolor - hmax, smax, lmax = self.maxcolor - - if self.skew < 0: - raise ValueError("Skew must be greater than 0") - elif self.skew == 1.0: - h = hmin + weight*(hmax - hmin) - s = smin + weight*(smax - smin) - l = lmin + weight*(lmax - lmin) - else: - base = self.skew - h = hmin + ((hmax-hmin)*(-1.0 + (base ** weight)) / (base - 1.0)) - s = smin + ((smax-smin)*(-1.0 + (base ** weight)) / (base - 1.0)) - l = lmin + ((lmax-lmin)*(-1.0 + (base ** weight)) / (base - 1.0)) - - return self.hsl_to_rgb(h, s, l) - - def hsl_to_rgb(self, h, s, l): - """Convert a color from HSL color-model to RGB. - - See also: - - http://www.w3.org/TR/css3-color/#hsl-color - """ - - h = h % 1.0 - s = min(max(s, 0.0), 1.0) - l = min(max(l, 0.0), 1.0) - - if l <= 0.5: - m2 = l*(s + 1.0) - else: - m2 = l + s - l*s - m1 = l*2.0 - m2 - r = self._hue_to_rgb(m1, m2, h + 1.0/3.0) - g = self._hue_to_rgb(m1, m2, h) - b = self._hue_to_rgb(m1, m2, h - 1.0/3.0) - - # Apply gamma correction - r **= self.gamma - g **= self.gamma - b **= self.gamma - - return (r, g, b) - - def _hue_to_rgb(self, m1, m2, h): - if h < 0.0: - h += 1.0 - elif h > 1.0: - h -= 1.0 - if h*6 < 1.0: - return m1 + (m2 - m1)*h*6.0 - elif h*2 < 1.0: - return m2 - elif h*3 < 2.0: - return m1 + (m2 - m1)*(2.0/3.0 - h)*6.0 - else: - return m1 - - -TEMPERATURE_COLORMAP = Theme( - mincolor = (2.0/3.0, 0.80, 0.25), # dark blue - maxcolor = (0.0, 1.0, 0.5), # satured red - gamma = 1.0 -) - -PINK_COLORMAP = Theme( - mincolor = (0.0, 1.0, 0.90), # pink - maxcolor = (0.0, 1.0, 0.5), # satured red -) - -GRAY_COLORMAP = Theme( - mincolor = (0.0, 0.0, 0.85), # light gray - maxcolor = (0.0, 0.0, 0.0), # black -) - -BW_COLORMAP = Theme( - minfontsize = 8.0, - maxfontsize = 24.0, - mincolor = (0.0, 0.0, 0.0), # black - maxcolor = (0.0, 0.0, 0.0), # black - minpenwidth = 0.1, - maxpenwidth = 8.0, -) - - -class DotWriter: - """Writer for the DOT language. - - See also: - - "The DOT Language" specification - http://www.graphviz.org/doc/info/lang.html - """ - - def __init__(self, fp): - self.fp = fp - - def graph(self, profile, theme): - self.begin_graph() - - fontname = theme.graph_fontname() - - self.attr('graph', fontname=fontname, ranksep=0.25, nodesep=0.125) - self.attr('node', fontname=fontname, shape="box", style="filled", fontcolor="white", width=0, height=0) - self.attr('edge', fontname=fontname) - - for function in profile.functions.itervalues(): - labels = [] - if function.process is not None: - labels.append(function.process) - if function.module is not None: - labels.append(function.module) - labels.append(function.name) - for event in TOTAL_TIME_RATIO, TIME_RATIO: - if event in function.events: - label = event.format(function[event]) - labels.append(label) - if function.called is not None: - labels.append(u"%u\xd7" % (function.called,)) - - if function.weight is not None: - weight = function.weight - else: - weight = 0.0 - - label = '\n'.join(labels) - self.node(function.id, - label = label, - color = self.color(theme.node_bgcolor(weight)), - fontcolor = self.color(theme.node_fgcolor(weight)), - fontsize = "%.2f" % theme.node_fontsize(weight), - ) - - for call in function.calls.itervalues(): - callee = profile.functions[call.callee_id] - - labels = [] - for event in TOTAL_TIME_RATIO, CALLS: - if event in call.events: - label = event.format(call[event]) - labels.append(label) - - if call.weight is not None: - weight = call.weight - elif callee.weight is not None: - weight = callee.weight - else: - weight = 0.0 - - label = '\n'.join(labels) - - self.edge(function.id, call.callee_id, - label = label, - color = self.color(theme.edge_color(weight)), - fontcolor = self.color(theme.edge_color(weight)), - fontsize = "%.2f" % theme.edge_fontsize(weight), - penwidth = "%.2f" % theme.edge_penwidth(weight), - labeldistance = "%.2f" % theme.edge_penwidth(weight), - arrowsize = "%.2f" % theme.edge_arrowsize(weight), - ) - - self.end_graph() - - def begin_graph(self): - self.write('digraph {\n') - - def end_graph(self): - self.write('}\n') - - def attr(self, what, **attrs): - self.write("\t") - self.write(what) - self.attr_list(attrs) - self.write(";\n") - - def node(self, node, **attrs): - self.write("\t") - self.id(node) - self.attr_list(attrs) - self.write(";\n") - - def edge(self, src, dst, **attrs): - self.write("\t") - self.id(src) - self.write(" -> ") - self.id(dst) - self.attr_list(attrs) - self.write(";\n") - - def attr_list(self, attrs): - if not attrs: - return - self.write(' [') - first = True - for name, value in attrs.iteritems(): - if first: - first = False - else: - self.write(", ") - self.id(name) - self.write('=') - self.id(value) - self.write(']') - - def id(self, id): - if isinstance(id, (int, float)): - s = str(id) - elif isinstance(id, basestring): - if id.isalnum() and not id.startswith('0x'): - s = id - else: - s = self.escape(id) - else: - raise TypeError - self.write(s) - - def color(self, (r, g, b)): - - def float2int(f): - if f <= 0.0: - return 0 - if f >= 1.0: - return 255 - return int(255.0*f + 0.5) - - return "#" + "".join(["%02x" % float2int(c) for c in (r, g, b)]) - - def escape(self, s): - s = s.encode('utf-8') - s = s.replace('\\', r'\\') - s = s.replace('\n', r'\n') - s = s.replace('\t', r'\t') - s = s.replace('"', r'\"') - return '"' + s + '"' - - def write(self, s): - self.fp.write(s) - - -class Main: - """Main program.""" - - themes = { - "color": TEMPERATURE_COLORMAP, - "pink": PINK_COLORMAP, - "gray": GRAY_COLORMAP, - "bw": BW_COLORMAP, - } - - def main(self): - """Main program.""" - - parser = optparse.OptionParser( - usage="\n\t%prog [options] [file] ...", - version="%%prog %s" % __version__) - parser.add_option( - '-o', '--output', metavar='FILE', - type="string", dest="output", - help="output filename [stdout]") - parser.add_option( - '-n', '--node-thres', metavar='PERCENTAGE', - type="float", dest="node_thres", default=0.5, - help="eliminate nodes below this threshold [default: %default]") - parser.add_option( - '-e', '--edge-thres', metavar='PERCENTAGE', - type="float", dest="edge_thres", default=0.1, - help="eliminate edges below this threshold [default: %default]") - parser.add_option( - '-f', '--format', - type="choice", choices=('prof', 'callgrind', 'oprofile', 'hprof', 'sysprof', 'pstats', 'shark', 'sleepy', 'aqtime', 'xperf'), - dest="format", default="prof", - help="profile format: prof, callgrind, oprofile, hprof, sysprof, shark, sleepy, aqtime, pstats, or xperf [default: %default]") - parser.add_option( - '-c', '--colormap', - type="choice", choices=('color', 'pink', 'gray', 'bw'), - dest="theme", default="color", - help="color map: color, pink, gray, or bw [default: %default]") - parser.add_option( - '-s', '--strip', - action="store_true", - dest="strip", default=False, - help="strip function parameters, template parameters, and const modifiers from demangled C++ function names") - parser.add_option( - '-w', '--wrap', - action="store_true", - dest="wrap", default=False, - help="wrap function names") - # add a new option to control skew of the colorization curve - parser.add_option( - '--skew', - type="float", dest="theme_skew", default=1.0, - help="skew the colorization curve. Values < 1.0 give more variety to lower percentages. Value > 1.0 give less variety to lower percentages") - (self.options, self.args) = parser.parse_args(sys.argv[1:]) - - if len(self.args) > 1 and self.options.format != 'pstats': - parser.error('incorrect number of arguments') - - try: - self.theme = self.themes[self.options.theme] - except KeyError: - parser.error('invalid colormap \'%s\'' % self.options.theme) - - # set skew on the theme now that it has been picked. - if self.options.theme_skew: - self.theme.skew = self.options.theme_skew - - if self.options.format == 'prof': - if not self.args: - fp = sys.stdin - else: - fp = open(self.args[0], 'rt') - parser = GprofParser(fp) - elif self.options.format == 'callgrind': - if not self.args: - fp = sys.stdin - else: - fp = open(self.args[0], 'rt') - parser = CallgrindParser(fp) - elif self.options.format == 'oprofile': - if not self.args: - fp = sys.stdin - else: - fp = open(self.args[0], 'rt') - parser = OprofileParser(fp) - elif self.options.format == 'sysprof': - if not self.args: - fp = sys.stdin - else: - fp = open(self.args[0], 'rt') - parser = SysprofParser(fp) - elif self.options.format == 'hprof': - if not self.args: - fp = sys.stdin - else: - fp = open(self.args[0], 'rt') - parser = HProfParser(fp) - elif self.options.format == 'pstats': - if not self.args: - parser.error('at least a file must be specified for pstats input') - parser = PstatsParser(*self.args) - elif self.options.format == 'xperf': - if not self.args: - fp = sys.stdin - else: - fp = open(self.args[0], 'rt') - parser = XPerfParser(fp) - elif self.options.format == 'shark': - if not self.args: - fp = sys.stdin - else: - fp = open(self.args[0], 'rt') - parser = SharkParser(fp) - elif self.options.format == 'sleepy': - if len(self.args) != 1: - parser.error('exactly one file must be specified for sleepy input') - parser = SleepyParser(self.args[0]) - elif self.options.format == 'aqtime': - if not self.args: - fp = sys.stdin - else: - fp = open(self.args[0], 'rt') - parser = AQtimeParser(fp) - else: - parser.error('invalid format \'%s\'' % self.options.format) - - self.profile = parser.parse() - - if self.options.output is None: - self.output = sys.stdout - else: - self.output = open(self.options.output, 'wt') - - self.write_graph() - - _parenthesis_re = re.compile(r'\([^()]*\)') - _angles_re = re.compile(r'<[^<>]*>') - _const_re = re.compile(r'\s+const$') - - def strip_function_name(self, name): - """Remove extraneous information from C++ demangled function names.""" - - # Strip function parameters from name by recursively removing paired parenthesis - while True: - name, n = self._parenthesis_re.subn('', name) - if not n: - break - - # Strip const qualifier - name = self._const_re.sub('', name) - - # Strip template parameters from name by recursively removing paired angles - while True: - name, n = self._angles_re.subn('', name) - if not n: - break - - return name - - def wrap_function_name(self, name): - """Split the function name on multiple lines.""" - - if len(name) > 32: - ratio = 2.0/3.0 - height = max(int(len(name)/(1.0 - ratio) + 0.5), 1) - width = max(len(name)/height, 32) - # TODO: break lines in symbols - name = textwrap.fill(name, width, break_long_words=False) - - # Take away spaces - name = name.replace(", ", ",") - name = name.replace("> >", ">>") - name = name.replace("> >", ">>") # catch consecutive - - return name - - def compress_function_name(self, name): - """Compress function name according to the user preferences.""" - - if self.options.strip: - name = self.strip_function_name(name) - - if self.options.wrap: - name = self.wrap_function_name(name) - - # TODO: merge functions with same resulting name - - return name - - def write_graph(self): - dot = DotWriter(self.output) - profile = self.profile - profile.prune(self.options.node_thres/100.0, self.options.edge_thres/100.0) - - for function in profile.functions.itervalues(): - function.name = self.compress_function_name(function.name) - - dot.graph(profile, self.theme) - - -if __name__ == '__main__': - Main().main() diff --git a/targets/SCRIPTS/PROFILING/profoai.sh b/targets/SCRIPTS/PROFILING/profoai.sh deleted file mode 100755 index aeee839b7a1..00000000000 --- a/targets/SCRIPTS/PROFILING/profoai.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -echo "----README------" -echo "" -echo "make sure that you have compiled the code with GPROF=1 and installed gprof and graphviz" - -echo "set up params" - -n_frames=4000 -abstraction=1 -traffic_load=2 -ue="1" -#ping="64 128 256 512 1024 1400" - -if [ $abstraction = 1 ]; then - option1="-a" -else - option1="-A AWGN -s 15" -fi; - -if [ $traffic_load = 1 ]; then - option2="-T1" -fi; -if [ $traffic_load = 2 ]; then - option2="-c8" -fi; -if [ $traffic_load = 3 ]; then - option2="-T3" -fi; - -echo "start oai profiling" -for i in $ue -do - rm gmon.out gmon.txt - echo "$OPENAIR_TARGETS/SIMU/USER/oaisim $option1 $option2 -n $n_frames -u $i > /dev/null" -$OPENAIR_TARGETS/SIMU/USER/oaisim $option1 $option2 -n $n_frames -u $i > /dev/null - - #mv $OPENAIR_TARGETS/SIMU/USER/gmon. . - gprof $OPENAIR_TARGETS/SIMU/USER/oaisim > gmon.txt - echo "$OPENAIR_TARGETS/SCRIPTS/gprof2dot.py gmon.txt > profoai.ue$ue.dot" - $OPENAIR_TARGETS/SCRIPTS/PROFILING/gprof2dot.py gmon.txt > profoai.a$abstraction.n$n_frames.ue$i.dot - dot -Tpng profoai.a$abstraction.n$n_frames.ue$i.dot > profoai.a$abstraction.n$n_frames.ue$i.png - echo "oai profiling with $i ue is done" - -done - -echo "end oai profiling" -- GitLab