Commit 1fa7ee1238cd50d0e3e2c36496043fb42a227945
1 parent
70139ef9
提交 _GLIBCXX_USE_CXX11_ABI=0 编译的websocketpp
Showing
360 changed files
with
70299 additions
and
0 deletions
Too many changes.
To preserve performance only 100 of 360 files are displayed.
3rdparty/websocketpp-0.8.2/.gitattributes
0 → 100644
1 | +# Lineendings | |
2 | +*.sln eol=crlf | |
3 | +*.vcproj eol=crlf | |
4 | +*.vcxproj* eol=crlf | |
5 | + | |
6 | +# Whitespace rules | |
7 | +# strict (no trailing, no tabs) | |
8 | +*.cpp whitespace=trailing-space,space-before-tab,tab-in-indent,cr-at-eol | |
9 | +*.hpp whitespace=trailing-space,space-before-tab,tab-in-indent,cr-at-eol | |
10 | +*.c whitespace=trailing-space,space-before-tab,tab-in-indent,cr-at-eol | |
11 | +*.h whitespace=trailing-space,space-before-tab,tab-in-indent,cr-at-eol | |
12 | + | |
13 | +# normal (no trailing) | |
14 | +*.sql whitespace=trailing-space,space-before-tab,cr-at-eol | |
15 | +*.txt whitespace=trailing-space,space-before-tab,cr-at-eol | |
16 | + | |
17 | +# special files which must ignore whitespace | |
18 | +*.patch whitespace=-trailing-space | ... | ... |
3rdparty/websocketpp-0.8.2/.gitignore
0 → 100644
1 | +# make .git* files visible to git | |
2 | +!.gitignore | |
3 | +!.gitattributes | |
4 | + | |
5 | +.DS_Store | |
6 | + | |
7 | +#vim stuff | |
8 | +*~ | |
9 | +*.swp | |
10 | + | |
11 | +*.o | |
12 | +*.so | |
13 | +*.so.? | |
14 | +*.so.?.?.? | |
15 | +*.a | |
16 | +*.dylib | |
17 | +lib/* | |
18 | + | |
19 | +# CMake | |
20 | +*.cmake | |
21 | +*.dir | |
22 | +CMakeFiles | |
23 | +INSTALL.* | |
24 | +ZERO_CHECK.* | |
25 | +CMakeCache.txt | |
26 | +install_manifest.txt | |
27 | + | |
28 | +# Windows/Visual Studio | |
29 | +*.vcproj* | |
30 | +*.sln | |
31 | +*.suo | |
32 | +*.ncb | |
33 | +*/Debug/* | |
34 | +*/*/Debug/* | |
35 | +bin/Debug | |
36 | +*/Release/* | |
37 | +*/*/Release/* | |
38 | +*/RelWithDebInfo/* | |
39 | +*/*/RelWithDebInfo/* | |
40 | + | |
41 | +# explicitly allow this path with /debug/ in it | |
42 | +!websocketpp/transport/debug/* | |
43 | + | |
44 | +objs_shared/ | |
45 | +objs_static/ | |
46 | + | |
47 | +examples/chat_server/chat_server | |
48 | +examples/echo_server/echo_server | |
49 | +examples/chat_client/chat_client | |
50 | +examples/echo_client/echo_client | |
51 | +test/basic/tests | |
52 | +libwebsocketpp.dylib.0.1.0 | |
53 | + | |
54 | +websocketpp.xcodeproj/xcuserdata/* | |
55 | +websocketpp.xcodeproj/project.xcworkspace/xcuserdata/* | |
56 | +policy_based_notes.hpp | |
57 | + | |
58 | +examples/echo_server_tls/echo_server_tls | |
59 | + | |
60 | +examples/fuzzing_client/fuzzing_client | |
61 | + | |
62 | +examples/stress_client/stress_client | |
63 | + | |
64 | +examples/broadcast_server_tls/broadcast_server | |
65 | + | |
66 | +test/basic/perf | |
67 | + | |
68 | +examples/echo_server_tls/echo_server_tls | |
69 | + | |
70 | +examples/concurrent_server/concurrent_server | |
71 | + | |
72 | +examples/fuzzing_server_tls/fuzzing_server | |
73 | + | |
74 | +examples/wsperf/wsperf | |
75 | + | |
76 | +.sconsign.dblite | |
77 | + | |
78 | +build/ | |
79 | +doxygen/ | |
80 | +examples/wsperf/wsperf_client | |
81 | + | |
82 | +*.out | |
83 | + | |
84 | +*.log | |
85 | +*.opensdf | |
86 | +*.sdf | |
87 | +*.vcxproj | |
88 | +*.vcxproj.filters | |
89 | +*.user | |
90 | +install | |
91 | +Makefile | |
92 | +bin | |
93 | + | |
94 | +Testing/Temporary/CTestCostData.txt | ... | ... |
3rdparty/websocketpp-0.8.2/.travis.yml
0 → 100644
1 | +language: cpp | |
2 | +compiler: | |
3 | + - gcc | |
4 | +before_install: | |
5 | + #- sudo apt-get install libboost-chrono1.48-dev libboost-regex1.48-dev libboost-system1.48-dev libboost-thread1.48-dev libboost-test1.48-dev libboost-random1.48-dev -y | |
6 | + - sudo add-apt-repository -y ppa:boost-latest/ppa && sudo apt-get update -q && sudo apt-get install -y libboost-chrono1.55-dev libboost-random1.55-dev libboost-regex1.55-dev libboost-system1.55-dev libboost-thread1.55-dev libboost-test1.55-dev | |
7 | +env: | |
8 | + global: | |
9 | + - BOOST_INCLUDES=/usr/include | |
10 | + - BOOST_LIBS=/usr/lib/x86_64-linux-gnu | |
11 | +script: scons -j 2 && scons test | |
12 | +branches: | |
13 | + only: | |
14 | + - master | |
15 | + - develop | |
16 | +notifications: | |
17 | + recipients: | |
18 | + - travis@zaphoyd.com | |
19 | + email: | |
20 | + on_success: change | |
21 | + on_failure: always | ... | ... |
3rdparty/websocketpp-0.8.2/CMakeLists.txt
0 → 100644
1 | + | |
2 | +############ Setup project and cmake | |
3 | +# Minimum cmake requirement. We should require a quite recent | |
4 | +# cmake for the dependency find macros etc. to be up to date. | |
5 | +cmake_minimum_required (VERSION 2.8.8) | |
6 | + | |
7 | +############ Paths | |
8 | + | |
9 | +set (WEBSOCKETPP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) | |
10 | +set (WEBSOCKETPP_INCLUDE ${WEBSOCKETPP_ROOT}/websocketpp) | |
11 | +set (WEBSOCKETPP_BUILD_ROOT ${CMAKE_CURRENT_BINARY_DIR}) | |
12 | +set (WEBSOCKETPP_BIN ${WEBSOCKETPP_BUILD_ROOT}/bin) | |
13 | +set (WEBSOCKETPP_LIB ${WEBSOCKETPP_BUILD_ROOT}/lib) | |
14 | + | |
15 | +add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) | |
16 | + | |
17 | +# CMake install step prefix. I assume linux users want the prefix to | |
18 | +# be the default /usr or /usr/local so this is only adjusted on Windows. | |
19 | +# This must be set prior to any call to project or it will not be read correctly. | |
20 | +# - Windows: Build the INSTALL project in your solution file. | |
21 | +# - Linux/OSX: make install. | |
22 | +if (WIN32) | |
23 | + set (CMAKE_INSTALL_PREFIX "${WEBSOCKETPP_ROOT}/install" CACHE PATH "") | |
24 | +endif () | |
25 | + | |
26 | +############ Project name and version | |
27 | +set (WEBSOCKETPP_MAJOR_VERSION 0) | |
28 | +set (WEBSOCKETPP_MINOR_VERSION 8) | |
29 | +set (WEBSOCKETPP_PATCH_VERSION 2) | |
30 | +set (WEBSOCKETPP_VERSION ${WEBSOCKETPP_MAJOR_VERSION}.${WEBSOCKETPP_MINOR_VERSION}.${WEBSOCKETPP_PATCH_VERSION}) | |
31 | + | |
32 | +if(POLICY CMP0048) | |
33 | + cmake_policy(GET CMP0048 _version_policy) | |
34 | +endif() | |
35 | + | |
36 | +if(_version_allowed STREQUAL NEW) | |
37 | + project (websocketpp VERSION ${WEBSOCKETPP_VERSION}) | |
38 | +else() | |
39 | + project (websocketpp) | |
40 | +endif() | |
41 | + | |
42 | +set_property(GLOBAL PROPERTY USE_FOLDERS ON) | |
43 | + | |
44 | +set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files") | |
45 | +if (WIN32 AND NOT CYGWIN) | |
46 | + set (DEF_INSTALL_CMAKE_DIR cmake) | |
47 | +else () | |
48 | + set (DEF_INSTALL_CMAKE_DIR lib/cmake/websocketpp) | |
49 | +endif () | |
50 | +set (INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files") | |
51 | + | |
52 | +# Make relative paths absolute (needed later on) | |
53 | +foreach (p INCLUDE CMAKE) | |
54 | + set (var INSTALL_${p}_DIR) | |
55 | + if (NOT IS_ABSOLUTE "${${var}}") | |
56 | + set (${var} "${CMAKE_INSTALL_PREFIX}/${${var}}") | |
57 | + endif () | |
58 | +endforeach () | |
59 | + | |
60 | +# Set CMake library search policy | |
61 | +if (COMMAND cmake_policy) | |
62 | + cmake_policy (SET CMP0003 NEW) | |
63 | + cmake_policy (SET CMP0005 NEW) | |
64 | +endif () | |
65 | + | |
66 | +# Disable unnecessary build types | |
67 | +set (CMAKE_CONFIGURATION_TYPES "Release;RelWithDebInfo;Debug" CACHE STRING "Configurations" FORCE) | |
68 | + | |
69 | +# Include our cmake macros | |
70 | +set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) | |
71 | +include (CMakeHelpers) | |
72 | + | |
73 | + | |
74 | +############ Build customization | |
75 | + | |
76 | +# Override from command line "CMake -D<OPTION>=TRUE/FALSE/0/1/ON/OFF" | |
77 | +option (ENABLE_CPP11 "Build websocketpp with CPP11 features enabled." TRUE) | |
78 | +option (BUILD_EXAMPLES "Build websocketpp examples." FALSE) | |
79 | +option (BUILD_TESTS "Build websocketpp tests." FALSE) | |
80 | + | |
81 | +if (BUILD_TESTS OR BUILD_EXAMPLES) | |
82 | + | |
83 | + enable_testing () | |
84 | + | |
85 | + ############ Compiler specific setup | |
86 | + | |
87 | + set (WEBSOCKETPP_PLATFORM_LIBS "") | |
88 | + set (WEBSOCKETPP_PLATFORM_TLS_LIBS "") | |
89 | + set (WEBSOCKETPP_BOOST_LIBS "") | |
90 | + | |
91 | + # VC9 and C++11 reasoning | |
92 | + if (ENABLE_CPP11 AND MSVC AND MSVC90) | |
93 | + message("* Detected Visual Studio 9 2008, disabling C++11 support.") | |
94 | + set (ENABLE_CPP11 FALSE) | |
95 | + endif () | |
96 | + | |
97 | + # Detect clang. Not officially reported by cmake. | |
98 | + execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-v" ERROR_VARIABLE CXX_VER_STDERR) | |
99 | + if ("${CXX_VER_STDERR}" MATCHES ".*clang.*") | |
100 | + set (CMAKE_COMPILER_IS_CLANGXX 1) | |
101 | + endif () | |
102 | + | |
103 | + # C++11 defines | |
104 | + if (ENABLE_CPP11) | |
105 | + if (MSVC) | |
106 | + add_definitions (-D_WEBSOCKETPP_CPP11_FUNCTIONAL_) | |
107 | + add_definitions (-D_WEBSOCKETPP_CPP11_SYSTEM_ERROR_) | |
108 | + add_definitions (-D_WEBSOCKETPP_CPP11_RANDOM_DEVICE_) | |
109 | + add_definitions (-D_WEBSOCKETPP_CPP11_MEMORY_) | |
110 | + else() | |
111 | + add_definitions (-D_WEBSOCKETPP_CPP11_STL_) | |
112 | + endif() | |
113 | + endif () | |
114 | + | |
115 | + # Visual studio | |
116 | + if (MSVC) | |
117 | + set (WEBSOCKETPP_BOOST_LIBS system thread) | |
118 | + set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL /Gy /GF /Ox /Ob2 /Ot /Oi /MP /arch:SSE2 /fp:fast") | |
119 | + set (CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG /INCREMENTAL:NO /OPT:REF /OPT:ICF") | |
120 | + add_definitions (/W3 /wd4996 /wd4995 /wd4355) | |
121 | + add_definitions (-DUNICODE -D_UNICODE) | |
122 | + add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) | |
123 | + add_definitions (-DNOMINMAX) | |
124 | + endif () | |
125 | + | |
126 | + # g++ | |
127 | + if (CMAKE_COMPILER_IS_GNUCXX) | |
128 | + if (NOT APPLE) | |
129 | + set (WEBSOCKETPP_PLATFORM_LIBS pthread rt) | |
130 | + else() | |
131 | + set (WEBSOCKETPP_PLATFORM_LIBS pthread) | |
132 | + endif() | |
133 | + set (WEBSOCKETPP_PLATFORM_TLS_LIBS ssl crypto) | |
134 | + set (WEBSOCKETPP_BOOST_LIBS system thread) | |
135 | + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") | |
136 | + if (NOT APPLE) | |
137 | + add_definitions (-DNDEBUG -Wall -Wcast-align) # todo: should we use CMAKE_C_FLAGS for these? | |
138 | + endif () | |
139 | + | |
140 | + # Try to detect version. Note: Not tested! | |
141 | + execute_process (COMMAND ${CMAKE_CXX_COMPILER} "-dumpversion" OUTPUT_VARIABLE GCC_VERSION) | |
142 | + if ("${GCC_VERSION}" STRGREATER "4.4.0") | |
143 | + message("* C++11 support partially enabled due to GCC version ${GCC_VERSION}") | |
144 | + set (WEBSOCKETPP_BOOST_LIBS system thread) | |
145 | + endif () | |
146 | + endif () | |
147 | + | |
148 | + # clang | |
149 | + if (CMAKE_COMPILER_IS_CLANGXX) | |
150 | + if (NOT APPLE) | |
151 | + set (WEBSOCKETPP_PLATFORM_LIBS pthread rt) | |
152 | + else() | |
153 | + set (WEBSOCKETPP_PLATFORM_LIBS pthread) | |
154 | + endif() | |
155 | + set (WEBSOCKETPP_PLATFORM_TLS_LIBS ssl crypto) | |
156 | + set (WEBSOCKETPP_BOOST_LIBS system thread) | |
157 | + set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++0x -stdlib=libc++") # todo: is libc++ really needed here? | |
158 | + if (NOT APPLE) | |
159 | + add_definitions (-DNDEBUG -Wall -Wno-padded) # todo: should we use CMAKE_C_FLAGS for these? | |
160 | + endif () | |
161 | + endif () | |
162 | + | |
163 | + # OSX, can override above. | |
164 | + if (APPLE) | |
165 | + add_definitions (-DNDEBUG -Wall) | |
166 | + endif () | |
167 | + | |
168 | + if (BUILD_EXAMPLES) | |
169 | + list (APPEND WEBSOCKETPP_BOOST_LIBS random) | |
170 | + endif() | |
171 | + | |
172 | + if (BUILD_TESTS) | |
173 | + list (APPEND WEBSOCKETPP_BOOST_LIBS unit_test_framework) | |
174 | + endif() | |
175 | + | |
176 | + ############ Dependencies | |
177 | + | |
178 | + # Set BOOST_ROOT env variable or pass with cmake -DBOOST_ROOT=path. | |
179 | + # BOOST_ROOT can also be defined by a previous run from cmake cache. | |
180 | + if (NOT "$ENV{BOOST_ROOT_CPP11}" STREQUAL "") | |
181 | + # Scons documentation for BOOST_ROOT_CPP11: | |
182 | + # "look for optional second boostroot compiled with clang's libc++ STL library | |
183 | + # this prevents warnings/errors when linking code built with two different | |
184 | + # incompatible STL libraries." | |
185 | + file (TO_CMAKE_PATH "$ENV{BOOST_ROOT_CPP11}" BOOST_ROOT) | |
186 | + set (BOOST_ROOT ${BOOST_ROOT} CACHE PATH "BOOST_ROOT dependency path" FORCE) | |
187 | + endif () | |
188 | + if ("${BOOST_ROOT}" STREQUAL "") | |
189 | + file (TO_CMAKE_PATH "$ENV{BOOST_ROOT}" BOOST_ROOT) | |
190 | + # Cache BOOST_ROOT for runs that do not define $ENV{BOOST_ROOT}. | |
191 | + set (BOOST_ROOT ${BOOST_ROOT} CACHE PATH "BOOST_ROOT dependency path" FORCE) | |
192 | + endif () | |
193 | + | |
194 | + message ("* Configuring Boost") | |
195 | + message (STATUS "-- Using BOOST_ROOT") | |
196 | + message (STATUS " " ${BOOST_ROOT}) | |
197 | + | |
198 | + if (MSVC) | |
199 | + set (Boost_USE_MULTITHREADED TRUE) | |
200 | + set (Boost_USE_STATIC_LIBS TRUE) | |
201 | + else () | |
202 | + set (Boost_USE_MULTITHREADED FALSE) | |
203 | + set (Boost_USE_STATIC_LIBS FALSE) | |
204 | + endif () | |
205 | + | |
206 | + if (BOOST_STATIC) | |
207 | + set (Boost_USE_STATIC_LIBS TRUE) | |
208 | + endif () | |
209 | + | |
210 | + if (NOT Boost_USE_STATIC_LIBS) | |
211 | + add_definitions (-DBOOST_TEST_DYN_LINK) | |
212 | + endif () | |
213 | + | |
214 | + set (Boost_FIND_REQUIRED TRUE) | |
215 | + set (Boost_FIND_QUIETLY TRUE) | |
216 | + set (Boost_DEBUG FALSE) | |
217 | + set (Boost_USE_MULTITHREADED TRUE) | |
218 | + set (Boost_ADDITIONAL_VERSIONS "1.39.0" "1.40.0" "1.41.0" "1.42.0" "1.43.0" "1.44.0" "1.46.1") # todo: someone who knows better spesify these! | |
219 | + | |
220 | + find_package (Boost 1.39.0 COMPONENTS "${WEBSOCKETPP_BOOST_LIBS}") | |
221 | + | |
222 | + if (Boost_FOUND) | |
223 | + # Boost is a project wide global dependency. | |
224 | + include_directories (${Boost_INCLUDE_DIRS}) | |
225 | + link_directories (${Boost_LIBRARY_DIRS}) | |
226 | + | |
227 | + # Pretty print status | |
228 | + message (STATUS "-- Include Directories") | |
229 | + foreach (include_dir ${Boost_INCLUDE_DIRS}) | |
230 | + message (STATUS " " ${include_dir}) | |
231 | + endforeach () | |
232 | + message (STATUS "-- Library Directories") | |
233 | + foreach (library_dir ${Boost_LIBRARY_DIRS}) | |
234 | + message (STATUS " " ${library_dir}) | |
235 | + endforeach () | |
236 | + message (STATUS "-- Libraries") | |
237 | + foreach (boost_lib ${Boost_LIBRARIES}) | |
238 | + message (STATUS " " ${boost_lib}) | |
239 | + endforeach () | |
240 | + message ("") | |
241 | + else () | |
242 | + message (FATAL_ERROR "Failed to find required dependency: boost") | |
243 | + endif () | |
244 | + | |
245 | + find_package(OpenSSL) | |
246 | + find_package(ZLIB) | |
247 | +endif() | |
248 | + | |
249 | +############ Add projects | |
250 | + | |
251 | +# Add main library | |
252 | +add_subdirectory (websocketpp) | |
253 | + | |
254 | +# Add examples | |
255 | +if (BUILD_EXAMPLES) | |
256 | + include_subdirs ("examples") | |
257 | +endif () | |
258 | + | |
259 | +# Add tests | |
260 | +if (BUILD_TESTS) | |
261 | + include_subdirs ("test") | |
262 | +endif () | |
263 | + | |
264 | +print_used_build_config() | |
265 | + | |
266 | +export (PACKAGE websocketpp) | |
267 | + | |
268 | +include(CMakePackageConfigHelpers) | |
269 | +configure_package_config_file(websocketpp-config.cmake.in | |
270 | + "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/websocketpp-config.cmake" | |
271 | + PATH_VARS INSTALL_INCLUDE_DIR | |
272 | + INSTALL_DESTINATION "${INSTALL_CMAKE_DIR}" | |
273 | + NO_CHECK_REQUIRED_COMPONENTS_MACRO | |
274 | +) | |
275 | +write_basic_package_version_file("${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/websocketpp-configVersion.cmake" | |
276 | + VERSION ${WEBSOCKETPP_VERSION} | |
277 | + COMPATIBILITY ExactVersion) | |
278 | + | |
279 | +# Install the websocketpp-config.cmake and websocketpp-configVersion.cmake | |
280 | +install (FILES | |
281 | + "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/websocketpp-config.cmake" | |
282 | + "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/websocketpp-configVersion.cmake" | |
283 | + DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev) | |
284 | + | ... | ... |
3rdparty/websocketpp-0.8.2/COPYING
0 → 100644
1 | +Main Library: | |
2 | + | |
3 | +Copyright (c) 2014, Peter Thorson. All rights reserved. | |
4 | + | |
5 | +Redistribution and use in source and binary forms, with or without | |
6 | +modification, are permitted provided that the following conditions are met: | |
7 | + * Redistributions of source code must retain the above copyright | |
8 | + notice, this list of conditions and the following disclaimer. | |
9 | + * Redistributions in binary form must reproduce the above copyright | |
10 | + notice, this list of conditions and the following disclaimer in the | |
11 | + documentation and/or other materials provided with the distribution. | |
12 | + * Neither the name of the WebSocket++ Project nor the | |
13 | + names of its contributors may be used to endorse or promote products | |
14 | + derived from this software without specific prior written permission. | |
15 | + | |
16 | +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
17 | +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
18 | +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
19 | +ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY | |
20 | +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
21 | +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
22 | +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
23 | +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
24 | +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
25 | +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
26 | + | |
27 | +Bundled Libraries: | |
28 | + | |
29 | +****** Base 64 Library (base64/base64.hpp) ****** | |
30 | +base64.hpp is a repackaging of the base64.cpp and base64.h files into a | |
31 | +single header suitable for use as a header only library. This conversion was | |
32 | +done by Peter Thorson (webmaster@zaphoyd.com) in 2012. All modifications to | |
33 | +the code are redistributed under the same license as the original, which is | |
34 | +listed below. | |
35 | + | |
36 | +base64.cpp and base64.h | |
37 | + | |
38 | +Copyright (C) 2004-2008 René Nyffenegger | |
39 | + | |
40 | +This source code is provided 'as-is', without any express or implied | |
41 | +warranty. In no event will the author be held liable for any damages | |
42 | +arising from the use of this software. | |
43 | + | |
44 | +Permission is granted to anyone to use this software for any purpose, | |
45 | +including commercial applications, and to alter it and redistribute it | |
46 | +freely, subject to the following restrictions: | |
47 | + | |
48 | +1. The origin of this source code must not be misrepresented; you must not | |
49 | + claim that you wrote the original source code. If you use this source code | |
50 | + in a product, an acknowledgment in the product documentation would be | |
51 | + appreciated but is not required. | |
52 | + | |
53 | +2. Altered source versions must be plainly marked as such, and must not be | |
54 | + misrepresented as being the original source code. | |
55 | + | |
56 | +3. This notice may not be removed or altered from any source distribution. | |
57 | + | |
58 | +René Nyffenegger rene.nyffenegger@adp-gmbh.ch | |
59 | + | |
60 | +****** SHA1 Library (sha1/sha1.hpp) ****** | |
61 | +sha1.hpp is a repackaging of the sha1.cpp and sha1.h files from the shallsha1 | |
62 | +library (http://code.google.com/p/smallsha1/) into a single header suitable for | |
63 | +use as a header only library. This conversion was done by Peter Thorson | |
64 | +(webmaster@zaphoyd.com) in 2013. All modifications to the code are redistributed | |
65 | +under the same license as the original, which is listed below. | |
66 | + | |
67 | + Copyright (c) 2011, Micael Hildenborg | |
68 | + All rights reserved. | |
69 | + | |
70 | + Redistribution and use in source and binary forms, with or without | |
71 | + modification, are permitted provided that the following conditions are met: | |
72 | + * Redistributions of source code must retain the above copyright | |
73 | + notice, this list of conditions and the following disclaimer. | |
74 | + * Redistributions in binary form must reproduce the above copyright | |
75 | + notice, this list of conditions and the following disclaimer in the | |
76 | + documentation and/or other materials provided with the distribution. | |
77 | + * Neither the name of Micael Hildenborg nor the | |
78 | + names of its contributors may be used to endorse or promote products | |
79 | + derived from this software without specific prior written permission. | |
80 | + | |
81 | + THIS SOFTWARE IS PROVIDED BY Micael Hildenborg ''AS IS'' AND ANY | |
82 | + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
83 | + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
84 | + DISCLAIMED. IN NO EVENT SHALL Micael Hildenborg BE LIABLE FOR ANY | |
85 | + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
86 | + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
87 | + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
88 | + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
89 | + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
90 | + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
91 | + | |
92 | +****** MD5 Library (common/md5.hpp) ****** | |
93 | +md5.hpp is a reformulation of the md5.h and md5.c code from | |
94 | +http://www.opensource.apple.com/source/cups/cups-59/cups/md5.c to allow it to | |
95 | +function as a component of a header only library. This conversion was done by | |
96 | +Peter Thorson (webmaster@zaphoyd.com) in 2012 for the WebSocket++ project. The | |
97 | +changes are released under the same license as the original (listed below) | |
98 | + | |
99 | +Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. | |
100 | + | |
101 | +This software is provided 'as-is', without any express or implied | |
102 | +warranty. In no event will the authors be held liable for any damages | |
103 | +arising from the use of this software. | |
104 | + | |
105 | +Permission is granted to anyone to use this software for any purpose, | |
106 | +including commercial applications, and to alter it and redistribute it | |
107 | +freely, subject to the following restrictions: | |
108 | + | |
109 | +1. The origin of this software must not be misrepresented; you must not | |
110 | + claim that you wrote the original software. If you use this software | |
111 | + in a product, an acknowledgment in the product documentation would be | |
112 | + appreciated but is not required. | |
113 | +2. Altered source versions must be plainly marked as such, and must not be | |
114 | + misrepresented as being the original software. | |
115 | +3. This notice may not be removed or altered from any source distribution. | |
116 | + | |
117 | +L. Peter Deutsch | |
118 | +ghost@aladdin.com | |
119 | + | |
120 | +****** UTF8 Validation logic (utf8_validation.hpp) ****** | |
121 | +utf8_validation.hpp is adapted from code originally written by Bjoern Hoehrmann | |
122 | +<bjoern@hoehrmann.de>. See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for | |
123 | +details. | |
124 | + | |
125 | +The original license: | |
126 | + | |
127 | +Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de> | |
128 | + | |
129 | +Permission is hereby granted, free of charge, to any person obtaining a copy | |
130 | +of this software and associated documentation files (the "Software"), to deal | |
131 | +in the Software without restriction, including without limitation the rights | |
132 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
133 | +copies of the Software, and to permit persons to whom the Software is | |
134 | +furnished to do so, subject to the following conditions: | |
135 | + | |
136 | +The above copyright notice and this permission notice shall be included in | |
137 | +all copies or substantial portions of the Software. | |
138 | + | |
139 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
140 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
141 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
142 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
143 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
144 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
145 | +SOFTWARE. | ... | ... |
3rdparty/websocketpp-0.8.2/Doxyfile
0 → 100644
1 | +# Doxyfile 1.8.8 | |
2 | + | |
3 | +# This file describes the settings to be used by the documentation system | |
4 | +# doxygen (www.doxygen.org) for a project. | |
5 | +# | |
6 | +# All text after a double hash (##) is considered a comment and is placed in | |
7 | +# front of the TAG it is preceding. | |
8 | +# | |
9 | +# All text after a single hash (#) is considered a comment and will be ignored. | |
10 | +# The format is: | |
11 | +# TAG = value [value, ...] | |
12 | +# For lists, items can also be appended using: | |
13 | +# TAG += value [value, ...] | |
14 | +# Values that contain spaces should be placed between quotes (\" \"). | |
15 | + | |
16 | +#--------------------------------------------------------------------------- | |
17 | +# Project related configuration options | |
18 | +#--------------------------------------------------------------------------- | |
19 | + | |
20 | +# This tag specifies the encoding used for all characters in the config file | |
21 | +# that follow. The default is UTF-8 which is also the encoding used for all text | |
22 | +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv | |
23 | +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv | |
24 | +# for the list of possible encodings. | |
25 | +# The default value is: UTF-8. | |
26 | + | |
27 | +DOXYFILE_ENCODING = UTF-8 | |
28 | + | |
29 | +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by | |
30 | +# double-quotes, unless you are using Doxywizard) that should identify the | |
31 | +# project for which the documentation is generated. This name is used in the | |
32 | +# title of most generated pages and in a few other places. | |
33 | +# The default value is: My Project. | |
34 | + | |
35 | +PROJECT_NAME = WebSocket++ | |
36 | + | |
37 | +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This | |
38 | +# could be handy for archiving the generated documentation or if some version | |
39 | +# control system is used. | |
40 | + | |
41 | +PROJECT_NUMBER = 0.8.2 | |
42 | + | |
43 | +# Using the PROJECT_BRIEF tag one can provide an optional one line description | |
44 | +# for a project that appears at the top of each page and should give viewer a | |
45 | +# quick idea about the purpose of the project. Keep the description short. | |
46 | + | |
47 | +PROJECT_BRIEF = "C++ websocket client/server library" | |
48 | + | |
49 | +# With the PROJECT_LOGO tag one can specify an logo or icon that is included in | |
50 | +# the documentation. The maximum height of the logo should not exceed 55 pixels | |
51 | +# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo | |
52 | +# to the output directory. | |
53 | + | |
54 | +PROJECT_LOGO = | |
55 | + | |
56 | +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path | |
57 | +# into which the generated documentation will be written. If a relative path is | |
58 | +# entered, it will be relative to the location where doxygen was started. If | |
59 | +# left blank the current directory will be used. | |
60 | + | |
61 | +OUTPUT_DIRECTORY = doxygen | |
62 | + | |
63 | +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- | |
64 | +# directories (in 2 levels) under the output directory of each output format and | |
65 | +# will distribute the generated files over these directories. Enabling this | |
66 | +# option can be useful when feeding doxygen a huge amount of source files, where | |
67 | +# putting all generated files in the same directory would otherwise causes | |
68 | +# performance problems for the file system. | |
69 | +# The default value is: NO. | |
70 | + | |
71 | +CREATE_SUBDIRS = NO | |
72 | + | |
73 | +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII | |
74 | +# characters to appear in the names of generated files. If set to NO, non-ASCII | |
75 | +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode | |
76 | +# U+3044. | |
77 | +# The default value is: NO. | |
78 | + | |
79 | +ALLOW_UNICODE_NAMES = NO | |
80 | + | |
81 | +# The OUTPUT_LANGUAGE tag is used to specify the language in which all | |
82 | +# documentation generated by doxygen is written. Doxygen will use this | |
83 | +# information to generate all constant output in the proper language. | |
84 | +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, | |
85 | +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), | |
86 | +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, | |
87 | +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), | |
88 | +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, | |
89 | +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, | |
90 | +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, | |
91 | +# Ukrainian and Vietnamese. | |
92 | +# The default value is: English. | |
93 | + | |
94 | +OUTPUT_LANGUAGE = English | |
95 | + | |
96 | +# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member | |
97 | +# descriptions after the members that are listed in the file and class | |
98 | +# documentation (similar to Javadoc). Set to NO to disable this. | |
99 | +# The default value is: YES. | |
100 | + | |
101 | +BRIEF_MEMBER_DESC = YES | |
102 | + | |
103 | +# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief | |
104 | +# description of a member or function before the detailed description | |
105 | +# | |
106 | +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the | |
107 | +# brief descriptions will be completely suppressed. | |
108 | +# The default value is: YES. | |
109 | + | |
110 | +REPEAT_BRIEF = YES | |
111 | + | |
112 | +# This tag implements a quasi-intelligent brief description abbreviator that is | |
113 | +# used to form the text in various listings. Each string in this list, if found | |
114 | +# as the leading text of the brief description, will be stripped from the text | |
115 | +# and the result, after processing the whole list, is used as the annotated | |
116 | +# text. Otherwise, the brief description is used as-is. If left blank, the | |
117 | +# following values are used ($name is automatically replaced with the name of | |
118 | +# the entity):The $name class, The $name widget, The $name file, is, provides, | |
119 | +# specifies, contains, represents, a, an and the. | |
120 | + | |
121 | +ABBREVIATE_BRIEF = | |
122 | + | |
123 | +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then | |
124 | +# doxygen will generate a detailed section even if there is only a brief | |
125 | +# description. | |
126 | +# The default value is: NO. | |
127 | + | |
128 | +ALWAYS_DETAILED_SEC = NO | |
129 | + | |
130 | +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all | |
131 | +# inherited members of a class in the documentation of that class as if those | |
132 | +# members were ordinary class members. Constructors, destructors and assignment | |
133 | +# operators of the base classes will not be shown. | |
134 | +# The default value is: NO. | |
135 | + | |
136 | +INLINE_INHERITED_MEMB = NO | |
137 | + | |
138 | +# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path | |
139 | +# before files name in the file list and in the header files. If set to NO the | |
140 | +# shortest path that makes the file name unique will be used | |
141 | +# The default value is: YES. | |
142 | + | |
143 | +FULL_PATH_NAMES = YES | |
144 | + | |
145 | +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. | |
146 | +# Stripping is only done if one of the specified strings matches the left-hand | |
147 | +# part of the path. The tag can be used to show relative paths in the file list. | |
148 | +# If left blank the directory from which doxygen is run is used as the path to | |
149 | +# strip. | |
150 | +# | |
151 | +# Note that you can specify absolute paths here, but also relative paths, which | |
152 | +# will be relative from the directory where doxygen is started. | |
153 | +# This tag requires that the tag FULL_PATH_NAMES is set to YES. | |
154 | + | |
155 | +STRIP_FROM_PATH = | |
156 | + | |
157 | +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the | |
158 | +# path mentioned in the documentation of a class, which tells the reader which | |
159 | +# header file to include in order to use a class. If left blank only the name of | |
160 | +# the header file containing the class definition is used. Otherwise one should | |
161 | +# specify the list of include paths that are normally passed to the compiler | |
162 | +# using the -I flag. | |
163 | + | |
164 | +STRIP_FROM_INC_PATH = | |
165 | + | |
166 | +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but | |
167 | +# less readable) file names. This can be useful is your file systems doesn't | |
168 | +# support long names like on DOS, Mac, or CD-ROM. | |
169 | +# The default value is: NO. | |
170 | + | |
171 | +SHORT_NAMES = NO | |
172 | + | |
173 | +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the | |
174 | +# first line (until the first dot) of a Javadoc-style comment as the brief | |
175 | +# description. If set to NO, the Javadoc-style will behave just like regular Qt- | |
176 | +# style comments (thus requiring an explicit @brief command for a brief | |
177 | +# description.) | |
178 | +# The default value is: NO. | |
179 | + | |
180 | +JAVADOC_AUTOBRIEF = NO | |
181 | + | |
182 | +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first | |
183 | +# line (until the first dot) of a Qt-style comment as the brief description. If | |
184 | +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus | |
185 | +# requiring an explicit \brief command for a brief description.) | |
186 | +# The default value is: NO. | |
187 | + | |
188 | +QT_AUTOBRIEF = NO | |
189 | + | |
190 | +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a | |
191 | +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as | |
192 | +# a brief description. This used to be the default behavior. The new default is | |
193 | +# to treat a multi-line C++ comment block as a detailed description. Set this | |
194 | +# tag to YES if you prefer the old behavior instead. | |
195 | +# | |
196 | +# Note that setting this tag to YES also means that rational rose comments are | |
197 | +# not recognized any more. | |
198 | +# The default value is: NO. | |
199 | + | |
200 | +MULTILINE_CPP_IS_BRIEF = NO | |
201 | + | |
202 | +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the | |
203 | +# documentation from any documented member that it re-implements. | |
204 | +# The default value is: YES. | |
205 | + | |
206 | +INHERIT_DOCS = YES | |
207 | + | |
208 | +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a | |
209 | +# new page for each member. If set to NO, the documentation of a member will be | |
210 | +# part of the file/class/namespace that contains it. | |
211 | +# The default value is: NO. | |
212 | + | |
213 | +SEPARATE_MEMBER_PAGES = NO | |
214 | + | |
215 | +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen | |
216 | +# uses this value to replace tabs by spaces in code fragments. | |
217 | +# Minimum value: 1, maximum value: 16, default value: 4. | |
218 | + | |
219 | +TAB_SIZE = 4 | |
220 | + | |
221 | +# This tag can be used to specify a number of aliases that act as commands in | |
222 | +# the documentation. An alias has the form: | |
223 | +# name=value | |
224 | +# For example adding | |
225 | +# "sideeffect=@par Side Effects:\n" | |
226 | +# will allow you to put the command \sideeffect (or @sideeffect) in the | |
227 | +# documentation, which will result in a user-defined paragraph with heading | |
228 | +# "Side Effects:". You can put \n's in the value part of an alias to insert | |
229 | +# newlines. | |
230 | + | |
231 | +ALIASES = | |
232 | + | |
233 | +# This tag can be used to specify a number of word-keyword mappings (TCL only). | |
234 | +# A mapping has the form "name=value". For example adding "class=itcl::class" | |
235 | +# will allow you to use the command class in the itcl::class meaning. | |
236 | + | |
237 | +TCL_SUBST = | |
238 | + | |
239 | +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources | |
240 | +# only. Doxygen will then generate output that is more tailored for C. For | |
241 | +# instance, some of the names that are used will be different. The list of all | |
242 | +# members will be omitted, etc. | |
243 | +# The default value is: NO. | |
244 | + | |
245 | +OPTIMIZE_OUTPUT_FOR_C = NO | |
246 | + | |
247 | +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or | |
248 | +# Python sources only. Doxygen will then generate output that is more tailored | |
249 | +# for that language. For instance, namespaces will be presented as packages, | |
250 | +# qualified scopes will look different, etc. | |
251 | +# The default value is: NO. | |
252 | + | |
253 | +OPTIMIZE_OUTPUT_JAVA = NO | |
254 | + | |
255 | +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran | |
256 | +# sources. Doxygen will then generate output that is tailored for Fortran. | |
257 | +# The default value is: NO. | |
258 | + | |
259 | +OPTIMIZE_FOR_FORTRAN = NO | |
260 | + | |
261 | +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL | |
262 | +# sources. Doxygen will then generate output that is tailored for VHDL. | |
263 | +# The default value is: NO. | |
264 | + | |
265 | +OPTIMIZE_OUTPUT_VHDL = NO | |
266 | + | |
267 | +# Doxygen selects the parser to use depending on the extension of the files it | |
268 | +# parses. With this tag you can assign which parser to use for a given | |
269 | +# extension. Doxygen has a built-in mapping, but you can override or extend it | |
270 | +# using this tag. The format is ext=language, where ext is a file extension, and | |
271 | +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, | |
272 | +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: | |
273 | +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: | |
274 | +# Fortran. In the later case the parser tries to guess whether the code is fixed | |
275 | +# or free formatted code, this is the default for Fortran type files), VHDL. For | |
276 | +# instance to make doxygen treat .inc files as Fortran files (default is PHP), | |
277 | +# and .f files as C (default is Fortran), use: inc=Fortran f=C. | |
278 | +# | |
279 | +# Note For files without extension you can use no_extension as a placeholder. | |
280 | +# | |
281 | +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise | |
282 | +# the files are not read by doxygen. | |
283 | + | |
284 | +EXTENSION_MAPPING = | |
285 | + | |
286 | +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments | |
287 | +# according to the Markdown format, which allows for more readable | |
288 | +# documentation. See http://daringfireball.net/projects/markdown/ for details. | |
289 | +# The output of markdown processing is further processed by doxygen, so you can | |
290 | +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in | |
291 | +# case of backward compatibilities issues. | |
292 | +# The default value is: YES. | |
293 | + | |
294 | +MARKDOWN_SUPPORT = YES | |
295 | + | |
296 | +# When enabled doxygen tries to link words that correspond to documented | |
297 | +# classes, or namespaces to their corresponding documentation. Such a link can | |
298 | +# be prevented in individual cases by by putting a % sign in front of the word | |
299 | +# or globally by setting AUTOLINK_SUPPORT to NO. | |
300 | +# The default value is: YES. | |
301 | + | |
302 | +AUTOLINK_SUPPORT = YES | |
303 | + | |
304 | +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want | |
305 | +# to include (a tag file for) the STL sources as input, then you should set this | |
306 | +# tag to YES in order to let doxygen match functions declarations and | |
307 | +# definitions whose arguments contain STL classes (e.g. func(std::string); | |
308 | +# versus func(std::string) {}). This also make the inheritance and collaboration | |
309 | +# diagrams that involve STL classes more complete and accurate. | |
310 | +# The default value is: NO. | |
311 | + | |
312 | +BUILTIN_STL_SUPPORT = YES | |
313 | + | |
314 | +# If you use Microsoft's C++/CLI language, you should set this option to YES to | |
315 | +# enable parsing support. | |
316 | +# The default value is: NO. | |
317 | + | |
318 | +CPP_CLI_SUPPORT = NO | |
319 | + | |
320 | +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: | |
321 | +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen | |
322 | +# will parse them like normal C++ but will assume all classes use public instead | |
323 | +# of private inheritance when no explicit protection keyword is present. | |
324 | +# The default value is: NO. | |
325 | + | |
326 | +SIP_SUPPORT = NO | |
327 | + | |
328 | +# For Microsoft's IDL there are propget and propput attributes to indicate | |
329 | +# getter and setter methods for a property. Setting this option to YES will make | |
330 | +# doxygen to replace the get and set methods by a property in the documentation. | |
331 | +# This will only work if the methods are indeed getting or setting a simple | |
332 | +# type. If this is not the case, or you want to show the methods anyway, you | |
333 | +# should set this option to NO. | |
334 | +# The default value is: YES. | |
335 | + | |
336 | +IDL_PROPERTY_SUPPORT = YES | |
337 | + | |
338 | +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC | |
339 | +# tag is set to YES, then doxygen will reuse the documentation of the first | |
340 | +# member in the group (if any) for the other members of the group. By default | |
341 | +# all members of a group must be documented explicitly. | |
342 | +# The default value is: NO. | |
343 | + | |
344 | +DISTRIBUTE_GROUP_DOC = NO | |
345 | + | |
346 | +# Set the SUBGROUPING tag to YES to allow class member groups of the same type | |
347 | +# (for instance a group of public functions) to be put as a subgroup of that | |
348 | +# type (e.g. under the Public Functions section). Set it to NO to prevent | |
349 | +# subgrouping. Alternatively, this can be done per class using the | |
350 | +# \nosubgrouping command. | |
351 | +# The default value is: YES. | |
352 | + | |
353 | +SUBGROUPING = YES | |
354 | + | |
355 | +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions | |
356 | +# are shown inside the group in which they are included (e.g. using \ingroup) | |
357 | +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX | |
358 | +# and RTF). | |
359 | +# | |
360 | +# Note that this feature does not work in combination with | |
361 | +# SEPARATE_MEMBER_PAGES. | |
362 | +# The default value is: NO. | |
363 | + | |
364 | +INLINE_GROUPED_CLASSES = NO | |
365 | + | |
366 | +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions | |
367 | +# with only public data fields or simple typedef fields will be shown inline in | |
368 | +# the documentation of the scope in which they are defined (i.e. file, | |
369 | +# namespace, or group documentation), provided this scope is documented. If set | |
370 | +# to NO, structs, classes, and unions are shown on a separate page (for HTML and | |
371 | +# Man pages) or section (for LaTeX and RTF). | |
372 | +# The default value is: NO. | |
373 | + | |
374 | +INLINE_SIMPLE_STRUCTS = NO | |
375 | + | |
376 | +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or | |
377 | +# enum is documented as struct, union, or enum with the name of the typedef. So | |
378 | +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct | |
379 | +# with name TypeT. When disabled the typedef will appear as a member of a file, | |
380 | +# namespace, or class. And the struct will be named TypeS. This can typically be | |
381 | +# useful for C code in case the coding convention dictates that all compound | |
382 | +# types are typedef'ed and only the typedef is referenced, never the tag name. | |
383 | +# The default value is: NO. | |
384 | + | |
385 | +TYPEDEF_HIDES_STRUCT = NO | |
386 | + | |
387 | +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This | |
388 | +# cache is used to resolve symbols given their name and scope. Since this can be | |
389 | +# an expensive process and often the same symbol appears multiple times in the | |
390 | +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small | |
391 | +# doxygen will become slower. If the cache is too large, memory is wasted. The | |
392 | +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range | |
393 | +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 | |
394 | +# symbols. At the end of a run doxygen will report the cache usage and suggest | |
395 | +# the optimal cache size from a speed point of view. | |
396 | +# Minimum value: 0, maximum value: 9, default value: 0. | |
397 | + | |
398 | +LOOKUP_CACHE_SIZE = 0 | |
399 | + | |
400 | +#--------------------------------------------------------------------------- | |
401 | +# Build related configuration options | |
402 | +#--------------------------------------------------------------------------- | |
403 | + | |
404 | +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in | |
405 | +# documentation are documented, even if no documentation was available. Private | |
406 | +# class members and static file members will be hidden unless the | |
407 | +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. | |
408 | +# Note: This will also disable the warnings about undocumented members that are | |
409 | +# normally produced when WARNINGS is set to YES. | |
410 | +# The default value is: NO. | |
411 | + | |
412 | +EXTRACT_ALL = NO | |
413 | + | |
414 | +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will | |
415 | +# be included in the documentation. | |
416 | +# The default value is: NO. | |
417 | + | |
418 | +EXTRACT_PRIVATE = NO | |
419 | + | |
420 | +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal | |
421 | +# scope will be included in the documentation. | |
422 | +# The default value is: NO. | |
423 | + | |
424 | +EXTRACT_PACKAGE = NO | |
425 | + | |
426 | +# If the EXTRACT_STATIC tag is set to YES all static members of a file will be | |
427 | +# included in the documentation. | |
428 | +# The default value is: NO. | |
429 | + | |
430 | +EXTRACT_STATIC = YES | |
431 | + | |
432 | +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined | |
433 | +# locally in source files will be included in the documentation. If set to NO | |
434 | +# only classes defined in header files are included. Does not have any effect | |
435 | +# for Java sources. | |
436 | +# The default value is: YES. | |
437 | + | |
438 | +EXTRACT_LOCAL_CLASSES = YES | |
439 | + | |
440 | +# This flag is only useful for Objective-C code. When set to YES local methods, | |
441 | +# which are defined in the implementation section but not in the interface are | |
442 | +# included in the documentation. If set to NO only methods in the interface are | |
443 | +# included. | |
444 | +# The default value is: NO. | |
445 | + | |
446 | +EXTRACT_LOCAL_METHODS = NO | |
447 | + | |
448 | +# If this flag is set to YES, the members of anonymous namespaces will be | |
449 | +# extracted and appear in the documentation as a namespace called | |
450 | +# 'anonymous_namespace{file}', where file will be replaced with the base name of | |
451 | +# the file that contains the anonymous namespace. By default anonymous namespace | |
452 | +# are hidden. | |
453 | +# The default value is: NO. | |
454 | + | |
455 | +EXTRACT_ANON_NSPACES = NO | |
456 | + | |
457 | +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all | |
458 | +# undocumented members inside documented classes or files. If set to NO these | |
459 | +# members will be included in the various overviews, but no documentation | |
460 | +# section is generated. This option has no effect if EXTRACT_ALL is enabled. | |
461 | +# The default value is: NO. | |
462 | + | |
463 | +HIDE_UNDOC_MEMBERS = NO | |
464 | + | |
465 | +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all | |
466 | +# undocumented classes that are normally visible in the class hierarchy. If set | |
467 | +# to NO these classes will be included in the various overviews. This option has | |
468 | +# no effect if EXTRACT_ALL is enabled. | |
469 | +# The default value is: NO. | |
470 | + | |
471 | +HIDE_UNDOC_CLASSES = NO | |
472 | + | |
473 | +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend | |
474 | +# (class|struct|union) declarations. If set to NO these declarations will be | |
475 | +# included in the documentation. | |
476 | +# The default value is: NO. | |
477 | + | |
478 | +HIDE_FRIEND_COMPOUNDS = NO | |
479 | + | |
480 | +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any | |
481 | +# documentation blocks found inside the body of a function. If set to NO these | |
482 | +# blocks will be appended to the function's detailed documentation block. | |
483 | +# The default value is: NO. | |
484 | + | |
485 | +HIDE_IN_BODY_DOCS = NO | |
486 | + | |
487 | +# The INTERNAL_DOCS tag determines if documentation that is typed after a | |
488 | +# \internal command is included. If the tag is set to NO then the documentation | |
489 | +# will be excluded. Set it to YES to include the internal documentation. | |
490 | +# The default value is: NO. | |
491 | + | |
492 | +INTERNAL_DOCS = NO | |
493 | + | |
494 | +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file | |
495 | +# names in lower-case letters. If set to YES upper-case letters are also | |
496 | +# allowed. This is useful if you have classes or files whose names only differ | |
497 | +# in case and if your file system supports case sensitive file names. Windows | |
498 | +# and Mac users are advised to set this option to NO. | |
499 | +# The default value is: system dependent. | |
500 | + | |
501 | +CASE_SENSE_NAMES = NO | |
502 | + | |
503 | +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with | |
504 | +# their full class and namespace scopes in the documentation. If set to YES the | |
505 | +# scope will be hidden. | |
506 | +# The default value is: NO. | |
507 | + | |
508 | +HIDE_SCOPE_NAMES = NO | |
509 | + | |
510 | +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of | |
511 | +# the files that are included by a file in the documentation of that file. | |
512 | +# The default value is: YES. | |
513 | + | |
514 | +SHOW_INCLUDE_FILES = YES | |
515 | + | |
516 | +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each | |
517 | +# grouped member an include statement to the documentation, telling the reader | |
518 | +# which file to include in order to use the member. | |
519 | +# The default value is: NO. | |
520 | + | |
521 | +SHOW_GROUPED_MEMB_INC = NO | |
522 | + | |
523 | +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include | |
524 | +# files with double quotes in the documentation rather than with sharp brackets. | |
525 | +# The default value is: NO. | |
526 | + | |
527 | +FORCE_LOCAL_INCLUDES = NO | |
528 | + | |
529 | +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the | |
530 | +# documentation for inline members. | |
531 | +# The default value is: YES. | |
532 | + | |
533 | +INLINE_INFO = YES | |
534 | + | |
535 | +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the | |
536 | +# (detailed) documentation of file and class members alphabetically by member | |
537 | +# name. If set to NO the members will appear in declaration order. | |
538 | +# The default value is: YES. | |
539 | + | |
540 | +SORT_MEMBER_DOCS = YES | |
541 | + | |
542 | +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief | |
543 | +# descriptions of file, namespace and class members alphabetically by member | |
544 | +# name. If set to NO the members will appear in declaration order. Note that | |
545 | +# this will also influence the order of the classes in the class list. | |
546 | +# The default value is: NO. | |
547 | + | |
548 | +SORT_BRIEF_DOCS = NO | |
549 | + | |
550 | +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the | |
551 | +# (brief and detailed) documentation of class members so that constructors and | |
552 | +# destructors are listed first. If set to NO the constructors will appear in the | |
553 | +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. | |
554 | +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief | |
555 | +# member documentation. | |
556 | +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting | |
557 | +# detailed member documentation. | |
558 | +# The default value is: NO. | |
559 | + | |
560 | +SORT_MEMBERS_CTORS_1ST = NO | |
561 | + | |
562 | +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy | |
563 | +# of group names into alphabetical order. If set to NO the group names will | |
564 | +# appear in their defined order. | |
565 | +# The default value is: NO. | |
566 | + | |
567 | +SORT_GROUP_NAMES = NO | |
568 | + | |
569 | +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by | |
570 | +# fully-qualified names, including namespaces. If set to NO, the class list will | |
571 | +# be sorted only by class name, not including the namespace part. | |
572 | +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. | |
573 | +# Note: This option applies only to the class list, not to the alphabetical | |
574 | +# list. | |
575 | +# The default value is: NO. | |
576 | + | |
577 | +SORT_BY_SCOPE_NAME = NO | |
578 | + | |
579 | +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper | |
580 | +# type resolution of all parameters of a function it will reject a match between | |
581 | +# the prototype and the implementation of a member function even if there is | |
582 | +# only one candidate or it is obvious which candidate to choose by doing a | |
583 | +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still | |
584 | +# accept a match between prototype and implementation in such cases. | |
585 | +# The default value is: NO. | |
586 | + | |
587 | +STRICT_PROTO_MATCHING = NO | |
588 | + | |
589 | +# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the | |
590 | +# todo list. This list is created by putting \todo commands in the | |
591 | +# documentation. | |
592 | +# The default value is: YES. | |
593 | + | |
594 | +GENERATE_TODOLIST = YES | |
595 | + | |
596 | +# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the | |
597 | +# test list. This list is created by putting \test commands in the | |
598 | +# documentation. | |
599 | +# The default value is: YES. | |
600 | + | |
601 | +GENERATE_TESTLIST = YES | |
602 | + | |
603 | +# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug | |
604 | +# list. This list is created by putting \bug commands in the documentation. | |
605 | +# The default value is: YES. | |
606 | + | |
607 | +GENERATE_BUGLIST = YES | |
608 | + | |
609 | +# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) | |
610 | +# the deprecated list. This list is created by putting \deprecated commands in | |
611 | +# the documentation. | |
612 | +# The default value is: YES. | |
613 | + | |
614 | +GENERATE_DEPRECATEDLIST= YES | |
615 | + | |
616 | +# The ENABLED_SECTIONS tag can be used to enable conditional documentation | |
617 | +# sections, marked by \if <section_label> ... \endif and \cond <section_label> | |
618 | +# ... \endcond blocks. | |
619 | + | |
620 | +ENABLED_SECTIONS = | |
621 | + | |
622 | +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the | |
623 | +# initial value of a variable or macro / define can have for it to appear in the | |
624 | +# documentation. If the initializer consists of more lines than specified here | |
625 | +# it will be hidden. Use a value of 0 to hide initializers completely. The | |
626 | +# appearance of the value of individual variables and macros / defines can be | |
627 | +# controlled using \showinitializer or \hideinitializer command in the | |
628 | +# documentation regardless of this setting. | |
629 | +# Minimum value: 0, maximum value: 10000, default value: 30. | |
630 | + | |
631 | +MAX_INITIALIZER_LINES = 30 | |
632 | + | |
633 | +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at | |
634 | +# the bottom of the documentation of classes and structs. If set to YES the list | |
635 | +# will mention the files that were used to generate the documentation. | |
636 | +# The default value is: YES. | |
637 | + | |
638 | +SHOW_USED_FILES = YES | |
639 | + | |
640 | +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This | |
641 | +# will remove the Files entry from the Quick Index and from the Folder Tree View | |
642 | +# (if specified). | |
643 | +# The default value is: YES. | |
644 | + | |
645 | +SHOW_FILES = YES | |
646 | + | |
647 | +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces | |
648 | +# page. This will remove the Namespaces entry from the Quick Index and from the | |
649 | +# Folder Tree View (if specified). | |
650 | +# The default value is: YES. | |
651 | + | |
652 | +SHOW_NAMESPACES = YES | |
653 | + | |
654 | +# The FILE_VERSION_FILTER tag can be used to specify a program or script that | |
655 | +# doxygen should invoke to get the current version for each file (typically from | |
656 | +# the version control system). Doxygen will invoke the program by executing (via | |
657 | +# popen()) the command command input-file, where command is the value of the | |
658 | +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided | |
659 | +# by doxygen. Whatever the program writes to standard output is used as the file | |
660 | +# version. For an example see the documentation. | |
661 | + | |
662 | +FILE_VERSION_FILTER = | |
663 | + | |
664 | +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed | |
665 | +# by doxygen. The layout file controls the global structure of the generated | |
666 | +# output files in an output format independent way. To create the layout file | |
667 | +# that represents doxygen's defaults, run doxygen with the -l option. You can | |
668 | +# optionally specify a file name after the option, if omitted DoxygenLayout.xml | |
669 | +# will be used as the name of the layout file. | |
670 | +# | |
671 | +# Note that if you run doxygen from a directory containing a file called | |
672 | +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE | |
673 | +# tag is left empty. | |
674 | + | |
675 | +LAYOUT_FILE = | |
676 | + | |
677 | +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing | |
678 | +# the reference definitions. This must be a list of .bib files. The .bib | |
679 | +# extension is automatically appended if omitted. This requires the bibtex tool | |
680 | +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. | |
681 | +# For LaTeX the style of the bibliography can be controlled using | |
682 | +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the | |
683 | +# search path. See also \cite for info how to create references. | |
684 | + | |
685 | +CITE_BIB_FILES = | |
686 | + | |
687 | +#--------------------------------------------------------------------------- | |
688 | +# Configuration options related to warning and progress messages | |
689 | +#--------------------------------------------------------------------------- | |
690 | + | |
691 | +# The QUIET tag can be used to turn on/off the messages that are generated to | |
692 | +# standard output by doxygen. If QUIET is set to YES this implies that the | |
693 | +# messages are off. | |
694 | +# The default value is: NO. | |
695 | + | |
696 | +QUIET = NO | |
697 | + | |
698 | +# The WARNINGS tag can be used to turn on/off the warning messages that are | |
699 | +# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES | |
700 | +# this implies that the warnings are on. | |
701 | +# | |
702 | +# Tip: Turn warnings on while writing the documentation. | |
703 | +# The default value is: YES. | |
704 | + | |
705 | +WARNINGS = YES | |
706 | + | |
707 | +# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate | |
708 | +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag | |
709 | +# will automatically be disabled. | |
710 | +# The default value is: YES. | |
711 | + | |
712 | +WARN_IF_UNDOCUMENTED = YES | |
713 | + | |
714 | +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for | |
715 | +# potential errors in the documentation, such as not documenting some parameters | |
716 | +# in a documented function, or documenting parameters that don't exist or using | |
717 | +# markup commands wrongly. | |
718 | +# The default value is: YES. | |
719 | + | |
720 | +WARN_IF_DOC_ERROR = YES | |
721 | + | |
722 | +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that | |
723 | +# are documented, but have no documentation for their parameters or return | |
724 | +# value. If set to NO doxygen will only warn about wrong or incomplete parameter | |
725 | +# documentation, but not about the absence of documentation. | |
726 | +# The default value is: NO. | |
727 | + | |
728 | +WARN_NO_PARAMDOC = NO | |
729 | + | |
730 | +# The WARN_FORMAT tag determines the format of the warning messages that doxygen | |
731 | +# can produce. The string should contain the $file, $line, and $text tags, which | |
732 | +# will be replaced by the file and line number from which the warning originated | |
733 | +# and the warning text. Optionally the format may contain $version, which will | |
734 | +# be replaced by the version of the file (if it could be obtained via | |
735 | +# FILE_VERSION_FILTER) | |
736 | +# The default value is: $file:$line: $text. | |
737 | + | |
738 | +WARN_FORMAT = "$file:$line: $text" | |
739 | + | |
740 | +# The WARN_LOGFILE tag can be used to specify a file to which warning and error | |
741 | +# messages should be written. If left blank the output is written to standard | |
742 | +# error (stderr). | |
743 | + | |
744 | +WARN_LOGFILE = | |
745 | + | |
746 | +#--------------------------------------------------------------------------- | |
747 | +# Configuration options related to the input files | |
748 | +#--------------------------------------------------------------------------- | |
749 | + | |
750 | +# The INPUT tag is used to specify the files and/or directories that contain | |
751 | +# documented source files. You may enter file names like myfile.cpp or | |
752 | +# directories like /usr/src/myproject. Separate the files or directories with | |
753 | +# spaces. | |
754 | +# Note: If this tag is empty the current directory is searched. | |
755 | + | |
756 | +INPUT = readme.md \ | |
757 | + changelog.md \ | |
758 | + roadmap.md \ | |
759 | + websocketpp \ | |
760 | + tutorials \ | |
761 | + docs | |
762 | + | |
763 | +# This tag can be used to specify the character encoding of the source files | |
764 | +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses | |
765 | +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv | |
766 | +# documentation (see: http://www.gnu.org/software/libiconv) for the list of | |
767 | +# possible encodings. | |
768 | +# The default value is: UTF-8. | |
769 | + | |
770 | +INPUT_ENCODING = UTF-8 | |
771 | + | |
772 | +# If the value of the INPUT tag contains directories, you can use the | |
773 | +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and | |
774 | +# *.h) to filter out the source-files in the directories. If left blank the | |
775 | +# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, | |
776 | +# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, | |
777 | +# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, | |
778 | +# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, | |
779 | +# *.qsf, *.as and *.js. | |
780 | + | |
781 | +FILE_PATTERNS = | |
782 | + | |
783 | +# The RECURSIVE tag can be used to specify whether or not subdirectories should | |
784 | +# be searched for input files as well. | |
785 | +# The default value is: NO. | |
786 | + | |
787 | +RECURSIVE = YES | |
788 | + | |
789 | +# The EXCLUDE tag can be used to specify files and/or directories that should be | |
790 | +# excluded from the INPUT source files. This way you can easily exclude a | |
791 | +# subdirectory from a directory tree whose root is specified with the INPUT tag. | |
792 | +# | |
793 | +# Note that relative paths are relative to the directory from which doxygen is | |
794 | +# run. | |
795 | + | |
796 | +EXCLUDE = build | |
797 | + | |
798 | +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or | |
799 | +# directories that are symbolic links (a Unix file system feature) are excluded | |
800 | +# from the input. | |
801 | +# The default value is: NO. | |
802 | + | |
803 | +EXCLUDE_SYMLINKS = NO | |
804 | + | |
805 | +# If the value of the INPUT tag contains directories, you can use the | |
806 | +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude | |
807 | +# certain files from those directories. | |
808 | +# | |
809 | +# Note that the wildcards are matched against the file with absolute path, so to | |
810 | +# exclude all test directories for example use the pattern */test/* | |
811 | + | |
812 | +EXCLUDE_PATTERNS = | |
813 | + | |
814 | +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names | |
815 | +# (namespaces, classes, functions, etc.) that should be excluded from the | |
816 | +# output. The symbol name can be a fully qualified name, a word, or if the | |
817 | +# wildcard * is used, a substring. Examples: ANamespace, AClass, | |
818 | +# AClass::ANamespace, ANamespace::*Test | |
819 | +# | |
820 | +# Note that the wildcards are matched against the file with absolute path, so to | |
821 | +# exclude all test directories use the pattern */test/* | |
822 | + | |
823 | +EXCLUDE_SYMBOLS = | |
824 | + | |
825 | +# The EXAMPLE_PATH tag can be used to specify one or more files or directories | |
826 | +# that contain example code fragments that are included (see the \include | |
827 | +# command). | |
828 | + | |
829 | +EXAMPLE_PATH = | |
830 | + | |
831 | +# If the value of the EXAMPLE_PATH tag contains directories, you can use the | |
832 | +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and | |
833 | +# *.h) to filter out the source-files in the directories. If left blank all | |
834 | +# files are included. | |
835 | + | |
836 | +EXAMPLE_PATTERNS = | |
837 | + | |
838 | +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be | |
839 | +# searched for input files to be used with the \include or \dontinclude commands | |
840 | +# irrespective of the value of the RECURSIVE tag. | |
841 | +# The default value is: NO. | |
842 | + | |
843 | +EXAMPLE_RECURSIVE = NO | |
844 | + | |
845 | +# The IMAGE_PATH tag can be used to specify one or more files or directories | |
846 | +# that contain images that are to be included in the documentation (see the | |
847 | +# \image command). | |
848 | + | |
849 | +IMAGE_PATH = | |
850 | + | |
851 | +# The INPUT_FILTER tag can be used to specify a program that doxygen should | |
852 | +# invoke to filter for each input file. Doxygen will invoke the filter program | |
853 | +# by executing (via popen()) the command: | |
854 | +# | |
855 | +# <filter> <input-file> | |
856 | +# | |
857 | +# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the | |
858 | +# name of an input file. Doxygen will then use the output that the filter | |
859 | +# program writes to standard output. If FILTER_PATTERNS is specified, this tag | |
860 | +# will be ignored. | |
861 | +# | |
862 | +# Note that the filter must not add or remove lines; it is applied before the | |
863 | +# code is scanned, but not when the output code is generated. If lines are added | |
864 | +# or removed, the anchors will not be placed correctly. | |
865 | + | |
866 | +INPUT_FILTER = | |
867 | + | |
868 | +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern | |
869 | +# basis. Doxygen will compare the file name with each pattern and apply the | |
870 | +# filter if there is a match. The filters are a list of the form: pattern=filter | |
871 | +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how | |
872 | +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the | |
873 | +# patterns match the file name, INPUT_FILTER is applied. | |
874 | + | |
875 | +FILTER_PATTERNS = | |
876 | + | |
877 | +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using | |
878 | +# INPUT_FILTER ) will also be used to filter the input files that are used for | |
879 | +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). | |
880 | +# The default value is: NO. | |
881 | + | |
882 | +FILTER_SOURCE_FILES = NO | |
883 | + | |
884 | +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file | |
885 | +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and | |
886 | +# it is also possible to disable source filtering for a specific pattern using | |
887 | +# *.ext= (so without naming a filter). | |
888 | +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. | |
889 | + | |
890 | +FILTER_SOURCE_PATTERNS = | |
891 | + | |
892 | +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that | |
893 | +# is part of the input, its contents will be placed on the main page | |
894 | +# (index.html). This can be useful if you have a project on for instance GitHub | |
895 | +# and want to reuse the introduction page also for the doxygen output. | |
896 | + | |
897 | +USE_MDFILE_AS_MAINPAGE = | |
898 | + | |
899 | +#--------------------------------------------------------------------------- | |
900 | +# Configuration options related to source browsing | |
901 | +#--------------------------------------------------------------------------- | |
902 | + | |
903 | +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be | |
904 | +# generated. Documented entities will be cross-referenced with these sources. | |
905 | +# | |
906 | +# Note: To get rid of all source code in the generated output, make sure that | |
907 | +# also VERBATIM_HEADERS is set to NO. | |
908 | +# The default value is: NO. | |
909 | + | |
910 | +SOURCE_BROWSER = YES | |
911 | + | |
912 | +# Setting the INLINE_SOURCES tag to YES will include the body of functions, | |
913 | +# classes and enums directly into the documentation. | |
914 | +# The default value is: NO. | |
915 | + | |
916 | +INLINE_SOURCES = NO | |
917 | + | |
918 | +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any | |
919 | +# special comment blocks from generated source code fragments. Normal C, C++ and | |
920 | +# Fortran comments will always remain visible. | |
921 | +# The default value is: YES. | |
922 | + | |
923 | +STRIP_CODE_COMMENTS = YES | |
924 | + | |
925 | +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented | |
926 | +# function all documented functions referencing it will be listed. | |
927 | +# The default value is: NO. | |
928 | + | |
929 | +REFERENCED_BY_RELATION = NO | |
930 | + | |
931 | +# If the REFERENCES_RELATION tag is set to YES then for each documented function | |
932 | +# all documented entities called/used by that function will be listed. | |
933 | +# The default value is: NO. | |
934 | + | |
935 | +REFERENCES_RELATION = NO | |
936 | + | |
937 | +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set | |
938 | +# to YES, then the hyperlinks from functions in REFERENCES_RELATION and | |
939 | +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will | |
940 | +# link to the documentation. | |
941 | +# The default value is: YES. | |
942 | + | |
943 | +REFERENCES_LINK_SOURCE = YES | |
944 | + | |
945 | +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the | |
946 | +# source code will show a tooltip with additional information such as prototype, | |
947 | +# brief description and links to the definition and documentation. Since this | |
948 | +# will make the HTML file larger and loading of large files a bit slower, you | |
949 | +# can opt to disable this feature. | |
950 | +# The default value is: YES. | |
951 | +# This tag requires that the tag SOURCE_BROWSER is set to YES. | |
952 | + | |
953 | +SOURCE_TOOLTIPS = YES | |
954 | + | |
955 | +# If the USE_HTAGS tag is set to YES then the references to source code will | |
956 | +# point to the HTML generated by the htags(1) tool instead of doxygen built-in | |
957 | +# source browser. The htags tool is part of GNU's global source tagging system | |
958 | +# (see http://www.gnu.org/software/global/global.html). You will need version | |
959 | +# 4.8.6 or higher. | |
960 | +# | |
961 | +# To use it do the following: | |
962 | +# - Install the latest version of global | |
963 | +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file | |
964 | +# - Make sure the INPUT points to the root of the source tree | |
965 | +# - Run doxygen as normal | |
966 | +# | |
967 | +# Doxygen will invoke htags (and that will in turn invoke gtags), so these | |
968 | +# tools must be available from the command line (i.e. in the search path). | |
969 | +# | |
970 | +# The result: instead of the source browser generated by doxygen, the links to | |
971 | +# source code will now point to the output of htags. | |
972 | +# The default value is: NO. | |
973 | +# This tag requires that the tag SOURCE_BROWSER is set to YES. | |
974 | + | |
975 | +USE_HTAGS = NO | |
976 | + | |
977 | +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a | |
978 | +# verbatim copy of the header file for each class for which an include is | |
979 | +# specified. Set to NO to disable this. | |
980 | +# See also: Section \class. | |
981 | +# The default value is: YES. | |
982 | + | |
983 | +VERBATIM_HEADERS = YES | |
984 | + | |
985 | +# If the CLANG_ASSISTED_PARSING tag is set to YES, then doxygen will use the | |
986 | +# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the | |
987 | +# cost of reduced performance. This can be particularly helpful with template | |
988 | +# rich C++ code for which doxygen's built-in parser lacks the necessary type | |
989 | +# information. | |
990 | +# Note: The availability of this option depends on whether or not doxygen was | |
991 | +# compiled with the --with-libclang option. | |
992 | +# The default value is: NO. | |
993 | + | |
994 | +CLANG_ASSISTED_PARSING = YES | |
995 | + | |
996 | +# If clang assisted parsing is enabled you can provide the compiler with command | |
997 | +# line options that you would normally use when invoking the compiler. Note that | |
998 | +# the include paths will already be set by doxygen for the files and directories | |
999 | +# specified with INPUT and INCLUDE_PATH. | |
1000 | +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. | |
1001 | + | |
1002 | +CLANG_OPTIONS = | |
1003 | + | |
1004 | +#--------------------------------------------------------------------------- | |
1005 | +# Configuration options related to the alphabetical class index | |
1006 | +#--------------------------------------------------------------------------- | |
1007 | + | |
1008 | +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all | |
1009 | +# compounds will be generated. Enable this if the project contains a lot of | |
1010 | +# classes, structs, unions or interfaces. | |
1011 | +# The default value is: YES. | |
1012 | + | |
1013 | +ALPHABETICAL_INDEX = YES | |
1014 | + | |
1015 | +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in | |
1016 | +# which the alphabetical index list will be split. | |
1017 | +# Minimum value: 1, maximum value: 20, default value: 5. | |
1018 | +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. | |
1019 | + | |
1020 | +COLS_IN_ALPHA_INDEX = 5 | |
1021 | + | |
1022 | +# In case all classes in a project start with a common prefix, all classes will | |
1023 | +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag | |
1024 | +# can be used to specify a prefix (or a list of prefixes) that should be ignored | |
1025 | +# while generating the index headers. | |
1026 | +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. | |
1027 | + | |
1028 | +IGNORE_PREFIX = | |
1029 | + | |
1030 | +#--------------------------------------------------------------------------- | |
1031 | +# Configuration options related to the HTML output | |
1032 | +#--------------------------------------------------------------------------- | |
1033 | + | |
1034 | +# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output | |
1035 | +# The default value is: YES. | |
1036 | + | |
1037 | +GENERATE_HTML = YES | |
1038 | + | |
1039 | +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a | |
1040 | +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of | |
1041 | +# it. | |
1042 | +# The default directory is: html. | |
1043 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1044 | + | |
1045 | +HTML_OUTPUT = html | |
1046 | + | |
1047 | +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each | |
1048 | +# generated HTML page (for example: .htm, .php, .asp). | |
1049 | +# The default value is: .html. | |
1050 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1051 | + | |
1052 | +HTML_FILE_EXTENSION = .html | |
1053 | + | |
1054 | +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for | |
1055 | +# each generated HTML page. If the tag is left blank doxygen will generate a | |
1056 | +# standard header. | |
1057 | +# | |
1058 | +# To get valid HTML the header file that includes any scripts and style sheets | |
1059 | +# that doxygen needs, which is dependent on the configuration options used (e.g. | |
1060 | +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a | |
1061 | +# default header using | |
1062 | +# doxygen -w html new_header.html new_footer.html new_stylesheet.css | |
1063 | +# YourConfigFile | |
1064 | +# and then modify the file new_header.html. See also section "Doxygen usage" | |
1065 | +# for information on how to generate the default header that doxygen normally | |
1066 | +# uses. | |
1067 | +# Note: The header is subject to change so you typically have to regenerate the | |
1068 | +# default header when upgrading to a newer version of doxygen. For a description | |
1069 | +# of the possible markers and block names see the documentation. | |
1070 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1071 | + | |
1072 | +HTML_HEADER = | |
1073 | + | |
1074 | +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each | |
1075 | +# generated HTML page. If the tag is left blank doxygen will generate a standard | |
1076 | +# footer. See HTML_HEADER for more information on how to generate a default | |
1077 | +# footer and what special commands can be used inside the footer. See also | |
1078 | +# section "Doxygen usage" for information on how to generate the default footer | |
1079 | +# that doxygen normally uses. | |
1080 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1081 | + | |
1082 | +HTML_FOOTER = | |
1083 | + | |
1084 | +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style | |
1085 | +# sheet that is used by each HTML page. It can be used to fine-tune the look of | |
1086 | +# the HTML output. If left blank doxygen will generate a default style sheet. | |
1087 | +# See also section "Doxygen usage" for information on how to generate the style | |
1088 | +# sheet that doxygen normally uses. | |
1089 | +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as | |
1090 | +# it is more robust and this tag (HTML_STYLESHEET) will in the future become | |
1091 | +# obsolete. | |
1092 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1093 | + | |
1094 | +HTML_STYLESHEET = | |
1095 | + | |
1096 | +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined | |
1097 | +# cascading style sheets that are included after the standard style sheets | |
1098 | +# created by doxygen. Using this option one can overrule certain style aspects. | |
1099 | +# This is preferred over using HTML_STYLESHEET since it does not replace the | |
1100 | +# standard style sheet and is therefor more robust against future updates. | |
1101 | +# Doxygen will copy the style sheet files to the output directory. | |
1102 | +# Note: The order of the extra stylesheet files is of importance (e.g. the last | |
1103 | +# stylesheet in the list overrules the setting of the previous ones in the | |
1104 | +# list). For an example see the documentation. | |
1105 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1106 | + | |
1107 | +HTML_EXTRA_STYLESHEET = docs/manual.css | |
1108 | + | |
1109 | +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or | |
1110 | +# other source files which should be copied to the HTML output directory. Note | |
1111 | +# that these files will be copied to the base HTML output directory. Use the | |
1112 | +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these | |
1113 | +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the | |
1114 | +# files will be copied as-is; there are no commands or markers available. | |
1115 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1116 | + | |
1117 | +HTML_EXTRA_FILES = | |
1118 | + | |
1119 | +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen | |
1120 | +# will adjust the colors in the stylesheet and background images according to | |
1121 | +# this color. Hue is specified as an angle on a colorwheel, see | |
1122 | +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value | |
1123 | +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 | |
1124 | +# purple, and 360 is red again. | |
1125 | +# Minimum value: 0, maximum value: 359, default value: 220. | |
1126 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1127 | + | |
1128 | +HTML_COLORSTYLE_HUE = 236 | |
1129 | + | |
1130 | +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors | |
1131 | +# in the HTML output. For a value of 0 the output will use grayscales only. A | |
1132 | +# value of 255 will produce the most vivid colors. | |
1133 | +# Minimum value: 0, maximum value: 255, default value: 100. | |
1134 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1135 | + | |
1136 | +HTML_COLORSTYLE_SAT = 0 | |
1137 | + | |
1138 | +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the | |
1139 | +# luminance component of the colors in the HTML output. Values below 100 | |
1140 | +# gradually make the output lighter, whereas values above 100 make the output | |
1141 | +# darker. The value divided by 100 is the actual gamma applied, so 80 represents | |
1142 | +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not | |
1143 | +# change the gamma. | |
1144 | +# Minimum value: 40, maximum value: 240, default value: 80. | |
1145 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1146 | + | |
1147 | +HTML_COLORSTYLE_GAMMA = 148 | |
1148 | + | |
1149 | +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML | |
1150 | +# page will contain the date and time when the page was generated. Setting this | |
1151 | +# to NO can help when comparing the output of multiple runs. | |
1152 | +# The default value is: YES. | |
1153 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1154 | + | |
1155 | +HTML_TIMESTAMP = NO | |
1156 | + | |
1157 | +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML | |
1158 | +# documentation will contain sections that can be hidden and shown after the | |
1159 | +# page has loaded. | |
1160 | +# The default value is: NO. | |
1161 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1162 | + | |
1163 | +HTML_DYNAMIC_SECTIONS = NO | |
1164 | + | |
1165 | +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries | |
1166 | +# shown in the various tree structured indices initially; the user can expand | |
1167 | +# and collapse entries dynamically later on. Doxygen will expand the tree to | |
1168 | +# such a level that at most the specified number of entries are visible (unless | |
1169 | +# a fully collapsed tree already exceeds this amount). So setting the number of | |
1170 | +# entries 1 will produce a full collapsed tree by default. 0 is a special value | |
1171 | +# representing an infinite number of entries and will result in a full expanded | |
1172 | +# tree by default. | |
1173 | +# Minimum value: 0, maximum value: 9999, default value: 100. | |
1174 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1175 | + | |
1176 | +HTML_INDEX_NUM_ENTRIES = 100 | |
1177 | + | |
1178 | +# If the GENERATE_DOCSET tag is set to YES, additional index files will be | |
1179 | +# generated that can be used as input for Apple's Xcode 3 integrated development | |
1180 | +# environment (see: http://developer.apple.com/tools/xcode/), introduced with | |
1181 | +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a | |
1182 | +# Makefile in the HTML output directory. Running make will produce the docset in | |
1183 | +# that directory and running make install will install the docset in | |
1184 | +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at | |
1185 | +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html | |
1186 | +# for more information. | |
1187 | +# The default value is: NO. | |
1188 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1189 | + | |
1190 | +GENERATE_DOCSET = NO | |
1191 | + | |
1192 | +# This tag determines the name of the docset feed. A documentation feed provides | |
1193 | +# an umbrella under which multiple documentation sets from a single provider | |
1194 | +# (such as a company or product suite) can be grouped. | |
1195 | +# The default value is: Doxygen generated docs. | |
1196 | +# This tag requires that the tag GENERATE_DOCSET is set to YES. | |
1197 | + | |
1198 | +DOCSET_FEEDNAME = "Doxygen generated docs" | |
1199 | + | |
1200 | +# This tag specifies a string that should uniquely identify the documentation | |
1201 | +# set bundle. This should be a reverse domain-name style string, e.g. | |
1202 | +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. | |
1203 | +# The default value is: org.doxygen.Project. | |
1204 | +# This tag requires that the tag GENERATE_DOCSET is set to YES. | |
1205 | + | |
1206 | +DOCSET_BUNDLE_ID = org.doxygen.Project | |
1207 | + | |
1208 | +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify | |
1209 | +# the documentation publisher. This should be a reverse domain-name style | |
1210 | +# string, e.g. com.mycompany.MyDocSet.documentation. | |
1211 | +# The default value is: org.doxygen.Publisher. | |
1212 | +# This tag requires that the tag GENERATE_DOCSET is set to YES. | |
1213 | + | |
1214 | +DOCSET_PUBLISHER_ID = org.doxygen.Publisher | |
1215 | + | |
1216 | +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. | |
1217 | +# The default value is: Publisher. | |
1218 | +# This tag requires that the tag GENERATE_DOCSET is set to YES. | |
1219 | + | |
1220 | +DOCSET_PUBLISHER_NAME = Publisher | |
1221 | + | |
1222 | +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three | |
1223 | +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The | |
1224 | +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop | |
1225 | +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on | |
1226 | +# Windows. | |
1227 | +# | |
1228 | +# The HTML Help Workshop contains a compiler that can convert all HTML output | |
1229 | +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML | |
1230 | +# files are now used as the Windows 98 help format, and will replace the old | |
1231 | +# Windows help format (.hlp) on all Windows platforms in the future. Compressed | |
1232 | +# HTML files also contain an index, a table of contents, and you can search for | |
1233 | +# words in the documentation. The HTML workshop also contains a viewer for | |
1234 | +# compressed HTML files. | |
1235 | +# The default value is: NO. | |
1236 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1237 | + | |
1238 | +GENERATE_HTMLHELP = NO | |
1239 | + | |
1240 | +# The CHM_FILE tag can be used to specify the file name of the resulting .chm | |
1241 | +# file. You can add a path in front of the file if the result should not be | |
1242 | +# written to the html output directory. | |
1243 | +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. | |
1244 | + | |
1245 | +CHM_FILE = | |
1246 | + | |
1247 | +# The HHC_LOCATION tag can be used to specify the location (absolute path | |
1248 | +# including file name) of the HTML help compiler ( hhc.exe). If non-empty | |
1249 | +# doxygen will try to run the HTML help compiler on the generated index.hhp. | |
1250 | +# The file has to be specified with full path. | |
1251 | +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. | |
1252 | + | |
1253 | +HHC_LOCATION = | |
1254 | + | |
1255 | +# The GENERATE_CHI flag controls if a separate .chi index file is generated ( | |
1256 | +# YES) or that it should be included in the master .chm file ( NO). | |
1257 | +# The default value is: NO. | |
1258 | +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. | |
1259 | + | |
1260 | +GENERATE_CHI = NO | |
1261 | + | |
1262 | +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) | |
1263 | +# and project file content. | |
1264 | +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. | |
1265 | + | |
1266 | +CHM_INDEX_ENCODING = | |
1267 | + | |
1268 | +# The BINARY_TOC flag controls whether a binary table of contents is generated ( | |
1269 | +# YES) or a normal table of contents ( NO) in the .chm file. Furthermore it | |
1270 | +# enables the Previous and Next buttons. | |
1271 | +# The default value is: NO. | |
1272 | +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. | |
1273 | + | |
1274 | +BINARY_TOC = NO | |
1275 | + | |
1276 | +# The TOC_EXPAND flag can be set to YES to add extra items for group members to | |
1277 | +# the table of contents of the HTML help documentation and to the tree view. | |
1278 | +# The default value is: NO. | |
1279 | +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. | |
1280 | + | |
1281 | +TOC_EXPAND = NO | |
1282 | + | |
1283 | +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and | |
1284 | +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that | |
1285 | +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help | |
1286 | +# (.qch) of the generated HTML documentation. | |
1287 | +# The default value is: NO. | |
1288 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1289 | + | |
1290 | +GENERATE_QHP = NO | |
1291 | + | |
1292 | +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify | |
1293 | +# the file name of the resulting .qch file. The path specified is relative to | |
1294 | +# the HTML output folder. | |
1295 | +# This tag requires that the tag GENERATE_QHP is set to YES. | |
1296 | + | |
1297 | +QCH_FILE = | |
1298 | + | |
1299 | +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help | |
1300 | +# Project output. For more information please see Qt Help Project / Namespace | |
1301 | +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). | |
1302 | +# The default value is: org.doxygen.Project. | |
1303 | +# This tag requires that the tag GENERATE_QHP is set to YES. | |
1304 | + | |
1305 | +QHP_NAMESPACE = org.doxygen.Project | |
1306 | + | |
1307 | +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt | |
1308 | +# Help Project output. For more information please see Qt Help Project / Virtual | |
1309 | +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- | |
1310 | +# folders). | |
1311 | +# The default value is: doc. | |
1312 | +# This tag requires that the tag GENERATE_QHP is set to YES. | |
1313 | + | |
1314 | +QHP_VIRTUAL_FOLDER = doc | |
1315 | + | |
1316 | +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom | |
1317 | +# filter to add. For more information please see Qt Help Project / Custom | |
1318 | +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- | |
1319 | +# filters). | |
1320 | +# This tag requires that the tag GENERATE_QHP is set to YES. | |
1321 | + | |
1322 | +QHP_CUST_FILTER_NAME = | |
1323 | + | |
1324 | +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the | |
1325 | +# custom filter to add. For more information please see Qt Help Project / Custom | |
1326 | +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- | |
1327 | +# filters). | |
1328 | +# This tag requires that the tag GENERATE_QHP is set to YES. | |
1329 | + | |
1330 | +QHP_CUST_FILTER_ATTRS = | |
1331 | + | |
1332 | +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this | |
1333 | +# project's filter section matches. Qt Help Project / Filter Attributes (see: | |
1334 | +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). | |
1335 | +# This tag requires that the tag GENERATE_QHP is set to YES. | |
1336 | + | |
1337 | +QHP_SECT_FILTER_ATTRS = | |
1338 | + | |
1339 | +# The QHG_LOCATION tag can be used to specify the location of Qt's | |
1340 | +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the | |
1341 | +# generated .qhp file. | |
1342 | +# This tag requires that the tag GENERATE_QHP is set to YES. | |
1343 | + | |
1344 | +QHG_LOCATION = | |
1345 | + | |
1346 | +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be | |
1347 | +# generated, together with the HTML files, they form an Eclipse help plugin. To | |
1348 | +# install this plugin and make it available under the help contents menu in | |
1349 | +# Eclipse, the contents of the directory containing the HTML and XML files needs | |
1350 | +# to be copied into the plugins directory of eclipse. The name of the directory | |
1351 | +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. | |
1352 | +# After copying Eclipse needs to be restarted before the help appears. | |
1353 | +# The default value is: NO. | |
1354 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1355 | + | |
1356 | +GENERATE_ECLIPSEHELP = NO | |
1357 | + | |
1358 | +# A unique identifier for the Eclipse help plugin. When installing the plugin | |
1359 | +# the directory name containing the HTML and XML files should also have this | |
1360 | +# name. Each documentation set should have its own identifier. | |
1361 | +# The default value is: org.doxygen.Project. | |
1362 | +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. | |
1363 | + | |
1364 | +ECLIPSE_DOC_ID = org.doxygen.Project | |
1365 | + | |
1366 | +# If you want full control over the layout of the generated HTML pages it might | |
1367 | +# be necessary to disable the index and replace it with your own. The | |
1368 | +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top | |
1369 | +# of each HTML page. A value of NO enables the index and the value YES disables | |
1370 | +# it. Since the tabs in the index contain the same information as the navigation | |
1371 | +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. | |
1372 | +# The default value is: NO. | |
1373 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1374 | + | |
1375 | +DISABLE_INDEX = NO | |
1376 | + | |
1377 | +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index | |
1378 | +# structure should be generated to display hierarchical information. If the tag | |
1379 | +# value is set to YES, a side panel will be generated containing a tree-like | |
1380 | +# index structure (just like the one that is generated for HTML Help). For this | |
1381 | +# to work a browser that supports JavaScript, DHTML, CSS and frames is required | |
1382 | +# (i.e. any modern browser). Windows users are probably better off using the | |
1383 | +# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can | |
1384 | +# further fine-tune the look of the index. As an example, the default style | |
1385 | +# sheet generated by doxygen has an example that shows how to put an image at | |
1386 | +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has | |
1387 | +# the same information as the tab index, you could consider setting | |
1388 | +# DISABLE_INDEX to YES when enabling this option. | |
1389 | +# The default value is: NO. | |
1390 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1391 | + | |
1392 | +GENERATE_TREEVIEW = NO | |
1393 | + | |
1394 | +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that | |
1395 | +# doxygen will group on one line in the generated HTML documentation. | |
1396 | +# | |
1397 | +# Note that a value of 0 will completely suppress the enum values from appearing | |
1398 | +# in the overview section. | |
1399 | +# Minimum value: 0, maximum value: 20, default value: 4. | |
1400 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1401 | + | |
1402 | +ENUM_VALUES_PER_LINE = 4 | |
1403 | + | |
1404 | +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used | |
1405 | +# to set the initial width (in pixels) of the frame in which the tree is shown. | |
1406 | +# Minimum value: 0, maximum value: 1500, default value: 250. | |
1407 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1408 | + | |
1409 | +TREEVIEW_WIDTH = 250 | |
1410 | + | |
1411 | +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to | |
1412 | +# external symbols imported via tag files in a separate window. | |
1413 | +# The default value is: NO. | |
1414 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1415 | + | |
1416 | +EXT_LINKS_IN_WINDOW = NO | |
1417 | + | |
1418 | +# Use this tag to change the font size of LaTeX formulas included as images in | |
1419 | +# the HTML documentation. When you change the font size after a successful | |
1420 | +# doxygen run you need to manually remove any form_*.png images from the HTML | |
1421 | +# output directory to force them to be regenerated. | |
1422 | +# Minimum value: 8, maximum value: 50, default value: 10. | |
1423 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1424 | + | |
1425 | +FORMULA_FONTSIZE = 10 | |
1426 | + | |
1427 | +# Use the FORMULA_TRANPARENT tag to determine whether or not the images | |
1428 | +# generated for formulas are transparent PNGs. Transparent PNGs are not | |
1429 | +# supported properly for IE 6.0, but are supported on all modern browsers. | |
1430 | +# | |
1431 | +# Note that when changing this option you need to delete any form_*.png files in | |
1432 | +# the HTML output directory before the changes have effect. | |
1433 | +# The default value is: YES. | |
1434 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1435 | + | |
1436 | +FORMULA_TRANSPARENT = YES | |
1437 | + | |
1438 | +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see | |
1439 | +# http://www.mathjax.org) which uses client side Javascript for the rendering | |
1440 | +# instead of using prerendered bitmaps. Use this if you do not have LaTeX | |
1441 | +# installed or if you want to formulas look prettier in the HTML output. When | |
1442 | +# enabled you may also need to install MathJax separately and configure the path | |
1443 | +# to it using the MATHJAX_RELPATH option. | |
1444 | +# The default value is: NO. | |
1445 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1446 | + | |
1447 | +USE_MATHJAX = NO | |
1448 | + | |
1449 | +# When MathJax is enabled you can set the default output format to be used for | |
1450 | +# the MathJax output. See the MathJax site (see: | |
1451 | +# http://docs.mathjax.org/en/latest/output.html) for more details. | |
1452 | +# Possible values are: HTML-CSS (which is slower, but has the best | |
1453 | +# compatibility), NativeMML (i.e. MathML) and SVG. | |
1454 | +# The default value is: HTML-CSS. | |
1455 | +# This tag requires that the tag USE_MATHJAX is set to YES. | |
1456 | + | |
1457 | +MATHJAX_FORMAT = HTML-CSS | |
1458 | + | |
1459 | +# When MathJax is enabled you need to specify the location relative to the HTML | |
1460 | +# output directory using the MATHJAX_RELPATH option. The destination directory | |
1461 | +# should contain the MathJax.js script. For instance, if the mathjax directory | |
1462 | +# is located at the same level as the HTML output directory, then | |
1463 | +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax | |
1464 | +# Content Delivery Network so you can quickly see the result without installing | |
1465 | +# MathJax. However, it is strongly recommended to install a local copy of | |
1466 | +# MathJax from http://www.mathjax.org before deployment. | |
1467 | +# The default value is: http://cdn.mathjax.org/mathjax/latest. | |
1468 | +# This tag requires that the tag USE_MATHJAX is set to YES. | |
1469 | + | |
1470 | +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest | |
1471 | + | |
1472 | +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax | |
1473 | +# extension names that should be enabled during MathJax rendering. For example | |
1474 | +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols | |
1475 | +# This tag requires that the tag USE_MATHJAX is set to YES. | |
1476 | + | |
1477 | +MATHJAX_EXTENSIONS = | |
1478 | + | |
1479 | +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces | |
1480 | +# of code that will be used on startup of the MathJax code. See the MathJax site | |
1481 | +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an | |
1482 | +# example see the documentation. | |
1483 | +# This tag requires that the tag USE_MATHJAX is set to YES. | |
1484 | + | |
1485 | +MATHJAX_CODEFILE = | |
1486 | + | |
1487 | +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for | |
1488 | +# the HTML output. The underlying search engine uses javascript and DHTML and | |
1489 | +# should work on any modern browser. Note that when using HTML help | |
1490 | +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) | |
1491 | +# there is already a search function so this one should typically be disabled. | |
1492 | +# For large projects the javascript based search engine can be slow, then | |
1493 | +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to | |
1494 | +# search using the keyboard; to jump to the search box use <access key> + S | |
1495 | +# (what the <access key> is depends on the OS and browser, but it is typically | |
1496 | +# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down | |
1497 | +# key> to jump into the search results window, the results can be navigated | |
1498 | +# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel | |
1499 | +# the search. The filter options can be selected when the cursor is inside the | |
1500 | +# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys> | |
1501 | +# to select a filter and <Enter> or <escape> to activate or cancel the filter | |
1502 | +# option. | |
1503 | +# The default value is: YES. | |
1504 | +# This tag requires that the tag GENERATE_HTML is set to YES. | |
1505 | + | |
1506 | +SEARCHENGINE = YES | |
1507 | + | |
1508 | +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be | |
1509 | +# implemented using a web server instead of a web client using Javascript. There | |
1510 | +# are two flavors of web server based searching depending on the EXTERNAL_SEARCH | |
1511 | +# setting. When disabled, doxygen will generate a PHP script for searching and | |
1512 | +# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing | |
1513 | +# and searching needs to be provided by external tools. See the section | |
1514 | +# "External Indexing and Searching" for details. | |
1515 | +# The default value is: NO. | |
1516 | +# This tag requires that the tag SEARCHENGINE is set to YES. | |
1517 | + | |
1518 | +SERVER_BASED_SEARCH = NO | |
1519 | + | |
1520 | +# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP | |
1521 | +# script for searching. Instead the search results are written to an XML file | |
1522 | +# which needs to be processed by an external indexer. Doxygen will invoke an | |
1523 | +# external search engine pointed to by the SEARCHENGINE_URL option to obtain the | |
1524 | +# search results. | |
1525 | +# | |
1526 | +# Doxygen ships with an example indexer ( doxyindexer) and search engine | |
1527 | +# (doxysearch.cgi) which are based on the open source search engine library | |
1528 | +# Xapian (see: http://xapian.org/). | |
1529 | +# | |
1530 | +# See the section "External Indexing and Searching" for details. | |
1531 | +# The default value is: NO. | |
1532 | +# This tag requires that the tag SEARCHENGINE is set to YES. | |
1533 | + | |
1534 | +EXTERNAL_SEARCH = NO | |
1535 | + | |
1536 | +# The SEARCHENGINE_URL should point to a search engine hosted by a web server | |
1537 | +# which will return the search results when EXTERNAL_SEARCH is enabled. | |
1538 | +# | |
1539 | +# Doxygen ships with an example indexer ( doxyindexer) and search engine | |
1540 | +# (doxysearch.cgi) which are based on the open source search engine library | |
1541 | +# Xapian (see: http://xapian.org/). See the section "External Indexing and | |
1542 | +# Searching" for details. | |
1543 | +# This tag requires that the tag SEARCHENGINE is set to YES. | |
1544 | + | |
1545 | +SEARCHENGINE_URL = | |
1546 | + | |
1547 | +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed | |
1548 | +# search data is written to a file for indexing by an external tool. With the | |
1549 | +# SEARCHDATA_FILE tag the name of this file can be specified. | |
1550 | +# The default file is: searchdata.xml. | |
1551 | +# This tag requires that the tag SEARCHENGINE is set to YES. | |
1552 | + | |
1553 | +SEARCHDATA_FILE = searchdata.xml | |
1554 | + | |
1555 | +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the | |
1556 | +# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is | |
1557 | +# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple | |
1558 | +# projects and redirect the results back to the right project. | |
1559 | +# This tag requires that the tag SEARCHENGINE is set to YES. | |
1560 | + | |
1561 | +EXTERNAL_SEARCH_ID = | |
1562 | + | |
1563 | +# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen | |
1564 | +# projects other than the one defined by this configuration file, but that are | |
1565 | +# all added to the same external search index. Each project needs to have a | |
1566 | +# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of | |
1567 | +# to a relative location where the documentation can be found. The format is: | |
1568 | +# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ... | |
1569 | +# This tag requires that the tag SEARCHENGINE is set to YES. | |
1570 | + | |
1571 | +EXTRA_SEARCH_MAPPINGS = | |
1572 | + | |
1573 | +#--------------------------------------------------------------------------- | |
1574 | +# Configuration options related to the LaTeX output | |
1575 | +#--------------------------------------------------------------------------- | |
1576 | + | |
1577 | +# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output. | |
1578 | +# The default value is: YES. | |
1579 | + | |
1580 | +GENERATE_LATEX = YES | |
1581 | + | |
1582 | +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a | |
1583 | +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of | |
1584 | +# it. | |
1585 | +# The default directory is: latex. | |
1586 | +# This tag requires that the tag GENERATE_LATEX is set to YES. | |
1587 | + | |
1588 | +LATEX_OUTPUT = latex | |
1589 | + | |
1590 | +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be | |
1591 | +# invoked. | |
1592 | +# | |
1593 | +# Note that when enabling USE_PDFLATEX this option is only used for generating | |
1594 | +# bitmaps for formulas in the HTML output, but not in the Makefile that is | |
1595 | +# written to the output directory. | |
1596 | +# The default file is: latex. | |
1597 | +# This tag requires that the tag GENERATE_LATEX is set to YES. | |
1598 | + | |
1599 | +LATEX_CMD_NAME = latex | |
1600 | + | |
1601 | +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate | |
1602 | +# index for LaTeX. | |
1603 | +# The default file is: makeindex. | |
1604 | +# This tag requires that the tag GENERATE_LATEX is set to YES. | |
1605 | + | |
1606 | +MAKEINDEX_CMD_NAME = makeindex | |
1607 | + | |
1608 | +# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX | |
1609 | +# documents. This may be useful for small projects and may help to save some | |
1610 | +# trees in general. | |
1611 | +# The default value is: NO. | |
1612 | +# This tag requires that the tag GENERATE_LATEX is set to YES. | |
1613 | + | |
1614 | +COMPACT_LATEX = NO | |
1615 | + | |
1616 | +# The PAPER_TYPE tag can be used to set the paper type that is used by the | |
1617 | +# printer. | |
1618 | +# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x | |
1619 | +# 14 inches) and executive (7.25 x 10.5 inches). | |
1620 | +# The default value is: a4. | |
1621 | +# This tag requires that the tag GENERATE_LATEX is set to YES. | |
1622 | + | |
1623 | +PAPER_TYPE = a4 | |
1624 | + | |
1625 | +# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names | |
1626 | +# that should be included in the LaTeX output. To get the times font for | |
1627 | +# instance you can specify | |
1628 | +# EXTRA_PACKAGES=times | |
1629 | +# If left blank no extra packages will be included. | |
1630 | +# This tag requires that the tag GENERATE_LATEX is set to YES. | |
1631 | + | |
1632 | +EXTRA_PACKAGES = | |
1633 | + | |
1634 | +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the | |
1635 | +# generated LaTeX document. The header should contain everything until the first | |
1636 | +# chapter. If it is left blank doxygen will generate a standard header. See | |
1637 | +# section "Doxygen usage" for information on how to let doxygen write the | |
1638 | +# default header to a separate file. | |
1639 | +# | |
1640 | +# Note: Only use a user-defined header if you know what you are doing! The | |
1641 | +# following commands have a special meaning inside the header: $title, | |
1642 | +# $datetime, $date, $doxygenversion, $projectname, $projectnumber, | |
1643 | +# $projectbrief, $projectlogo. Doxygen will replace $title with the empy string, | |
1644 | +# for the replacement values of the other commands the user is refered to | |
1645 | +# HTML_HEADER. | |
1646 | +# This tag requires that the tag GENERATE_LATEX is set to YES. | |
1647 | + | |
1648 | +LATEX_HEADER = | |
1649 | + | |
1650 | +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the | |
1651 | +# generated LaTeX document. The footer should contain everything after the last | |
1652 | +# chapter. If it is left blank doxygen will generate a standard footer. See | |
1653 | +# LATEX_HEADER for more information on how to generate a default footer and what | |
1654 | +# special commands can be used inside the footer. | |
1655 | +# | |
1656 | +# Note: Only use a user-defined footer if you know what you are doing! | |
1657 | +# This tag requires that the tag GENERATE_LATEX is set to YES. | |
1658 | + | |
1659 | +LATEX_FOOTER = | |
1660 | + | |
1661 | +# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or | |
1662 | +# other source files which should be copied to the LATEX_OUTPUT output | |
1663 | +# directory. Note that the files will be copied as-is; there are no commands or | |
1664 | +# markers available. | |
1665 | +# This tag requires that the tag GENERATE_LATEX is set to YES. | |
1666 | + | |
1667 | +LATEX_EXTRA_FILES = | |
1668 | + | |
1669 | +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is | |
1670 | +# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will | |
1671 | +# contain links (just like the HTML output) instead of page references. This | |
1672 | +# makes the output suitable for online browsing using a PDF viewer. | |
1673 | +# The default value is: YES. | |
1674 | +# This tag requires that the tag GENERATE_LATEX is set to YES. | |
1675 | + | |
1676 | +PDF_HYPERLINKS = YES | |
1677 | + | |
1678 | +# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate | |
1679 | +# the PDF file directly from the LaTeX files. Set this option to YES to get a | |
1680 | +# higher quality PDF documentation. | |
1681 | +# The default value is: YES. | |
1682 | +# This tag requires that the tag GENERATE_LATEX is set to YES. | |
1683 | + | |
1684 | +USE_PDFLATEX = YES | |
1685 | + | |
1686 | +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode | |
1687 | +# command to the generated LaTeX files. This will instruct LaTeX to keep running | |
1688 | +# if errors occur, instead of asking the user for help. This option is also used | |
1689 | +# when generating formulas in HTML. | |
1690 | +# The default value is: NO. | |
1691 | +# This tag requires that the tag GENERATE_LATEX is set to YES. | |
1692 | + | |
1693 | +LATEX_BATCHMODE = NO | |
1694 | + | |
1695 | +# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the | |
1696 | +# index chapters (such as File Index, Compound Index, etc.) in the output. | |
1697 | +# The default value is: NO. | |
1698 | +# This tag requires that the tag GENERATE_LATEX is set to YES. | |
1699 | + | |
1700 | +LATEX_HIDE_INDICES = NO | |
1701 | + | |
1702 | +# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source | |
1703 | +# code with syntax highlighting in the LaTeX output. | |
1704 | +# | |
1705 | +# Note that which sources are shown also depends on other settings such as | |
1706 | +# SOURCE_BROWSER. | |
1707 | +# The default value is: NO. | |
1708 | +# This tag requires that the tag GENERATE_LATEX is set to YES. | |
1709 | + | |
1710 | +LATEX_SOURCE_CODE = NO | |
1711 | + | |
1712 | +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the | |
1713 | +# bibliography, e.g. plainnat, or ieeetr. See | |
1714 | +# http://en.wikipedia.org/wiki/BibTeX and \cite for more info. | |
1715 | +# The default value is: plain. | |
1716 | +# This tag requires that the tag GENERATE_LATEX is set to YES. | |
1717 | + | |
1718 | +LATEX_BIB_STYLE = plain | |
1719 | + | |
1720 | +#--------------------------------------------------------------------------- | |
1721 | +# Configuration options related to the RTF output | |
1722 | +#--------------------------------------------------------------------------- | |
1723 | + | |
1724 | +# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The | |
1725 | +# RTF output is optimized for Word 97 and may not look too pretty with other RTF | |
1726 | +# readers/editors. | |
1727 | +# The default value is: NO. | |
1728 | + | |
1729 | +GENERATE_RTF = NO | |
1730 | + | |
1731 | +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a | |
1732 | +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of | |
1733 | +# it. | |
1734 | +# The default directory is: rtf. | |
1735 | +# This tag requires that the tag GENERATE_RTF is set to YES. | |
1736 | + | |
1737 | +RTF_OUTPUT = rtf | |
1738 | + | |
1739 | +# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF | |
1740 | +# documents. This may be useful for small projects and may help to save some | |
1741 | +# trees in general. | |
1742 | +# The default value is: NO. | |
1743 | +# This tag requires that the tag GENERATE_RTF is set to YES. | |
1744 | + | |
1745 | +COMPACT_RTF = NO | |
1746 | + | |
1747 | +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will | |
1748 | +# contain hyperlink fields. The RTF file will contain links (just like the HTML | |
1749 | +# output) instead of page references. This makes the output suitable for online | |
1750 | +# browsing using Word or some other Word compatible readers that support those | |
1751 | +# fields. | |
1752 | +# | |
1753 | +# Note: WordPad (write) and others do not support links. | |
1754 | +# The default value is: NO. | |
1755 | +# This tag requires that the tag GENERATE_RTF is set to YES. | |
1756 | + | |
1757 | +RTF_HYPERLINKS = NO | |
1758 | + | |
1759 | +# Load stylesheet definitions from file. Syntax is similar to doxygen's config | |
1760 | +# file, i.e. a series of assignments. You only have to provide replacements, | |
1761 | +# missing definitions are set to their default value. | |
1762 | +# | |
1763 | +# See also section "Doxygen usage" for information on how to generate the | |
1764 | +# default style sheet that doxygen normally uses. | |
1765 | +# This tag requires that the tag GENERATE_RTF is set to YES. | |
1766 | + | |
1767 | +RTF_STYLESHEET_FILE = | |
1768 | + | |
1769 | +# Set optional variables used in the generation of an RTF document. Syntax is | |
1770 | +# similar to doxygen's config file. A template extensions file can be generated | |
1771 | +# using doxygen -e rtf extensionFile. | |
1772 | +# This tag requires that the tag GENERATE_RTF is set to YES. | |
1773 | + | |
1774 | +RTF_EXTENSIONS_FILE = | |
1775 | + | |
1776 | +#--------------------------------------------------------------------------- | |
1777 | +# Configuration options related to the man page output | |
1778 | +#--------------------------------------------------------------------------- | |
1779 | + | |
1780 | +# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for | |
1781 | +# classes and files. | |
1782 | +# The default value is: NO. | |
1783 | + | |
1784 | +GENERATE_MAN = NO | |
1785 | + | |
1786 | +# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a | |
1787 | +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of | |
1788 | +# it. A directory man3 will be created inside the directory specified by | |
1789 | +# MAN_OUTPUT. | |
1790 | +# The default directory is: man. | |
1791 | +# This tag requires that the tag GENERATE_MAN is set to YES. | |
1792 | + | |
1793 | +MAN_OUTPUT = man | |
1794 | + | |
1795 | +# The MAN_EXTENSION tag determines the extension that is added to the generated | |
1796 | +# man pages. In case the manual section does not start with a number, the number | |
1797 | +# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is | |
1798 | +# optional. | |
1799 | +# The default value is: .3. | |
1800 | +# This tag requires that the tag GENERATE_MAN is set to YES. | |
1801 | + | |
1802 | +MAN_EXTENSION = .3 | |
1803 | + | |
1804 | +# The MAN_SUBDIR tag determines the name of the directory created within | |
1805 | +# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by | |
1806 | +# MAN_EXTENSION with the initial . removed. | |
1807 | +# This tag requires that the tag GENERATE_MAN is set to YES. | |
1808 | + | |
1809 | +MAN_SUBDIR = | |
1810 | + | |
1811 | +# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it | |
1812 | +# will generate one additional man file for each entity documented in the real | |
1813 | +# man page(s). These additional files only source the real man page, but without | |
1814 | +# them the man command would be unable to find the correct page. | |
1815 | +# The default value is: NO. | |
1816 | +# This tag requires that the tag GENERATE_MAN is set to YES. | |
1817 | + | |
1818 | +MAN_LINKS = NO | |
1819 | + | |
1820 | +#--------------------------------------------------------------------------- | |
1821 | +# Configuration options related to the XML output | |
1822 | +#--------------------------------------------------------------------------- | |
1823 | + | |
1824 | +# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that | |
1825 | +# captures the structure of the code including all documentation. | |
1826 | +# The default value is: NO. | |
1827 | + | |
1828 | +GENERATE_XML = NO | |
1829 | + | |
1830 | +# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a | |
1831 | +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of | |
1832 | +# it. | |
1833 | +# The default directory is: xml. | |
1834 | +# This tag requires that the tag GENERATE_XML is set to YES. | |
1835 | + | |
1836 | +XML_OUTPUT = xml | |
1837 | + | |
1838 | +# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program | |
1839 | +# listings (including syntax highlighting and cross-referencing information) to | |
1840 | +# the XML output. Note that enabling this will significantly increase the size | |
1841 | +# of the XML output. | |
1842 | +# The default value is: YES. | |
1843 | +# This tag requires that the tag GENERATE_XML is set to YES. | |
1844 | + | |
1845 | +XML_PROGRAMLISTING = YES | |
1846 | + | |
1847 | +#--------------------------------------------------------------------------- | |
1848 | +# Configuration options related to the DOCBOOK output | |
1849 | +#--------------------------------------------------------------------------- | |
1850 | + | |
1851 | +# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files | |
1852 | +# that can be used to generate PDF. | |
1853 | +# The default value is: NO. | |
1854 | + | |
1855 | +GENERATE_DOCBOOK = NO | |
1856 | + | |
1857 | +# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put. | |
1858 | +# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in | |
1859 | +# front of it. | |
1860 | +# The default directory is: docbook. | |
1861 | +# This tag requires that the tag GENERATE_DOCBOOK is set to YES. | |
1862 | + | |
1863 | +DOCBOOK_OUTPUT = docbook | |
1864 | + | |
1865 | +# If the DOCBOOK_PROGRAMLISTING tag is set to YES doxygen will include the | |
1866 | +# program listings (including syntax highlighting and cross-referencing | |
1867 | +# information) to the DOCBOOK output. Note that enabling this will significantly | |
1868 | +# increase the size of the DOCBOOK output. | |
1869 | +# The default value is: NO. | |
1870 | +# This tag requires that the tag GENERATE_DOCBOOK is set to YES. | |
1871 | + | |
1872 | +DOCBOOK_PROGRAMLISTING = NO | |
1873 | + | |
1874 | +#--------------------------------------------------------------------------- | |
1875 | +# Configuration options for the AutoGen Definitions output | |
1876 | +#--------------------------------------------------------------------------- | |
1877 | + | |
1878 | +# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen | |
1879 | +# Definitions (see http://autogen.sf.net) file that captures the structure of | |
1880 | +# the code including all documentation. Note that this feature is still | |
1881 | +# experimental and incomplete at the moment. | |
1882 | +# The default value is: NO. | |
1883 | + | |
1884 | +GENERATE_AUTOGEN_DEF = NO | |
1885 | + | |
1886 | +#--------------------------------------------------------------------------- | |
1887 | +# Configuration options related to the Perl module output | |
1888 | +#--------------------------------------------------------------------------- | |
1889 | + | |
1890 | +# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module | |
1891 | +# file that captures the structure of the code including all documentation. | |
1892 | +# | |
1893 | +# Note that this feature is still experimental and incomplete at the moment. | |
1894 | +# The default value is: NO. | |
1895 | + | |
1896 | +GENERATE_PERLMOD = NO | |
1897 | + | |
1898 | +# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary | |
1899 | +# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI | |
1900 | +# output from the Perl module output. | |
1901 | +# The default value is: NO. | |
1902 | +# This tag requires that the tag GENERATE_PERLMOD is set to YES. | |
1903 | + | |
1904 | +PERLMOD_LATEX = NO | |
1905 | + | |
1906 | +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely | |
1907 | +# formatted so it can be parsed by a human reader. This is useful if you want to | |
1908 | +# understand what is going on. On the other hand, if this tag is set to NO the | |
1909 | +# size of the Perl module output will be much smaller and Perl will parse it | |
1910 | +# just the same. | |
1911 | +# The default value is: YES. | |
1912 | +# This tag requires that the tag GENERATE_PERLMOD is set to YES. | |
1913 | + | |
1914 | +PERLMOD_PRETTY = YES | |
1915 | + | |
1916 | +# The names of the make variables in the generated doxyrules.make file are | |
1917 | +# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful | |
1918 | +# so different doxyrules.make files included by the same Makefile don't | |
1919 | +# overwrite each other's variables. | |
1920 | +# This tag requires that the tag GENERATE_PERLMOD is set to YES. | |
1921 | + | |
1922 | +PERLMOD_MAKEVAR_PREFIX = | |
1923 | + | |
1924 | +#--------------------------------------------------------------------------- | |
1925 | +# Configuration options related to the preprocessor | |
1926 | +#--------------------------------------------------------------------------- | |
1927 | + | |
1928 | +# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all | |
1929 | +# C-preprocessor directives found in the sources and include files. | |
1930 | +# The default value is: YES. | |
1931 | + | |
1932 | +ENABLE_PREPROCESSING = YES | |
1933 | + | |
1934 | +# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names | |
1935 | +# in the source code. If set to NO only conditional compilation will be | |
1936 | +# performed. Macro expansion can be done in a controlled way by setting | |
1937 | +# EXPAND_ONLY_PREDEF to YES. | |
1938 | +# The default value is: NO. | |
1939 | +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. | |
1940 | + | |
1941 | +MACRO_EXPANSION = NO | |
1942 | + | |
1943 | +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then | |
1944 | +# the macro expansion is limited to the macros specified with the PREDEFINED and | |
1945 | +# EXPAND_AS_DEFINED tags. | |
1946 | +# The default value is: NO. | |
1947 | +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. | |
1948 | + | |
1949 | +EXPAND_ONLY_PREDEF = NO | |
1950 | + | |
1951 | +# If the SEARCH_INCLUDES tag is set to YES the includes files in the | |
1952 | +# INCLUDE_PATH will be searched if a #include is found. | |
1953 | +# The default value is: YES. | |
1954 | +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. | |
1955 | + | |
1956 | +SEARCH_INCLUDES = YES | |
1957 | + | |
1958 | +# The INCLUDE_PATH tag can be used to specify one or more directories that | |
1959 | +# contain include files that are not input files but should be processed by the | |
1960 | +# preprocessor. | |
1961 | +# This tag requires that the tag SEARCH_INCLUDES is set to YES. | |
1962 | + | |
1963 | +INCLUDE_PATH = | |
1964 | + | |
1965 | +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard | |
1966 | +# patterns (like *.h and *.hpp) to filter out the header-files in the | |
1967 | +# directories. If left blank, the patterns specified with FILE_PATTERNS will be | |
1968 | +# used. | |
1969 | +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. | |
1970 | + | |
1971 | +INCLUDE_FILE_PATTERNS = | |
1972 | + | |
1973 | +# The PREDEFINED tag can be used to specify one or more macro names that are | |
1974 | +# defined before the preprocessor is started (similar to the -D option of e.g. | |
1975 | +# gcc). The argument of the tag is a list of macros of the form: name or | |
1976 | +# name=definition (no spaces). If the definition and the "=" are omitted, "=1" | |
1977 | +# is assumed. To prevent a macro definition from being undefined via #undef or | |
1978 | +# recursively expanded use the := operator instead of the = operator. | |
1979 | +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. | |
1980 | + | |
1981 | +PREDEFINED = | |
1982 | + | |
1983 | +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this | |
1984 | +# tag can be used to specify a list of macro names that should be expanded. The | |
1985 | +# macro definition that is found in the sources will be used. Use the PREDEFINED | |
1986 | +# tag if you want to use a different macro definition that overrules the | |
1987 | +# definition found in the source code. | |
1988 | +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. | |
1989 | + | |
1990 | +EXPAND_AS_DEFINED = | |
1991 | + | |
1992 | +# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will | |
1993 | +# remove all references to function-like macros that are alone on a line, have | |
1994 | +# an all uppercase name, and do not end with a semicolon. Such function macros | |
1995 | +# are typically used for boiler-plate code, and will confuse the parser if not | |
1996 | +# removed. | |
1997 | +# The default value is: YES. | |
1998 | +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. | |
1999 | + | |
2000 | +SKIP_FUNCTION_MACROS = YES | |
2001 | + | |
2002 | +#--------------------------------------------------------------------------- | |
2003 | +# Configuration options related to external references | |
2004 | +#--------------------------------------------------------------------------- | |
2005 | + | |
2006 | +# The TAGFILES tag can be used to specify one or more tag files. For each tag | |
2007 | +# file the location of the external documentation should be added. The format of | |
2008 | +# a tag file without this location is as follows: | |
2009 | +# TAGFILES = file1 file2 ... | |
2010 | +# Adding location for the tag files is done as follows: | |
2011 | +# TAGFILES = file1=loc1 "file2 = loc2" ... | |
2012 | +# where loc1 and loc2 can be relative or absolute paths or URLs. See the | |
2013 | +# section "Linking to external documentation" for more information about the use | |
2014 | +# of tag files. | |
2015 | +# Note: Each tag file must have a unique name (where the name does NOT include | |
2016 | +# the path). If a tag file is not located in the directory in which doxygen is | |
2017 | +# run, you must also specify the path to the tagfile here. | |
2018 | + | |
2019 | +TAGFILES = | |
2020 | + | |
2021 | +# When a file name is specified after GENERATE_TAGFILE, doxygen will create a | |
2022 | +# tag file that is based on the input files it reads. See section "Linking to | |
2023 | +# external documentation" for more information about the usage of tag files. | |
2024 | + | |
2025 | +GENERATE_TAGFILE = | |
2026 | + | |
2027 | +# If the ALLEXTERNALS tag is set to YES all external class will be listed in the | |
2028 | +# class index. If set to NO only the inherited external classes will be listed. | |
2029 | +# The default value is: NO. | |
2030 | + | |
2031 | +ALLEXTERNALS = NO | |
2032 | + | |
2033 | +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in | |
2034 | +# the modules index. If set to NO, only the current project's groups will be | |
2035 | +# listed. | |
2036 | +# The default value is: YES. | |
2037 | + | |
2038 | +EXTERNAL_GROUPS = YES | |
2039 | + | |
2040 | +# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in | |
2041 | +# the related pages index. If set to NO, only the current project's pages will | |
2042 | +# be listed. | |
2043 | +# The default value is: YES. | |
2044 | + | |
2045 | +EXTERNAL_PAGES = YES | |
2046 | + | |
2047 | +# The PERL_PATH should be the absolute path and name of the perl script | |
2048 | +# interpreter (i.e. the result of 'which perl'). | |
2049 | +# The default file (with absolute path) is: /usr/bin/perl. | |
2050 | + | |
2051 | +PERL_PATH = /usr/bin/perl | |
2052 | + | |
2053 | +#--------------------------------------------------------------------------- | |
2054 | +# Configuration options related to the dot tool | |
2055 | +#--------------------------------------------------------------------------- | |
2056 | + | |
2057 | +# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram | |
2058 | +# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to | |
2059 | +# NO turns the diagrams off. Note that this option also works with HAVE_DOT | |
2060 | +# disabled, but it is recommended to install and use dot, since it yields more | |
2061 | +# powerful graphs. | |
2062 | +# The default value is: YES. | |
2063 | + | |
2064 | +CLASS_DIAGRAMS = YES | |
2065 | + | |
2066 | +# You can define message sequence charts within doxygen comments using the \msc | |
2067 | +# command. Doxygen will then run the mscgen tool (see: | |
2068 | +# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the | |
2069 | +# documentation. The MSCGEN_PATH tag allows you to specify the directory where | |
2070 | +# the mscgen tool resides. If left empty the tool is assumed to be found in the | |
2071 | +# default search path. | |
2072 | + | |
2073 | +MSCGEN_PATH = | |
2074 | + | |
2075 | +# You can include diagrams made with dia in doxygen documentation. Doxygen will | |
2076 | +# then run dia to produce the diagram and insert it in the documentation. The | |
2077 | +# DIA_PATH tag allows you to specify the directory where the dia binary resides. | |
2078 | +# If left empty dia is assumed to be found in the default search path. | |
2079 | + | |
2080 | +DIA_PATH = | |
2081 | + | |
2082 | +# If set to YES, the inheritance and collaboration graphs will hide inheritance | |
2083 | +# and usage relations if the target is undocumented or is not a class. | |
2084 | +# The default value is: YES. | |
2085 | + | |
2086 | +HIDE_UNDOC_RELATIONS = YES | |
2087 | + | |
2088 | +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is | |
2089 | +# available from the path. This tool is part of Graphviz (see: | |
2090 | +# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent | |
2091 | +# Bell Labs. The other options in this section have no effect if this option is | |
2092 | +# set to NO | |
2093 | +# The default value is: NO. | |
2094 | + | |
2095 | +HAVE_DOT = NO | |
2096 | + | |
2097 | +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed | |
2098 | +# to run in parallel. When set to 0 doxygen will base this on the number of | |
2099 | +# processors available in the system. You can set it explicitly to a value | |
2100 | +# larger than 0 to get control over the balance between CPU load and processing | |
2101 | +# speed. | |
2102 | +# Minimum value: 0, maximum value: 32, default value: 0. | |
2103 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2104 | + | |
2105 | +DOT_NUM_THREADS = 0 | |
2106 | + | |
2107 | +# When you want a differently looking font in the dot files that doxygen | |
2108 | +# generates you can specify the font name using DOT_FONTNAME. You need to make | |
2109 | +# sure dot is able to find the font, which can be done by putting it in a | |
2110 | +# standard location or by setting the DOTFONTPATH environment variable or by | |
2111 | +# setting DOT_FONTPATH to the directory containing the font. | |
2112 | +# The default value is: Helvetica. | |
2113 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2114 | + | |
2115 | +DOT_FONTNAME = Helvetica | |
2116 | + | |
2117 | +# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of | |
2118 | +# dot graphs. | |
2119 | +# Minimum value: 4, maximum value: 24, default value: 10. | |
2120 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2121 | + | |
2122 | +DOT_FONTSIZE = 10 | |
2123 | + | |
2124 | +# By default doxygen will tell dot to use the default font as specified with | |
2125 | +# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set | |
2126 | +# the path where dot can find it using this tag. | |
2127 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2128 | + | |
2129 | +DOT_FONTPATH = | |
2130 | + | |
2131 | +# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for | |
2132 | +# each documented class showing the direct and indirect inheritance relations. | |
2133 | +# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO. | |
2134 | +# The default value is: YES. | |
2135 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2136 | + | |
2137 | +CLASS_GRAPH = YES | |
2138 | + | |
2139 | +# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a | |
2140 | +# graph for each documented class showing the direct and indirect implementation | |
2141 | +# dependencies (inheritance, containment, and class references variables) of the | |
2142 | +# class with other documented classes. | |
2143 | +# The default value is: YES. | |
2144 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2145 | + | |
2146 | +COLLABORATION_GRAPH = YES | |
2147 | + | |
2148 | +# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for | |
2149 | +# groups, showing the direct groups dependencies. | |
2150 | +# The default value is: YES. | |
2151 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2152 | + | |
2153 | +GROUP_GRAPHS = YES | |
2154 | + | |
2155 | +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and | |
2156 | +# collaboration diagrams in a style similar to the OMG's Unified Modeling | |
2157 | +# Language. | |
2158 | +# The default value is: NO. | |
2159 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2160 | + | |
2161 | +UML_LOOK = NO | |
2162 | + | |
2163 | +# If the UML_LOOK tag is enabled, the fields and methods are shown inside the | |
2164 | +# class node. If there are many fields or methods and many nodes the graph may | |
2165 | +# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the | |
2166 | +# number of items for each type to make the size more manageable. Set this to 0 | |
2167 | +# for no limit. Note that the threshold may be exceeded by 50% before the limit | |
2168 | +# is enforced. So when you set the threshold to 10, up to 15 fields may appear, | |
2169 | +# but if the number exceeds 15, the total amount of fields shown is limited to | |
2170 | +# 10. | |
2171 | +# Minimum value: 0, maximum value: 100, default value: 10. | |
2172 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2173 | + | |
2174 | +UML_LIMIT_NUM_FIELDS = 10 | |
2175 | + | |
2176 | +# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and | |
2177 | +# collaboration graphs will show the relations between templates and their | |
2178 | +# instances. | |
2179 | +# The default value is: NO. | |
2180 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2181 | + | |
2182 | +TEMPLATE_RELATIONS = NO | |
2183 | + | |
2184 | +# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to | |
2185 | +# YES then doxygen will generate a graph for each documented file showing the | |
2186 | +# direct and indirect include dependencies of the file with other documented | |
2187 | +# files. | |
2188 | +# The default value is: YES. | |
2189 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2190 | + | |
2191 | +INCLUDE_GRAPH = YES | |
2192 | + | |
2193 | +# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are | |
2194 | +# set to YES then doxygen will generate a graph for each documented file showing | |
2195 | +# the direct and indirect include dependencies of the file with other documented | |
2196 | +# files. | |
2197 | +# The default value is: YES. | |
2198 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2199 | + | |
2200 | +INCLUDED_BY_GRAPH = YES | |
2201 | + | |
2202 | +# If the CALL_GRAPH tag is set to YES then doxygen will generate a call | |
2203 | +# dependency graph for every global function or class method. | |
2204 | +# | |
2205 | +# Note that enabling this option will significantly increase the time of a run. | |
2206 | +# So in most cases it will be better to enable call graphs for selected | |
2207 | +# functions only using the \callgraph command. | |
2208 | +# The default value is: NO. | |
2209 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2210 | + | |
2211 | +CALL_GRAPH = NO | |
2212 | + | |
2213 | +# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller | |
2214 | +# dependency graph for every global function or class method. | |
2215 | +# | |
2216 | +# Note that enabling this option will significantly increase the time of a run. | |
2217 | +# So in most cases it will be better to enable caller graphs for selected | |
2218 | +# functions only using the \callergraph command. | |
2219 | +# The default value is: NO. | |
2220 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2221 | + | |
2222 | +CALLER_GRAPH = NO | |
2223 | + | |
2224 | +# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical | |
2225 | +# hierarchy of all classes instead of a textual one. | |
2226 | +# The default value is: YES. | |
2227 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2228 | + | |
2229 | +GRAPHICAL_HIERARCHY = YES | |
2230 | + | |
2231 | +# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the | |
2232 | +# dependencies a directory has on other directories in a graphical way. The | |
2233 | +# dependency relations are determined by the #include relations between the | |
2234 | +# files in the directories. | |
2235 | +# The default value is: YES. | |
2236 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2237 | + | |
2238 | +DIRECTORY_GRAPH = YES | |
2239 | + | |
2240 | +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images | |
2241 | +# generated by dot. | |
2242 | +# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order | |
2243 | +# to make the SVG files visible in IE 9+ (other browsers do not have this | |
2244 | +# requirement). | |
2245 | +# Possible values are: png, jpg, gif and svg. | |
2246 | +# The default value is: png. | |
2247 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2248 | + | |
2249 | +DOT_IMAGE_FORMAT = png | |
2250 | + | |
2251 | +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to | |
2252 | +# enable generation of interactive SVG images that allow zooming and panning. | |
2253 | +# | |
2254 | +# Note that this requires a modern browser other than Internet Explorer. Tested | |
2255 | +# and working are Firefox, Chrome, Safari, and Opera. | |
2256 | +# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make | |
2257 | +# the SVG files visible. Older versions of IE do not have SVG support. | |
2258 | +# The default value is: NO. | |
2259 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2260 | + | |
2261 | +INTERACTIVE_SVG = NO | |
2262 | + | |
2263 | +# The DOT_PATH tag can be used to specify the path where the dot tool can be | |
2264 | +# found. If left blank, it is assumed the dot tool can be found in the path. | |
2265 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2266 | + | |
2267 | +DOT_PATH = | |
2268 | + | |
2269 | +# The DOTFILE_DIRS tag can be used to specify one or more directories that | |
2270 | +# contain dot files that are included in the documentation (see the \dotfile | |
2271 | +# command). | |
2272 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2273 | + | |
2274 | +DOTFILE_DIRS = | |
2275 | + | |
2276 | +# The MSCFILE_DIRS tag can be used to specify one or more directories that | |
2277 | +# contain msc files that are included in the documentation (see the \mscfile | |
2278 | +# command). | |
2279 | + | |
2280 | +MSCFILE_DIRS = | |
2281 | + | |
2282 | +# The DIAFILE_DIRS tag can be used to specify one or more directories that | |
2283 | +# contain dia files that are included in the documentation (see the \diafile | |
2284 | +# command). | |
2285 | + | |
2286 | +DIAFILE_DIRS = | |
2287 | + | |
2288 | +# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the | |
2289 | +# path where java can find the plantuml.jar file. If left blank, it is assumed | |
2290 | +# PlantUML is not used or called during a preprocessing step. Doxygen will | |
2291 | +# generate a warning when it encounters a \startuml command in this case and | |
2292 | +# will not generate output for the diagram. | |
2293 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2294 | + | |
2295 | +PLANTUML_JAR_PATH = | |
2296 | + | |
2297 | +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes | |
2298 | +# that will be shown in the graph. If the number of nodes in a graph becomes | |
2299 | +# larger than this value, doxygen will truncate the graph, which is visualized | |
2300 | +# by representing a node as a red box. Note that doxygen if the number of direct | |
2301 | +# children of the root node in a graph is already larger than | |
2302 | +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that | |
2303 | +# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. | |
2304 | +# Minimum value: 0, maximum value: 10000, default value: 50. | |
2305 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2306 | + | |
2307 | +DOT_GRAPH_MAX_NODES = 50 | |
2308 | + | |
2309 | +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs | |
2310 | +# generated by dot. A depth value of 3 means that only nodes reachable from the | |
2311 | +# root by following a path via at most 3 edges will be shown. Nodes that lay | |
2312 | +# further from the root node will be omitted. Note that setting this option to 1 | |
2313 | +# or 2 may greatly reduce the computation time needed for large code bases. Also | |
2314 | +# note that the size of a graph can be further restricted by | |
2315 | +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. | |
2316 | +# Minimum value: 0, maximum value: 1000, default value: 0. | |
2317 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2318 | + | |
2319 | +MAX_DOT_GRAPH_DEPTH = 0 | |
2320 | + | |
2321 | +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent | |
2322 | +# background. This is disabled by default, because dot on Windows does not seem | |
2323 | +# to support this out of the box. | |
2324 | +# | |
2325 | +# Warning: Depending on the platform used, enabling this option may lead to | |
2326 | +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to | |
2327 | +# read). | |
2328 | +# The default value is: NO. | |
2329 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2330 | + | |
2331 | +DOT_TRANSPARENT = NO | |
2332 | + | |
2333 | +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output | |
2334 | +# files in one run (i.e. multiple -o and -T options on the command line). This | |
2335 | +# makes dot run faster, but since only newer versions of dot (>1.8.10) support | |
2336 | +# this, this feature is disabled by default. | |
2337 | +# The default value is: NO. | |
2338 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2339 | + | |
2340 | +DOT_MULTI_TARGETS = NO | |
2341 | + | |
2342 | +# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page | |
2343 | +# explaining the meaning of the various boxes and arrows in the dot generated | |
2344 | +# graphs. | |
2345 | +# The default value is: YES. | |
2346 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2347 | + | |
2348 | +GENERATE_LEGEND = YES | |
2349 | + | |
2350 | +# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot | |
2351 | +# files that are used to generate the various graphs. | |
2352 | +# The default value is: YES. | |
2353 | +# This tag requires that the tag HAVE_DOT is set to YES. | |
2354 | + | |
2355 | +DOT_CLEANUP = YES | ... | ... |
3rdparty/websocketpp-0.8.2/SConstruct
0 → 100644
1 | +import os, sys, commands | |
2 | +env = Environment(ENV = os.environ) | |
3 | + | |
4 | +# figure out a better way to configure this | |
5 | +if os.environ.has_key('CXX'): | |
6 | + env['CXX'] = os.environ['CXX'] | |
7 | + | |
8 | +if os.environ.has_key('DEBUG'): | |
9 | + env['DEBUG'] = os.environ['DEBUG'] | |
10 | + | |
11 | +if os.environ.has_key('CXXFLAGS'): | |
12 | + #env['CXXFLAGS'] = os.environ['CXXFLAGS'] | |
13 | + env.Append(CXXFLAGS = os.environ['CXXFLAGS']) | |
14 | + | |
15 | +if os.environ.has_key('LINKFLAGS'): | |
16 | + #env['LDFLAGS'] = os.environ['LDFLAGS'] | |
17 | + env.Append(LINKFLAGS = os.environ['LINKFLAGS']) | |
18 | + | |
19 | +## Boost | |
20 | +## | |
21 | +## Note: You need to either set BOOSTROOT to the root of a stock Boost distribution | |
22 | +## or set BOOST_INCLUDES and BOOST_LIBS if Boost comes with your OS distro e.g. and | |
23 | +## needs BOOST_INCLUDES=/usr/include/boost and BOOST_LIBS=/usr/lib like Ubuntu. | |
24 | +## | |
25 | +if os.environ.has_key('BOOSTROOT'): | |
26 | + os.environ['BOOST_ROOT'] = os.environ['BOOSTROOT'] | |
27 | + | |
28 | +if os.environ.has_key('BOOST_ROOT'): | |
29 | + env['BOOST_INCLUDES'] = os.environ['BOOST_ROOT'] | |
30 | + env['BOOST_LIBS'] = os.path.join(os.environ['BOOST_ROOT'], 'stage', 'lib') | |
31 | +elif os.environ.has_key('BOOST_INCLUDES') and os.environ.has_key('BOOST_LIBS'): | |
32 | + env['BOOST_INCLUDES'] = os.environ['BOOST_INCLUDES'] | |
33 | + env['BOOST_LIBS'] = os.environ['BOOST_LIBS'] | |
34 | +else: | |
35 | + raise SCons.Errors.UserError, "Neither BOOST_ROOT, nor BOOST_INCLUDES + BOOST_LIBS was set!" | |
36 | + | |
37 | +## Custom OpenSSL | |
38 | +if os.environ.has_key('OPENSSL_PATH'): | |
39 | + env.Append(CPPPATH = os.path.join(os.environ['OPENSSL_PATH'], 'include')) | |
40 | + env.Append(LIBPATH = os.environ['OPENSSL_PATH']) | |
41 | + | |
42 | +if os.environ.has_key('WSPP_ENABLE_CPP11'): | |
43 | + env['WSPP_ENABLE_CPP11'] = True | |
44 | +else: | |
45 | + env['WSPP_ENABLE_CPP11'] = False | |
46 | + | |
47 | +boost_linkshared = False | |
48 | + | |
49 | +def boostlibs(libnames,localenv): | |
50 | + if localenv['PLATFORM'].startswith('win'): | |
51 | + # Win/VC++ supports autolinking. nothing to do. | |
52 | + # http://www.boost.org/doc/libs/1_49_0/more/getting_started/windows.html#auto-linking | |
53 | + return [] | |
54 | + else: | |
55 | + libs = [] | |
56 | + prefix = localenv['SHLIBPREFIX'] if boost_linkshared else localenv['LIBPREFIX'] | |
57 | + suffix = localenv['SHLIBSUFFIX'] if boost_linkshared else localenv['LIBSUFFIX'] | |
58 | + for name in libnames: | |
59 | + lib = File(os.path.join(localenv['BOOST_LIBS'], '%sboost_%s%s' % (prefix, name, suffix))) | |
60 | + libs.append(lib) | |
61 | + return libs | |
62 | + | |
63 | +if env['PLATFORM'].startswith('win'): | |
64 | + env.Append(CPPDEFINES = ['WIN32', | |
65 | + 'NDEBUG', | |
66 | + 'WIN32_LEAN_AND_MEAN', | |
67 | + '_WIN32_WINNT=0x0600', | |
68 | + '_CONSOLE', | |
69 | + 'BOOST_TEST_DYN_LINK', | |
70 | + 'NOMINMAX', | |
71 | + '_WEBSOCKETPP_CPP11_MEMORY_', | |
72 | + '_WEBSOCKETPP_CPP11_FUNCTIONAL_']) | |
73 | + arch_flags = '/arch:SSE2' | |
74 | + opt_flags = '/Ox /Oi /fp:fast' | |
75 | + warn_flags = '/W3 /wd4996 /wd4995 /wd4355' | |
76 | + env['CCFLAGS'] = '%s /EHsc /GR /GS- /MD /nologo %s %s' % (warn_flags, arch_flags, opt_flags) | |
77 | + env['LINKFLAGS'] = '/INCREMENTAL:NO /MANIFEST /NOLOGO /OPT:REF /OPT:ICF /MACHINE:X86' | |
78 | +elif env['PLATFORM'] == 'posix': | |
79 | + if env.has_key('DEBUG'): | |
80 | + env.Append(CCFLAGS = ['-g', '-O0']) | |
81 | + else: | |
82 | + env.Append(CPPDEFINES = ['NDEBUG']) | |
83 | + env.Append(CCFLAGS = ['-O1', '-fomit-frame-pointer']) | |
84 | + env.Append(CCFLAGS = ['-Wall']) | |
85 | + #env['LINKFLAGS'] = '' | |
86 | +elif env['PLATFORM'] == 'darwin': | |
87 | + if not os.environ.has_key('CXX'): | |
88 | + env['CXX'] = "clang++" | |
89 | + if env.has_key('DEBUG'): | |
90 | + env.Append(CCFLAGS = ['-g', '-O0']) | |
91 | + else: | |
92 | + env.Append(CPPDEFINES = ['NDEBUG']) | |
93 | + env.Append(CCFLAGS = ['-O1', '-fomit-frame-pointer']) | |
94 | + env.Append(CCFLAGS = ['-Wall']) | |
95 | + #env['LINKFLAGS'] = '' | |
96 | + | |
97 | +if env['PLATFORM'].startswith('win'): | |
98 | + #env['LIBPATH'] = env['BOOST_LIBS'] | |
99 | + pass | |
100 | +else: | |
101 | + env.Append(LIBPATH = ['/usr/lib', '/usr/local/lib']) | |
102 | + | |
103 | +# Compiler specific warning flags | |
104 | +if env['CXX'].startswith('g++'): | |
105 | + #env.Append(CCFLAGS = ['-Wconversion']) | |
106 | + env.Append(CCFLAGS = ['-Wcast-align']) | |
107 | + env.Append(CCFLAGS = ['-Wshadow']) | |
108 | + env.Append(CCFLAGS = ['-Wunused-parameter']) | |
109 | +elif env['CXX'].startswith('clang++'): | |
110 | + #env.Append(CCFLAGS = ['-Wcast-align']) | |
111 | + #env.Append(CCFLAGS = ['-Wglobal-constructors']) | |
112 | + #env.Append(CCFLAGS = ['-Wconversion']) | |
113 | + env.Append(CCFLAGS = ['-Wno-padded']) | |
114 | + env.Append(CCFLAGS = ['-Wshadow']) | |
115 | + env.Append(CCFLAGS = ['-Wunused-parameter']) | |
116 | + | |
117 | + env.Append(CCFLAGS = ['-Wsometimes-uninitialized']) | |
118 | + env.Append(CCFLAGS = ['-Wuninitialized']) | |
119 | + | |
120 | + #env.Append(CCFLAGS = ['-Weverything']) | |
121 | + #env.Append(CCFLAGS = ['-Wno-documentation']) | |
122 | + #env.Append(CCFLAGS = ['-Wno-weak-vtables']) | |
123 | + #env.Append(CCFLAGS = ['-Wno-global-constructors']) | |
124 | + #env.Append(CCFLAGS = ['-Wno-sign-conversion']) | |
125 | + #env.Append(CCFLAGS = ['-Wno-exit-time-destructors']) | |
126 | + | |
127 | + | |
128 | + | |
129 | + | |
130 | + # Wpadded | |
131 | + # Wsign-conversion | |
132 | + # | |
133 | + | |
134 | +platform_libs = [] | |
135 | +tls_libs = [] | |
136 | + | |
137 | +tls_build = False | |
138 | + | |
139 | +if env['PLATFORM'] == 'posix': | |
140 | + platform_libs = ['pthread', 'rt'] | |
141 | + tls_libs = ['ssl', 'crypto'] | |
142 | + tls_build = True | |
143 | +elif env['PLATFORM'] == 'darwin': | |
144 | + tls_libs = ['ssl', 'crypto'] | |
145 | + tls_build = True | |
146 | +elif env['PLATFORM'].startswith('win'): | |
147 | + # Win/VC++ supports autolinking. nothing to do. | |
148 | + pass | |
149 | + | |
150 | +## Append WebSocket++ path | |
151 | +env.Append(CPPPATH = ['#']) | |
152 | + | |
153 | +##### Set up C++11 environment | |
154 | +polyfill_libs = [] # boost libraries used as drop in replacements for incomplete | |
155 | + # C++11 STL implementations | |
156 | +env_cpp11 = env.Clone () | |
157 | + | |
158 | +if env_cpp11['CXX'].startswith('g++'): | |
159 | + # TODO: check g++ version | |
160 | + GCC_VERSION = commands.getoutput(env_cpp11['CXX'] + ' -dumpversion') | |
161 | + | |
162 | + if GCC_VERSION > "4.4.0": | |
163 | + print "C++11 build environment partially enabled" | |
164 | + env_cpp11.Append(WSPP_CPP11_ENABLED = "true",CXXFLAGS = ['-std=c++0x'],TOOLSET = ['g++'],CPPDEFINES = ['_WEBSOCKETPP_CPP11_STL_']) | |
165 | + else: | |
166 | + print "C++11 build environment is not supported on this version of G++" | |
167 | +elif env_cpp11['CXX'].startswith('clang++'): | |
168 | + print "C++11 build environment enabled" | |
169 | + env.Append(CXXFLANGS = ['-stdlib=libc++'],LINKFLAGS=['-stdlib=libc++']) | |
170 | + env_cpp11.Append(WSPP_CPP11_ENABLED = "true",CXXFLAGS = ['-std=c++0x','-stdlib=libc++'],LINKFLAGS = ['-stdlib=libc++'],TOOLSET = ['clang++'],CPPDEFINES = ['_WEBSOCKETPP_CPP11_STL_']) | |
171 | + | |
172 | + # look for optional second boostroot compiled with clang's libc++ STL library | |
173 | + # this prevents warnings/errors when linking code built with two different | |
174 | + # incompatible STL libraries. | |
175 | + if os.environ.has_key('BOOST_ROOT_CPP11'): | |
176 | + env_cpp11['BOOST_INCLUDES'] = os.environ['BOOST_ROOT_CPP11'] | |
177 | + env_cpp11['BOOST_LIBS'] = os.path.join(os.environ['BOOST_ROOT_CPP11'], 'stage', 'lib') | |
178 | + elif os.environ.has_key('BOOST_INCLUDES_CPP11') and os.environ.has_key('BOOST_LIBS_CPP11'): | |
179 | + env_cpp11['BOOST_INCLUDES'] = os.environ['BOOST_INCLUDES_CPP11'] | |
180 | + env_cpp11['BOOST_LIBS'] = os.environ['BOOST_LIBS_CPP11'] | |
181 | +else: | |
182 | + print "C++11 build environment disabled" | |
183 | + | |
184 | +# if the build system is known to allow the isystem modifier for library include | |
185 | +# values then use it for the boost libraries. Otherwise just add them to the | |
186 | +# regular CPPPATH values. | |
187 | +if env['CXX'].startswith('g++') or env['CXX'].startswith('clang'): | |
188 | + env.Append(CPPFLAGS = '-isystem ' + env['BOOST_INCLUDES']) | |
189 | +else: | |
190 | + env.Append(CPPPATH = [env['BOOST_INCLUDES']]) | |
191 | +env.Append(LIBPATH = [env['BOOST_LIBS']]) | |
192 | + | |
193 | +# if the build system is known to allow the isystem modifier for library include | |
194 | +# values then use it for the boost libraries. Otherwise just add them to the | |
195 | +# regular CPPPATH values. | |
196 | +if env_cpp11['CXX'].startswith('g++') or env_cpp11['CXX'].startswith('clang'): | |
197 | + env_cpp11.Append(CPPFLAGS = '-isystem ' + env_cpp11['BOOST_INCLUDES']) | |
198 | +else: | |
199 | + env_cpp11.Append(CPPPATH = [env_cpp11['BOOST_INCLUDES']]) | |
200 | +env_cpp11.Append(LIBPATH = [env_cpp11['BOOST_LIBS']]) | |
201 | + | |
202 | +releasedir = 'build/release/' | |
203 | +debugdir = 'build/debug/' | |
204 | +testdir = 'build/test/' | |
205 | +builddir = releasedir | |
206 | + | |
207 | +Export('env') | |
208 | +Export('env_cpp11') | |
209 | +Export('platform_libs') | |
210 | +Export('boostlibs') | |
211 | +Export('tls_libs') | |
212 | +Export('polyfill_libs') | |
213 | + | |
214 | +## END OF CONFIG !! | |
215 | + | |
216 | +## TARGETS: | |
217 | + | |
218 | +if not env['PLATFORM'].startswith('win'): | |
219 | + # Unit tests, add test folders with SConscript files to to_test list. | |
220 | + to_test = ['utility','http','logger','random','processors','message_buffer','extension','transport/iostream','transport/asio','roles','endpoint','connection','transport'] #,'http','processors','connection' | |
221 | + | |
222 | + for t in to_test: | |
223 | + new_tests = SConscript('#/test/'+t+'/SConscript',variant_dir = testdir + t, duplicate = 0) | |
224 | + for a in new_tests: | |
225 | + new_alias = Alias('test', [a], a.abspath) | |
226 | + AlwaysBuild(new_alias) | |
227 | + | |
228 | +# Main test application | |
229 | +#main = SConscript('#/examples/dev/SConscript',variant_dir = builddir + 'dev',duplicate = 0) | |
230 | + | |
231 | +# echo_server | |
232 | +echo_server = SConscript('#/examples/echo_server/SConscript',variant_dir = builddir + 'echo_server',duplicate = 0) | |
233 | + | |
234 | +# echo_client | |
235 | +echo_client = SConscript('#/examples/echo_client/SConscript',variant_dir = builddir + 'echo_client',duplicate = 0) | |
236 | + | |
237 | +# print_client | |
238 | +print_client = SConscript('#/examples/print_client/SConscript',variant_dir = builddir + 'print_client',duplicate = 0) | |
239 | + | |
240 | +# echo_server_tls | |
241 | +if tls_build: | |
242 | + echo_server_tls = SConscript('#/examples/echo_server_tls/SConscript',variant_dir = builddir + 'echo_server_tls',duplicate = 0) | |
243 | + echo_server_both = SConscript('#/examples/echo_server_both/SConscript',variant_dir = builddir + 'echo_server_both',duplicate = 0) | |
244 | + print_client_tls = SConscript('#/examples/print_client_tls/SConscript',variant_dir = builddir + 'print_client_tls',duplicate = 0) | |
245 | + | |
246 | +# broadcast_server | |
247 | +broadcast_server = SConscript('#/examples/broadcast_server/SConscript',variant_dir = builddir + 'broadcast_server',duplicate = 0) | |
248 | + | |
249 | +# testee_server | |
250 | +testee_server = SConscript('#/examples/testee_server/SConscript',variant_dir = builddir + 'testee_server',duplicate = 0) | |
251 | + | |
252 | +# testee_client | |
253 | +testee_client = SConscript('#/examples/testee_client/SConscript',variant_dir = builddir + 'testee_client',duplicate = 0) | |
254 | + | |
255 | +# scratch_client | |
256 | +scratch_client = SConscript('#/examples/scratch_client/SConscript',variant_dir = builddir + 'scratch_client',duplicate = 0) | |
257 | + | |
258 | +# scratch_server | |
259 | +scratch_server = SConscript('#/examples/scratch_server/SConscript',variant_dir = builddir + 'scratch_server',duplicate = 0) | |
260 | + | |
261 | + | |
262 | +# debug_client | |
263 | +debug_client = SConscript('#/examples/debug_client/SConscript',variant_dir = builddir + 'debug_client',duplicate = 0) | |
264 | + | |
265 | +# debug_server | |
266 | +debug_server = SConscript('#/examples/debug_server/SConscript',variant_dir = builddir + 'debug_server',duplicate = 0) | |
267 | + | |
268 | +# subprotocol_server | |
269 | +subprotocol_server = SConscript('#/examples/subprotocol_server/SConscript',variant_dir = builddir + 'subprotocol_server',duplicate = 0) | |
270 | + | |
271 | +# telemetry_server | |
272 | +telemetry_server = SConscript('#/examples/telemetry_server/SConscript',variant_dir = builddir + 'telemetry_server',duplicate = 0) | |
273 | + | |
274 | +# external_io_service | |
275 | +external_io_service = SConscript('#/examples/external_io_service/SConscript',variant_dir = builddir + 'external_io_service',duplicate = 0) | |
276 | + | |
277 | +if not env['PLATFORM'].startswith('win'): | |
278 | + # iostream_server | |
279 | + iostream_server = SConscript('#/examples/iostream_server/SConscript',variant_dir = builddir + 'iostream_server',duplicate = 0) | |
280 | + | |
281 | + # telemetry_client | |
282 | + telemetry_client = SConscript('#/examples/telemetry_client/SConscript',variant_dir = builddir + 'telemetry_client',duplicate = 0) | |
283 | + | |
284 | + # print_server | |
285 | + print_server = SConscript('#/examples/print_server/SConscript',variant_dir = builddir + 'print_server',duplicate = 0) | ... | ... |
3rdparty/websocketpp-0.8.2/changelog.md
0 → 100644
1 | +HEAD | |
2 | + | |
3 | +0.8.2 - 2020-04-19 | |
4 | +- Examples: Update print_client_tls example to remove use of deprecated | |
5 | + OpenSSL functions. | |
6 | +- Compatibility: Removes the use of make_shared in a number of cases where | |
7 | + it would be incompatible with newer versions of ASIO. Thank you Stefan | |
8 | + Floeren for the patch. #810 #814 #862 #843 #794 #808 | |
9 | +- CMake: Update cmake installer to better handle dependencies when using | |
10 | + g++ on MacOS. Thank you Luca Palano for reporting and a patch. #831 | |
11 | +- CMake: Update cmake installer to use a variable for the include directory | |
12 | + improving the ability of the install to be customized. THank you Schrijvers | |
13 | + Luc and Gianfranco Costamanga for reporting and a patch. #842 | |
14 | + | |
15 | +0.8.1 - 2018-07-16 | |
16 | +Note: This release does not change library behavior. It only corrects issues | |
17 | +in the installer and test system. | |
18 | +- Test Suite: Adjust test suite to match behavior introduced in 0.8.0. Thank | |
19 | + you Gianfranco Costamagna for reporting and a patch. #731 | |
20 | +- CMake: Update cmake installer to only install library files globally. | |
21 | + Thank you Gianfraco Costamanga for reporting and a patch. #732 | |
22 | + | |
23 | +0.8.0 - 2018-07-12 | |
24 | +- Examples: Add `print_client` example. This demonstrates a minimal non-TLS | |
25 | + client that connects to a server and prints out the messages it receives. | |
26 | +- Examples: Add `print_client_tls` example. This demonstrates a minimal TLS | |
27 | + client, including basic support via Asio+OpenSSL for certificate chain | |
28 | + and hostname verification. | |
29 | +- Feature: Add getter for all headers to the HTTP parsers. This allows a | |
30 | + wrapping library to enumerate all headers to send upstream. Thank you Jupp | |
31 | + Müller for reporting and an initial pull request. | |
32 | +- Improvement: Move the `socket_init_handler` to execute as a part of `init_asio` | |
33 | + rather than connection `pre_init`. This allows setting of socket options prior | |
34 | + to the bind/listen/accept system calls. Thank you ChristianRobl3D for | |
35 | + reporting #530. | |
36 | +- Improvement: Timers in transport integration tests should only fail if their | |
37 | + own test times out, rather than any test. #643 Thank you Alex Korotkin for | |
38 | + reporting and a patch. | |
39 | +- Improvement: Preserve transport layer error codes in more cases, particularly | |
40 | + during calls to `endpoint::listen`. #652 Thank you vadz for reporting and | |
41 | + patches. | |
42 | +- Compatibility: Make sure the chrono library used by Boost/Asio is in sync | |
43 | + with what the websocketpp is using. Thank you Flow86 for reporting and a | |
44 | + patch. | |
45 | +- Compatibility: Update `telemetry_client` to use a slightly more cross platform | |
46 | + method of sleeping. Should work on windows now. Thank you Meir Yanovich for | |
47 | + reporting. | |
48 | +- Compatibility: Updated permessage-deflate support to reflect that the zlib | |
49 | + library does not actually support a sliding window size of 256 bits. | |
50 | + WebSocket++ will no longer negotiate 256 bit deflate windows. If the user | |
51 | + of the library tries to request a 256 bit window a 512 bit window will be | |
52 | + specified instead (This was the previous behavior). #596 #653 Thank you | |
53 | + Vinnie Falco and Gianfranco Costamagna for reporting. | |
54 | +- Compatibility: Better error handling and logging in cases where extension | |
55 | + requests parse correctly but negotiation fails. | |
56 | +- Compatibility: Removed custom handling of `SSL_R_SHORT_READ` error condition. | |
57 | + This error code no longer exists in modern versions of OpenSSL and causes | |
58 | + a build error. It wasn't being used for anything particularly important | |
59 | + (slightly improving error reporting) and there isn't a great replacement. | |
60 | + #599 Thank you Gianfranco Costamagna for reporting. | |
61 | +- Compatibility: Add missing `<stdint>` headers. Fixes issues with g++ 5.4.0. | |
62 | + #638 Thank you Alex Korotkin for reporting and a patch. | |
63 | +- Compatibility: Remove the use of `std::auto_ptr` and `std::binary_function` | |
64 | + from builds with C++11 or later. These features are deprecated and were | |
65 | + removed entirely in C++17. This change allows building WebSocket++ on | |
66 | + C++17 compilers. #592 Thank you Michal Fojtak for reporting and a patch | |
67 | +- Compatibility: Add 1014 close code and adds missing descriptions for codes | |
68 | + 1012 and 1013. #589 Thank you jbwdevries and ronneke1996 for reporting and | |
69 | + patches. | |
70 | +- Compatibility: Add hooks to support `mingw-std-threads` C++11 thread and mutex | |
71 | + polyfill library as an alternative to Boost. #608 Thank you Peter Taylor for | |
72 | + reporting and an initial patch. | |
73 | +- Compatibility: Changed the handshake connection token to 'Upgrade' from | |
74 | + 'upgrade'. Technically this header is supposed to be processed case | |
75 | + insensitively. In practice, there are browsers (such as Edge) that don't do | |
76 | + this and they tend to use the uppercase value used as an example in RFC6455. | |
77 | + Thank you Johann Bauer for reporting and a patch. #727 | |
78 | +- Bug: Store loggers in shared pointers to avoid crashes related to connections | |
79 | + trying to write logs entries after their respective endpoint has been | |
80 | + deallocated. Thank you Thalhammer for reporting and Jupp Müller for the | |
81 | + patch. #539 #501 | |
82 | +- Bug: Change default listen backlog from 0 to `socket_base::max_connections`. | |
83 | + #549. Thank you derwassi and zwelab for reporting and na1pir for providing | |
84 | + access to hardware to debug the issue. | |
85 | +- Bug: Fix a crash in the accept loop when `get_connection` fails. #551 Thank you | |
86 | + Walter Gray for a patch. | |
87 | +- Bug/Documentation: Fix incorrect example code that used | |
88 | + `websocketpp::lib::error_code` instead of `websocketpp::exception`. Thank you | |
89 | + heretic13 for reporting | |
90 | +- Bug: Fix uninitialized shared pointer in Asio transport test suite. #647 | |
91 | + Thank you Alex Korotkin for reporting and a patch. | |
92 | +- Bug: Fix a thread safety issue in the permessage-deflate extension that | |
93 | + caused message corruption when sending compressed messages from a different | |
94 | + thread than the main I/O thread. #615 Thank you KyleNyenhuis and Pieter De | |
95 | + Gendt for reporting and a patch. | |
96 | +- Bug: Fix an undefined behavior issue performing a 64 bit wide shift on a 64 | |
97 | + bit value. #636 Thank you Gregor Jasny for reporting and a patch | |
98 | +- Bug: Fix some compile issues with ASIO_STANDALONE. #662 #665 Thank you | |
99 | + chronoxor and Guillaume Egles for reporting and patches. | |
100 | + | |
101 | +0.7.0 - 2016-02-22 | |
102 | +- MINOR BREAKING SOCKET POLICY CHANGE: Asio transport socket policy method | |
103 | + `cancel_socket` will now return `lib::asio::error_code` instead of `void`. | |
104 | + Custom Asio transport socket policies will need to be updated accordingly. | |
105 | + This does not affect anyone using the bundled socket policies. | |
106 | +- Feature: Basic support for the permessage-deflate extension. #344 | |
107 | +- Feature: Allow accessing the local endpoint when using the Asio transport. | |
108 | + This allows inspection of the address and port in cases where they are chosen | |
109 | + by the operating system rather than the user. Thank you Andreas Weis and | |
110 | + Muzahid Hussain for reporting and related code. #458 | |
111 | +- Feature: Add support for subprotocols in Hybi00. Thank you Lukas Obermann | |
112 | + for reporting and a patch. #518 | |
113 | +- Feature: Adds `tcp_pre_bind handler` to Asio transport. This allows setting | |
114 | + arbitrary socket options after the listen acceptor has been created but before | |
115 | + the socket bind has been performed. #634 #439 Thank you Gregor Jasny for | |
116 | + the patch. | |
117 | +- Improvement: Better automatic std::chrono feature detection for Visual Studio | |
118 | +- Improvement: Major refactoring to bundled CMake build system. CMake can now be | |
119 | + used to build all of the examples and the test suite. Thank you Thijs Wenker | |
120 | + for a significant portion of this code. #378, #435, #449 | |
121 | +- Improvement: In build environments where `lib::error_code` and | |
122 | + `lib::asio::error_code` match (such as using `boost::asio` with | |
123 | + `boost::system_error` or standalone asio with `std::system_error`, transport | |
124 | + errors are passed through natively rather than being reported as a translated | |
125 | + `pass_through` error type. | |
126 | +- Improvement: Add a `get_transport_error` method to Asio transport connections | |
127 | + to allow retrieving a machine readable native transport error. | |
128 | +- Improvement: Add `connection::get_response`, `connection::get_response_code`, | |
129 | + and `connection::get_response_msg` methods to allow accessing additional | |
130 | + information about the HTTP responses that WebSocket++ sends. #465 Thank you | |
131 | + Flow86 for reporting. | |
132 | +- Improvement: Removes use of empty strings ("") in favor of `string::clear()` | |
133 | + and `string::empty()`. This avoids generating unnecessary temporary objects. | |
134 | + #468 Thank you Vladislav Yaroslavlev for reporting and a patch. | |
135 | +- Documentation: Adds an example demonstrating the use of external `io_service` | |
136 | +- Documentation: Adds a simple `echo_client` example. | |
137 | +- Documentation: Begins migration of the web based user manual into Doxygen. | |
138 | +- Bug: Fix memory leak when `init_asio` produces an error. #454 Thank you Mark | |
139 | + Grimes for reporting and fixing. | |
140 | +- Bug: Fix crash when processing a specially crafted HTTP header. Thank you Eli | |
141 | + Fidler for reporting, test cases, and a patch. #456 | |
142 | +- Bug: Fix an issue where standalone Asio builds that use TLS would not compile | |
143 | + due to lingering boost code. #448 Thank you mjsp for reporting | |
144 | +- Bug: Fix an issue where canceling a socket could throw an exception on some | |
145 | + older Windows XP platforms. It now prints an appropriate set of log messages | |
146 | + instead. Thank you Thijs Wenker for reporting and researching solutions. #460 | |
147 | +- Bug: Fix an issue where deferred HTTP connections that start sending a very | |
148 | + long response before their HTTP handler ends would result in a second set of | |
149 | + HTTP headers being injected into the output. Thank you Kevin Smith for | |
150 | + reporting and providing test case details. #443 | |
151 | +- Bug: Fix an issue where the wrong type of strand was being created. Thank you | |
152 | + Bastien Brunnenstein for reporting and a patch. #462 | |
153 | +- Bug: Fix an issue where TLS includes were broken for Asio Standalone builds. | |
154 | + Thank you giachi and Bastien Brunnenstein for reporting. #491 | |
155 | +- Bug: Remove the use of cached read and write handlers in the Asio transport. | |
156 | + This feature caused memory leaks when the `io_service` the connection was | |
157 | + running on was abruptly stopped. There isn't a clean and safe way of using | |
158 | + this optimization without global state and the associated locks. The locks | |
159 | + perform worse. Thank you Xavier Gibert for reporting, test cases, and code. | |
160 | + Fixes #490. | |
161 | +- Bug: Fix a heap buffer overflow when checking very short URIs. Thank you | |
162 | + Xavier Gibert for reporting and a patch #524 | |
163 | +- Compatibility: Fixes a number of build & config issues on Visual Studio 2015 | |
164 | +- Compatibility: Removes non-standards compliant masking behavior. #395, #469 | |
165 | +- Compatibility: Replace deprecated use of `auto_ptr` on systems where | |
166 | + `unique_ptr` is available. | |
167 | + | |
168 | +0.6.0 - 2015-06-02 | |
169 | +- MINOR BREAKING TRANSPORT POLICY CHANGE: Custom transport policies will now be | |
170 | + required to include a new method `void set_uri(uri_ptr u)`. An implementation | |
171 | + is not required. The stub transport policy includes an example stub method | |
172 | + that can be added to any existing custom transport policy to fulfill this | |
173 | + requirement. This does not affect anyone using the bundled transports or | |
174 | + configs. | |
175 | +- MINOR BREAKING SOCKET POLICY CHANGE: Custom asio transport socket policies | |
176 | + will now be required to include a new method `void set_uri(uri_ptr u)`. Like | |
177 | + with the transport layer, an implementation is not required. This does not | |
178 | + affect anyone using the bundled socket policies. | |
179 | +- MINOR BREAKING DEPENDENCY CHANGE: When using Boost versions greater than or | |
180 | + equal to 1.49 in C++03 mode, `libboost-chrono` is needed now instead of | |
181 | + `libboost-date_time`. Users with C++11 compilers or using Boost versions 1.48 | |
182 | + and earlier are not affected. Note: This change affects the bundled unit test | |
183 | + suite. | |
184 | +- Feature: WebSocket++ Asio transport policy can now be used with the standalone | |
185 | + version of Asio (1.8.0+) when a C++11 compiler and standard library are | |
186 | + present. This means that it is possible now to use WebSocket++'s Asio | |
187 | + transport entirely without Boost. Thank you Robert Seiler for proof of concept | |
188 | + code that was used as a guide for this implementation. Fixes #324 | |
189 | +- Feature: Adds a vectored/scatter-gather write handler to the iostream | |
190 | + transport. | |
191 | +- Feature: Adds the ability to defer sending an HTTP response until sometime | |
192 | + after the `http_handler` is run. This allows processing of long running http | |
193 | + handlers to defer their response until it is ready without blocking the | |
194 | + network thread. references #425 | |
195 | +- Improvement: `echo_server_tls` has been update to demonstrate how to configure | |
196 | + it for Mozilla's recommended intermediate and modern TLS security profiles. | |
197 | +- Improvement: `endpoint::set_timer` now uses a steady clock provided by | |
198 | + `boost::chrono` or `std::chrono` where available instead of the non-monotonic | |
199 | + system clock. Thank you breyed for reporting. fixes #241 | |
200 | +- Improvement: Outgoing TLS connections to servers using the SNI extension to | |
201 | + choose a certificate will now work. Thank you moozzyk for reporting. | |
202 | + Fixes #400 | |
203 | +- Improvement: Removes an unnecessary mutex lock in `get_con_from_hdl`. | |
204 | +- Cleanup: Asio transport policy has been refactored to remove many Boost | |
205 | + dependencies. On C++03 compilers the `boost::noncopyable` dependency has been | |
206 | + removed and the `boost::date_time` dependency has been replaced with the newer | |
207 | + `boost::chrono` when possible. On C++11 compilers the `boost::aligned_storage` | |
208 | + and `boost::date_time` dependencies are gone, replaced with equivalent C++11 | |
209 | + standard library features. | |
210 | +- Bug: Fixes a potential dangling pointer and inconsistent error message | |
211 | + handling in `websocketpp::exception`. #432 Thank you Tom Swirly for the fix. | |
212 | + | |
213 | +0.5.1 - 2015-02-27 | |
214 | +- Bug: Fixes an issue where some frame data was counted against the max header | |
215 | + size limit, resulting in connections that included a lot of frame data | |
216 | + immediately after the opening handshake to fail. | |
217 | +- Bug: Fix a typo in the name of the set method for `max_http_body_size`. #406 | |
218 | + Thank you jplatte for reporting. | |
219 | + | |
220 | +0.5.0 - 2015-01-22 | |
221 | +- BREAKING UTILITY CHANGE: Deprecated methods `http::parser::parse_headers`, | |
222 | + `http::response::parse_complete`, and `http::request::parse_complete` have | |
223 | + been removed. | |
224 | +- Security: Disabled SSLv3 in example servers. | |
225 | +- Feature: Adds basic support for accessing HTTP request bodies in the http | |
226 | + handler. #181 | |
227 | +- Feature: Adds the ability to register a shutdown handler when using the | |
228 | + iostream transport. This provides a clean interface for triggering the shut | |
229 | + down of external sockets and other cleanup without hooking in to higher level | |
230 | + WebSocket handlers. | |
231 | +- Feature: Adds the ability to register a write handler when using the iostream | |
232 | + transport. This handler can be used to handle transport output in place of | |
233 | + registering an ostream to write to. | |
234 | +- Feature: Adds a new logging policy that outputs to syslog. #386 Thank you Tom | |
235 | + Hughes for submitting the initial version of this policy. | |
236 | +- Improvement: Message payload logging now prints text for text messages rather | |
237 | + than binary. | |
238 | +- Improvement: Overhaul of handshake state machine. Should make it impossible | |
239 | + for exceptions to bubble out of transport methods like `io_service::run`. | |
240 | +- Improvement: Overhaul of handshake error reporting. Fail handler error codes | |
241 | + will be more detailed and precise. Adds new [fail] and [http] logging channels | |
242 | + that log failed websocket connections and successful HTTP connections | |
243 | + respectively. A new aggregate channel package, `alevel::access_core`, allows | |
244 | + enabling connect, disconnect, fail, and http together. Successful HTTP | |
245 | + connections will no longer trigger a fail handler. | |
246 | +- Improvement: Ability to terminate connection during an http handler to cleanly | |
247 | + suppress the default outgoing HTTP response. | |
248 | +- Documentation: Add Sending & Receiving Messages step to chapter one of the | |
249 | + `utility_client` tutorial. Update `utility_client` example to match. | |
250 | +- Cleanup: Removes unused files & STL includes. Adds required STL includes. | |
251 | + Normalizes include order. | |
252 | +- Bug: Fixes a fatal state error when a handshake response is completed | |
253 | + immediately after that handshake times out. #389 | |
254 | +- Bug: MinGW fixes; C++11 feature detection, localtime use. #393 Thank you | |
255 | + Schebb for reporting, code, and testing. | |
256 | +- Bug: Fixes an issue where `websocketpp::exception::what()` could return an out | |
257 | + of scope pointer. #397 Thank you fabioang for reporting. | |
258 | +- Bug: Fixes an issue where endpoints were not reset properly after a call to | |
259 | + `endpoint::listen` failed. #390 Thank you wyyqyl for reporting. | |
260 | + | |
261 | +0.4.0 - 2014-11-04 | |
262 | +- BREAKING API CHANGE: All WebSocket++ methods now throw an exception of type | |
263 | + `websocketpp::exception` which derives from `std::exception`. This normalizes | |
264 | + all exception types under the standard exception hierarchy and allows | |
265 | + WebSocket++ exceptions to be caught in the same statement as others. The error | |
266 | + code that was previously thrown is wrapped in the exception object and can be | |
267 | + accessed via the `websocketpp::exception::code()` method. | |
268 | +- BREAKING API CHANGE: Custom logging policies have some new required | |
269 | + constructors that take generic config settings rather than pointers to | |
270 | + std::ostreams. This allows writing logging policies that do not involve the | |
271 | + use of std::ostream. This does not affect anyone using the built in logging | |
272 | + policies. | |
273 | +- BREAKING UTILITY CHANGE: `websocketpp::lib::net::htonll` and | |
274 | + `websocketpp::lib::net::ntohll` have been prefixed with an underscore to avoid | |
275 | + conflicts with similarly named macros in some operating systems. If you are | |
276 | + using the WebSocket++ provided 64 bit host/network byte order functions you | |
277 | + will need to switch to the prefixed versions. | |
278 | +- BREAKING UTILITY CHANGE: The signature of `base64_encode` has changed from | |
279 | + `websocketpp::base64_encode(unsigned char const *, unsigned int)` to | |
280 | + `websocketpp::base64_encode(unsigned char const *, size_t)`. | |
281 | +- BREAKING UTILITY CHANGE: The signature of `sha1::calc` has changed from | |
282 | + `websocketpp::sha1::calc(void const *, int, unsigned char *)` to | |
283 | + `websocketpp::sha1::calc(void const *, size_t, unsigned char *)` | |
284 | +- Feature: Adds incomplete `minimal_server` and `minimal_client` configs that | |
285 | + can be used to build custom configs without pulling in the dependencies of | |
286 | + `core` or `core_client`. These configs will offer a stable base config to | |
287 | + future-proof custom configs. | |
288 | +- Improvement: Core library no longer has std::iostream as a dependency. | |
289 | + std::iostream is still required for the optional iostream logging policy and | |
290 | + iostream transport. | |
291 | +- Bug: C++11 Chrono support was being incorrectly detected by the `boost_config` | |
292 | + header. Thank you Max Dmitrichenko for reporting and a patch. | |
293 | +- Bug: use of `std::put_time` is now guarded by a unique flag rather than a | |
294 | + chrono library flag. Thank you Max Dmitrichenko for reporting. | |
295 | +- Bug: Fixes non-thread safe use of std::localtime. #347 #383 | |
296 | +- Compatibility: Adjust usage of std::min to be more compatible with systems | |
297 | + that define a min(...) macro. | |
298 | +- Compatibility: Removes unused parameters from all library, test, and example | |
299 | + code. This assists with those developing with -Werror and -Wunused-parameter | |
300 | + #376 | |
301 | +- Compatibility: Renames ntohll and htonll methods to avoid conflicts with | |
302 | + platform specific macros. #358 #381, #382 Thank you logotype, unphased, | |
303 | + svendjo | |
304 | +- Cleanup: Removes unused functions, fixes variable shadow warnings, normalizes | |
305 | + all whitespace in library, examples, and tests to 4 spaces. #376 | |
306 | + | |
307 | +0.3.0 - 2014-08-10 | |
308 | +- Feature: Adds `start_perpetual` and `stop_perpetual` methods to asio transport | |
309 | + These may be used to replace manually managed `asio::io_service::work` objects | |
310 | +- Feature: Allow setting pong and handshake timeouts at runtime. | |
311 | +- Feature: Allows changing the listen backlog queue length. | |
312 | +- Feature: Split tcp init into pre and post init. | |
313 | +- Feature: Adds URI method to extract query string from URI. Thank you Banaan | |
314 | + for code. #298 | |
315 | +- Feature: Adds a compile time switch to asio transport config to disable | |
316 | + certain multithreading features (some locks, asio strands) | |
317 | +- Feature: Adds the ability to pause reading on a connection. Paused connections | |
318 | + will not read more data from their socket, allowing TCP flow control to work | |
319 | + without blocking the main thread. | |
320 | +- Feature: Adds the ability to specify whether or not to use the `SO_REUSEADDR` | |
321 | + TCP socket option. The default for this value has been changed from `true` to | |
322 | + `false`. | |
323 | +- Feature: Adds the ability to specify a maximum message size. | |
324 | +- Feature: Adds `close::status::get_string(...)` method to look up a human | |
325 | + readable string given a close code value. | |
326 | +- Feature: Adds `connection::read_all(...)` method to iostream transport as a | |
327 | + convenience method for reading all data into the connection buffer without the | |
328 | + end user needing to manually loop on `read_some`. | |
329 | +- Improvement: Open, close, and pong timeouts can be disabled entirely by | |
330 | + setting their duration to 0. | |
331 | +- Improvement: Numerous performance improvements. Including: tuned default | |
332 | + buffer sizes based on profiling, caching of handler binding for async | |
333 | + reads/writes, non-malloc allocators for read/write handlers, disabling of a | |
334 | + number of questionably useful range sanity checks in tight inner loops. | |
335 | +- Improvement: Cleaned up the handling of TLS related errors. TLS errors will | |
336 | + now be reported with more detail on the info channel rather than all being | |
337 | + `tls_short_read` or `pass_through`. In addition, many cases where a TLS short | |
338 | + read was in fact expected are no longer classified as errors. Expected TLS | |
339 | + short reads and quasi-expected socket shutdown related errors will no longer | |
340 | + be reported as unclean WebSocket shutdowns to the application. Information | |
341 | + about them will remain in the info error channel for debugging purposes. | |
342 | +- Improvement: `start_accept` and `listen` errors are now reported to the caller | |
343 | + either via an exception or an ec parameter. | |
344 | +- Improvement: Outgoing writes are now batched for improved message throughput | |
345 | + and reduced system call and TCP frame overhead. | |
346 | +- Bug: Fix some cases of calls to empty lib::function objects. | |
347 | +- Bug: Fix memory leak of connection objects due to cached handlers holding on to | |
348 | + reference counted pointers. #310 Thank you otaras for reporting. | |
349 | +- Bug: Fix issue with const endpoint accessors (such as `get_user_agent`) not | |
350 | + compiling due to non-const mutex use. #292 Thank you logofive for reporting. | |
351 | +- Bug: Fix handler allocation crash with multithreaded `io_service`. | |
352 | +- Bug: Fixes incorrect whitespace handling in header parsing. #301 Thank you | |
353 | + Wolfram Schroers for reporting | |
354 | +- Bug: Fix a crash when parsing empty HTTP headers. Thank you Thingol for | |
355 | + reporting. | |
356 | +- Bug: Fix a crash following use of the `stop_listening` function. Thank you | |
357 | + Thingol for reporting. | |
358 | +- Bug: Fix use of variable names that shadow function parameters. The library | |
359 | + should compile cleanly with -Wshadow now. Thank you giszo for reporting. #318 | |
360 | +- Bug: Fix an issue where `set_open_handshake_timeout` was ignored by server | |
361 | + code. Thank you Robin Rowe for reporting. | |
362 | +- Bug: Fix an issue where custom timeout values weren't being propagated from | |
363 | + endpoints to new connections. | |
364 | +- Bug: Fix a number of memory leaks related to server connection failures. #323 | |
365 | + #333 #334 #335 Thank you droppy and aydany for reporting and patches. | |
366 | + reporting. | |
367 | +- Compatibility: Fix compile time conflict with Visual Studio's MIN/MAX macros. | |
368 | + Thank you Robin Rowe for reporting. | |
369 | +- Documentation: Examples and test suite build system now defaults to clang on | |
370 | + OS X | |
371 | + | |
372 | +0.3.0-alpha4 - 2013-10-11 | |
373 | +- HTTP requests ending normally are no longer logged as errors. Thank you Banaan | |
374 | + for reporting. #294 | |
375 | +- Eliminates spurious expired timers in certain error conditions. Thank you | |
376 | + Banaan for reporting. #295 | |
377 | +- Consolidates all bundled library licenses into the COPYING file. #294 | |
378 | +- Updates bundled sha1 library to one with a cleaner interface and more | |
379 | + straight-forward license. Thank you lotodore for reporting and Evgeni Golov | |
380 | + for reviewing. #294 | |
381 | +- Re-introduces strands to asio transport, allowing `io_service` thread pools to | |
382 | + be used (with some limitations). | |
383 | +- Removes endpoint code that kept track of a connection list that was never used | |
384 | + anywhere. Removes a lock and reduces connection creation/deletion complexity | |
385 | + from O(log n) to O(1) in the number of connections. | |
386 | +- A number of internal changes to transport APIs | |
387 | +- Deprecates iostream transport `readsome` in favor of `read_some` which is more | |
388 | + consistent with the naming of the rest of the library. | |
389 | +- Adds preliminary signaling to iostream transport of eof and fatal transport | |
390 | + errors | |
391 | +- Updates transport code to use shared pointers rather than raw pointers to | |
392 | + prevent asio from retaining pointers to connection methods after the | |
393 | + connection goes out of scope. #293 Thank you otaras for reporting. | |
394 | +- Fixes an issue where custom headers couldn't be set for client connections | |
395 | + Thank you Jerry Win and Wolfram Schroers for reporting. | |
396 | +- Fixes a compile error on visual studio when using interrupts. Thank you Javier | |
397 | + Rey Neira for reporting this. | |
398 | +- Adds new 1012 and 1013 close codes per IANA registry | |
399 | +- Add `set_remote_endpoint` method to iostream transport. | |
400 | +- Add `set_secure` method to iostream transport. | |
401 | +- Fix typo in .gitattributes file. Thank you jstarasov for reporting this. #280 | |
402 | +- Add missing locale include. Thank you Toninoso for reporting this. #281 | |
403 | +- Refactors `asio_transport` endpoint and adds full documentation and exception | |
404 | + free varients of all methods. | |
405 | +- Removes `asio_transport` endpoint method cancel(). Use `stop_listen()` instead | |
406 | +- Wrap internal `io_service` `run_one()` method | |
407 | +- Suppress error when trying to shut down a connection that was already closed | |
408 | + | |
409 | +0.3.0-alpha3 - 2013-07-16 | |
410 | +- Minor refactor to bundled sha1 library | |
411 | +- HTTP header comparisons are now case insensitive. #220, #275 | |
412 | +- Refactors URI to be exception free and not use regular expressions. This | |
413 | + eliminates the dependency on boost or C++11 regex libraries allowing native | |
414 | + C++11 usage on GCC 4.4 and higher and significantly reduces staticly built | |
415 | + binary sizes. | |
416 | +- Updates handling of Server and User-Agent headers to better handle custom | |
417 | + settings and allow suppression of these headers for security purposes. | |
418 | +- Fix issue where pong timeout handler always fired. Thank you Steven Klassen | |
419 | + for reporting this bug. | |
420 | +- Add ping and pong endpoint wrapper methods | |
421 | +- Add `get_request()` pass through method to connection to allow calling methods | |
422 | + specific to the HTTP policy in use. | |
423 | +- Fix issue compile error with `WEBSOCKETPP_STRICT_MASKING` enabled and another | |
424 | + issue where `WEBSOCKETPP_STRICT_MASKING` was not applied to incoming messages. | |
425 | + Thank you Petter Norby for reporting and testing these bugs. #264 | |
426 | +- Add additional macro guards for use with boost_config. Thank you breyed | |
427 | + for testing and code. #261 | |
428 | + | |
429 | +0.3.0-alpha2 - 2013-06-09 | |
430 | +- Fix a regression that caused servers being sent two close frames in a row | |
431 | + to end a connection uncleanly. #259 | |
432 | +- Fix a regression that caused spurious frames following a legitimate close | |
433 | + frames to erroneously trigger handlers. #258 | |
434 | +- Change default HTTP response error code when no http_handler is defined from | |
435 | + 500/Internal Server Error to 426/Upgrade Required | |
436 | +- Remove timezone from logger timestamp to work around issues with the Windows | |
437 | + implementation of strftime. Thank you breyed for testing and code. #257 | |
438 | +- Switch integer literals to char literals to improve VCPP compatibility. | |
439 | + Thank you breyed for testing and code. #257 | |
440 | +- Add MSVCPP warning suppression for the bundled SHA1 library. Thank you breyed | |
441 | + for testing and code. #257 | |
442 | + | |
443 | +0.3.0-alpha1 - 2013-06-09 | |
444 | +- Initial Release | ... | ... |
3rdparty/websocketpp-0.8.2/docs/config.dox
0 → 100644
1 | +/** \page reference.config Config Reference | |
2 | + | |
3 | +WebSocket++ uses a config template parameter to supply a number of compile type policy types and default numerical values for buffer sizes, timeouts, security behavior, etc. Swapping policies allows changing certain core library behavior designed to be pluggable. | |
4 | + | |
5 | +A custom config can be made standalone or can subclass one of the bundled configs and just override a few things. | |
6 | + | |
7 | +__Example__ | |
8 | +``` | |
9 | +// some config options may require additional includes or dependencies. | |
10 | +// syslog logging policy, for example, requires <syslog.h>, | |
11 | +// the permessage deflate settings require zlib. | |
12 | +#include <websocketpp/logger/syslog.hpp> | |
13 | +#include <websocketpp/extensions/permessage_deflate/enabled.hpp> | |
14 | + | |
15 | +// Custom server config based on bundled asio config | |
16 | +struct custom_server_config : public websocketpp::config::asio { | |
17 | + // Replace default stream logger with a syslog logger | |
18 | + typedef websocketpp::log::syslog<concurrency_type, websocketpp::log::elevel> elog_type; | |
19 | + typedef websocketpp::log::syslog<concurrency_type, websocketpp::log::alevel> alog_type; | |
20 | + | |
21 | + // Reduce read buffer size to optimize for small messages | |
22 | + static const size_t connection_read_buffer_size = 1024; | |
23 | + | |
24 | + // enable permessage_compress extension | |
25 | + struct permessage_deflate_config {}; | |
26 | + | |
27 | + typedef websocketpp::extensions::permessage_deflate::enabled | |
28 | + <permessage_deflate_config> permessage_deflate_type; | |
29 | +}; | |
30 | + | |
31 | +typedef websocketpp::server<custom_server_config> server_endpoint_type; | |
32 | +``` | |
33 | + | |
34 | +Core Config Options | |
35 | +------------------- | |
36 | + | |
37 | +### Policies | |
38 | + | |
39 | +Policies are classes used to allow clean swapping of behavior without changing the core library | |
40 | + | |
41 | +| Typedef Name | Effect | | |
42 | +| ------------------------- | -------------------------------------- | | |
43 | +| concurrency_type | Concurrency policy | | |
44 | +| elog_type | Error logger type | | |
45 | +| alog_type | Access logger type | | |
46 | +| request_type | HTTP request type | | |
47 | +| response_type | HTTP response type | | |
48 | +| message_type | Type to deliver recieved messages | | |
49 | +| con_msg_manager_type | Connection level message manager | | |
50 | +| endpoint_msg_manager_type | Endpoint level message manager | | |
51 | +| rng_type | Random Number Generation policy | | |
52 | +| transport_type | Transport policy to use | | |
53 | +| endpoint_base | User overridable Endpoint base class | | |
54 | +| connection_base | User overridable Connection base class | | |
55 | + | |
56 | +### Timeouts Values | |
57 | + | |
58 | +These represent the length of time (in ms) before the given operation is aborted | |
59 | + | |
60 | +| Field | Type | Default | Operation | | |
61 | +| ----------------------- | ---- | ------- | --------------------------- | | |
62 | +| timeout_open_handshake | long | 5000 | Opening handshake | | |
63 | +| timeout_close_handshake | long | 5000 | Closing handshake | | |
64 | +| timeout_pong | long | 5000 | No pong recieved after ping | | |
65 | + | |
66 | +### Performance tuning | |
67 | + | |
68 | +| Field | Type | Default | Meaning | | |
69 | +| --------------------------- | ------ | -------- | ------------------------------------------------------------------ | | |
70 | +| connection_read_buffer_size | size_t | 16384 | Size of the per-connection read buffer | | |
71 | +| enable_multithreading | bool | true | Disabling may reduce locking overhead for single threaded programs | | |
72 | + | |
73 | +#### Connection Read Buffer | |
74 | + | |
75 | +Each connection has an internal buffer of this size. A larger value will result in fewer trips through the library and less CPU overhead at the expense of increased memory usage per connection. | |
76 | + | |
77 | +If your application primarily deals in very large messages you may want to try setting this value higher. | |
78 | + | |
79 | +If your application has a lot of connections or primarily deals in small messages you may want to try setting this smaller. | |
80 | + | |
81 | +### Security settings | |
82 | + | |
83 | +| Field | Type | Default | Effect | | |
84 | +| ---------------------- | ------ | ------- | -------------------------------------- | | |
85 | +| drop_on_protocol_error | bool | false | Omit close handshake on protocol error | | |
86 | +| silent_close | bool | false | Don't return close codes or reasons | | |
87 | +| max_message_size | size_t | 32MB | WebSocket max message size limit | | |
88 | +| max_http_body_size | size_t | 32MB | HTTP Parser's max body size limit | | |
89 | + | |
90 | +#### Drop on protocol error | |
91 | +Drop connections on protocol error rather than sending a close frame. Off by default. This may result in legitimate messages near the error being dropped as well. It may free up resources otherwise spent dealing with misbehaving clients. | |
92 | + | |
93 | +#### Silent Close | |
94 | +Silence close suppresses the return of detailed connection close information during the closing handshake. This information is useful for debugging and presenting useful errors to end users but may be undesirable for security reasons in some production environments. Close reasons could be used by an attacker to confirm that the endpoint is out of resources or be used to identify the WebSocket implementation in use. | |
95 | + | |
96 | +Note: this will suppress *all* close codes, including those explicitly sent by local applications. | |
97 | + | |
98 | +#### Max message size | |
99 | +Default value for the processor's maximum message size. Maximum message size determines the point at which the library will drop a connection with the message_too_big protocol error. | |
100 | + | |
101 | +#### Max HTTP header size | |
102 | +Maximum body size determines the point at which the library will abort reading an HTTP message body and return the 413/request entity too large error. | |
103 | + | |
104 | +Transport Config Options | |
105 | +------------------------ | |
106 | + | |
107 | +### Policies | |
108 | + | |
109 | +Policies are classes used to allow clean swapping of behavior without changing the core library | |
110 | + | |
111 | +| Typedef Name | Effect | | |
112 | +| ---------------- | ------------------ | | |
113 | +| concurrency_type | Concurrency Policy | | |
114 | +| elog_type | Error logger type | | |
115 | +| alog_type | Access logger type | | |
116 | +| request_type | HTTP request type | | |
117 | +| response_type | HTTP response type | | |
118 | + | |
119 | +### Timeouts Values | |
120 | + | |
121 | +These represent the length of time (in ms) before the given operation is aborted | |
122 | + | |
123 | +| Field | Type | Default | Operation | | |
124 | +| ------------------------ | ---- | ------- | --------------------------------------------- | | |
125 | +| timeout_socket_pre_init | long | 5000 | Transport dependent | | |
126 | +| timeout_proxy | long | 5000 | Proxy handshake | | |
127 | +| timeout_socket_post_init | long | 5000 | Transport dependent (commonly: TLS handshake) | | |
128 | +| timeout_dns_resolve | long | 5000 | DNS resolution | | |
129 | +| timeout_connect | long | 5000 | TCP Connect | | |
130 | +| timeout_socket_shutdown | long | 5000 | Socket shutdown | | |
131 | + | |
132 | +### Performance tuning | |
133 | + | |
134 | +| Field | Type | Default | Meaning | | |
135 | +| --------------------------- | ------ | -------- | ------------------------------------------------------------------ | | |
136 | +| enable_multithreading | bool | true | Disabling may reduce locking overhead for single threaded programs | | |
137 | + | |
138 | +*/ | ... | ... |
3rdparty/websocketpp-0.8.2/docs/faq.dox
0 → 100644
1 | +/** \page faq FAQ | |
2 | + | |
3 | +## General Library Usage | |
4 | + | |
5 | +### Can a handler be changed after a connection is established? Can one be removed? | |
6 | +Yes, but not globally. | |
7 | + | |
8 | +Handlers assigned to endpoints will be automatically copied to the connections created by that endpoint. Changing a handler on an endpoint will only affect future connections. | |
9 | + | |
10 | +Once a particular connection is created, it's handlers can be changed individually by calling the `set_*_handler` methods. Once changed, all future events of that type for that connection will use the new handler. | |
11 | + | |
12 | +To remove a handler that was previously set, call the set method with `nullptr` or `NULL`. | |
13 | + | |
14 | +### Can I reject or conditionally accept a connection | |
15 | +Yes. The `validate` handler is called after the initial handshake has been recieved but before WebSocket++ has responded. This gives you the opportunity to inspect the incoming connection request, its headers, origin, subprotocols, and the remote endpoint IP. Return `true` from the validate handler to accept the connection and `false` to reject it. | |
16 | + | |
17 | +To set a custom HTTP error message for your rejection, use `websocketpp::connection::set_status` and (optionally) `websocketpp::connection::set_body()` to set the HTTP status code and error message body text. If you do not set body text a message will be generated automatically based on the status code. | |
18 | + | |
19 | +### How do I negotiate subprotocols? | |
20 | +WebSocket connections may offer a particular subprotocol they want to use. The WebSocket protocol does not define the meaning or interpretation of the subprotocol. This interpretation is left up to the individual application endpoints. | |
21 | + | |
22 | +WebSocket++ servers can read the requested subprotocols during the `validate` handler by calling `websocketpp::connection::get_requested_subprotocols`. The list is ordered by client priority. You may optionally choose one of these subprotocols with `websocketpp::connection::select_subprotocol`. The handshake will then complete and let the client know which one was chosen. If you do not choose any, the "blank"/empty/none subprotocol will be used. | |
23 | + | |
24 | +WebSocket++ clients can add a subprotocol to an outgoing connection by calling `websocketpp::connection::add_subprotocol` before calling `websocketpp::client::connect`. The order of adding will be interpreted as the order of preference. | |
25 | + | |
26 | +In both caases, after the connection has been established, the selected subprotocol is available via the `websocketpp::connection::get_subprotocol` method. | |
27 | + | |
28 | +Note: some browsers will allow the connection to continue if they requested a subprotocol and your server doesn't select one. Others will reject the connection. | |
29 | + | |
30 | +### How do I cleanly exit an Asio transport based program | |
31 | + | |
32 | +The Asio transport based clients and servers use the Asio library's underlying `io_service` to handle asyncronous networking operations. The standard behavior of the io_service is to run until there are no async operations left and then return. WebSocket++, when using the Asio transport, behaves like a standard Asio application. If you want your WebSocket++/Asio based program to stop network operations and cleanly close all sockets you will want to do the following: | |
33 | + | |
34 | +- For servers, call `websocketpp::transport::asio::endpoint::stop_listening` to initiate the closing of the server listening socket. | |
35 | +- For clients, if you have engaged perpetual mode with `websocketpp::transport::asio::endpoint::start_perpetual`, disable it with `websocketpp::transport::asio::endpoint::stop_perpetual`. | |
36 | +- For both, run `websocketpp::endpoint::close` or `websocketpp::connection::close` on all currently outstanding connections. This will initiate the WebSocket closing handshake for these connections | |
37 | +- Wait. Asio is asyncronous. When the calls to the above methods (stop_listening, close, etc) complete the server *will still be listening*, the connections *will still be active* until the io_service gets around to asyncronously processing the socket and WebSocket protocol closing handshakes. The `io_service::run` method will exit cleanly and automatically when all operations are complete. | |
38 | + | |
39 | +__WARNING__: Asio's `io_service` has a method called `stop`. WebSocket++ wraps this method as `websocketpp::transport::asio::endpoint::stop`. While this operation has a benign sounding name, it is a powerful and destructive operation that should only be used in special cases. If you are using `io_service::stop` or `endpoint::stop` without a very good reason your program is likely broken and may exhibit erratic behavior. Specifically, `io_service::stop` stops the processing of events entirely. This does not give current operations (such as socket closing handshakes) the opportunity to finish. It will leave your sockets in a dangling state that may invoke operating system level timeouts or other errors. | |
40 | + | |
41 | +__Special cases__: | |
42 | +- If your client uses the `start_perpetual` method it will prevent the io_service from exiting even if it has nothing to do. This is useful if you want a client endpoint to idle in the background to allow new connections to be formed on demand rather than generating a new endpoint for each. | |
43 | +- If you are using an external io_service and/or are placing non-WebSocket++ operations on the `io_service` those operations may keep the `io_service` open even after all WebSocket++ operations have completed. | |
44 | +- If you are using `poll`/`poll_one`/`run_one` or otherwise manually driving the `io_service` event loop you may need to adjust usage to make sure you are correctly recognizing the "done with work" and "not done but idling / `io_service::work`" cases. | |
45 | + | |
46 | +### Is there a way to check the validity of a `connection_hdl`? | |
47 | + | |
48 | +Sometimes, not generally though, because there isn’t a way to check if a TCP connection is valid. | |
49 | + | |
50 | +You can try upgrading your hdl to a full connection_ptr using `websocketpp::endpoint::get_con_from_hdl`. If this fails, the hdl is definitely invalid. If it succeeds it may or may not be. The only way to tell definitively is to try and send something (either a message or a ping). | |
51 | + | |
52 | +If you handle errors from methods like send, ping, close, etc correctly then you shouldn’t have to worry about accidentally sending to dead connections. The send/ping/pong/close methods will set or throw a specific error in the case that you tried to send something but the connection was closed/gone/etc. | |
53 | + | |
54 | +### How do I fix the "address is in use" error when trying to restart my server? | |
55 | + | |
56 | +Normally, for security purposes, operating systems prevent programs from listening on sockets created by other programs. When your program crashes and restarts, the new instance is a different program from the perspective of the operating system. As such it can’t listen on the socket address/port that the previous program was using until after a timeout occurs to make sure the old program was done with it. | |
57 | + | |
58 | +The first step for handling this is to make sure that you provide a method (signal handler, admin websocket message, etc) to perform a clean server shutdown. There is a question elsewhere in this FAQ that describes the steps necessary for this. | |
59 | + | |
60 | +The clean close strategy won't help in the case of crashes or other abnormal closures. An option to consider for these cases is the use of the SO_REUSEADDR socket option. This instructs the OS to not request an exclusive lock on the socket. This means that after your program crashes the replacement you start can immediately listen on that address/port combo again. | |
61 | + | |
62 | +__Please note__: how this works exactly depends on your operating system. Additionally, not exclusively locking your listening socket could allow hijacking by other programs if you are running in a shared resource environment. For development this is generally no problem. For a production environment, think carefully about the security model. `websocketpp::transport::asio::endpoint::set_reuse_addr` is the method to do this. You must specify this setting before calling `websocketpp::transport::asio::endpoint::listen`. | |
63 | + | |
64 | +### How do I send and recieve binary messages? | |
65 | + | |
66 | +When supported by the remote endpoint, WebSocket++ allows reading and sending messages in the two formats specified in RFC6455, UTF8 text and binary. WebSocket++ performs UTF8 validation on all outgoing text messages to ensure that they meet the specification. Binary messages do not have any additional processing and their interpretation is left entirely to the library user. | |
67 | + | |
68 | +To determine the type of an incoming message, use `websocketpp::message_buffer::message::get_opcode`. The relevant return values are `websocketpp::frame::opcode::text` and `websocketpp::frame::opcode::binary`. There is no difference in how payloads are retrieved between these modes, only in how WebSocket++ validated the contents and how the library user is to interpret the data. | |
69 | + | |
70 | +To specify the type of an outgoing message, use the frame opcode values listed above as the second op parameter for `websocketpp::connection::send`. There are two relevant overloads of send. One that takes a `std::string` and defaults to op=text. The other that takes a `void const *` and a `size_t` length and defaults to op=binary. Note: You can send binary messages via the string overload and text messages via the void * overload. In the case that you are manually building a message buffer rather than using the automatic send member functions, you can pass the opcode in as a parameter to the message buffer constructor or user the `websocketpp::message_buffer::message::set_opcode` member function to set or re-set it later. | |
71 | + | |
72 | +## Dependency Management | |
73 | + | |
74 | +### Can WebSocket++ be used without Boost? | |
75 | +Yes. WebSocket++ only uses Boost features as polyfills for C++11 language features and libraries. If you have a C++11 compiler and standard library you can use WebSocket++ without Boost. In most cases setting your build environment to use the C++11 (or later) language dialect is sufficient to enable this mode of use. | |
76 | + | |
77 | +With less common compilers (and sometimes very recently release compilers) there may be specific issues with certain libraries that aren't automatically detected by the library. For these situations there are additional defines available to fine tune which C++11 libraries and features are used. TODO: more details about them. | |
78 | + | |
79 | +For the iostream/raw transport the C++11 standard library is sufficient. For the Asio based transports, there is no C++11 library that provides the networking capabilaties that Asio does. As such even with a C++11 build system, you will need a standalone copy of Asio to use if Boost Asio is not available. | |
80 | + | |
81 | +MinGW users who want to avoid Boost should also consult the nearby question about MinGW compatibility. | |
82 | + | |
83 | +### Can WebSocket++ be used with standalone Asio | |
84 | +Yes. The process is the same as used with standalone Asio itself. Define `ASIO_STANDALONE` before including Asio or WebSocket++ headers. You will need to download a copy of the Asio headers separately (http://www.think-async.com) and make sure they are in your build system's include path. | |
85 | + | |
86 | +### Can WebSocket++ be used without TLS or OpenSSL? | |
87 | +Yes. When using the iostream/raw transport, there are no TLS features and OpenSSL is not required. When using the Asio transport TLS features are optional. You only need OpenSSL if you want to use TLS. You can only make or recieve encrypted connections (https/wss) if you have enabled TLS features. | |
88 | + | |
89 | +Whether an Asio endpoint uses TLS or not is determined by its config template parameter. The default bundled `websocketpp::config::asio` and `websocketpp::config::asio_client` configs do not support TLS, the `websocketpp::config::asio_tls` and `websocketpp::config::asio_tls_client` do. | |
90 | + | |
91 | +The `<websocketpp/config/asio.hpp>` and `<websocketpp/config/asio_client.hpp>` headers will include both the TLS and non-TLS varients of their respective configs and require the presence of OpenSSL. The `<websocketpp/config/asio_no_tls.hpp>` and `<websocketpp/config/asio_no_tls_client.hpp>` headers will include only the non-TLS configs and do not require OpenSSL. | |
92 | + | |
93 | +### Build issues with TLS on recent versions of OS X | |
94 | +Mac OS X ships a severely outdated version of the OpenSSL library. To securely use TLS with WebSocket++ on OS X you will need to install a modern version of OpenSSL via homebrew or compiling from source. | |
95 | + | |
96 | +### Can WebSocket++ be used with MinGW | |
97 | +Generally, yes. Note that in C++11 mode MinGW does not currently support the C++11 STL `<thread>` library. WebSocket++ requires a thread/mutex library. Options include Boost thread (the default when a compatible C++11 `<thread>` can't be found) or `mingw-std-threads` (https://github.com/meganz/mingw-std-threads) by including those headers and defining `_WEBSOCKETPP_MINGW_THREAD_`. | |
98 | + | |
99 | +## Compression | |
100 | + | |
101 | +### How do I use permessage-deflate in version 0.6.0-permessagedeflate and 0.7.0? | |
102 | + | |
103 | +These versions of the library require a custom config to use the permessage-deflate extension. Here is a minimal example of such a custom config. You can also integrate these lines into an existing custom config. | |
104 | + | |
105 | +Note that in these versions there is no fine grained control over which connections are compressed or not. Clients will request compression with the default settings and use it if the server supports it. Servers will accept whatever parameters clients request. | |
106 | + | |
107 | +Outgoing messages by default will be compressed if compression was auto-negotiated during the handshake. There is an option to force a specific message to be sent uncompressed even if compression was negotiated. This may be useful for sending data that you know to be compressed already (images, zip files, etc). | |
108 | + | |
109 | + | |
110 | +__Server Example__ | |
111 | +``` | |
112 | +#include <websocketpp/extensions/permessage_deflate/enabled.hpp> | |
113 | + | |
114 | +struct deflate_server_config : public websocketpp::config::asio { | |
115 | + // ... additional custom config if you need it for other things | |
116 | + | |
117 | + /// permessage_compress extension | |
118 | + struct permessage_deflate_config {}; | |
119 | + | |
120 | + typedef websocketpp::extensions::permessage_deflate::enabled | |
121 | + <permessage_deflate_config> permessage_deflate_type; | |
122 | +}; | |
123 | + | |
124 | +typedef websocketpp::server<deflate_server_config> server_endpoint_type; | |
125 | +``` | |
126 | + | |
127 | +__Client Example__ | |
128 | +``` | |
129 | +#include <websocketpp/extensions/permessage_deflate/enabled.hpp> | |
130 | + | |
131 | +struct deflate_client_config : public websocketpp::config::asio_client { | |
132 | + // ... additional custom config if you need it for other things | |
133 | + | |
134 | + /// permessage_compress extension | |
135 | + struct permessage_deflate_config {}; | |
136 | + | |
137 | + typedef websocketpp::extensions::permessage_deflate::enabled | |
138 | + <permessage_deflate_config> permessage_deflate_type; | |
139 | +}; | |
140 | + | |
141 | +typedef websocketpp::client<deflate_client_config> client_endpoint_type; | |
142 | +``` | |
143 | + | |
144 | +## Security | |
145 | + | |
146 | +### Is it possible to terminate a malicious connection quickly, without tying up resources performing clean close steps, | |
147 | + | |
148 | +Yes. The library will automatically detect and terminate connections that violate the WebSocket protocol. In cases where the library believes the remote endpoint to be malicious or sufficiently broken to be unlikely to understand or process the closing handshake, it will be omited. | |
149 | + | |
150 | +If your application detects conditions above the protocol level that you believe to be malicious, for example, if you recognize an IP from a known denial of service attack, you can close the connection with two different levels of urgency. Use the standard `websocketpp::endpoint::close` or `websocketpp::connection::close` methods with one of the following special close codes: | |
151 | +- `websocketpp::close::status::omit_handshake`: Omits the closing handshake, but cleanly closes the TCP connection. | |
152 | +- `websocketpp::close::status::force_tcp_drop`: Forcibly drop the TCP connection. | |
153 | + | |
154 | +Please note that usage of these disconnect methods results in a violation of the WebSocket protocol and may have negative reprocusions for the remote endpoint with respect to network timeouts. Please use caution when using them. | |
155 | + | |
156 | +## Build Issues | |
157 | + | |
158 | +### Getting compile errors related to `std::chrono`, `boost::chrono`, `waitable_timer`, or `steady_clock` | |
159 | + | |
160 | +Your build system may be confused about whether it is supposed to be using `boost::chrono` or `std::chrono`. Boost automatically detects this setup on some compilers but not others. Defining `BOOST_ASIO_HAS_STD_CHRONO` can help. See http://www.boost.org/doc/libs/1_60_0/doc/html/boost_asio/overview/cpp2011/chrono.html for more details. | |
161 | + | |
162 | +*/ | ... | ... |
3rdparty/websocketpp-0.8.2/docs/getting_started.dox
0 → 100644
1 | +/** \page getting_started Getting Started | |
2 | + | |
3 | +WebSocket++ code is available on github at https://github.com/zaphoyd/websocketpp | |
4 | +The official project homepage lives at http://www.zaphoyd.com/websocketpp | |
5 | + | |
6 | +The git repository is organized into several directories: | |
7 | + | |
8 | +- **docs**: This documentation | |
9 | +- **examples**: Example programs that demonstrate how to build basic versions of some commonly used patterns for WebSocket clients and servers. | |
10 | +- **test**: Unit tests that confirm that the code you have works properly and help detect platform specific issues. | |
11 | +- **tutorials**: Detailed walkthroughs of a select set of the example programs. | |
12 | +- **websocketpp**: All of the library code and default configuration files. | |
13 | + | |
14 | +WebSocket++ is a header only library. You can start using it by including the websocketpp source directory in your project's include path and including the appropriate WebSocket++ headers in your program. You may also need to include and/or link to appropriate Boost/system libraries. TODO: More information: Building a program with WebSocket++, Walkthroughs of the example programs | |
15 | + | |
16 | +WebSocket++ includes cmake and scons scripts for building the examples and unit tests. Neither system is needed unless you want to build tests or examples in an automated fashion. | |
17 | + | |
18 | +__Usage questions__ should be posted to the project mailing list at http://groups.google.com/group/websocketpp/ or the IRC channel (\#websocketpp on freenode). | |
19 | + | |
20 | +__Bugs and issues__ should be posted to the project GitHub issues queue: https://github.com/zaphoyd/websocketpp/issues. | |
21 | + | |
22 | +__Pull requests__ on GitHub are welcome. Please make them against the `develop` branch. | |
23 | + | |
24 | +WebSocket++ is written and maintained by Peter Thorson. You can contact me via GitHub messaging, IRC, or via email at websocket@zaphoyd.com. | |
25 | + | |
26 | +*/ | |
27 | + | ... | ... |
3rdparty/websocketpp-0.8.2/docs/handlers.dox
0 → 100644
1 | +/** \page reference.handlers Handler Reference | |
2 | + | |
3 | +Handlers allow WebSocket++ programs to receive notifications about events | |
4 | +that happen in relation to their connections. Some handlers also behave as | |
5 | +hooks that give the program a chance to modify state or adjust settings before | |
6 | +the connection continues. | |
7 | + | |
8 | +Handlers are registered by calling the appropriate `set_*_handler` method on either an | |
9 | +endpoint or connection. The * refers to the name of the handler (as | |
10 | +specified in the signature field below). For example, to set the open handler, | |
11 | +call `set_open_handler(...)`. | |
12 | + | |
13 | +Setting handlers on an endpoint will result in them being copied as the default | |
14 | +handler to all new connections created by that endpoint. Changing an endpoint's | |
15 | +handlers will not affect connections that are already in progress. This includes | |
16 | +connections that are in the listening state. As such, it is important to set any | |
17 | +endpoint handlers before you call `endpoint::start_accept` or else the handlers | |
18 | +will not be attached to your first connection. | |
19 | + | |
20 | +Setting handlers on a connection will result in the handler being changed for | |
21 | +that connection only, starting at the next time that handler is called. This can | |
22 | +be used to change the handler during a connection. | |
23 | + | |
24 | +Connection Handlers | |
25 | +------------------- | |
26 | + | |
27 | +These handlers will be called at most once per connection in the order specified below. | |
28 | + | |
29 | +### Socket Init Handler | |
30 | + | |
31 | +| Event | Signature | Availability | | |
32 | +| --------------------- | ----------------------------------------------------- | -------------------- | | |
33 | +| Socket initialization | `socket_init(connection_hdl, asio::ip::tcp::socket&)` | 0.3.0 Asio Transport | | |
34 | + | |
35 | +This hook is triggered after the socket has been initialized but before a connection is established. | |
36 | +It allows setting arbitrary socket options before connections are sent/recieved. | |
37 | + | |
38 | +### TCP Pre-init Handler | |
39 | + | |
40 | +| Event | Signature | Availability | | |
41 | +| ----------------------------- | ------------------------------ | -------------------- | | |
42 | +| TCP established, no data sent | `tcp_pre_init(connection_hdl)` | 0.3.0 Asio Transport | | |
43 | + | |
44 | +This hook is triggered after the TCP connection is established, but before any pre-WebSocket-handshake | |
45 | +operations have been run. Common pre-handshake operations include TLS handshakes and proxy connections. | |
46 | + | |
47 | +### TCP Post-init Handler | |
48 | + | |
49 | +| Event | Signature | Availability | | |
50 | +| ----------------------- | ------------------------------------------ | ----------------------------- | | |
51 | +| Request for TLS context | `tls_context_ptr tls_init(connection_hdl)` | 0.3.0 Asio Transport with TLS | | |
52 | + | |
53 | +This hook is triggered before the TLS handshake to request the TLS context to use. You must | |
54 | +return a pointer to a configured TLS conext to continue. This provides the opportuinity to | |
55 | +set up the TLS settings, certificates, etc. | |
56 | + | |
57 | +### Validate Handler | |
58 | + | |
59 | +| Event | Signature | Availability | | |
60 | +| ------------------------------------- | ------------------------------- | ---------------------------- | | |
61 | +| Hook to accept or reject a connection | `bool validate(connection_hdl)` | 0.3.0 Core, Server role only | | |
62 | + | |
63 | +This hook is triggered for servers during the opening handshake after the request has been | |
64 | +processed but before the response has been sent. It gives a program the opportunity to inspect | |
65 | +headers and other connection details and either accept or reject the connection. Validate happens | |
66 | +before the open or fail handler. | |
67 | + | |
68 | +Return true to accept the connection, false to reject. If no validate handler is registered, | |
69 | +all connections will be accepted. | |
70 | + | |
71 | +### Open Connection Handler | |
72 | + | |
73 | +| Event | Signature | Availability | | |
74 | +| ------------------------- | ---------------------- | ------------ | | |
75 | +| Successful new connection | `open(connection_hdl)` | 0.3.0 Core | | |
76 | + | |
77 | +Either open or fail will be called for each connection. Never both. All | |
78 | +connections that begin with an open handler call will also have a matching | |
79 | +close handler call when the connection ends. | |
80 | + | |
81 | +### Fail Connection Handler | |
82 | + | |
83 | +| Event | Signature | Availability | | |
84 | +| ----------------------------------- | ---------------------- | ------------ | | |
85 | +| Connection failed (before opening) | `fail(connection_hdl)` | 0.3.0 Core | | |
86 | + | |
87 | +Either open or fail will be called for each connection. Never both. Connections | |
88 | +that fail will never have a close handler called. | |
89 | + | |
90 | +### Close Connection Handler | |
91 | + | |
92 | +| Event | Signature | Availability | | |
93 | +| --------------------------------- | ----------------------- | ------------ | | |
94 | +| Connection closed (after opening) | `close(connection_hdl)` | 0.3.0 Core | | |
95 | + | |
96 | +Close will be called exactly once for every connection that open was called for. | |
97 | +Close is not called for failed connections. | |
98 | + | |
99 | +Message Handlers | |
100 | +---------------- | |
101 | + | |
102 | +These handers are called in response to incoming messages or message like events. They only will be called while the connection is in the open state. | |
103 | + | |
104 | +### Message Handler | |
105 | + | |
106 | +| Event | Signature | Availability | | |
107 | +| --------------------- | -------------------------------------- | ------------ | | |
108 | +| Data message recieved | `message(connection_hdl, message_ptr)` | 0.3.0 Core | | |
109 | + | |
110 | +Applies to all non-control messages, including both text and binary opcodes. The | |
111 | +`message_ptr` type and its API depends on your endpoint type and its config. | |
112 | + | |
113 | +### Ping Handler | |
114 | + | |
115 | +| Event | Signature | Availability | | |
116 | +| ------------- | ---------------------------------------- | ------------ | | |
117 | +| Ping recieved | `bool ping(connection_hdl, std::string)` | 0.3.0 Core | | |
118 | + | |
119 | +Second (string) argument is the binary ping payload. Handler return value | |
120 | +indicates whether or not to respond to the ping with a pong. If no ping handler | |
121 | +is set, WebSocket++ will respond with a pong containing the same binary data as | |
122 | +the ping (Per requirements in RFC6455). | |
123 | + | |
124 | +### Pong Handler | |
125 | + | |
126 | +| Event | Signature | Availability | | |
127 | +| ------------- | ----------------------------------- | ------------ | | |
128 | +| Pong recieved | `pong(connection_hdl, std::string)` | 0.3.0 Core | | |
129 | + | |
130 | +Second (string) argument is the binary pong payload. | |
131 | + | |
132 | +### Pong Timeout Handler | |
133 | + | |
134 | +| Event | Signature | Availability | | |
135 | +| ---------------------------------- | ------------------------------------------- | ---------------------------------------- | | |
136 | +| Timed out while waiting for a pong | `pong_timeout(connection_hdl, std::string)` | 0.3.0 Core, transport with timer support | | |
137 | + | |
138 | +Triggered if there is no response to a ping after the configured duration. The second | |
139 | +(string) argument is the binary payload of the unanswered ping. | |
140 | + | |
141 | +### HTTP Handler | |
142 | + | |
143 | +| Event | Signature | Availability | | |
144 | +| --------------------- | --------------------- | ---------------------------- | | |
145 | +| HTTP request recieved | `http(connection_hdl` | 0.3.0 Core, Server role only | | |
146 | + | |
147 | +Called when HTTP requests that are not WebSocket handshake upgrade requests are | |
148 | +recieved. Allows responding to regular HTTP requests. If no handler is registered | |
149 | +a 426/Upgrade Required error is returned. | |
150 | + | |
151 | +### Interrupt Handler | |
152 | + | |
153 | +| Event | Signature | Availability | | |
154 | +| ----------------------------------- | --------------------------- | ------------ | | |
155 | +| Connection was manually interrupted | `interrupt(connection_hdl)` | 0.3.0 Core | | |
156 | + | |
157 | +Interrupt events can be triggered by calling `endpoint::interrupt` or `connection::interrupt`. | |
158 | +Interrupt is similar to a timer event with duration zero but with lower overhead. It is useful | |
159 | +for single threaded programs to allow breaking up a very long handler into multiple parts and | |
160 | +for multi threaded programs as a way for worker threads to signale to the main/network thread | |
161 | +that an event is ready. | |
162 | + | |
163 | +todo: write low and high watermark handlers | |
164 | + | |
165 | +*/ | ... | ... |
3rdparty/websocketpp-0.8.2/docs/logging.dox
0 → 100644
1 | +/** \page reference.logging Logging Reference | |
2 | + | |
3 | +WebSocket++ has the capability of logging events during the lifetime of the connections that it processes. Each endpoint has two independent logging interfaces that are used by all connections created by that endpoint. The first is an access interface that allows logging routine events in the life of a connection (such as connect/disconnect and receipt of messages). The other is an error interface that allows logging non-routine problems or errors. Each interface has a number of different named channels that can be toggled on and off independently. | |
4 | + | |
5 | +Exactly how these logs are processed and where they are written to depends on which logging policy is in use. Several logging policies are included by default and you can write your own policy if you need something more specialized. Selecting a policy is done via the \subpage reference.config "endpoint config". | |
6 | + | |
7 | +Common functionality (all policies) | |
8 | +----------------------------------- | |
9 | + | |
10 | +### Logging Channels | |
11 | + | |
12 | +Each logging interface is divided into 32 named channels. Log messages are written to a specific interface on a specific channel. Which log messages are actually printed is determined by which channels are enabled or not. Channels can be enabled or disabled either at compile time or at runtime. | |
13 | + | |
14 | +### Enabling and Disabling Channels | |
15 | + | |
16 | +Channels disabled at compile time are removed from the code entirely (assuming correct compiler optimization settings) and are not available for runtime enabling or disabling. To disable channels at compile time, use the `alog_level` and `elog_level` values within your \subpage reference.config "endpoint config". Channels not disabled at compile time can be enabled or disabled at runtime using the `websocketpp::endpoint::set_access_channels()`, `websocketpp::endpoint::clear_access_channels()`, `websocketpp::endpoint::set_error_channels()`, and `websocketpp::endpoint::clear_error_channels()` methods. | |
17 | + | |
18 | +The set and clear functions act only on the channels specified. `set_access_channels(log::alevel::connect)` will enable logging of new connections. Following this with `set_access_channels(log::alevel::disconnect)` will enable logging of disconnections in addition to connections. Use `clear*` functions to disable a specific channel. Channels may be combined using bitwise operations to create aggregate packages of channels that may be set or cleared at once. Default packages include `websocketpp::log::alevel::all`, `websocketpp::log::elevel::all`, `websocketpp::log::alevel::none`, `websocketpp::log::elevel::none`. These represent all possible access/error channels and no access/error channels respectively. For convenience, setting none is aliased to clearing all. | |
19 | + | |
20 | +### Examples | |
21 | + | |
22 | +__Disable all__ | |
23 | + | |
24 | +`clear_access_channels(log::alevel::all)` | |
25 | + | |
26 | +__Disable all (alternative method)__ | |
27 | + | |
28 | +`set_access_channels(log::alevel::none)` | |
29 | + | |
30 | +__Multiple channels at once__ | |
31 | + | |
32 | +`log::alevel::message_payload | log::alevel::message_payload` | |
33 | + | |
34 | +__All except one__ | |
35 | + | |
36 | +`log::alevel::all ^ log::alevel::message_payload` | |
37 | + | |
38 | +__Default settings__ | |
39 | + | |
40 | +By default, only debug/development logging is disabled. | |
41 | + | |
42 | +### Access to underlying loggers | |
43 | + | |
44 | +Logging interfaces may be directly accessed via their associated endpoint or connection using get_alog() and get_elog(). This allows access to methods specific to the chosen logging policy. | |
45 | + | |
46 | +Basic Logging (Default Policy) | |
47 | +------------------------------ | |
48 | + | |
49 | +The basic logging policy (`websocketpp::log::basic`) writes logs to a std::ostream. By default, access logs are written to stdout and error logs are written to stderr. Each logging interface may be optionally redirected to an arbitrary C++ stream (including file streams) using the `websocketpp::log::basic::set_ostream()` method. | |
50 | + | |
51 | +Syslog Logging | |
52 | +-------------- | |
53 | + | |
54 | +The syslog logging policy (`websocketpp::log::syslog`) logs to POSIX syslog. It is included in the header `<websocketpp/logger/syslog.hpp>`. It requires a system with `<syslog.h>`. | |
55 | + | |
56 | +Stub Logging | |
57 | +------------ | |
58 | + | |
59 | +The stub logging policy (`websocketpp::log::stub`) implements the logging policy interface but ignores all input and provides no output. It can be used to stub out the logging system in tests or to completely disable and remove nearly all logging related code. | |
60 | + | |
61 | +The stub logger also provides documentation for the minimal required interface to build a custom logging policy. | |
62 | + | |
63 | +Log level reference | |
64 | +------------------- | |
65 | + | |
66 | +### Error Logging Levels | |
67 | + | |
68 | +Each of these channels is in the namespace `websocketpp::log::elevel` | |
69 | + | |
70 | +| Level | Description | | |
71 | +| ------- | -------------------------------------------------------------------------------------------------------------------------- | | |
72 | +| none | Special aggregate value representing "no levels" | | |
73 | +| devel | Low level debugging information (warning: very chatty). Requires debug or custom config. | | |
74 | +| library | Information about unusual system states or other minor internal library problems, less chatty than devel. | | |
75 | +| info | Information about minor configuration problems or additional information about other warnings. | | |
76 | +| warn | Information about important problems not severe enough to terminate connections. | | |
77 | +| rerror | Recoverable error. Recovery may mean cleanly closing the connection with an appropriate error code to the remote endpoint. | | |
78 | +| fatal | Unrecoverable error. This error will trigger immediate unclean termination of the connection or endpoint. | | |
79 | +| all | Special aggregate value representing "all levels" | | |
80 | + | |
81 | +### Access Logging Levels | |
82 | + | |
83 | +Each of these channels is in the namespace `websocketpp::log::alevel` | |
84 | + | |
85 | +| Level | Description | | |
86 | +| --------------- | -------------------------------------------------------------------------------------------------- | | |
87 | +| none | Special aggregate value representing "no levels" | | |
88 | +| connect | One line for each new connection that includes a host of information including: the remote address, websocket version, requested resource, http code, remote user agent | | |
89 | +| disconnect | One line for each connection that is closed. Includes closing codes and reasons | | |
90 | +| control | One line per control message | | |
91 | +| frame_header | One line per frame, includes the full frame header | | |
92 | +| frame_payload | One line per frame, includes the full message payload (warning: lots of output for large messages) | | |
93 | +| message_header | Reserved | | |
94 | +| message_payload | Reserved | | |
95 | +| endpoint | Reserved | | |
96 | +| debug_handshake | Extra information about opening handshakes | | |
97 | +| debug_close | Extra information about closing handshakes | | |
98 | +| devel | Development messages (warning: very chatty). Requires debug or custom config. | | |
99 | +| app | Special channel for application specific logs. Not used by the library. | | |
100 | +| all | Special aggregate value representing "all levels" | | |
101 | + | |
102 | +*/ | ... | ... |
3rdparty/websocketpp-0.8.2/docs/manual.css
0 → 100644
1 | +.tabs, .tabs2, .tabs3, .navpath ul { | |
2 | + background-image: none; | |
3 | + background-color: #333; | |
4 | + border: none; | |
5 | + border-bottom: 1px solid #575757; | |
6 | +} | |
7 | + | |
8 | +.tablist li, .navpath li { | |
9 | + background-image: none; | |
10 | + background-color: #333; | |
11 | +} | |
12 | + | |
13 | +.tablist a, .navpath li.navelem a { | |
14 | + color: #ccc; | |
15 | + text-shadow: 0px 1px 1px black; | |
16 | +} | |
17 | + | |
18 | +.tablist a:hover, .navpath li.navelem a:hover { | |
19 | + background-image: none; | |
20 | + background-color: #444; | |
21 | + color: #ccc; | |
22 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/docs/manual.dox
0 → 100644
1 | +/** \mainpage | |
2 | + | |
3 | +WebSocket++ is a C++ library that can be used to implement WebSocket functionality. The goals of the project are to provide a WebSocket implementation that is portable, flexible, lightweight, low level, and high performance. | |
4 | + | |
5 | +WebSocket++ does not intend to be used alone as a web application framework or full featured web services platform. As such the components, examples, and performance tuning are geared towards operation as a WebSocket client or server. There are some minimal convenience features that stray from this (for example the ability to respond to HTTP requests other than WebSocket Upgrades) but these are not the focus of the project. In particular WebSocket++ does not intend to implement any non-WebSocket related fallback options (ajax / long polling / comet / etc). | |
6 | + | |
7 | +In order to remain compact and improve portability, the WebSocket++ project strives to reduce or eliminate external dependencies where possible and appropriate. WebSocket++ core has no dependencies other than the C++11 standard library. For non-C++11 compilers the Boost libraries provide drop in polyfills for the C++11 functionality used. | |
8 | + | |
9 | +WebSocket++ implements a pluggable data transport component. The default component allows reduced functionality by using STL iostream or raw byte shuffling via reading and writing char buffers. This component has no non-STL dependencies and can be used in a C++11 environment without Boost. Also included is an Asio based transport component that provides full featured network client/server functionality. This component requires either Boost Asio or a C++11 compiler and standalone Asio. As an advanced option, WebSocket++ supports custom transport layers if you want to provide your own using another library. | |
10 | + | |
11 | +In order to accommodate the wide variety of use cases WebSocket++ has collected, the library is built in a way that most of the major components are loosely coupled and can be swapped out and replaced. WebSocket++ will attempt to track the future development of the WebSocket protocol and any extensions as they are developed. | |
12 | + | |
13 | +- \subpage getting_started "Getting Started" | |
14 | +- \subpage faq "FAQ" | |
15 | +- \subpage tutorials "Tutorials" | |
16 | +- \subpage md_changelog "Change Log / Version History" | |
17 | +- Reference | |
18 | + - \subpage reference.handlers "Handler Reference" | |
19 | + - \subpage reference.config "Config Reference" | |
20 | + - \subpage reference.logging "Logging Reference" | |
21 | + | |
22 | +*/ | |
23 | + | ... | ... |
3rdparty/websocketpp-0.8.2/docs/simple_broadcast_server.cpp
0 → 100644
1 | +#include <set> | |
2 | + | |
3 | +#include <websocketpp/config/asio_no_tls.hpp> | |
4 | +#include <websocketpp/server.hpp> | |
5 | + | |
6 | +typedef websocketpp::server<websocketpp::config::asio> server; | |
7 | + | |
8 | +using websocketpp::connection_hdl; | |
9 | +using websocketpp::lib::placeholders::_1; | |
10 | +using websocketpp::lib::placeholders::_2; | |
11 | +using websocketpp::lib::bind; | |
12 | + | |
13 | +class broadcast_server { | |
14 | +public: | |
15 | + broadcast_server() { | |
16 | + m_server.init_asio(); | |
17 | + | |
18 | + m_server.set_open_handler(bind(&broadcast_server::on_open,this,::_1)); | |
19 | + m_server.set_close_handler(bind(&broadcast_server::on_close,this,::_1)); | |
20 | + m_server.set_message_handler(bind(&broadcast_server::on_message,this,::_1,::_2)); | |
21 | + } | |
22 | + | |
23 | + void on_open(connection_hdl hdl) { | |
24 | + m_connections.insert(hdl); | |
25 | + } | |
26 | + | |
27 | + void on_close(connection_hdl hdl) { | |
28 | + m_connections.erase(hdl); | |
29 | + } | |
30 | + | |
31 | + void on_message(connection_hdl hdl, server::message_ptr msg) { | |
32 | + for (auto it : m_connections) { | |
33 | + m_server.send(it,msg); | |
34 | + } | |
35 | + } | |
36 | + | |
37 | + void run(uint16_t port) { | |
38 | + m_server.listen(port); | |
39 | + m_server.start_accept(); | |
40 | + m_server.run(); | |
41 | + } | |
42 | +private: | |
43 | + typedef std::set<connection_hdl,std::owner_less<connection_hdl>> con_list; | |
44 | + | |
45 | + server m_server; | |
46 | + con_list m_connections; | |
47 | +}; | |
48 | + | |
49 | +int main() { | |
50 | + broadcast_server server; | |
51 | + server.run(9002); | |
52 | +} | |
0 | 53 | \ No newline at end of file | ... | ... |
3rdparty/websocketpp-0.8.2/docs/simple_count_server_thread.cpp
0 → 100644
1 | +#include <functional> | |
2 | +#include <mutex> | |
3 | +#include <set> | |
4 | +#include <thread> | |
5 | + | |
6 | +#include <websocketpp/config/asio_no_tls.hpp> | |
7 | +#include <websocketpp/server.hpp> | |
8 | + | |
9 | +typedef websocketpp::server<websocketpp::config::asio> server; | |
10 | + | |
11 | +using websocketpp::connection_hdl; | |
12 | + | |
13 | +class count_server { | |
14 | +public: | |
15 | + count_server() : m_count(0) { | |
16 | + m_server.init_asio(); | |
17 | + | |
18 | + m_server.set_open_handler(bind(&count_server::on_open,this,_1)); | |
19 | + m_server.set_close_handler(bind(&count_server::on_close,this,_1)); | |
20 | + } | |
21 | + | |
22 | + void on_open(connection_hdl hdl) { | |
23 | + std::lock_guard<std::mutex> lock(m_mutex); | |
24 | + m_connections.insert(hdl); | |
25 | + } | |
26 | + | |
27 | + void on_close(connection_hdl hdl) { | |
28 | + std::lock_guard<std::mutex> lock(m_mutex); | |
29 | + m_connections.erase(hdl); | |
30 | + } | |
31 | + | |
32 | + void count() { | |
33 | + while (1) { | |
34 | + sleep(1); | |
35 | + m_count++; | |
36 | + | |
37 | + std::stringstream ss; | |
38 | + ss << m_count; | |
39 | + | |
40 | + std::lock_guard<std::mutex> lock(m_mutex); | |
41 | + for (auto it : m_connections) { | |
42 | + m_server.send(it,ss.str(),websocketpp::frame::opcode::text); | |
43 | + } | |
44 | + } | |
45 | + } | |
46 | + | |
47 | + void run(uint16_t port) { | |
48 | + m_server.listen(port); | |
49 | + m_server.start_accept(); | |
50 | + m_server.run(); | |
51 | + } | |
52 | +private: | |
53 | + typedef std::set<connection_hdl,std::owner_less<connection_hdl>> con_list; | |
54 | + | |
55 | + int m_count; | |
56 | + server m_server; | |
57 | + con_list m_connections; | |
58 | + std::mutex m_mutex; | |
59 | +}; | |
60 | + | |
61 | +int main() { | |
62 | + count_server server; | |
63 | + std::thread t(std::bind(&count_server::count,&server)); | |
64 | + server.run(9002); | |
65 | +} | |
0 | 66 | \ No newline at end of file | ... | ... |
3rdparty/websocketpp-0.8.2/docs/tutorials.dox
0 → 100644
1 | +/** \page tutorials Tutorials | |
2 | + | |
3 | +These tutorials are works in progress, some are more complete than others. | |
4 | + | |
5 | +- \subpage md_tutorials_utility_client_utility_client | |
6 | +- \subpage md_tutorials_utility_server_utility_server | |
7 | +- \subpage md_tutorials_broadcast_tutorial_broadcast_tutorial | |
8 | +- \subpage md_tutorials_chat_tutorial_chat_tutorial | |
9 | + | |
10 | +*/ | ... | ... |
3rdparty/websocketpp-0.8.2/examples/associative_storage/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +init_target (associative_storage) | |
6 | + | |
7 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
8 | + | |
9 | +link_boost () | |
10 | +final_target () | |
11 | + | |
12 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | ... | ... |
3rdparty/websocketpp-0.8.2/examples/associative_storage/associative_storage.cpp
0 → 100644
1 | +#include <iostream> | |
2 | +#include <map> | |
3 | +#include <exception> | |
4 | +#include <websocketpp/config/asio_no_tls.hpp> | |
5 | +#include <websocketpp/server.hpp> | |
6 | + | |
7 | +typedef websocketpp::server<websocketpp::config::asio> server; | |
8 | + | |
9 | +using websocketpp::connection_hdl; | |
10 | +using websocketpp::lib::placeholders::_1; | |
11 | +using websocketpp::lib::placeholders::_2; | |
12 | +using websocketpp::lib::bind; | |
13 | + | |
14 | +struct connection_data { | |
15 | + int sessionid; | |
16 | + std::string name; | |
17 | +}; | |
18 | + | |
19 | +class print_server { | |
20 | +public: | |
21 | + print_server() : m_next_sessionid(1) { | |
22 | + m_server.init_asio(); | |
23 | + | |
24 | + m_server.set_open_handler(bind(&print_server::on_open,this,::_1)); | |
25 | + m_server.set_close_handler(bind(&print_server::on_close,this,::_1)); | |
26 | + m_server.set_message_handler(bind(&print_server::on_message,this,::_1,::_2)); | |
27 | + } | |
28 | + | |
29 | + void on_open(connection_hdl hdl) { | |
30 | + connection_data data; | |
31 | + | |
32 | + data.sessionid = m_next_sessionid++; | |
33 | + data.name.clear(); | |
34 | + | |
35 | + m_connections[hdl] = data; | |
36 | + } | |
37 | + | |
38 | + void on_close(connection_hdl hdl) { | |
39 | + connection_data& data = get_data_from_hdl(hdl); | |
40 | + | |
41 | + std::cout << "Closing connection " << data.name | |
42 | + << " with sessionid " << data.sessionid << std::endl; | |
43 | + | |
44 | + m_connections.erase(hdl); | |
45 | + } | |
46 | + | |
47 | + void on_message(connection_hdl hdl, server::message_ptr msg) { | |
48 | + connection_data& data = get_data_from_hdl(hdl); | |
49 | + | |
50 | + if (data.name.empty()) { | |
51 | + data.name = msg->get_payload(); | |
52 | + std::cout << "Setting name of connection with sessionid " | |
53 | + << data.sessionid << " to " << data.name << std::endl; | |
54 | + } else { | |
55 | + std::cout << "Got a message from connection " << data.name | |
56 | + << " with sessionid " << data.sessionid << std::endl; | |
57 | + } | |
58 | + } | |
59 | + | |
60 | + connection_data& get_data_from_hdl(connection_hdl hdl) { | |
61 | + auto it = m_connections.find(hdl); | |
62 | + | |
63 | + if (it == m_connections.end()) { | |
64 | + // this connection is not in the list. This really shouldn't happen | |
65 | + // and probably means something else is wrong. | |
66 | + throw std::invalid_argument("No data available for session"); | |
67 | + } | |
68 | + | |
69 | + return it->second; | |
70 | + } | |
71 | + | |
72 | + void run(uint16_t port) { | |
73 | + m_server.listen(port); | |
74 | + m_server.start_accept(); | |
75 | + m_server.run(); | |
76 | + } | |
77 | +private: | |
78 | + typedef std::map<connection_hdl,connection_data,std::owner_less<connection_hdl>> con_list; | |
79 | + | |
80 | + int m_next_sessionid; | |
81 | + server m_server; | |
82 | + con_list m_connections; | |
83 | +}; | |
84 | + | |
85 | +int main() { | |
86 | + print_server server; | |
87 | + server.run(9002); | |
88 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/broadcast_server/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +init_target (broadcast_server) | |
6 | + | |
7 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
8 | + | |
9 | +link_boost () | |
10 | +final_target () | |
11 | + | |
12 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | ... | ... |
3rdparty/websocketpp-0.8.2/examples/broadcast_server/SConscript
0 → 100644
1 | +## Broadcast Server example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | + | |
10 | +env = env.Clone () | |
11 | +env_cpp11 = env_cpp11.Clone () | |
12 | + | |
13 | +prgs = [] | |
14 | + | |
15 | +# if a C++11 environment is available build using that, otherwise use boost | |
16 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
17 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] | |
18 | + prgs += env_cpp11.Program('broadcast_server', ["broadcast_server.cpp"], LIBS = ALL_LIBS) | |
19 | +else: | |
20 | + ALL_LIBS = boostlibs(['system','thread'],env) + [platform_libs] + [polyfill_libs] | |
21 | + prgs += env.Program('broadcast_server', ["broadcast_server.cpp"], LIBS = ALL_LIBS) | |
22 | + | |
23 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/broadcast_server/broadcast_server.cpp
0 → 100644
1 | +#include <websocketpp/config/asio_no_tls.hpp> | |
2 | + | |
3 | +#include <websocketpp/server.hpp> | |
4 | + | |
5 | +#include <iostream> | |
6 | +#include <set> | |
7 | + | |
8 | +/*#include <boost/thread.hpp> | |
9 | +#include <boost/thread/mutex.hpp> | |
10 | +#include <boost/thread/condition_variable.hpp>*/ | |
11 | +#include <websocketpp/common/thread.hpp> | |
12 | + | |
13 | +typedef websocketpp::server<websocketpp::config::asio> server; | |
14 | + | |
15 | +using websocketpp::connection_hdl; | |
16 | +using websocketpp::lib::placeholders::_1; | |
17 | +using websocketpp::lib::placeholders::_2; | |
18 | +using websocketpp::lib::bind; | |
19 | + | |
20 | +using websocketpp::lib::thread; | |
21 | +using websocketpp::lib::mutex; | |
22 | +using websocketpp::lib::lock_guard; | |
23 | +using websocketpp::lib::unique_lock; | |
24 | +using websocketpp::lib::condition_variable; | |
25 | + | |
26 | +/* on_open insert connection_hdl into channel | |
27 | + * on_close remove connection_hdl from channel | |
28 | + * on_message queue send to all channels | |
29 | + */ | |
30 | + | |
31 | +enum action_type { | |
32 | + SUBSCRIBE, | |
33 | + UNSUBSCRIBE, | |
34 | + MESSAGE | |
35 | +}; | |
36 | + | |
37 | +struct action { | |
38 | + action(action_type t, connection_hdl h) : type(t), hdl(h) {} | |
39 | + action(action_type t, connection_hdl h, server::message_ptr m) | |
40 | + : type(t), hdl(h), msg(m) {} | |
41 | + | |
42 | + action_type type; | |
43 | + websocketpp::connection_hdl hdl; | |
44 | + server::message_ptr msg; | |
45 | +}; | |
46 | + | |
47 | +class broadcast_server { | |
48 | +public: | |
49 | + broadcast_server() { | |
50 | + // Initialize Asio Transport | |
51 | + m_server.init_asio(); | |
52 | + | |
53 | + // Register handler callbacks | |
54 | + m_server.set_open_handler(bind(&broadcast_server::on_open,this,::_1)); | |
55 | + m_server.set_close_handler(bind(&broadcast_server::on_close,this,::_1)); | |
56 | + m_server.set_message_handler(bind(&broadcast_server::on_message,this,::_1,::_2)); | |
57 | + } | |
58 | + | |
59 | + void run(uint16_t port) { | |
60 | + // listen on specified port | |
61 | + m_server.listen(port); | |
62 | + | |
63 | + // Start the server accept loop | |
64 | + m_server.start_accept(); | |
65 | + | |
66 | + // Start the ASIO io_service run loop | |
67 | + try { | |
68 | + m_server.run(); | |
69 | + } catch (const std::exception & e) { | |
70 | + std::cout << e.what() << std::endl; | |
71 | + } | |
72 | + } | |
73 | + | |
74 | + void on_open(connection_hdl hdl) { | |
75 | + { | |
76 | + lock_guard<mutex> guard(m_action_lock); | |
77 | + //std::cout << "on_open" << std::endl; | |
78 | + m_actions.push(action(SUBSCRIBE,hdl)); | |
79 | + } | |
80 | + m_action_cond.notify_one(); | |
81 | + } | |
82 | + | |
83 | + void on_close(connection_hdl hdl) { | |
84 | + { | |
85 | + lock_guard<mutex> guard(m_action_lock); | |
86 | + //std::cout << "on_close" << std::endl; | |
87 | + m_actions.push(action(UNSUBSCRIBE,hdl)); | |
88 | + } | |
89 | + m_action_cond.notify_one(); | |
90 | + } | |
91 | + | |
92 | + void on_message(connection_hdl hdl, server::message_ptr msg) { | |
93 | + // queue message up for sending by processing thread | |
94 | + { | |
95 | + lock_guard<mutex> guard(m_action_lock); | |
96 | + //std::cout << "on_message" << std::endl; | |
97 | + m_actions.push(action(MESSAGE,hdl,msg)); | |
98 | + } | |
99 | + m_action_cond.notify_one(); | |
100 | + } | |
101 | + | |
102 | + void process_messages() { | |
103 | + while(1) { | |
104 | + unique_lock<mutex> lock(m_action_lock); | |
105 | + | |
106 | + while(m_actions.empty()) { | |
107 | + m_action_cond.wait(lock); | |
108 | + } | |
109 | + | |
110 | + action a = m_actions.front(); | |
111 | + m_actions.pop(); | |
112 | + | |
113 | + lock.unlock(); | |
114 | + | |
115 | + if (a.type == SUBSCRIBE) { | |
116 | + lock_guard<mutex> guard(m_connection_lock); | |
117 | + m_connections.insert(a.hdl); | |
118 | + } else if (a.type == UNSUBSCRIBE) { | |
119 | + lock_guard<mutex> guard(m_connection_lock); | |
120 | + m_connections.erase(a.hdl); | |
121 | + } else if (a.type == MESSAGE) { | |
122 | + lock_guard<mutex> guard(m_connection_lock); | |
123 | + | |
124 | + con_list::iterator it; | |
125 | + for (it = m_connections.begin(); it != m_connections.end(); ++it) { | |
126 | + m_server.send(*it,a.msg); | |
127 | + } | |
128 | + } else { | |
129 | + // undefined. | |
130 | + } | |
131 | + } | |
132 | + } | |
133 | +private: | |
134 | + typedef std::set<connection_hdl,std::owner_less<connection_hdl> > con_list; | |
135 | + | |
136 | + server m_server; | |
137 | + con_list m_connections; | |
138 | + std::queue<action> m_actions; | |
139 | + | |
140 | + mutex m_action_lock; | |
141 | + mutex m_connection_lock; | |
142 | + condition_variable m_action_cond; | |
143 | +}; | |
144 | + | |
145 | +int main() { | |
146 | + try { | |
147 | + broadcast_server server_instance; | |
148 | + | |
149 | + // Start a thread to run the processing loop | |
150 | + thread t(bind(&broadcast_server::process_messages,&server_instance)); | |
151 | + | |
152 | + // Run the asio loop with the main thread | |
153 | + server_instance.run(9002); | |
154 | + | |
155 | + t.join(); | |
156 | + | |
157 | + } catch (websocketpp::exception const & e) { | |
158 | + std::cout << e.what() << std::endl; | |
159 | + } | |
160 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/debug_client/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +if (OPENSSL_FOUND) | |
6 | + | |
7 | +init_target (debug_client) | |
8 | + | |
9 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
10 | + | |
11 | +link_boost () | |
12 | +link_openssl() | |
13 | +final_target () | |
14 | + | |
15 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | |
16 | + | |
17 | +endif() | |
0 | 18 | \ No newline at end of file | ... | ... |
3rdparty/websocketpp-0.8.2/examples/debug_client/SConscript
0 → 100644
1 | +## Debug client example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | +Import('tls_libs') | |
10 | + | |
11 | +env = env.Clone () | |
12 | +env_cpp11 = env_cpp11.Clone () | |
13 | + | |
14 | +prgs = [] | |
15 | + | |
16 | +# if a C++11 environment is available build using that, otherwise use boost | |
17 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
18 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] + [tls_libs] | |
19 | + prgs += env_cpp11.Program('debug_client', ["debug_client.cpp"], LIBS = ALL_LIBS) | |
20 | +else: | |
21 | + ALL_LIBS = boostlibs(['system','random'],env) + [platform_libs] + [polyfill_libs] + [tls_libs] | |
22 | + prgs += env.Program('debug_client', ["debug_client.cpp"], LIBS = ALL_LIBS) | |
23 | + | |
24 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/debug_client/debug_client.cpp
0 → 100644
1 | +/* | |
2 | + * Copyright (c) 2014, Peter Thorson. All rights reserved. | |
3 | + * | |
4 | + * Redistribution and use in source and binary forms, with or without | |
5 | + * modification, are permitted provided that the following conditions are met: | |
6 | + * * Redistributions of source code must retain the above copyright | |
7 | + * notice, this list of conditions and the following disclaimer. | |
8 | + * * Redistributions in binary form must reproduce the above copyright | |
9 | + * notice, this list of conditions and the following disclaimer in the | |
10 | + * documentation and/or other materials provided with the distribution. | |
11 | + * * Neither the name of the WebSocket++ Project nor the | |
12 | + * names of its contributors may be used to endorse or promote products | |
13 | + * derived from this software without specific prior written permission. | |
14 | + * | |
15 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
16 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 | + * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY | |
19 | + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
20 | + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
21 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
22 | + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
24 | + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | + */ | |
26 | + | |
27 | +/** ====== WARNING ======== | |
28 | + * This example is presently used as a scratch space. It may or may not be broken | |
29 | + * at any given time. | |
30 | + */ | |
31 | + | |
32 | +#include <websocketpp/config/asio_client.hpp> | |
33 | + | |
34 | +#include <websocketpp/client.hpp> | |
35 | + | |
36 | +#include <iostream> | |
37 | +#include <chrono> | |
38 | + | |
39 | +typedef websocketpp::client<websocketpp::config::asio_client> client; | |
40 | + | |
41 | +using websocketpp::lib::placeholders::_1; | |
42 | +using websocketpp::lib::placeholders::_2; | |
43 | +using websocketpp::lib::bind; | |
44 | + | |
45 | +// pull out the type of messages sent by our config | |
46 | +typedef websocketpp::config::asio_tls_client::message_type::ptr message_ptr; | |
47 | +typedef websocketpp::lib::shared_ptr<boost::asio::ssl::context> context_ptr; | |
48 | +typedef client::connection_ptr connection_ptr; | |
49 | + | |
50 | + | |
51 | + | |
52 | +class perftest { | |
53 | +public: | |
54 | + typedef perftest type; | |
55 | + typedef std::chrono::duration<int,std::micro> dur_type; | |
56 | + | |
57 | + perftest () { | |
58 | + m_endpoint.set_access_channels(websocketpp::log::alevel::all); | |
59 | + m_endpoint.set_error_channels(websocketpp::log::elevel::all); | |
60 | + | |
61 | + // Initialize ASIO | |
62 | + m_endpoint.init_asio(); | |
63 | + | |
64 | + // Register our handlers | |
65 | + m_endpoint.set_socket_init_handler(bind(&type::on_socket_init,this,::_1)); | |
66 | + //m_endpoint.set_tls_init_handler(bind(&type::on_tls_init,this,::_1)); | |
67 | + m_endpoint.set_message_handler(bind(&type::on_message,this,::_1,::_2)); | |
68 | + m_endpoint.set_open_handler(bind(&type::on_open,this,::_1)); | |
69 | + m_endpoint.set_close_handler(bind(&type::on_close,this,::_1)); | |
70 | + m_endpoint.set_fail_handler(bind(&type::on_fail,this,::_1)); | |
71 | + } | |
72 | + | |
73 | + void start(std::string uri) { | |
74 | + websocketpp::lib::error_code ec; | |
75 | + client::connection_ptr con = m_endpoint.get_connection(uri, ec); | |
76 | + | |
77 | + if (ec) { | |
78 | + m_endpoint.get_alog().write(websocketpp::log::alevel::app,ec.message()); | |
79 | + return; | |
80 | + } | |
81 | + | |
82 | + //con->set_proxy("http://humupdates.uchicago.edu:8443"); | |
83 | + | |
84 | + m_endpoint.connect(con); | |
85 | + | |
86 | + // Start the ASIO io_service run loop | |
87 | + m_start = std::chrono::high_resolution_clock::now(); | |
88 | + m_endpoint.run(); | |
89 | + } | |
90 | + | |
91 | + void on_socket_init(websocketpp::connection_hdl) { | |
92 | + m_socket_init = std::chrono::high_resolution_clock::now(); | |
93 | + } | |
94 | + | |
95 | + context_ptr on_tls_init(websocketpp::connection_hdl) { | |
96 | + m_tls_init = std::chrono::high_resolution_clock::now(); | |
97 | + context_ptr ctx = websocketpp::lib::make_shared<boost::asio::ssl::context>(boost::asio::ssl::context::tlsv1); | |
98 | + | |
99 | + try { | |
100 | + ctx->set_options(boost::asio::ssl::context::default_workarounds | | |
101 | + boost::asio::ssl::context::no_sslv2 | | |
102 | + boost::asio::ssl::context::no_sslv3 | | |
103 | + boost::asio::ssl::context::single_dh_use); | |
104 | + } catch (std::exception& e) { | |
105 | + std::cout << e.what() << std::endl; | |
106 | + } | |
107 | + return ctx; | |
108 | + } | |
109 | + | |
110 | + void on_fail(websocketpp::connection_hdl hdl) { | |
111 | + client::connection_ptr con = m_endpoint.get_con_from_hdl(hdl); | |
112 | + | |
113 | + std::cout << "Fail handler" << std::endl; | |
114 | + std::cout << con->get_state() << std::endl; | |
115 | + std::cout << con->get_local_close_code() << std::endl; | |
116 | + std::cout << con->get_local_close_reason() << std::endl; | |
117 | + std::cout << con->get_remote_close_code() << std::endl; | |
118 | + std::cout << con->get_remote_close_reason() << std::endl; | |
119 | + std::cout << con->get_ec() << " - " << con->get_ec().message() << std::endl; | |
120 | + } | |
121 | + | |
122 | + void on_open(websocketpp::connection_hdl hdl) { | |
123 | + m_open = std::chrono::high_resolution_clock::now(); | |
124 | + m_endpoint.send(hdl, "", websocketpp::frame::opcode::text); | |
125 | + } | |
126 | + void on_message(websocketpp::connection_hdl hdl, message_ptr) { | |
127 | + m_message = std::chrono::high_resolution_clock::now(); | |
128 | + m_endpoint.close(hdl,websocketpp::close::status::going_away,""); | |
129 | + } | |
130 | + void on_close(websocketpp::connection_hdl) { | |
131 | + m_close = std::chrono::high_resolution_clock::now(); | |
132 | + | |
133 | + std::cout << "Socket Init: " << std::chrono::duration_cast<dur_type>(m_socket_init-m_start).count() << std::endl; | |
134 | + std::cout << "TLS Init: " << std::chrono::duration_cast<dur_type>(m_tls_init-m_start).count() << std::endl; | |
135 | + std::cout << "Open: " << std::chrono::duration_cast<dur_type>(m_open-m_start).count() << std::endl; | |
136 | + std::cout << "Message: " << std::chrono::duration_cast<dur_type>(m_message-m_start).count() << std::endl; | |
137 | + std::cout << "Close: " << std::chrono::duration_cast<dur_type>(m_close-m_start).count() << std::endl; | |
138 | + } | |
139 | +private: | |
140 | + client m_endpoint; | |
141 | + | |
142 | + std::chrono::high_resolution_clock::time_point m_start; | |
143 | + std::chrono::high_resolution_clock::time_point m_socket_init; | |
144 | + std::chrono::high_resolution_clock::time_point m_tls_init; | |
145 | + std::chrono::high_resolution_clock::time_point m_open; | |
146 | + std::chrono::high_resolution_clock::time_point m_message; | |
147 | + std::chrono::high_resolution_clock::time_point m_close; | |
148 | +}; | |
149 | + | |
150 | +int main(int argc, char* argv[]) { | |
151 | + std::string uri = "wss://echo.websocket.org"; | |
152 | + | |
153 | + if (argc == 2) { | |
154 | + uri = argv[1]; | |
155 | + } | |
156 | + | |
157 | + try { | |
158 | + perftest endpoint; | |
159 | + endpoint.start(uri); | |
160 | + } catch (websocketpp::exception const & e) { | |
161 | + std::cout << e.what() << std::endl; | |
162 | + } catch (std::exception const & e) { | |
163 | + std::cout << e.what() << std::endl; | |
164 | + } catch (...) { | |
165 | + std::cout << "other exception" << std::endl; | |
166 | + } | |
167 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/debug_server/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +init_target (debug_server) | |
6 | + | |
7 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
8 | + | |
9 | +link_boost () | |
10 | +final_target () | |
11 | + | |
12 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | ... | ... |
3rdparty/websocketpp-0.8.2/examples/debug_server/SConscript
0 → 100644
1 | +## Debug server example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | + | |
10 | +env = env.Clone () | |
11 | +env_cpp11 = env_cpp11.Clone () | |
12 | + | |
13 | +prgs = [] | |
14 | + | |
15 | +# if a C++11 environment is available build using that, otherwise use boost | |
16 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
17 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] | |
18 | + prgs += env_cpp11.Program('debug_server', ["debug_server.cpp"], LIBS = ALL_LIBS) | |
19 | +else: | |
20 | + ALL_LIBS = boostlibs(['system'],env) + [platform_libs] + [polyfill_libs] | |
21 | + prgs += env.Program('debug_server', ["debug_server.cpp"], LIBS = ALL_LIBS) | |
22 | + | |
23 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/debug_server/debug_server.cpp
0 → 100644
1 | +/* | |
2 | + * Copyright (c) 2014, Peter Thorson. All rights reserved. | |
3 | + * | |
4 | + * Redistribution and use in source and binary forms, with or without | |
5 | + * modification, are permitted provided that the following conditions are met: | |
6 | + * * Redistributions of source code must retain the above copyright | |
7 | + * notice, this list of conditions and the following disclaimer. | |
8 | + * * Redistributions in binary form must reproduce the above copyright | |
9 | + * notice, this list of conditions and the following disclaimer in the | |
10 | + * documentation and/or other materials provided with the distribution. | |
11 | + * * Neither the name of the WebSocket++ Project nor the | |
12 | + * names of its contributors may be used to endorse or promote products | |
13 | + * derived from this software without specific prior written permission. | |
14 | + * | |
15 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
16 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 | + * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY | |
19 | + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
20 | + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
21 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
22 | + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
24 | + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | + */ | |
26 | + | |
27 | +/** ====== WARNING ======== | |
28 | + * This example is presently used as a scratch space. It may or may not be broken | |
29 | + * at any given time. | |
30 | + */ | |
31 | + | |
32 | +#include <websocketpp/config/debug_asio_no_tls.hpp> | |
33 | + | |
34 | +// Custom logger | |
35 | +#include <websocketpp/logger/syslog.hpp> | |
36 | + | |
37 | +#include <websocketpp/server.hpp> | |
38 | + | |
39 | +#include <iostream> | |
40 | + | |
41 | +//////////////////////////////////////////////////////////////////////////////// | |
42 | +///////////////// Custom Config for debugging custom policies ////////////////// | |
43 | +//////////////////////////////////////////////////////////////////////////////// | |
44 | + | |
45 | +struct debug_custom : public websocketpp::config::debug_asio { | |
46 | + typedef debug_custom type; | |
47 | + typedef debug_asio base; | |
48 | + | |
49 | + typedef base::concurrency_type concurrency_type; | |
50 | + | |
51 | + typedef base::request_type request_type; | |
52 | + typedef base::response_type response_type; | |
53 | + | |
54 | + typedef base::message_type message_type; | |
55 | + typedef base::con_msg_manager_type con_msg_manager_type; | |
56 | + typedef base::endpoint_msg_manager_type endpoint_msg_manager_type; | |
57 | + | |
58 | + /// Custom Logging policies | |
59 | + /*typedef websocketpp::log::syslog<concurrency_type, | |
60 | + websocketpp::log::elevel> elog_type; | |
61 | + typedef websocketpp::log::syslog<concurrency_type, | |
62 | + websocketpp::log::alevel> alog_type; | |
63 | + */ | |
64 | + typedef base::alog_type alog_type; | |
65 | + typedef base::elog_type elog_type; | |
66 | + | |
67 | + typedef base::rng_type rng_type; | |
68 | + | |
69 | + struct transport_config : public base::transport_config { | |
70 | + typedef type::concurrency_type concurrency_type; | |
71 | + typedef type::alog_type alog_type; | |
72 | + typedef type::elog_type elog_type; | |
73 | + typedef type::request_type request_type; | |
74 | + typedef type::response_type response_type; | |
75 | + typedef websocketpp::transport::asio::basic_socket::endpoint | |
76 | + socket_type; | |
77 | + }; | |
78 | + | |
79 | + typedef websocketpp::transport::asio::endpoint<transport_config> | |
80 | + transport_type; | |
81 | + | |
82 | + static const long timeout_open_handshake = 0; | |
83 | +}; | |
84 | + | |
85 | +//////////////////////////////////////////////////////////////////////////////// | |
86 | + | |
87 | +typedef websocketpp::server<debug_custom> server; | |
88 | + | |
89 | +using websocketpp::lib::placeholders::_1; | |
90 | +using websocketpp::lib::placeholders::_2; | |
91 | +using websocketpp::lib::bind; | |
92 | + | |
93 | +// pull out the type of messages sent by our config | |
94 | +typedef server::message_ptr message_ptr; | |
95 | + | |
96 | +bool validate(server *, websocketpp::connection_hdl) { | |
97 | + //sleep(6); | |
98 | + return true; | |
99 | +} | |
100 | + | |
101 | +void on_http(server* s, websocketpp::connection_hdl hdl) { | |
102 | + server::connection_ptr con = s->get_con_from_hdl(hdl); | |
103 | + | |
104 | + std::string res = con->get_request_body(); | |
105 | + | |
106 | + std::stringstream ss; | |
107 | + ss << "got HTTP request with " << res.size() << " bytes of body data."; | |
108 | + | |
109 | + con->set_body(ss.str()); | |
110 | + con->set_status(websocketpp::http::status_code::ok); | |
111 | +} | |
112 | + | |
113 | +void on_fail(server* s, websocketpp::connection_hdl hdl) { | |
114 | + server::connection_ptr con = s->get_con_from_hdl(hdl); | |
115 | + | |
116 | + std::cout << "Fail handler: " << con->get_ec() << " " << con->get_ec().message() << std::endl; | |
117 | +} | |
118 | + | |
119 | +void on_close(websocketpp::connection_hdl) { | |
120 | + std::cout << "Close handler" << std::endl; | |
121 | +} | |
122 | + | |
123 | +// Define a callback to handle incoming messages | |
124 | +void on_message(server* s, websocketpp::connection_hdl hdl, message_ptr msg) { | |
125 | + std::cout << "on_message called with hdl: " << hdl.lock().get() | |
126 | + << " and message: " << msg->get_payload() | |
127 | + << std::endl; | |
128 | + | |
129 | + try { | |
130 | + s->send(hdl, msg->get_payload(), msg->get_opcode()); | |
131 | + } catch (websocketpp::exception const & e) { | |
132 | + std::cout << "Echo failed because: " | |
133 | + << "(" << e.what() << ")" << std::endl; | |
134 | + } | |
135 | +} | |
136 | + | |
137 | +int main() { | |
138 | + // Create a server endpoint | |
139 | + server echo_server; | |
140 | + | |
141 | + try { | |
142 | + // Set logging settings | |
143 | + echo_server.set_access_channels(websocketpp::log::alevel::all); | |
144 | + echo_server.clear_access_channels(websocketpp::log::alevel::frame_payload); | |
145 | + | |
146 | + // Initialize ASIO | |
147 | + echo_server.init_asio(); | |
148 | + echo_server.set_reuse_addr(true); | |
149 | + | |
150 | + // Register our message handler | |
151 | + echo_server.set_message_handler(bind(&on_message,&echo_server,::_1,::_2)); | |
152 | + | |
153 | + echo_server.set_http_handler(bind(&on_http,&echo_server,::_1)); | |
154 | + echo_server.set_fail_handler(bind(&on_fail,&echo_server,::_1)); | |
155 | + echo_server.set_close_handler(&on_close); | |
156 | + | |
157 | + echo_server.set_validate_handler(bind(&validate,&echo_server,::_1)); | |
158 | + | |
159 | + // Listen on port 9012 | |
160 | + echo_server.listen(9012); | |
161 | + | |
162 | + // Start the server accept loop | |
163 | + echo_server.start_accept(); | |
164 | + | |
165 | + // Start the ASIO io_service run loop | |
166 | + echo_server.run(); | |
167 | + } catch (websocketpp::exception const & e) { | |
168 | + std::cout << e.what() << std::endl; | |
169 | + } catch (const std::exception & e) { | |
170 | + std::cout << e.what() << std::endl; | |
171 | + } catch (...) { | |
172 | + std::cout << "other exception" << std::endl; | |
173 | + } | |
174 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/dev/CMakeLists.txt
0 → 100644
3rdparty/websocketpp-0.8.2/examples/dev/SConscript
0 → 100644
1 | +## Main development example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | + | |
10 | +env_cpp11 = env_cpp11.Clone () | |
11 | + | |
12 | +prgs = [] | |
13 | + | |
14 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
15 | + BOOST_LIBS_CPP11 = boostlibs(['unit_test_framework','system','timer','chrono'],env_cpp11) + [platform_libs] + [polyfill_libs] | |
16 | + prgs += env_cpp11.Program('main', ["main.cpp"], LIBS = BOOST_LIBS_CPP11) | |
17 | + | |
18 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/dev/main.cpp
0 → 100644
1 | +//#ifndef _WEBSOCKETPP_CPP11_STL_ | |
2 | +// #define _WEBSOCKETPP_CPP11_STL_ | |
3 | +//#endif | |
4 | + | |
5 | +#include <random> | |
6 | +#include <boost/timer/timer.hpp> | |
7 | + | |
8 | +#include <websocketpp/config/core.hpp> | |
9 | + | |
10 | +//#include <websocketpp/security/none.hpp> | |
11 | + | |
12 | +//#include <websocketpp/concurrency/none.hpp> | |
13 | +//#include <websocketpp/concurrency/stl.hpp> | |
14 | + | |
15 | +//#include <websocketpp/transport/iostream.hpp> | |
16 | +#include <websocketpp/server.hpp> | |
17 | + | |
18 | +#include <iostream> | |
19 | +#include <sstream> | |
20 | + | |
21 | +//typedef websocketpp::concurrency::stl concurrency; | |
22 | +//typedef websocketpp::transport::iostream<concurrency> transport; | |
23 | +//typedef websocketpp::server<concurrency,transport> server; | |
24 | +typedef websocketpp::server<websocketpp::config::core> server; | |
25 | + | |
26 | +/*class handler : public server::handler { | |
27 | + bool validate(connection_ptr con) { | |
28 | + std::cout << "handler validate" << std::endl; | |
29 | + if (con->get_origin() != "http://www.example.com") { | |
30 | + con->set_status(websocketpp::http::status_code::FORBIDDEN); | |
31 | + return false; | |
32 | + } | |
33 | + return true; | |
34 | + } | |
35 | + | |
36 | + void http(connection_ptr con) { | |
37 | + std::cout << "handler http" << std::endl; | |
38 | + } | |
39 | + | |
40 | + void on_load(connection_ptr con, ptr old_handler) { | |
41 | + std::cout << "handler on_load" << std::endl; | |
42 | + } | |
43 | + void on_unload(connection_ptr con, ptr new_handler) { | |
44 | + std::cout << "handler on_unload" << std::endl; | |
45 | + } | |
46 | + | |
47 | + void on_open(connection_ptr con) { | |
48 | + std::cout << "handler on_open" << std::endl; | |
49 | + } | |
50 | + void on_fail(connection_ptr con) { | |
51 | + std::cout << "handler on_fail" << std::endl; | |
52 | + } | |
53 | + | |
54 | + void on_message(connection_ptr con, message_ptr msg) { | |
55 | + std::cout << "handler on_message" << std::endl; | |
56 | + | |
57 | + | |
58 | + } | |
59 | + | |
60 | + void on_close(connection_ptr con) { | |
61 | + std::cout << "handler on_close" << std::endl; | |
62 | + } | |
63 | +};*/ | |
64 | + | |
65 | +int main() { | |
66 | + typedef websocketpp::message_buffer::message<websocketpp::message_buffer::alloc::con_msg_manager> | |
67 | + message_type; | |
68 | + typedef websocketpp::message_buffer::alloc::con_msg_manager<message_type> | |
69 | + con_msg_man_type; | |
70 | + | |
71 | + con_msg_man_type::ptr manager = websocketpp::lib::make_shared<con_msg_man_type>(); | |
72 | + | |
73 | + size_t foo = 1024; | |
74 | + | |
75 | + message_type::ptr input = manager->get_message(websocketpp::frame::opcode::TEXT,foo); | |
76 | + message_type::ptr output = manager->get_message(websocketpp::frame::opcode::TEXT,foo); | |
77 | + websocketpp::frame::masking_key_type key; | |
78 | + | |
79 | + std::random_device dev; | |
80 | + | |
81 | + | |
82 | + | |
83 | + key.i = 0x12345678; | |
84 | + | |
85 | + double m = 18094238402394.0824923; | |
86 | + | |
87 | + /*std::cout << "Some Math" << std::endl; | |
88 | + { | |
89 | + boost::timer::auto_cpu_timer t; | |
90 | + | |
91 | + for (int i = 0; i < foo; i++) { | |
92 | + m /= 1.001; | |
93 | + } | |
94 | + | |
95 | + }*/ | |
96 | + | |
97 | + std::cout << m << std::endl; | |
98 | + | |
99 | + std::cout << "Random Gen" << std::endl; | |
100 | + { | |
101 | + boost::timer::auto_cpu_timer t; | |
102 | + | |
103 | + input->get_raw_payload().replace(0,foo,foo,'\0'); | |
104 | + output->get_raw_payload().replace(0,foo,foo,'\0'); | |
105 | + } | |
106 | + | |
107 | + std::cout << "Out of place accelerated" << std::endl; | |
108 | + { | |
109 | + boost::timer::auto_cpu_timer t; | |
110 | + | |
111 | + websocketpp::frame::word_mask_exact(reinterpret_cast<uint8_t*>(const_cast<char*>(input->get_raw_payload().data())), reinterpret_cast<uint8_t*>(const_cast<char*>(output->get_raw_payload().data())), foo, key); | |
112 | + } | |
113 | + | |
114 | + std::cout << websocketpp::utility::to_hex(input->get_payload().c_str(),20) << std::endl; | |
115 | + std::cout << websocketpp::utility::to_hex(output->get_payload().c_str(),20) << std::endl; | |
116 | + | |
117 | + input->get_raw_payload().replace(0,foo,foo,'\0'); | |
118 | + output->get_raw_payload().replace(0,foo,foo,'\0'); | |
119 | + | |
120 | + std::cout << "In place accelerated" << std::endl; | |
121 | + { | |
122 | + boost::timer::auto_cpu_timer t; | |
123 | + | |
124 | + websocketpp::frame::word_mask_exact(reinterpret_cast<uint8_t*>(const_cast<char*>(input->get_raw_payload().data())), reinterpret_cast<uint8_t*>(const_cast<char*>(input->get_raw_payload().data())), foo, key); | |
125 | + } | |
126 | + | |
127 | + std::cout << websocketpp::utility::to_hex(input->get_payload().c_str(),20) << std::endl; | |
128 | + std::cout << websocketpp::utility::to_hex(output->get_payload().c_str(),20) << std::endl; | |
129 | + | |
130 | + input->get_raw_payload().replace(0,foo,foo,'\0'); | |
131 | + output->get_raw_payload().replace(0,foo,foo,'\0'); | |
132 | + std::cout << "Out of place byte by byte" << std::endl; | |
133 | + { | |
134 | + boost::timer::auto_cpu_timer t; | |
135 | + | |
136 | + websocketpp::frame::byte_mask(input->get_raw_payload().begin(), input->get_raw_payload().end(), output->get_raw_payload().begin(), key); | |
137 | + } | |
138 | + | |
139 | + std::cout << websocketpp::utility::to_hex(input->get_payload().c_str(),20) << std::endl; | |
140 | + std::cout << websocketpp::utility::to_hex(output->get_payload().c_str(),20) << std::endl; | |
141 | + | |
142 | + input->get_raw_payload().replace(0,foo,foo,'\0'); | |
143 | + output->get_raw_payload().replace(0,foo,foo,'\0'); | |
144 | + std::cout << "In place byte by byte" << std::endl; | |
145 | + { | |
146 | + boost::timer::auto_cpu_timer t; | |
147 | + | |
148 | + websocketpp::frame::byte_mask(input->get_raw_payload().begin(), input->get_raw_payload().end(), input->get_raw_payload().begin(), key); | |
149 | + } | |
150 | + | |
151 | + std::cout << websocketpp::utility::to_hex(input->get_payload().c_str(),20) << std::endl; | |
152 | + std::cout << websocketpp::utility::to_hex(output->get_payload().c_str(),20) << std::endl; | |
153 | + | |
154 | + input->get_raw_payload().replace(0,foo,foo,'a'); | |
155 | + output->get_raw_payload().replace(0,foo,foo,'b'); | |
156 | + std::cout << "Copy" << std::endl; | |
157 | + { | |
158 | + boost::timer::auto_cpu_timer t; | |
159 | + | |
160 | + std::copy(input->get_raw_payload().begin(), input->get_raw_payload().end(), output->get_raw_payload().begin()); | |
161 | + } | |
162 | + | |
163 | + std::cout << websocketpp::utility::to_hex(input->get_payload().c_str(),20) << std::endl; | |
164 | + std::cout << websocketpp::utility::to_hex(output->get_payload().c_str(),20) << std::endl; | |
165 | + | |
166 | + /*server::handler::ptr h(new handler()); | |
167 | + | |
168 | + server test_server(h); | |
169 | + server::connection_ptr con; | |
170 | + | |
171 | + std::stringstream output; | |
172 | + | |
173 | + test_server.register_ostream(&output); | |
174 | + | |
175 | + con = test_server.get_connection(); | |
176 | + | |
177 | + con->start(); | |
178 | + | |
179 | + //foo.handle_accept(con,true); | |
180 | + | |
181 | + std::stringstream input; | |
182 | + input << "GET / HTTP/1.1\r\nHost: www.example.com\r\nConnection: Upgrade\r\nUpgrade: websocket\r\nSec-WebSocket-Version: 13\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\nOrigin: http://www.example.com\r\n\r\n"; | |
183 | + //input << "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n"; | |
184 | + input >> *con; | |
185 | + | |
186 | + std::stringstream input2; | |
187 | + input2 << "messageabc2"; | |
188 | + input2 >> *con; | |
189 | + | |
190 | + std::stringstream input3; | |
191 | + input3 << "messageabc3"; | |
192 | + input3 >> *con; | |
193 | + | |
194 | + std::stringstream input4; | |
195 | + input4 << "close"; | |
196 | + input4 >> *con; | |
197 | + | |
198 | + std::cout << "connection output:" << std::endl; | |
199 | + std::cout << output.str() << std::endl;*/ | |
200 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/echo_client/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +init_target (echo_client) | |
6 | + | |
7 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
8 | + | |
9 | +link_boost () | |
10 | +final_target () | |
11 | + | |
12 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | ... | ... |
3rdparty/websocketpp-0.8.2/examples/echo_client/SConscript
0 → 100644
1 | +## echo_client example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | + | |
10 | +env = env.Clone () | |
11 | +env_cpp11 = env_cpp11.Clone () | |
12 | + | |
13 | +prgs = [] | |
14 | + | |
15 | +# if a C++11 environment is available build using that, otherwise use boost | |
16 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
17 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] + ['z'] | |
18 | + prgs += env_cpp11.Program('echo_client', ["echo_client.cpp"], LIBS = ALL_LIBS) | |
19 | +else: | |
20 | + ALL_LIBS = boostlibs(['system','random'],env) + [platform_libs] + [polyfill_libs] + ['z'] | |
21 | + prgs += env.Program('echo_client', ["echo_client.cpp"], LIBS = ALL_LIBS) | |
22 | + | |
23 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/echo_client/echo_client.cpp
0 → 100644
1 | +/* | |
2 | + * Copyright (c) 2016, Peter Thorson. All rights reserved. | |
3 | + * | |
4 | + * Redistribution and use in source and binary forms, with or without | |
5 | + * modification, are permitted provided that the following conditions are met: | |
6 | + * * Redistributions of source code must retain the above copyright | |
7 | + * notice, this list of conditions and the following disclaimer. | |
8 | + * * Redistributions in binary form must reproduce the above copyright | |
9 | + * notice, this list of conditions and the following disclaimer in the | |
10 | + * documentation and/or other materials provided with the distribution. | |
11 | + * * Neither the name of the WebSocket++ Project nor the | |
12 | + * names of its contributors may be used to endorse or promote products | |
13 | + * derived from this software without specific prior written permission. | |
14 | + * | |
15 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
16 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 | + * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY | |
19 | + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
20 | + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
21 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
22 | + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
24 | + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | + * | |
26 | + */ | |
27 | + | |
28 | +#include <websocketpp/config/asio_no_tls_client.hpp> | |
29 | +#include <websocketpp/client.hpp> | |
30 | + | |
31 | +#include <iostream> | |
32 | + | |
33 | +typedef websocketpp::client<websocketpp::config::asio_client> client; | |
34 | + | |
35 | +using websocketpp::lib::placeholders::_1; | |
36 | +using websocketpp::lib::placeholders::_2; | |
37 | +using websocketpp::lib::bind; | |
38 | + | |
39 | +// pull out the type of messages sent by our config | |
40 | +typedef websocketpp::config::asio_client::message_type::ptr message_ptr; | |
41 | + | |
42 | +// This message handler will be invoked once for each incoming message. It | |
43 | +// prints the message and then sends a copy of the message back to the server. | |
44 | +void on_message(client* c, websocketpp::connection_hdl hdl, message_ptr msg) { | |
45 | + std::cout << "on_message called with hdl: " << hdl.lock().get() | |
46 | + << " and message: " << msg->get_payload() | |
47 | + << std::endl; | |
48 | + | |
49 | + | |
50 | + websocketpp::lib::error_code ec; | |
51 | + | |
52 | + c->send(hdl, msg->get_payload(), msg->get_opcode(), ec); | |
53 | + if (ec) { | |
54 | + std::cout << "Echo failed because: " << ec.message() << std::endl; | |
55 | + } | |
56 | +} | |
57 | + | |
58 | +int main(int argc, char* argv[]) { | |
59 | + // Create a client endpoint | |
60 | + client c; | |
61 | + | |
62 | + std::string uri = "ws://localhost:9002"; | |
63 | + | |
64 | + if (argc == 2) { | |
65 | + uri = argv[1]; | |
66 | + } | |
67 | + | |
68 | + try { | |
69 | + // Set logging to be pretty verbose (everything except message payloads) | |
70 | + c.set_access_channels(websocketpp::log::alevel::all); | |
71 | + c.clear_access_channels(websocketpp::log::alevel::frame_payload); | |
72 | + | |
73 | + // Initialize ASIO | |
74 | + c.init_asio(); | |
75 | + | |
76 | + // Register our message handler | |
77 | + c.set_message_handler(bind(&on_message,&c,::_1,::_2)); | |
78 | + | |
79 | + websocketpp::lib::error_code ec; | |
80 | + client::connection_ptr con = c.get_connection(uri, ec); | |
81 | + if (ec) { | |
82 | + std::cout << "could not create connection because: " << ec.message() << std::endl; | |
83 | + return 0; | |
84 | + } | |
85 | + | |
86 | + // Note that connect here only requests a connection. No network messages are | |
87 | + // exchanged until the event loop starts running in the next line. | |
88 | + c.connect(con); | |
89 | + | |
90 | + // Start the ASIO io_service run loop | |
91 | + // this will cause a single connection to be made to the server. c.run() | |
92 | + // will exit when this connection is closed. | |
93 | + c.run(); | |
94 | + } catch (websocketpp::exception const & e) { | |
95 | + std::cout << e.what() << std::endl; | |
96 | + } | |
97 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/echo_server/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +init_target (echo_server) | |
6 | + | |
7 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
8 | + | |
9 | +link_boost () | |
10 | +final_target () | |
11 | + | |
12 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | ... | ... |
3rdparty/websocketpp-0.8.2/examples/echo_server/SConscript
0 → 100644
1 | +## Main development example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | + | |
10 | +env = env.Clone () | |
11 | +env_cpp11 = env_cpp11.Clone () | |
12 | + | |
13 | +prgs = [] | |
14 | + | |
15 | +# if a C++11 environment is available build using that, otherwise use boost | |
16 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
17 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] | |
18 | + prgs += env_cpp11.Program('echo_server', ["echo_server.cpp"], LIBS = ALL_LIBS) | |
19 | +else: | |
20 | + ALL_LIBS = boostlibs(['system'],env) + [platform_libs] + [polyfill_libs] | |
21 | + prgs += env.Program('echo_server', ["echo_server.cpp"], LIBS = ALL_LIBS) | |
22 | + | |
23 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/echo_server/echo_handler.hpp
0 → 100644
1 | +/* | |
2 | + * Copyright (c) 2012, Peter Thorson. All rights reserved. | |
3 | + * | |
4 | + * Redistribution and use in source and binary forms, with or without | |
5 | + * modification, are permitted provided that the following conditions are met: | |
6 | + * * Redistributions of source code must retain the above copyright | |
7 | + * notice, this list of conditions and the following disclaimer. | |
8 | + * * Redistributions in binary form must reproduce the above copyright | |
9 | + * notice, this list of conditions and the following disclaimer in the | |
10 | + * documentation and/or other materials provided with the distribution. | |
11 | + * * Neither the name of the WebSocket++ Project nor the | |
12 | + * names of its contributors may be used to endorse or promote products | |
13 | + * derived from this software without specific prior written permission. | |
14 | + * | |
15 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
16 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 | + * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY | |
19 | + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
20 | + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
21 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
22 | + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
24 | + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | + * | |
26 | + */ | |
27 | + | |
28 | +#ifndef WEBSOCKETPP_ECHO_SERVER_HANDLER_HPP | |
29 | +#define WEBSOCKETPP_ECHO_SERVER_HANDLER_HPP | |
30 | + | |
31 | +class echo_handler : public server::handler { | |
32 | + void on_message(connection_ptr con, std::string msg) { | |
33 | + con->write(msg); | |
34 | + } | |
35 | +}; | |
36 | + | |
37 | +#endif // WEBSOCKETPP_ECHO_SERVER_HANDLER_HPP | ... | ... |
3rdparty/websocketpp-0.8.2/examples/echo_server/echo_server.cpp
0 → 100644
1 | +#include <websocketpp/config/asio_no_tls.hpp> | |
2 | + | |
3 | +#include <websocketpp/server.hpp> | |
4 | + | |
5 | +#include <iostream> | |
6 | + | |
7 | +typedef websocketpp::server<websocketpp::config::asio> server; | |
8 | + | |
9 | +using websocketpp::lib::placeholders::_1; | |
10 | +using websocketpp::lib::placeholders::_2; | |
11 | +using websocketpp::lib::bind; | |
12 | + | |
13 | +// pull out the type of messages sent by our config | |
14 | +typedef server::message_ptr message_ptr; | |
15 | + | |
16 | +// Define a callback to handle incoming messages | |
17 | +void on_message(server* s, websocketpp::connection_hdl hdl, message_ptr msg) { | |
18 | + std::cout << "on_message called with hdl: " << hdl.lock().get() | |
19 | + << " and message: " << msg->get_payload() | |
20 | + << std::endl; | |
21 | + | |
22 | + // check for a special command to instruct the server to stop listening so | |
23 | + // it can be cleanly exited. | |
24 | + if (msg->get_payload() == "stop-listening") { | |
25 | + s->stop_listening(); | |
26 | + return; | |
27 | + } | |
28 | + | |
29 | + try { | |
30 | + s->send(hdl, msg->get_payload(), msg->get_opcode()); | |
31 | + } catch (websocketpp::exception const & e) { | |
32 | + std::cout << "Echo failed because: " | |
33 | + << "(" << e.what() << ")" << std::endl; | |
34 | + } | |
35 | +} | |
36 | + | |
37 | +int main() { | |
38 | + // Create a server endpoint | |
39 | + server echo_server; | |
40 | + | |
41 | + try { | |
42 | + // Set logging settings | |
43 | + echo_server.set_access_channels(websocketpp::log::alevel::all); | |
44 | + echo_server.clear_access_channels(websocketpp::log::alevel::frame_payload); | |
45 | + | |
46 | + // Initialize Asio | |
47 | + echo_server.init_asio(); | |
48 | + | |
49 | + // Register our message handler | |
50 | + echo_server.set_message_handler(bind(&on_message,&echo_server,::_1,::_2)); | |
51 | + | |
52 | + // Listen on port 9002 | |
53 | + echo_server.listen(9002); | |
54 | + | |
55 | + // Start the server accept loop | |
56 | + echo_server.start_accept(); | |
57 | + | |
58 | + // Start the ASIO io_service run loop | |
59 | + echo_server.run(); | |
60 | + } catch (websocketpp::exception const & e) { | |
61 | + std::cout << e.what() << std::endl; | |
62 | + } catch (...) { | |
63 | + std::cout << "other exception" << std::endl; | |
64 | + } | |
65 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/echo_server_both/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | + | |
6 | +if (OPENSSL_FOUND) | |
7 | + | |
8 | +init_target (echo_server_both) | |
9 | + | |
10 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
11 | + | |
12 | +link_boost () | |
13 | +link_openssl() | |
14 | +final_target () | |
15 | + | |
16 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | |
17 | + | |
18 | +endif() | ... | ... |
3rdparty/websocketpp-0.8.2/examples/echo_server_both/SConscript
0 → 100644
1 | +## Combo plain+tls echo server | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | +Import('tls_libs') | |
10 | + | |
11 | +env = env.Clone () | |
12 | +env_cpp11 = env_cpp11.Clone () | |
13 | + | |
14 | +prgs = [] | |
15 | + | |
16 | +# if a C++11 environment is available build using that, otherwise use boost | |
17 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
18 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] + [tls_libs] | |
19 | + prgs += env_cpp11.Program('echo_server_both', ["echo_server_both.cpp"], LIBS = ALL_LIBS) | |
20 | +else: | |
21 | + ALL_LIBS = boostlibs(['system'],env) + [platform_libs] + [polyfill_libs] + [tls_libs] | |
22 | + prgs += env.Program('echo_server_both', ["echo_server_both.cpp"], LIBS = ALL_LIBS) | |
23 | + | |
24 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/echo_server_both/echo_server_both.cpp
0 → 100644
1 | +#include <websocketpp/config/asio.hpp> | |
2 | +#include <websocketpp/server.hpp> | |
3 | + | |
4 | +#include <iostream> | |
5 | + | |
6 | +// define types for two different server endpoints, one for each config we are | |
7 | +// using | |
8 | +typedef websocketpp::server<websocketpp::config::asio> server_plain; | |
9 | +typedef websocketpp::server<websocketpp::config::asio_tls> server_tls; | |
10 | + | |
11 | +// alias some of the bind related functions as they are a bit long | |
12 | +using websocketpp::lib::placeholders::_1; | |
13 | +using websocketpp::lib::placeholders::_2; | |
14 | +using websocketpp::lib::bind; | |
15 | + | |
16 | +// type of the ssl context pointer is long so alias it | |
17 | +typedef websocketpp::lib::shared_ptr<boost::asio::ssl::context> context_ptr; | |
18 | + | |
19 | +// The shared on_message handler takes a template parameter so the function can | |
20 | +// resolve any endpoint dependent types like message_ptr or connection_ptr | |
21 | +template <typename EndpointType> | |
22 | +void on_message(EndpointType* s, websocketpp::connection_hdl hdl, | |
23 | + typename EndpointType::message_ptr msg) | |
24 | +{ | |
25 | + std::cout << "on_message called with hdl: " << hdl.lock().get() | |
26 | + << " and message: " << msg->get_payload() | |
27 | + << std::endl; | |
28 | + | |
29 | + try { | |
30 | + s->send(hdl, msg->get_payload(), msg->get_opcode()); | |
31 | + } catch (websocketpp::exception const & e) { | |
32 | + std::cout << "Echo failed because: " | |
33 | + << "(" << e.what() << ")" << std::endl; | |
34 | + } | |
35 | +} | |
36 | + | |
37 | +// No change to TLS init methods from echo_server_tls | |
38 | +std::string get_password() { | |
39 | + return "test"; | |
40 | +} | |
41 | + | |
42 | +context_ptr on_tls_init(websocketpp::connection_hdl hdl) { | |
43 | + std::cout << "on_tls_init called with hdl: " << hdl.lock().get() << std::endl; | |
44 | + context_ptr ctx(new boost::asio::ssl::context(boost::asio::ssl::context::tlsv1)); | |
45 | + | |
46 | + try { | |
47 | + ctx->set_options(boost::asio::ssl::context::default_workarounds | | |
48 | + boost::asio::ssl::context::no_sslv2 | | |
49 | + boost::asio::ssl::context::no_sslv3 | | |
50 | + boost::asio::ssl::context::single_dh_use); | |
51 | + ctx->set_password_callback(bind(&get_password)); | |
52 | + ctx->use_certificate_chain_file("server.pem"); | |
53 | + ctx->use_private_key_file("server.pem", boost::asio::ssl::context::pem); | |
54 | + } catch (std::exception& e) { | |
55 | + std::cout << e.what() << std::endl; | |
56 | + } | |
57 | + return ctx; | |
58 | +} | |
59 | + | |
60 | +int main() { | |
61 | + // set up an external io_service to run both endpoints on. This is not | |
62 | + // strictly necessary, but simplifies thread management a bit. | |
63 | + boost::asio::io_service ios; | |
64 | + | |
65 | + // set up plain endpoint | |
66 | + server_plain endpoint_plain; | |
67 | + // initialize asio with our external io_service rather than an internal one | |
68 | + endpoint_plain.init_asio(&ios); | |
69 | + endpoint_plain.set_message_handler( | |
70 | + bind(&on_message<server_plain>,&endpoint_plain,::_1,::_2)); | |
71 | + endpoint_plain.listen(80); | |
72 | + endpoint_plain.start_accept(); | |
73 | + | |
74 | + // set up tls endpoint | |
75 | + server_tls endpoint_tls; | |
76 | + endpoint_tls.init_asio(&ios); | |
77 | + endpoint_tls.set_message_handler( | |
78 | + bind(&on_message<server_tls>,&endpoint_tls,::_1,::_2)); | |
79 | + // TLS endpoint has an extra handler for the tls init | |
80 | + endpoint_tls.set_tls_init_handler(bind(&on_tls_init,::_1)); | |
81 | + // tls endpoint listens on a different port | |
82 | + endpoint_tls.listen(443); | |
83 | + endpoint_tls.start_accept(); | |
84 | + | |
85 | + // Start the ASIO io_service run loop running both endpoints | |
86 | + ios.run(); | |
87 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/echo_server_both/server.pem
0 → 100644
1 | +-----BEGIN RSA PRIVATE KEY----- | |
2 | +Proc-Type: 4,ENCRYPTED | |
3 | +DEK-Info: DES-EDE3-CBC,A0ED66EF872A48A9 | |
4 | + | |
5 | +gXuvKojXzApVhhPVNdRliiajbC4PtwQG5c8TA7JADLgwOR7o9t6KtXEr37bDRpvB | |
6 | +9aO9P+SJaK5OOp3XKPGthOdqv+tvCRTlmzmC8GjPLBX389DWT2xoGu7JkGwDtdSm | |
7 | +rnF49Rlp5bfjpACk5xKNiKeDo1CWfeEJzw9Kto0g+5eMaEdors64oPzjXs3geA2g | |
8 | +TxCJSHv9qSX6++pCLKKCUTbyzidAxV/Zb0AAubt5V40QKqX4HhSwwstFnTaX3tlb | |
9 | +3QOdY+y04VIkM6d7qN5W8M7NzRkMpZ1qBpQcUMpkhQcRzWP2wub5AAff9D2GntRd | |
10 | +4Dz1vn3u41U3Okdr0CNj+iH7byCzuokoAhk6ZQEN6WB+GTpGgfBXdtUZrfpb0MKm | |
11 | +UNYP5AF2AmUqJRXhViTDVtu/V2tHF3LGuNT+W2Dz+spFZEq0byEO0N858eR0dikc | |
12 | +6jOASvNQbSwD0+mkgBC1gXKKU3ngj2gpJUwljeACdWFd8N2egrZfyI05CmX7vPNC | |
13 | +NXbs7k2buWNdjP4/D8IM+HDVidWzQa/kG/qokXKqllem9Egg37lUucwnP3cX2/Hw | |
14 | +U2mfaBWzeZtqc+GqRp08rYIql+Reai3sUYlQMnNk01prVY47UQb+dxuqjaxGV5Xx | |
15 | +Xkx0s2mfQnNRjL4S7Hjhqelufi6GpkCQ2EGsPpA+6K1ztZ0ame9Q2BE1SXeM/6vU | |
16 | +rxT5nRrCxueyXAyQSGcqMX9//gSeK8WWBqG/c1IAMVDa0NWrJeOJhSziE+ta3B0m | |
17 | +bHAPBY6vh0iB3lLdRlbUOPbC6R1TpxMOs+6Vbs2+OTifFpvOVymEoZq/nroyg68P | |
18 | +vn5uCKogwWA7o8EArf/UTlIwWJmH9bgILdZKld4wMel2HQg16RDzm+mEXAJi52a/ | |
19 | +FC+fgfphdxltmUJ+rqOyR4AHULjaTWUQqTIB6sdlzgmES1nXAiE71zX//KFqomar | |
20 | +O60SPPk3C1bs0x5DsvmGJa8SIfDhyd+D7NPyqwEKqrZsaotYGklNkfqxa6pa8mrc | |
21 | +ejxquW1PK4FvBk26+osu5a90Jih0PcQM7DUMMr2WHdTiMSXWAiK2ToYF8Itt25Qv | |
22 | +Cd0CsSYw9CJkXNr1u1+mObheaY9QYOmztnSJLy4ZO2JsMhqNwuAueIcwmhXOREq7 | |
23 | +kzlnGMgJcuSeAS/OBNj8Zgx0c7QQ0kzc+YmnOCsqoMtPsu/CsXJ4iJiM3Tki/2jT | |
24 | +bywrTiQwE6R3a/87GREOREX+WLicZBWX3k9/4tBL5XSe1p5wPpuIRQUDvAGNfNHP | |
25 | +JN7kujDF4SehilF1qtvCygAwvxHFDj+EwhXKNDKJzoZZIM15rAk3k92n2j6nz1qH | |
26 | +a3xOU05yydOlO6F6w51I1QoDddmkzCRNB0TeO3D6rekHsCK1aDWmC+qRcm2ZFtVz | |
27 | +sY6fdZN2NEmMQokIh9Opi1f8CSYSizPESMzdu2SF0xVO9n/IGIkn1ksK04O2BZo0 | |
28 | +X3LBPHLfCRsQNY1eF17bj07fYU2oPZKs/XzJiwxkqK6LFvpeAVaYrtg9fqRO/UVe | |
29 | +QhUIj3BL550ocEpa15xLehLrmwzYiW5zwGjSHQ4EgZluGLCwyKGTh4QswEJRA9Rt | |
30 | +-----END RSA PRIVATE KEY----- | |
31 | +-----BEGIN CERTIFICATE----- | |
32 | +MIIE0DCCA7igAwIBAgIJAM5MuKJezXq0MA0GCSqGSIb3DQEBBQUAMIGgMQswCQYD | |
33 | +VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xGDAW | |
34 | +BgNVBAoTD1phcGhveWQgU3R1ZGlvczEUMBIGA1UECxMLV2ViU29ja2V0KysxFjAU | |
35 | +BgNVBAMTDVBldGVyIFRob3Jzb24xJDAiBgkqhkiG9w0BCQEWFXdlYm1hc3RlckB6 | |
36 | +YXBob3lkLmNvbTAeFw0xMTExMTUyMTIwMDZaFw0xMjExMTQyMTIwMDZaMIGgMQsw | |
37 | +CQYDVQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28x | |
38 | +GDAWBgNVBAoTD1phcGhveWQgU3R1ZGlvczEUMBIGA1UECxMLV2ViU29ja2V0Kysx | |
39 | +FjAUBgNVBAMTDVBldGVyIFRob3Jzb24xJDAiBgkqhkiG9w0BCQEWFXdlYm1hc3Rl | |
40 | +ckB6YXBob3lkLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANR0 | |
41 | +tdwAnIB8I9qRZ7QbzEWY95RpM7GIn0u/9oH90PzdHiE0rXSkKT+yw3XUzH0iw5t0 | |
42 | +5dEwSC+srSP5Vm4cA6kXc94agVVaPW89tGcdP4fHptCruSrzQsDXELCPl5UUvMpA | |
43 | +YUcGisdXYPN/EeOoqb9wKWxoW5mREsyyeWWS89fYN5qU/d0QpbSvEWghqLbL/ZS2 | |
44 | +hOlXT9LufOeA+vHiV1/T/h5xC7ecIH02YDQw1EnqxbPmkLPcWThztLS9FiufNDRM | |
45 | +Rhcoaj2b9VDHvDwdbeA0T5v5qNdG34LaapYOelxzQMOtM0f9Dgqehodyxl2qm9mR | |
46 | +lq432dlOEzDnVCPNHwECAwEAAaOCAQkwggEFMB0GA1UdDgQWBBTTPKfNMnKOykhv | |
47 | ++vKS7vql5JsMyzCB1QYDVR0jBIHNMIHKgBTTPKfNMnKOykhv+vKS7vql5JsMy6GB | |
48 | +pqSBozCBoDELMAkGA1UEBhMCVVMxETAPBgNVBAgTCElsbGlub2lzMRAwDgYDVQQH | |
49 | +EwdDaGljYWdvMRgwFgYDVQQKEw9aYXBob3lkIFN0dWRpb3MxFDASBgNVBAsTC1dl | |
50 | +YlNvY2tldCsrMRYwFAYDVQQDEw1QZXRlciBUaG9yc29uMSQwIgYJKoZIhvcNAQkB | |
51 | +FhV3ZWJtYXN0ZXJAemFwaG95ZC5jb22CCQDOTLiiXs16tDAMBgNVHRMEBTADAQH/ | |
52 | +MA0GCSqGSIb3DQEBBQUAA4IBAQB+SH0s/hrv5VYqgX6SNLzxdSLvCVsUkCdTpxwY | |
53 | +wOJ84XmYcXDMhKDtZqLtOtN6pfEwVusFlC9mkieuunztCnWNmsSG83RuljJPjFSi | |
54 | +1d4Id4bKEQkQ4cfnjoHKivRrViWLnxuNnLzC6tpyGH/35kKWhhr6T58AXerFgVw3 | |
55 | +mHvLPTr1DuhdAZA0ZuvuseVAFFAjI3RetSySwHJE3ak8KswDVfLi6E3XxMVsIWTS | |
56 | +/iFsC2WwoZQlljya2V/kRYIhu+uCdqJ01wunn2BvmURPSgr4GTBF0FQ9JGpNbXxM | |
57 | +TAU7oQJgyFc5sCcuEgPTO0dWVQTvdZVgay4tkmduKDRkmJBF | |
58 | +-----END CERTIFICATE----- | ... | ... |
3rdparty/websocketpp-0.8.2/examples/echo_server_tls/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | + | |
6 | +if (OPENSSL_FOUND) | |
7 | + | |
8 | +init_target (echo_server_tls) | |
9 | + | |
10 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
11 | + | |
12 | +link_boost () | |
13 | +link_openssl() | |
14 | +final_target () | |
15 | + | |
16 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | |
17 | + | |
18 | +endif() | ... | ... |
3rdparty/websocketpp-0.8.2/examples/echo_server_tls/SConscript
0 → 100644
1 | +## Main development example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | +Import('tls_libs') | |
10 | + | |
11 | +env = env.Clone () | |
12 | +env_cpp11 = env_cpp11.Clone () | |
13 | + | |
14 | +prgs = [] | |
15 | + | |
16 | +# if a C++11 environment is available build using that, otherwise use boost | |
17 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
18 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] + [tls_libs] | |
19 | + prgs += env_cpp11.Program('echo_server_tls', ["echo_server_tls.cpp"], LIBS = ALL_LIBS) | |
20 | +else: | |
21 | + ALL_LIBS = boostlibs(['system'],env) + [platform_libs] + [polyfill_libs] + [tls_libs] | |
22 | + prgs += env.Program('echo_server_tls', ["echo_server_tls.cpp"], LIBS = ALL_LIBS) | |
23 | + | |
24 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/echo_server_tls/dh.pem
0 → 100644
1 | +-----BEGIN DH PARAMETERS----- | |
2 | +MIIBCAKCAQEAqxMGKZB8YNV8WQnbJWwwwmifc+PfVRtd1FN5v5aQSsf6dpjX3Zlh | |
3 | +N1NmgecsQyg4u2EWe4Umta10QzCgYaxf6QdTCg7iprLzFNw7IvWYbQ6du12NMGDr | |
4 | +hmwA6KQKwbTgPL6mSlSlcK2wTP2FzxDTNffFu10cB/6Fj4kdQjPG0c1Koz/z7OOq | |
5 | +BuDElJLClS8rjp3z1xvrc7gX95dFa2KaKgOAYDkpe8tfHRhHfJeIVS/whH9hzx6r | |
6 | +OBg+E5K9JyvayrUoKgPeptRKCqo8A4YevtMLpRxMup0nMUgAIv6+BGTwPAFpwgl/ | |
7 | +8UIVcvjh1v95PwGDM/Q8yvIBJznBYk/e2wIBAg== | |
8 | +-----END DH PARAMETERS----- | ... | ... |
3rdparty/websocketpp-0.8.2/examples/echo_server_tls/echo_server_tls.cpp
0 → 100644
1 | +/* | |
2 | + * Copyright (c) 2015, Peter Thorson. All rights reserved. | |
3 | + * | |
4 | + * Redistribution and use in source and binary forms, with or without | |
5 | + * modification, are permitted provided that the following conditions are met: | |
6 | + * * Redistributions of source code must retain the above copyright | |
7 | + * notice, this list of conditions and the following disclaimer. | |
8 | + * * Redistributions in binary form must reproduce the above copyright | |
9 | + * notice, this list of conditions and the following disclaimer in the | |
10 | + * documentation and/or other materials provided with the distribution. | |
11 | + * * Neither the name of the WebSocket++ Project nor the | |
12 | + * names of its contributors may be used to endorse or promote products | |
13 | + * derived from this software without specific prior written permission. | |
14 | + * | |
15 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
16 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 | + * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY | |
19 | + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
20 | + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
21 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
22 | + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
24 | + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | + * | |
26 | + */ | |
27 | + | |
28 | + /** | |
29 | + * NOTES | |
30 | + * | |
31 | + * This example uses a number of standard classes through the websocketpp::lib | |
32 | + * namespace. This is to allow easy switching between Boost, the C++11 STL, and | |
33 | + * the standalone Asio library. Your program need not use these namespaces if | |
34 | + * you do not need this sort of flexibility. | |
35 | + */ | |
36 | + | |
37 | +#include <websocketpp/config/asio.hpp> | |
38 | + | |
39 | +#include <websocketpp/server.hpp> | |
40 | + | |
41 | +#include <iostream> | |
42 | + | |
43 | +typedef websocketpp::server<websocketpp::config::asio_tls> server; | |
44 | + | |
45 | +using websocketpp::lib::placeholders::_1; | |
46 | +using websocketpp::lib::placeholders::_2; | |
47 | +using websocketpp::lib::bind; | |
48 | + | |
49 | +// pull out the type of messages sent by our config | |
50 | +typedef websocketpp::config::asio::message_type::ptr message_ptr; | |
51 | +typedef websocketpp::lib::shared_ptr<websocketpp::lib::asio::ssl::context> context_ptr; | |
52 | + | |
53 | +void on_message(server* s, websocketpp::connection_hdl hdl, message_ptr msg) { | |
54 | + std::cout << "on_message called with hdl: " << hdl.lock().get() | |
55 | + << " and message: " << msg->get_payload() | |
56 | + << std::endl; | |
57 | + | |
58 | + try { | |
59 | + s->send(hdl, msg->get_payload(), msg->get_opcode()); | |
60 | + } catch (websocketpp::exception const & e) { | |
61 | + std::cout << "Echo failed because: " | |
62 | + << "(" << e.what() << ")" << std::endl; | |
63 | + } | |
64 | +} | |
65 | + | |
66 | +void on_http(server* s, websocketpp::connection_hdl hdl) { | |
67 | + server::connection_ptr con = s->get_con_from_hdl(hdl); | |
68 | + | |
69 | + con->set_body("Hello World!"); | |
70 | + con->set_status(websocketpp::http::status_code::ok); | |
71 | +} | |
72 | + | |
73 | +std::string get_password() { | |
74 | + return "test"; | |
75 | +} | |
76 | + | |
77 | +// See https://wiki.mozilla.org/Security/Server_Side_TLS for more details about | |
78 | +// the TLS modes. The code below demonstrates how to implement both the modern | |
79 | +enum tls_mode { | |
80 | + MOZILLA_INTERMEDIATE = 1, | |
81 | + MOZILLA_MODERN = 2 | |
82 | +}; | |
83 | + | |
84 | +context_ptr on_tls_init(tls_mode mode, websocketpp::connection_hdl hdl) { | |
85 | + namespace asio = websocketpp::lib::asio; | |
86 | + | |
87 | + std::cout << "on_tls_init called with hdl: " << hdl.lock().get() << std::endl; | |
88 | + std::cout << "using TLS mode: " << (mode == MOZILLA_MODERN ? "Mozilla Modern" : "Mozilla Intermediate") << std::endl; | |
89 | + | |
90 | + context_ptr ctx = websocketpp::lib::make_shared<asio::ssl::context>(asio::ssl::context::sslv23); | |
91 | + | |
92 | + try { | |
93 | + if (mode == MOZILLA_MODERN) { | |
94 | + // Modern disables TLSv1 | |
95 | + ctx->set_options(asio::ssl::context::default_workarounds | | |
96 | + asio::ssl::context::no_sslv2 | | |
97 | + asio::ssl::context::no_sslv3 | | |
98 | + asio::ssl::context::no_tlsv1 | | |
99 | + asio::ssl::context::single_dh_use); | |
100 | + } else { | |
101 | + ctx->set_options(asio::ssl::context::default_workarounds | | |
102 | + asio::ssl::context::no_sslv2 | | |
103 | + asio::ssl::context::no_sslv3 | | |
104 | + asio::ssl::context::single_dh_use); | |
105 | + } | |
106 | + ctx->set_password_callback(bind(&get_password)); | |
107 | + ctx->use_certificate_chain_file("server.pem"); | |
108 | + ctx->use_private_key_file("server.pem", asio::ssl::context::pem); | |
109 | + | |
110 | + // Example method of generating this file: | |
111 | + // `openssl dhparam -out dh.pem 2048` | |
112 | + // Mozilla Intermediate suggests 1024 as the minimum size to use | |
113 | + // Mozilla Modern suggests 2048 as the minimum size to use. | |
114 | + ctx->use_tmp_dh_file("dh.pem"); | |
115 | + | |
116 | + std::string ciphers; | |
117 | + | |
118 | + if (mode == MOZILLA_MODERN) { | |
119 | + ciphers = "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK"; | |
120 | + } else { | |
121 | + ciphers = "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA"; | |
122 | + } | |
123 | + | |
124 | + if (SSL_CTX_set_cipher_list(ctx->native_handle() , ciphers.c_str()) != 1) { | |
125 | + std::cout << "Error setting cipher list" << std::endl; | |
126 | + } | |
127 | + } catch (std::exception& e) { | |
128 | + std::cout << "Exception: " << e.what() << std::endl; | |
129 | + } | |
130 | + return ctx; | |
131 | +} | |
132 | + | |
133 | +int main() { | |
134 | + // Create a server endpoint | |
135 | + server echo_server; | |
136 | + | |
137 | + // Initialize ASIO | |
138 | + echo_server.init_asio(); | |
139 | + | |
140 | + // Register our message handler | |
141 | + echo_server.set_message_handler(bind(&on_message,&echo_server,::_1,::_2)); | |
142 | + echo_server.set_http_handler(bind(&on_http,&echo_server,::_1)); | |
143 | + echo_server.set_tls_init_handler(bind(&on_tls_init,MOZILLA_INTERMEDIATE,::_1)); | |
144 | + | |
145 | + // Listen on port 9002 | |
146 | + echo_server.listen(9002); | |
147 | + | |
148 | + // Start the server accept loop | |
149 | + echo_server.start_accept(); | |
150 | + | |
151 | + // Start the ASIO io_service run loop | |
152 | + echo_server.run(); | |
153 | + | |
154 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/echo_server_tls/server.pem
0 → 100644
1 | +-----BEGIN PRIVATE KEY----- | |
2 | +MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDMYjHlTUeUGSys | |
3 | +Fz5PZcvgS3gojBlEAOu2gXFQDcJ7kq6dJ4jKsPaH1Q5jAtEDkU/el8otzfacOgyp | |
4 | +2ZxioRimpmcORWGU0bKJcenh4ZQ1oK1CQObjeYk1YgE7H8/sBetSdtL4n1rB8LIz | |
5 | +AV/k6kwSZFu3/lSmc6g09H4efSKGKVBcVOjBamcvFGVH4KhM2NyL+ffeV5H2Ucxk | |
6 | +ipyhpr4uxEoC3EV60sQxloqZb+upBM0LS4kVvaYMcn39XkUx3Z8FwN5+hFGwsWda | |
7 | +tU8zDxEuRMrZxG7mwDXLBGehtQvoJIVMQbOuwBQcgAbsVyy1dxV3aczbLX0iGEuG | |
8 | +eBhdFE+BAgMBAAECggEAQaPn0nUXYAEVz89HO8i9ybNzS9Jy6txA18SK1+MTawyY | |
9 | +9/AShsZ+5vEORc5JwpOQyzSEwmE7qsEaABLbnvGOMTeQMY0m4dzXMj1bmCgSqYaJ | |
10 | +HpYpkTUfU/2913dIF81u3nU7HI5RX6gmEyuF2MdG10FUE6ujFDJg+2DqgHA//kYD | |
11 | +hkXFinVS2PuZs8d5xdzpF0aCIWTuOc+Fgsyhdm/lZRIzFdID45YUVuPIN2uh+GkM | |
12 | +ENp/r1x7dPlDRqiL1ufP0mTQGs26S5kQSF8W0BClkOIOgmrhSON4+Vqhqx+ki/7w | |
13 | +RY+7mmgdvt0uzYT+Lk2cDw4f89Rsh7rR1EieBpQ2YQKBgQDq6zAHWfweJmkugT0w | |
14 | +HzI0UKfcOdzlJBwMu6tSgSHU99dnXlTwQY8sG7vtfRekokoo7XY4JsSk1n6E9OVy | |
15 | +4UKuEvU1+llDGxtvHxEEGOAgwB8wxMuY4uNYgDVhTlUzr2ERcet7FOIGzxEWzSsg | |
16 | +5vgnTQfyMzAh5/6k8CsHVI4u2wKBgQDeuYVCgg555lcc5rvTFxfU15d3fweSd78+ | |
17 | +akgIBaXAlFbxI+5znGPmKG/ii4N2XObC8B568fA2nIxw6M1xgbKyvvmN3ECYiqWv | |
18 | +bx8x6Vg5Slg0vJr+DrPgvIKbOWEEKF/cfpTeeVLP0gUBT63mA3qezuRx1r0JJr7A | |
19 | +k9a4Td9j0wKBgDmRQMfMaVgKGaRnz1LHkkn3qerx0wvj+Wu1YZpqQpwp0ANovm/R | |
20 | +4P/yG+9qxCx4CKxW5K2F8pJibcavLLsmMGzwAF8l5lHnhqWIe2cBoYrlCb+tuibR | |
21 | +Et1RLcOWqpJr2+GmhQo4Z9s7SvjHdlYtw4n9+oCDwrvMWj6ZDDJTqjQZAoGAEhRt | |
22 | +RODZ2/texvHT/Wa6gISfvwuIydL+q0plXoFW2zMve5O3H5tqYJyXuIQqv8j60og7 | |
23 | +cS+CmGxM2j2Lr9MfdnMaPvHKLJfUq1ER7zNJ/hyS3HUS/9yhrXSgBYm63mOIpJWB | |
24 | +8C1ZE5Ww4lJdg3Z01b9lu/f6kGucwHU/0OZBZBECgYAQ+dl2kKKd+lQ9O/LVz7oD | |
25 | +goQMPYF+QZcEhY4vlYKkWVtR2A0CiY6XeTi6vO/qVUt/ht+UO3XIJFOjGV1VyORQ | |
26 | +Bhibfstxl5s59jGlns5y5QqcRKzCiX74BKG0xQUtHgga7Od6L+GJKbJAPBfncYwW | |
27 | +U7Tfwwi0WbbgQoy5Xr/5gg== | |
28 | +-----END PRIVATE KEY----- | |
29 | +-----BEGIN CERTIFICATE----- | |
30 | +MIIFBTCCAu2gAwIBAgICEAEwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVT | |
31 | +MQswCQYDVQQIDAJJTDEUMBIGA1UECgwLV2ViU29ja2V0KysxKjAoBgNVBAsMIVdl | |
32 | +YlNvY2tldCsrIENlcnRpZmljYXRlIEF1dGhvcml0eTEkMCIGA1UEAwwbV2ViU29j | |
33 | +a2V0KysgSW50ZXJtZWRpYXRlIENBMB4XDTE2MDYwODEyNDUxMloXDTI2MDYwNjEy | |
34 | +NDUxMlowfjELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAklMMRAwDgYDVQQHDAdDaGlj | |
35 | +YWdvMRQwEgYDVQQKDAtXZWJTb2NrZXQrKzEgMB4GA1UECwwXV2ViU29ja2V0Kysg | |
36 | +VExTIEV4YW1wbGUxGDAWBgNVBAMMD3dlYnNvY2tldHBwLm9yZzCCASIwDQYJKoZI | |
37 | +hvcNAQEBBQADggEPADCCAQoCggEBAMxiMeVNR5QZLKwXPk9ly+BLeCiMGUQA67aB | |
38 | +cVANwnuSrp0niMqw9ofVDmMC0QORT96Xyi3N9pw6DKnZnGKhGKamZw5FYZTRsolx | |
39 | +6eHhlDWgrUJA5uN5iTViATsfz+wF61J20vifWsHwsjMBX+TqTBJkW7f+VKZzqDT0 | |
40 | +fh59IoYpUFxU6MFqZy8UZUfgqEzY3Iv5995XkfZRzGSKnKGmvi7ESgLcRXrSxDGW | |
41 | +iplv66kEzQtLiRW9pgxyff1eRTHdnwXA3n6EUbCxZ1q1TzMPES5EytnEbubANcsE | |
42 | +Z6G1C+gkhUxBs67AFByABuxXLLV3FXdpzNstfSIYS4Z4GF0UT4ECAwEAAaOBhzCB | |
43 | +hDALBgNVHQ8EBAMCBDAwEwYDVR0lBAwwCgYIKwYBBQUHAwEwYAYDVR0RBFkwV4IP | |
44 | +d2Vic29ja2V0cHAub3JnghN3d3cud2Vic29ja2V0cHAub3Jnghl1dGlsaXRpZXMu | |
45 | +d2Vic29ja2V0cHAub3JnghRkb2NzLndlYnNvY2tldHBwLm9yZzANBgkqhkiG9w0B | |
46 | +AQsFAAOCAgEAelJvIWFikBU3HVoP0icuoezTHGqABPLCeooTC/GELq7lHCFEjiqW | |
47 | +p96Zc3vrk+0Z0tkYy3E0fpuzPtlTUhBzO3fMF41FpB5ix3W/tH9YJvrozlIuDD1I | |
48 | +IEusxomeeiMRbyYpX/gkSOO74ylCzMEQVzleMNdpzpeXOg0Kp5z2JNShdEoT7eMR | |
49 | +qkJQJjMdL6QeXUqWNvX1Zqb8v6VeWGWjuu/cl374P8D8bjn89VwZQ5HFqoLOhI5v | |
50 | +XEYsMViZWwLSMcfWTU2Rdi0RxUZQVciLP/3GQROR1/0/e1J1kd7GsRWQMZcU20Vy | |
51 | +jXBVAiWhW1bgd0XOrrFILsAmnBtinEJiE+h5UC4ksZtwWf9x1IhXGlpb9bmD4+Ud | |
52 | +93wmqytPXBFL6wwlj4IYjjy0gU6xP6h7nwhHXnBlwFWGDpe8Cco9qgyJxJxBTtj9 | |
53 | +MbBv+BSLXJoniDASdk6RIqCjPWZtWbQ7j5mIKV0bdJQZpBX553QOy8AoIpJE32An | |
54 | +FzR0SSCHOCgSAbqtM8CvLO6mquEJunmwKQx6xfos5N6ee+D+JtUFTw04TrjZUzFs | |
55 | +Z7v3SN/N4Hd13iTBDSu4XY/tJYICvTRLYNrzQRh/XEVbEEVxXhL8rxNn5aL1pqrV | |
56 | +yEnvHXrnSXWxTif1K+hS2HfTkQ6d1GjglvmwkoBqBHuRH0OJ1VguTqM= | |
57 | +-----END CERTIFICATE----- | ... | ... |
3rdparty/websocketpp-0.8.2/examples/enriched_storage/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +init_target (enriched_storage) | |
6 | + | |
7 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
8 | + | |
9 | +link_boost () | |
10 | +final_target () | |
11 | + | |
12 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | ... | ... |
3rdparty/websocketpp-0.8.2/examples/enriched_storage/enriched_storage.cpp
0 → 100644
1 | +#include <iostream> | |
2 | +#include <websocketpp/config/asio_no_tls.hpp> | |
3 | +#include <websocketpp/server.hpp> | |
4 | + | |
5 | +struct connection_data { | |
6 | + int sessionid; | |
7 | + std::string name; | |
8 | +}; | |
9 | + | |
10 | +struct custom_config : public websocketpp::config::asio { | |
11 | + // pull default settings from our core config | |
12 | + typedef websocketpp::config::asio core; | |
13 | + | |
14 | + typedef core::concurrency_type concurrency_type; | |
15 | + typedef core::request_type request_type; | |
16 | + typedef core::response_type response_type; | |
17 | + typedef core::message_type message_type; | |
18 | + typedef core::con_msg_manager_type con_msg_manager_type; | |
19 | + typedef core::endpoint_msg_manager_type endpoint_msg_manager_type; | |
20 | + typedef core::alog_type alog_type; | |
21 | + typedef core::elog_type elog_type; | |
22 | + typedef core::rng_type rng_type; | |
23 | + typedef core::transport_type transport_type; | |
24 | + typedef core::endpoint_base endpoint_base; | |
25 | + | |
26 | + // Set a custom connection_base class | |
27 | + typedef connection_data connection_base; | |
28 | +}; | |
29 | + | |
30 | +typedef websocketpp::server<custom_config> server; | |
31 | +typedef server::connection_ptr connection_ptr; | |
32 | + | |
33 | +using websocketpp::connection_hdl; | |
34 | +using websocketpp::lib::placeholders::_1; | |
35 | +using websocketpp::lib::placeholders::_2; | |
36 | +using websocketpp::lib::bind; | |
37 | + | |
38 | +class print_server { | |
39 | +public: | |
40 | + print_server() : m_next_sessionid(1) { | |
41 | + m_server.init_asio(); | |
42 | + | |
43 | + m_server.set_open_handler(bind(&print_server::on_open,this,::_1)); | |
44 | + m_server.set_close_handler(bind(&print_server::on_close,this,::_1)); | |
45 | + m_server.set_message_handler(bind(&print_server::on_message,this,::_1,::_2)); | |
46 | + } | |
47 | + | |
48 | + void on_open(connection_hdl hdl) { | |
49 | + connection_ptr con = m_server.get_con_from_hdl(hdl); | |
50 | + | |
51 | + con->sessionid = m_next_sessionid++; | |
52 | + } | |
53 | + | |
54 | + void on_close(connection_hdl hdl) { | |
55 | + connection_ptr con = m_server.get_con_from_hdl(hdl); | |
56 | + | |
57 | + std::cout << "Closing connection " << con->name | |
58 | + << " with sessionid " << con->sessionid << std::endl; | |
59 | + } | |
60 | + | |
61 | + void on_message(connection_hdl hdl, server::message_ptr msg) { | |
62 | + connection_ptr con = m_server.get_con_from_hdl(hdl); | |
63 | + | |
64 | + if (con->name.empty()) { | |
65 | + con->name = msg->get_payload(); | |
66 | + std::cout << "Setting name of connection with sessionid " | |
67 | + << con->sessionid << " to " << con->name << std::endl; | |
68 | + } else { | |
69 | + std::cout << "Got a message from connection " << con->name | |
70 | + << " with sessionid " << con->sessionid << std::endl; | |
71 | + } | |
72 | + } | |
73 | + | |
74 | + void run(uint16_t port) { | |
75 | + m_server.listen(port); | |
76 | + m_server.start_accept(); | |
77 | + m_server.run(); | |
78 | + } | |
79 | +private: | |
80 | + int m_next_sessionid; | |
81 | + server m_server; | |
82 | +}; | |
83 | + | |
84 | +int main() { | |
85 | + print_server server; | |
86 | + server.run(9002); | |
87 | +} | |
0 | 88 | \ No newline at end of file | ... | ... |
3rdparty/websocketpp-0.8.2/examples/external_io_service/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +init_target (external_io_service) | |
6 | + | |
7 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
8 | + | |
9 | +link_boost () | |
10 | +final_target () | |
11 | + | |
12 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | ... | ... |
3rdparty/websocketpp-0.8.2/examples/external_io_service/SConscript
0 → 100644
1 | +## Main development example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | + | |
10 | +env = env.Clone () | |
11 | +env_cpp11 = env_cpp11.Clone () | |
12 | + | |
13 | +prgs = [] | |
14 | + | |
15 | +# if a C++11 environment is available build using that, otherwise use boost | |
16 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
17 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] | |
18 | + prgs += env_cpp11.Program('external_io_service', ["external_io_service.cpp"], LIBS = ALL_LIBS) | |
19 | +else: | |
20 | + ALL_LIBS = boostlibs(['system'],env) + [platform_libs] + [polyfill_libs] | |
21 | + prgs += env.Program('external_io_service', ["external_io_service.cpp"], LIBS = ALL_LIBS) | |
22 | + | |
23 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/external_io_service/external_io_service.cpp
0 → 100644
1 | +/* | |
2 | + * Copyright (c) 2015, Peter Thorson. All rights reserved. | |
3 | + * | |
4 | + * Redistribution and use in source and binary forms, with or without | |
5 | + * modification, are permitted provided that the following conditions are met: | |
6 | + * * Redistributions of source code must retain the above copyright | |
7 | + * notice, this list of conditions and the following disclaimer. | |
8 | + * * Redistributions in binary form must reproduce the above copyright | |
9 | + * notice, this list of conditions and the following disclaimer in the | |
10 | + * documentation and/or other materials provided with the distribution. | |
11 | + * * Neither the name of the WebSocket++ Project nor the | |
12 | + * names of its contributors may be used to endorse or promote products | |
13 | + * derived from this software without specific prior written permission. | |
14 | + * | |
15 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
16 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 | + * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY | |
19 | + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
20 | + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
21 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
22 | + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
24 | + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | + */ | |
26 | + | |
27 | +#include "tcp_echo_server.hpp" | |
28 | + | |
29 | +#include <websocketpp/config/asio_no_tls.hpp> | |
30 | +#include <websocketpp/server.hpp> | |
31 | + | |
32 | +#include <iostream> | |
33 | + | |
34 | +using websocketpp::lib::placeholders::_1; | |
35 | +using websocketpp::lib::placeholders::_2; | |
36 | +using websocketpp::lib::bind; | |
37 | + | |
38 | +typedef websocketpp::server<websocketpp::config::asio> ws_echo_server; | |
39 | + | |
40 | +// Define a callback to handle incoming messages | |
41 | +void on_message(ws_echo_server* s, websocketpp::connection_hdl hdl, ws_echo_server::message_ptr msg) { | |
42 | + std::cout << "on_message called with hdl: " << hdl.lock().get() | |
43 | + << " and message: " << msg->get_payload() | |
44 | + << std::endl; | |
45 | + | |
46 | + // check for a special command to instruct the server to stop listening so | |
47 | + // it can be cleanly exited. | |
48 | + if (msg->get_payload() == "stop-listening") { | |
49 | + s->stop_listening(); | |
50 | + return; | |
51 | + } | |
52 | + | |
53 | + try { | |
54 | + s->send(hdl, msg->get_payload(), msg->get_opcode()); | |
55 | + } catch (websocketpp::exception const & e) { | |
56 | + std::cout << "Echo failed because: " | |
57 | + << "(" << e.what() << ")" << std::endl; | |
58 | + } | |
59 | +} | |
60 | + | |
61 | +int main() { | |
62 | + asio::io_service service; | |
63 | + | |
64 | + // Add a TCP echo server on port 9003 | |
65 | + tcp_echo_server custom_http_server(service, 9003); | |
66 | + | |
67 | + // Add a WebSocket echo server on port 9002 | |
68 | + ws_echo_server ws_server; | |
69 | + ws_server.set_access_channels(websocketpp::log::alevel::all); | |
70 | + ws_server.clear_access_channels(websocketpp::log::alevel::frame_payload); | |
71 | + | |
72 | + // The only difference in this code between an internal and external | |
73 | + // io_service is the different constructor to init_asio | |
74 | + ws_server.init_asio(&service); | |
75 | + | |
76 | + // Register our message handler | |
77 | + ws_server.set_message_handler(bind(&on_message,&ws_server,::_1,::_2)); | |
78 | + ws_server.listen(9002); | |
79 | + ws_server.start_accept(); | |
80 | + | |
81 | + // TODO: add a timer? | |
82 | + | |
83 | + // Start the Asio io_service run loop for all | |
84 | + service.run(); | |
85 | +} | |
0 | 86 | \ No newline at end of file | ... | ... |
3rdparty/websocketpp-0.8.2/examples/external_io_service/tcp_echo_server.hpp
0 → 100644
1 | +/* | |
2 | + * Copyright (c) 2015, Peter Thorson. All rights reserved. | |
3 | + * | |
4 | + * Redistribution and use in source and binary forms, with or without | |
5 | + * modification, are permitted provided that the following conditions are met: | |
6 | + * * Redistributions of source code must retain the above copyright | |
7 | + * notice, this list of conditions and the following disclaimer. | |
8 | + * * Redistributions in binary form must reproduce the above copyright | |
9 | + * notice, this list of conditions and the following disclaimer in the | |
10 | + * documentation and/or other materials provided with the distribution. | |
11 | + * * Neither the name of the WebSocket++ Project nor the | |
12 | + * names of its contributors may be used to endorse or promote products | |
13 | + * derived from this software without specific prior written permission. | |
14 | + * | |
15 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
16 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 | + * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY | |
19 | + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
20 | + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
21 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
22 | + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
24 | + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | + */ | |
26 | + | |
27 | +/** | |
28 | + * TCP Echo Server | |
29 | + * | |
30 | + * This file defines a simple TCP Echo Server. It is adapted from the Asio | |
31 | + * example: cpp03/echo/async_tcp_echo_server.cpp | |
32 | + */ | |
33 | + | |
34 | +#include <websocketpp/common/asio.hpp> | |
35 | +#include <websocketpp/common/memory.hpp> | |
36 | +#include <websocketpp/common/functional.hpp> | |
37 | + | |
38 | +using websocketpp::lib::placeholders::_1; | |
39 | +using websocketpp::lib::placeholders::_2; | |
40 | +using websocketpp::lib::bind; | |
41 | + | |
42 | +namespace asio = websocketpp::lib::asio; | |
43 | + | |
44 | +struct tcp_echo_session : websocketpp::lib::enable_shared_from_this<tcp_echo_session> { | |
45 | + typedef websocketpp::lib::shared_ptr<tcp_echo_session> ptr; | |
46 | + | |
47 | + tcp_echo_session(asio::io_service & service) : m_socket(service) {} | |
48 | + | |
49 | + void start() { | |
50 | + m_socket.async_read_some(asio::buffer(m_buffer, sizeof(m_buffer)), | |
51 | + websocketpp::lib::bind( | |
52 | + &tcp_echo_session::handle_read, shared_from_this(), _1, _2)); | |
53 | + } | |
54 | + | |
55 | + void handle_read(const asio::error_code & ec, size_t transferred) { | |
56 | + if (!ec) { | |
57 | + asio::async_write(m_socket, | |
58 | + asio::buffer(m_buffer, transferred), | |
59 | + bind(&tcp_echo_session::handle_write, shared_from_this(), _1)); | |
60 | + } | |
61 | + } | |
62 | + | |
63 | + void handle_write(const asio::error_code & ec) { | |
64 | + if (!ec) { | |
65 | + m_socket.async_read_some(asio::buffer(m_buffer, sizeof(m_buffer)), | |
66 | + bind(&tcp_echo_session::handle_read, shared_from_this(), _1, _2)); | |
67 | + } | |
68 | + } | |
69 | + | |
70 | + asio::ip::tcp::socket m_socket; | |
71 | + char m_buffer[1024]; | |
72 | +}; | |
73 | + | |
74 | +struct tcp_echo_server { | |
75 | + tcp_echo_server(asio::io_service & service, short port) | |
76 | + : m_service(service) | |
77 | + , m_acceptor(service, asio::ip::tcp::endpoint(asio::ip::tcp::v6(), port)) | |
78 | + { | |
79 | + this->start_accept(); | |
80 | + } | |
81 | + | |
82 | + void start_accept() { | |
83 | + tcp_echo_session::ptr new_session(new tcp_echo_session(m_service)); | |
84 | + m_acceptor.async_accept(new_session->m_socket, | |
85 | + bind(&tcp_echo_server::handle_accept, this, new_session, _1)); | |
86 | + } | |
87 | + | |
88 | + void handle_accept(tcp_echo_session::ptr new_session, const asio::error_code & ec) { | |
89 | + if (!ec) { | |
90 | + new_session->start(); | |
91 | + } | |
92 | + start_accept(); | |
93 | + } | |
94 | + | |
95 | + asio::io_service & m_service; | |
96 | + asio::ip::tcp::acceptor m_acceptor; | |
97 | +}; | ... | ... |
3rdparty/websocketpp-0.8.2/examples/handler_switch/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +init_target (handler_switch) | |
6 | + | |
7 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
8 | + | |
9 | +link_boost () | |
10 | +final_target () | |
11 | + | |
12 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | ... | ... |
3rdparty/websocketpp-0.8.2/examples/handler_switch/handler_switch.cpp
0 → 100644
1 | +#include <iostream> | |
2 | + | |
3 | +#include <websocketpp/config/asio_no_tls.hpp> | |
4 | +#include <websocketpp/server.hpp> | |
5 | + | |
6 | +typedef websocketpp::server<websocketpp::config::asio> server; | |
7 | + | |
8 | +using websocketpp::connection_hdl; | |
9 | +using websocketpp::lib::placeholders::_1; | |
10 | +using websocketpp::lib::placeholders::_2; | |
11 | +using websocketpp::lib::bind; | |
12 | +using websocketpp::lib::ref; | |
13 | + | |
14 | +void custom_on_msg(server & s, connection_hdl hdl, server::message_ptr msg) { | |
15 | + std::cout << "Message sent to custom handler" << std::endl; | |
16 | +} | |
17 | + | |
18 | +void default_on_msg(server & s, connection_hdl hdl, server::message_ptr msg) { | |
19 | + std::cout << "Message sent to default handler" << std::endl; | |
20 | + | |
21 | + if (msg->get_payload() == "upgrade") { | |
22 | + // Upgrade our connection_hdl to a full connection_ptr | |
23 | + server::connection_ptr con = s.get_con_from_hdl(hdl); | |
24 | + | |
25 | + // Change the on message handler for this connection only to | |
26 | + // custom_on_mesage | |
27 | + con->set_message_handler(bind(&custom_on_msg,ref(s),::_1,::_2)); | |
28 | + std::cout << "Upgrading connection to custom handler" << std::endl; | |
29 | + } | |
30 | +} | |
31 | + | |
32 | +int main() { | |
33 | + server s; | |
34 | + | |
35 | + s.set_message_handler(bind(&default_on_msg,ref(s),::_1,::_2)); | |
36 | + | |
37 | + s.init_asio(); | |
38 | + s.listen(9002); | |
39 | + s.start_accept(); | |
40 | + | |
41 | + s.run(); | |
42 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/iostream_server/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +init_target (iostream_server) | |
6 | + | |
7 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
8 | + | |
9 | +link_boost () | |
10 | +final_target () | |
11 | + | |
12 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | ... | ... |
3rdparty/websocketpp-0.8.2/examples/iostream_server/SConscript
0 → 100644
1 | +## iostream server example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | + | |
10 | +env = env.Clone () | |
11 | +env_cpp11 = env_cpp11.Clone () | |
12 | + | |
13 | +prgs = [] | |
14 | + | |
15 | +# if a C++11 environment is available build using that, otherwise use boost | |
16 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
17 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] | |
18 | + prgs += env_cpp11.Program('iostream_server', ["iostream_server.cpp"], LIBS = ALL_LIBS) | |
19 | +else: | |
20 | + ALL_LIBS = boostlibs(['system'],env) + [platform_libs] + [polyfill_libs] | |
21 | + prgs += env.Program('iostream_server', ["iostream_server.cpp"], LIBS = ALL_LIBS) | |
22 | + | |
23 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/iostream_server/iostream_server.cpp
0 → 100644
1 | +#include <websocketpp/config/core.hpp> | |
2 | + | |
3 | +#include <websocketpp/server.hpp> | |
4 | + | |
5 | +#include <iostream> | |
6 | +#include <fstream> | |
7 | + | |
8 | +typedef websocketpp::server<websocketpp::config::core> server; | |
9 | + | |
10 | +using websocketpp::lib::placeholders::_1; | |
11 | +using websocketpp::lib::placeholders::_2; | |
12 | +using websocketpp::lib::bind; | |
13 | + | |
14 | +// pull out the type of messages sent by our config | |
15 | +typedef server::message_ptr message_ptr; | |
16 | + | |
17 | +// Define a callback to handle incoming messages | |
18 | +void on_message(server* s, websocketpp::connection_hdl hdl, message_ptr msg) { | |
19 | + if (msg->get_opcode() == websocketpp::frame::opcode::text) { | |
20 | + s->get_alog().write(websocketpp::log::alevel::app, | |
21 | + "Text Message Received: "+msg->get_payload()); | |
22 | + } else { | |
23 | + s->get_alog().write(websocketpp::log::alevel::app, | |
24 | + "Binary Message Received: "+websocketpp::utility::to_hex(msg->get_payload())); | |
25 | + } | |
26 | + | |
27 | + try { | |
28 | + s->send(hdl, msg->get_payload(), msg->get_opcode()); | |
29 | + } catch (websocketpp::exception const & e) { | |
30 | + s->get_alog().write(websocketpp::log::alevel::app, | |
31 | + std::string("Echo Failed: ")+e.what()); | |
32 | + } | |
33 | +} | |
34 | + | |
35 | +int main() { | |
36 | + server s; | |
37 | + std::ofstream log; | |
38 | + | |
39 | + try { | |
40 | + // set up access channels to only log interesting things | |
41 | + s.clear_access_channels(websocketpp::log::alevel::all); | |
42 | + s.set_access_channels(websocketpp::log::alevel::connect); | |
43 | + s.set_access_channels(websocketpp::log::alevel::disconnect); | |
44 | + s.set_access_channels(websocketpp::log::alevel::app); | |
45 | + | |
46 | + // Log to a file rather than stdout, as we are using stdout for real | |
47 | + // output | |
48 | + log.open("output.log"); | |
49 | + s.get_alog().set_ostream(&log); | |
50 | + s.get_elog().set_ostream(&log); | |
51 | + | |
52 | + // print all output to stdout | |
53 | + s.register_ostream(&std::cout); | |
54 | + | |
55 | + // Register our message handler | |
56 | + s.set_message_handler(bind(&on_message,&s,::_1,::_2)); | |
57 | + | |
58 | + server::connection_ptr con = s.get_connection(); | |
59 | + | |
60 | + con->start(); | |
61 | + | |
62 | + // C++ iostream's don't support the idea of asynchronous i/o. As such | |
63 | + // there are two input strategies demonstrated here. Buffered I/O will | |
64 | + // read from stdin in chunks until EOF. This works very well for | |
65 | + // replaying canned connections as would be done in automated testing. | |
66 | + // | |
67 | + // If the server is being used live however, assuming input is being | |
68 | + // piped from elsewhere in realtime, this strategy will result in small | |
69 | + // messages being buffered forever. The non-buffered strategy below | |
70 | + // reads characters from stdin one at a time. This is inefficient and | |
71 | + // for more serious uses should be replaced with a platform specific | |
72 | + // asyncronous i/o technique like select, poll, IOCP, etc | |
73 | + bool buffered_io = false; | |
74 | + | |
75 | + if (buffered_io) { | |
76 | + std::cin >> *con; | |
77 | + con->eof(); | |
78 | + } else { | |
79 | + char a; | |
80 | + while(std::cin.get(a)) { | |
81 | + con->read_some(&a,1); | |
82 | + } | |
83 | + con->eof(); | |
84 | + } | |
85 | + } catch (websocketpp::exception const & e) { | |
86 | + std::cout << e.what() << std::endl; | |
87 | + } | |
88 | + log.close(); | |
89 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/print_client/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +init_target (print_client) | |
6 | + | |
7 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
8 | + | |
9 | +link_boost () | |
10 | +final_target () | |
11 | + | |
12 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | ... | ... |
3rdparty/websocketpp-0.8.2/examples/print_client/SConscript
0 → 100644
1 | +## Print client example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | + | |
10 | +env = env.Clone () | |
11 | +env_cpp11 = env_cpp11.Clone () | |
12 | + | |
13 | +prgs = [] | |
14 | + | |
15 | +# if a C++11 environment is available build using that, otherwise use boost | |
16 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
17 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] | |
18 | + prgs += env_cpp11.Program('print_client', ["print_client.cpp"], LIBS = ALL_LIBS) | |
19 | +else: | |
20 | + ALL_LIBS = boostlibs(['system'],env) + [platform_libs] + [polyfill_libs] | |
21 | + prgs += env.Program('print_client', ["print_client.cpp"], LIBS = ALL_LIBS) | |
22 | + | |
23 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/print_client/print_client.cpp
0 → 100644
1 | +/* | |
2 | + * Copyright (c) 2016, Peter Thorson. All rights reserved. | |
3 | + * | |
4 | + * Redistribution and use in source and binary forms, with or without | |
5 | + * modification, are permitted provided that the following conditions are met: | |
6 | + * * Redistributions of source code must retain the above copyright | |
7 | + * notice, this list of conditions and the following disclaimer. | |
8 | + * * Redistributions in binary form must reproduce the above copyright | |
9 | + * notice, this list of conditions and the following disclaimer in the | |
10 | + * documentation and/or other materials provided with the distribution. | |
11 | + * * Neither the name of the WebSocket++ Project nor the | |
12 | + * names of its contributors may be used to endorse or promote products | |
13 | + * derived from this software without specific prior written permission. | |
14 | + * | |
15 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
16 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 | + * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY | |
19 | + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
20 | + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
21 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
22 | + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
24 | + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | + * | |
26 | + */ | |
27 | + | |
28 | +#include <websocketpp/config/asio_no_tls_client.hpp> | |
29 | +#include <websocketpp/client.hpp> | |
30 | + | |
31 | +#include <iostream> | |
32 | + | |
33 | +typedef websocketpp::client<websocketpp::config::asio_client> client; | |
34 | + | |
35 | +void on_message(websocketpp::connection_hdl, client::message_ptr msg) { | |
36 | + std::cout << msg->get_payload() << std::endl; | |
37 | +} | |
38 | + | |
39 | +int main(int argc, char* argv[]) { | |
40 | + client c; | |
41 | + | |
42 | + std::string uri = "ws://localhost:9002"; | |
43 | + | |
44 | + if (argc == 2) { | |
45 | + uri = argv[1]; | |
46 | + } | |
47 | + | |
48 | + try { | |
49 | + // Set logging to be pretty verbose (everything except message payloads) | |
50 | + c.set_access_channels(websocketpp::log::alevel::all); | |
51 | + c.clear_access_channels(websocketpp::log::alevel::frame_payload); | |
52 | + c.set_error_channels(websocketpp::log::elevel::all); | |
53 | + | |
54 | + // Initialize ASIO | |
55 | + c.init_asio(); | |
56 | + | |
57 | + // Register our message handler | |
58 | + c.set_message_handler(&on_message); | |
59 | + | |
60 | + websocketpp::lib::error_code ec; | |
61 | + client::connection_ptr con = c.get_connection(uri, ec); | |
62 | + if (ec) { | |
63 | + std::cout << "could not create connection because: " << ec.message() << std::endl; | |
64 | + return 0; | |
65 | + } | |
66 | + | |
67 | + // Note that connect here only requests a connection. No network messages are | |
68 | + // exchanged until the event loop starts running in the next line. | |
69 | + c.connect(con); | |
70 | + | |
71 | + // Start the ASIO io_service run loop | |
72 | + // this will cause a single connection to be made to the server. c.run() | |
73 | + // will exit when this connection is closed. | |
74 | + c.run(); | |
75 | + } catch (websocketpp::exception const & e) { | |
76 | + std::cout << e.what() << std::endl; | |
77 | + } | |
78 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/print_client_tls/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +if (OPENSSL_FOUND) | |
6 | + | |
7 | +init_target (print_client_tls) | |
8 | + | |
9 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
10 | + | |
11 | +link_boost () | |
12 | +link_openssl() | |
13 | +final_target () | |
14 | + | |
15 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | |
16 | + | |
17 | +endif() | |
0 | 18 | \ No newline at end of file | ... | ... |
3rdparty/websocketpp-0.8.2/examples/print_client_tls/SConscript
0 → 100644
1 | +## Print client tls example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | +Import('tls_libs') | |
10 | + | |
11 | +env = env.Clone () | |
12 | +env_cpp11 = env_cpp11.Clone () | |
13 | + | |
14 | +prgs = [] | |
15 | + | |
16 | +# if a C++11 environment is available build using that, otherwise use boost | |
17 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
18 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] + [tls_libs] | |
19 | + prgs += env_cpp11.Program('print_client_tls', ["print_client_tls.cpp"], LIBS = ALL_LIBS) | |
20 | +else: | |
21 | + ALL_LIBS = boostlibs(['system'],env) + [platform_libs] + [polyfill_libs] + [tls_libs] | |
22 | + prgs += env.Program('print_client_tls', ["print_client_tls.cpp"], LIBS = ALL_LIBS) | |
23 | + | |
24 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/print_client_tls/ca-chain.cert.pem
0 → 100644
1 | +-----BEGIN CERTIFICATE----- | |
2 | +MIIFxTCCA62gAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwYDELMAkGA1UEBhMCVVMx | |
3 | +CzAJBgNVBAgMAklMMRAwDgYDVQQHDAdDaGljYWdvMRQwEgYDVQQKDAtXZWJTb2Nr | |
4 | +ZXQrKzEcMBoGA1UEAwwTV2ViU29ja2V0KysgUm9vdCBDQTAeFw0xNjA1MjUxMzU4 | |
5 | +MjdaFw0yNjA1MjMxMzU4MjdaMIGCMQswCQYDVQQGEwJVUzELMAkGA1UECAwCSUwx | |
6 | +FDASBgNVBAoMC1dlYlNvY2tldCsrMSowKAYDVQQLDCFXZWJTb2NrZXQrKyBDZXJ0 | |
7 | +aWZpY2F0ZSBBdXRob3JpdHkxJDAiBgNVBAMMG1dlYlNvY2tldCsrIEludGVybWVk | |
8 | +aWF0ZSBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMNaFAzlx0KJ | |
9 | +gG15yRHI3xn9+B1woHG4uuOr124Sk1JllPcO3enusgIYTMl0FiYYW9CsyPoe4L0P | |
10 | +wflbz20vDDjxmXG+NPgjuYmnPaq7q2JXYz+cShv9+o60EIwEIe+EWk1ZQs9YSdQ0 | |
11 | +r4UOxGVq6eEuWJi8Wh02cbnxdjwvrk7lTMFVY+z5EX8cCj6Tbrd0lyIf/0X8OkOb | |
12 | +q2HOqqzTgT2apBCWCEW6grW6rtMOoDx93BOZDBEGz39sJ5i8AQ8XIdYCdUcOMdJU | |
13 | +SCAw/MMyFTHXhv8hJdG5GcDSfc7woB9xRUf8UHuCH0nYkTb260TWvyDCYJy001ko | |
14 | +SWoRbh2hVgPqQ9FTDMzMTY8T8C5u3BRfGN5PHuSPhwfHv/p1g4uPnltDBe4CNtOs | |
15 | +wu8w1wbrr3uI7qETnqOzbXlcT7o4rCrrRQqLbNOssf2mMH+Phq6dINjXpZjiAhO0 | |
16 | +SURtBMmQdAZcQkGStzFitEkb2Py5LEIxQ068i8RCowTyD9+/jbO1fZyxJ4X8TDUe | |
17 | +Xx48xWnu0i4f8/9ldnWLwX9h3ilaZVsr7buNYJoMlz+v73TQoWKSybJ2SMe/Cddj | |
18 | +OZCy5r1UakuZhX6n1ScD/hbO8FEfmQRpAywYajyU4dZ9XMbf5bo6OAUqlJ2f4yYh | |
19 | +VAy5mi1JHfD5PiJN90j79GXXvtBTJc4hAgMBAAGjZjBkMB0GA1UdDgQWBBTKMn5O | |
20 | +3NUPpztL1bAz8UCsOBLpkjAfBgNVHSMEGDAWgBTNBBKZQN694xplMGyMruXFv27o | |
21 | +eTASBgNVHRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0B | |
22 | +AQsFAAOCAgEAyNkZUEAdP73th4/RLu0d2foMiIqKlcvw3JsW0tto3MT5lvQ5UugH | |
23 | +OwluhWhnMLE0KsknQd7/p4ZwyZugWAYjGcDydp0GDIDfNBBEOQkOAL23KkYiRFqt | |
24 | +VPBTZi9S7P2MJLY0j94liIg94nikhz/0q7JxxWFlvSHUjwZxXrbFjfZRPOS1vIq/ | |
25 | +/VK2QjUsdIXE3NOPYfQwd9FpG2YS8ZcMeipwNYVAs2FBEeWzGH1j6i2hP8FFBDYP | |
26 | +0LTvJYOJvlCeyIvPBjKk9461/Z4CPJcKtKC59onQmiqSK/Juak/bpPoY7jJ228KG | |
27 | +bEBzClIEHgbDiBewFTHbyOWhW2ySRLOGsPeqKDSbm4J1N5rfKnrSQB9PfOmWoRfJ | |
28 | +vqPlXFSlpdgD4j/WnEumpvt78fT+cn+AkRG8tE5DQrCWZTK47TSWn902Fm0A19Rl | |
29 | +pSbE9qsulXurOqEuOOayrzcUmbZ/jkU+wj+/tN4Gl8K98WbjcXvwz0sRL3SgRRrI | |
30 | +awUdaGWKQHrTJNEOTisepUAuHVDmvuQz0j/Ru+PbB9K3GcKY6X6+o1c2JBC1V6KX | |
31 | +aHHZQ+xPm+VEa1pG/QVHGpt2AbGUQlXwDYtOIRwEhO27tFbH8Q68s2cMLYjsF5gd | |
32 | +MWuMYCPkFv10/V2f2lAIPSEzw2pldIGERcb4VG4xuD0qU+HH/aAID7k= | |
33 | +-----END CERTIFICATE----- | |
34 | +-----BEGIN CERTIFICATE----- | |
35 | +MIIFpjCCA46gAwIBAgIJAL42eqbfw976MA0GCSqGSIb3DQEBCwUAMGAxCzAJBgNV | |
36 | +BAYTAlVTMQswCQYDVQQIDAJJTDEQMA4GA1UEBwwHQ2hpY2FnbzEUMBIGA1UECgwL | |
37 | +V2ViU29ja2V0KysxHDAaBgNVBAMME1dlYlNvY2tldCsrIFJvb3QgQ0EwHhcNMTYw | |
38 | +NTI1MTM1MTUzWhcNMzYwNTIwMTM1MTUzWjBgMQswCQYDVQQGEwJVUzELMAkGA1UE | |
39 | +CAwCSUwxEDAOBgNVBAcMB0NoaWNhZ28xFDASBgNVBAoMC1dlYlNvY2tldCsrMRww | |
40 | +GgYDVQQDDBNXZWJTb2NrZXQrKyBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOC | |
41 | +Ag8AMIICCgKCAgEA4QjJ0v5yri+pAN67I/XPz88D8oIczCW96CIuwc44aDC9Kptb | |
42 | +9iY8xwbGCyQsFZ/1IQ74QfnXZSwq8EwedcBIdcyHdBu6qtNkCVKeDIZAMBef6Hx+ | |
43 | +tWSe1op3sDbUlT8NHiTxZCZWk/2/yIi8yPzQTi4y1vF04vvrQS5RFomCz17kdyOa | |
44 | +NdxO5p+I4afdoVKtzA1aHoBqdTe7vzM3eww4AxKfgIEDdIuOGDiglI/b/frlwiOi | |
45 | +SfTOsPzu52TOPW2d1Ad5BG4GuMpnTUOVnc8j18w9LdeXO0J10oVyCmwiPuzFCcDB | |
46 | +g1xvVr5TXzIZ5J+qlso7+mUfZGH+nxOT7Tc78o1EvX6JbfQAI2PrpcksmJfFnN4l | |
47 | +4XnXDW/eKl8AlLUr/cW5axAfql4QHJoBCZcfYldQpMoL5R1ikLtY53cOJpycFoWm | |
48 | +1IEfkLBZ4C1old+KoaErG0+Aur8/kwAJGMnmMvZqGZ5pgXtVipOLy5TKuS6ZKO8g | |
49 | +MRzalaF/naiu3pF+/sctaqkAPvOr65WrANNGxTQ93ePdyuT6sOEUKXxaXcTtAOOM | |
50 | +5FCgX8dPxkOACxTrxppvb+bYmYL9GIuYDGYxSRu3Fm+04eXIh+uCqcuWPQuRPc5t | |
51 | +VXvk/M0fPaJvKfP6lRAoE5Dp4qPRvL6tRVtOXfP6d+O+yGnxRoLKAW7ejoMCAwEA | |
52 | +AaNjMGEwHQYDVR0OBBYEFM0EEplA3r3jGmUwbIyu5cW/buh5MB8GA1UdIwQYMBaA | |
53 | +FM0EEplA3r3jGmUwbIyu5cW/buh5MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/ | |
54 | +BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQAQ4eY4LhW795wl9XuDVg2vOFTYmIS0 | |
55 | +OxrunFX4f3RjddbIbXzYmQ0cJ8pJ5l7eGYcg/DYQRY4Tk6LjXMs9VhIU10akqLS4 | |
56 | +qGE+Bmp3Jhu5NxZbKkY+k+kTAA1LYxFCjGjSV0v5QNLFULDAmGer2zWwU5DcDwwq | |
57 | +8yWyBuI974UyE/49/TeckfqwBrb90LL2lFEwoL86XZK2IZMPyMBC/S1X5P/Kc15Q | |
58 | +d8lwOPS5AirFkkrzs/px+mRia5U1uWKIPRLq9Medvjf8HR8SFWq9eRtkxiLaWyRv | |
59 | +HBVyVRKCubCZR8psVLK/zrF+Bc+Hr9aAi3TuqTKjIOI7hrq5oJcJpebZDNoBIqoj | |
60 | +kab13WcRwG+BQvuK1CEkd1aq8Nh2GX6Reb2Zv82/WntgP1a0sztbIGgrUBYQryb5 | |
61 | +HF79v4e2byY613SiQ3lz+g/AWxaZsYH80/Zl+hEwEtU4fFz34Jcv9Kvda1JpknBT | |
62 | +Fi63ugfoNeNriO02AReMmDvuBG3X8RF1UQyBoTU3uZuW7X26MizEjiVCK9qaOLED | |
63 | +WDSEoyKLe4JKd387CVlsCY8K/6fBlFTI/hJhggDz8pZFj3n2irUI44kjgOmoxOrW | |
64 | +JY2jgY89AEMN9yOKkyQGara8pF9IJxTQ7jurYnWcUbompWeybJRwvWN0h+tGV+bd | |
65 | +l/aq/5LwL3fVpg== | |
66 | +-----END CERTIFICATE----- | ... | ... |
3rdparty/websocketpp-0.8.2/examples/print_client_tls/print_client_tls.cpp
0 → 100644
1 | +/* | |
2 | + * Copyright (c) 2016, Peter Thorson. All rights reserved. | |
3 | + * | |
4 | + * Redistribution and use in source and binary forms, with or without | |
5 | + * modification, are permitted provided that the following conditions are met: | |
6 | + * * Redistributions of source code must retain the above copyright | |
7 | + * notice, this list of conditions and the following disclaimer. | |
8 | + * * Redistributions in binary form must reproduce the above copyright | |
9 | + * notice, this list of conditions and the following disclaimer in the | |
10 | + * documentation and/or other materials provided with the distribution. | |
11 | + * * Neither the name of the WebSocket++ Project nor the | |
12 | + * names of its contributors may be used to endorse or promote products | |
13 | + * derived from this software without specific prior written permission. | |
14 | + * | |
15 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
16 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 | + * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY | |
19 | + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
20 | + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
21 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
22 | + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
24 | + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | + * | |
26 | + */ | |
27 | + | |
28 | +#include <websocketpp/config/asio_client.hpp> | |
29 | +#include <websocketpp/client.hpp> | |
30 | + | |
31 | +#include <iostream> | |
32 | + | |
33 | +typedef websocketpp::client<websocketpp::config::asio_tls_client> client; | |
34 | +typedef websocketpp::lib::shared_ptr<websocketpp::lib::asio::ssl::context> context_ptr; | |
35 | + | |
36 | +using websocketpp::lib::placeholders::_1; | |
37 | +using websocketpp::lib::placeholders::_2; | |
38 | +using websocketpp::lib::bind; | |
39 | + | |
40 | +void on_message(websocketpp::connection_hdl, client::message_ptr msg) { | |
41 | + std::cout << msg->get_payload() << std::endl; | |
42 | +} | |
43 | + | |
44 | +/// Verify that one of the subject alternative names matches the given hostname | |
45 | +bool verify_subject_alternative_name(const char * hostname, X509 * cert) { | |
46 | + STACK_OF(GENERAL_NAME) * san_names = NULL; | |
47 | + | |
48 | + san_names = (STACK_OF(GENERAL_NAME) *) X509_get_ext_d2i(cert, NID_subject_alt_name, NULL, NULL); | |
49 | + if (san_names == NULL) { | |
50 | + return false; | |
51 | + } | |
52 | + | |
53 | + int san_names_count = sk_GENERAL_NAME_num(san_names); | |
54 | + | |
55 | + bool result = false; | |
56 | + | |
57 | + for (int i = 0; i < san_names_count; i++) { | |
58 | + const GENERAL_NAME * current_name = sk_GENERAL_NAME_value(san_names, i); | |
59 | + | |
60 | + if (current_name->type != GEN_DNS) { | |
61 | + continue; | |
62 | + } | |
63 | + | |
64 | + char const * dns_name = (char const *) ASN1_STRING_get0_data(current_name->d.dNSName); | |
65 | + | |
66 | + // Make sure there isn't an embedded NUL character in the DNS name | |
67 | + if (ASN1_STRING_length(current_name->d.dNSName) != strlen(dns_name)) { | |
68 | + break; | |
69 | + } | |
70 | + // Compare expected hostname with the CN | |
71 | + result = (strcasecmp(hostname, dns_name) == 0); | |
72 | + } | |
73 | + sk_GENERAL_NAME_pop_free(san_names, GENERAL_NAME_free); | |
74 | + | |
75 | + return result; | |
76 | +} | |
77 | + | |
78 | +/// Verify that the certificate common name matches the given hostname | |
79 | +bool verify_common_name(char const * hostname, X509 * cert) { | |
80 | + // Find the position of the CN field in the Subject field of the certificate | |
81 | + int common_name_loc = X509_NAME_get_index_by_NID(X509_get_subject_name(cert), NID_commonName, -1); | |
82 | + if (common_name_loc < 0) { | |
83 | + return false; | |
84 | + } | |
85 | + | |
86 | + // Extract the CN field | |
87 | + X509_NAME_ENTRY * common_name_entry = X509_NAME_get_entry(X509_get_subject_name(cert), common_name_loc); | |
88 | + if (common_name_entry == NULL) { | |
89 | + return false; | |
90 | + } | |
91 | + | |
92 | + // Convert the CN field to a C string | |
93 | + ASN1_STRING * common_name_asn1 = X509_NAME_ENTRY_get_data(common_name_entry); | |
94 | + if (common_name_asn1 == NULL) { | |
95 | + return false; | |
96 | + } | |
97 | + | |
98 | + char const * common_name_str = (char const *) ASN1_STRING_get0_data(common_name_asn1); | |
99 | + | |
100 | + // Make sure there isn't an embedded NUL character in the CN | |
101 | + if (ASN1_STRING_length(common_name_asn1) != strlen(common_name_str)) { | |
102 | + return false; | |
103 | + } | |
104 | + | |
105 | + // Compare expected hostname with the CN | |
106 | + return (strcasecmp(hostname, common_name_str) == 0); | |
107 | +} | |
108 | + | |
109 | +/** | |
110 | + * This code is derived from examples and documentation found ato00po | |
111 | + * http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/example/cpp03/ssl/client.cpp | |
112 | + * and | |
113 | + * https://github.com/iSECPartners/ssl-conservatory | |
114 | + */ | |
115 | +bool verify_certificate(const char * hostname, bool preverified, boost::asio::ssl::verify_context& ctx) { | |
116 | + // The verify callback can be used to check whether the certificate that is | |
117 | + // being presented is valid for the peer. For example, RFC 2818 describes | |
118 | + // the steps involved in doing this for HTTPS. Consult the OpenSSL | |
119 | + // documentation for more details. Note that the callback is called once | |
120 | + // for each certificate in the certificate chain, starting from the root | |
121 | + // certificate authority. | |
122 | + | |
123 | + // Retrieve the depth of the current cert in the chain. 0 indicates the | |
124 | + // actual server cert, upon which we will perform extra validation | |
125 | + // (specifically, ensuring that the hostname matches. For other certs we | |
126 | + // will use the 'preverified' flag from Asio, which incorporates a number of | |
127 | + // non-implementation specific OpenSSL checking, such as the formatting of | |
128 | + // certs and the trusted status based on the CA certs we imported earlier. | |
129 | + int depth = X509_STORE_CTX_get_error_depth(ctx.native_handle()); | |
130 | + | |
131 | + // if we are on the final cert and everything else checks out, ensure that | |
132 | + // the hostname is present on the list of SANs or the common name (CN). | |
133 | + if (depth == 0 && preverified) { | |
134 | + X509* cert = X509_STORE_CTX_get_current_cert(ctx.native_handle()); | |
135 | + | |
136 | + if (verify_subject_alternative_name(hostname, cert)) { | |
137 | + return true; | |
138 | + } else if (verify_common_name(hostname, cert)) { | |
139 | + return true; | |
140 | + } else { | |
141 | + return false; | |
142 | + } | |
143 | + } | |
144 | + | |
145 | + return preverified; | |
146 | +} | |
147 | + | |
148 | +/// TLS Initialization handler | |
149 | +/** | |
150 | + * WebSocket++ core and the Asio Transport do not handle TLS context creation | |
151 | + * and setup. This callback is provided so that the end user can set up their | |
152 | + * TLS context using whatever settings make sense for their application. | |
153 | + * | |
154 | + * As Asio and OpenSSL do not provide great documentation for the very common | |
155 | + * case of connect and actually perform basic verification of server certs this | |
156 | + * example includes a basic implementation (using Asio and OpenSSL) of the | |
157 | + * following reasonable default settings and verification steps: | |
158 | + * | |
159 | + * - Disable SSLv2 and SSLv3 | |
160 | + * - Load trusted CA certificates and verify the server cert is trusted. | |
161 | + * - Verify that the hostname matches either the common name or one of the | |
162 | + * subject alternative names on the certificate. | |
163 | + * | |
164 | + * This is not meant to be an exhaustive reference implimentation of a perfect | |
165 | + * TLS client, but rather a reasonable starting point for building a secure | |
166 | + * TLS encrypted WebSocket client. | |
167 | + * | |
168 | + * If any TLS, Asio, or OpenSSL experts feel that these settings are poor | |
169 | + * defaults or there are critically missing steps please open a GitHub issue | |
170 | + * or drop a line on the project mailing list. | |
171 | + * | |
172 | + * Note the bundled CA cert ca-chain.cert.pem is the CA cert that signed the | |
173 | + * cert bundled with echo_server_tls. You can use print_client_tls with this | |
174 | + * CA cert to connect to echo_server_tls as long as you use /etc/hosts or | |
175 | + * something equivilent to spoof one of the names on that cert | |
176 | + * (websocketpp.org, for example). | |
177 | + */ | |
178 | +context_ptr on_tls_init(const char * hostname, websocketpp::connection_hdl) { | |
179 | + context_ptr ctx = websocketpp::lib::make_shared<boost::asio::ssl::context>(boost::asio::ssl::context::sslv23); | |
180 | + | |
181 | + try { | |
182 | + ctx->set_options(boost::asio::ssl::context::default_workarounds | | |
183 | + boost::asio::ssl::context::no_sslv2 | | |
184 | + boost::asio::ssl::context::no_sslv3 | | |
185 | + boost::asio::ssl::context::single_dh_use); | |
186 | + | |
187 | + | |
188 | + ctx->set_verify_mode(boost::asio::ssl::verify_peer); | |
189 | + ctx->set_verify_callback(bind(&verify_certificate, hostname, ::_1, ::_2)); | |
190 | + | |
191 | + // Here we load the CA certificates of all CA's that this client trusts. | |
192 | + ctx->load_verify_file("ca-chain.cert.pem"); | |
193 | + } catch (std::exception& e) { | |
194 | + std::cout << e.what() << std::endl; | |
195 | + } | |
196 | + return ctx; | |
197 | +} | |
198 | + | |
199 | +int main(int argc, char* argv[]) { | |
200 | + client c; | |
201 | + | |
202 | + std::string hostname = "localhost"; | |
203 | + std::string port = "9002"; | |
204 | + | |
205 | + | |
206 | + if (argc == 3) { | |
207 | + hostname = argv[1]; | |
208 | + port = argv[2]; | |
209 | + } else { | |
210 | + std::cout << "Usage: print_server_tls <hostname> <port>" << std::endl; | |
211 | + return 1; | |
212 | + } | |
213 | + | |
214 | + std::string uri = "wss://" + hostname + ":" + port; | |
215 | + | |
216 | + try { | |
217 | + // Set logging to be pretty verbose (everything except message payloads) | |
218 | + c.set_access_channels(websocketpp::log::alevel::all); | |
219 | + c.clear_access_channels(websocketpp::log::alevel::frame_payload); | |
220 | + c.set_error_channels(websocketpp::log::elevel::all); | |
221 | + | |
222 | + // Initialize ASIO | |
223 | + c.init_asio(); | |
224 | + | |
225 | + // Register our message handler | |
226 | + c.set_message_handler(&on_message); | |
227 | + c.set_tls_init_handler(bind(&on_tls_init, hostname.c_str(), ::_1)); | |
228 | + | |
229 | + websocketpp::lib::error_code ec; | |
230 | + client::connection_ptr con = c.get_connection(uri, ec); | |
231 | + if (ec) { | |
232 | + std::cout << "could not create connection because: " << ec.message() << std::endl; | |
233 | + return 0; | |
234 | + } | |
235 | + | |
236 | + // Note that connect here only requests a connection. No network messages are | |
237 | + // exchanged until the event loop starts running in the next line. | |
238 | + c.connect(con); | |
239 | + | |
240 | + c.get_alog().write(websocketpp::log::alevel::app, "Connecting to " + uri); | |
241 | + | |
242 | + // Start the ASIO io_service run loop | |
243 | + // this will cause a single connection to be made to the server. c.run() | |
244 | + // will exit when this connection is closed. | |
245 | + c.run(); | |
246 | + } catch (websocketpp::exception const & e) { | |
247 | + std::cout << e.what() << std::endl; | |
248 | + } | |
249 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/print_server/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +init_target (print_server) | |
6 | + | |
7 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
8 | + | |
9 | +link_boost () | |
10 | +final_target () | |
11 | + | |
12 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | ... | ... |
3rdparty/websocketpp-0.8.2/examples/print_server/SConscript
0 → 100644
1 | +## Print server example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | + | |
10 | +env = env.Clone () | |
11 | +env_cpp11 = env_cpp11.Clone () | |
12 | + | |
13 | +prgs = [] | |
14 | + | |
15 | +# if a C++11 environment is available build using that, otherwise use boost | |
16 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
17 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] | |
18 | + prgs += env_cpp11.Program('print_server', ["print_server.cpp"], LIBS = ALL_LIBS) | |
19 | +else: | |
20 | + ALL_LIBS = boostlibs(['system'],env) + [platform_libs] + [polyfill_libs] | |
21 | + prgs += env.Program('print_server', ["print_server.cpp"], LIBS = ALL_LIBS) | |
22 | + | |
23 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/print_server/print_server.cpp
0 → 100644
1 | +#include <iostream> | |
2 | + | |
3 | +#include <websocketpp/config/asio_no_tls.hpp> | |
4 | +#include <websocketpp/server.hpp> | |
5 | + | |
6 | +typedef websocketpp::server<websocketpp::config::asio> server; | |
7 | + | |
8 | +void on_message(websocketpp::connection_hdl, server::message_ptr msg) { | |
9 | + std::cout << msg->get_payload() << std::endl; | |
10 | +} | |
11 | + | |
12 | +int main() { | |
13 | + server print_server; | |
14 | + | |
15 | + print_server.set_message_handler(&on_message); | |
16 | + print_server.set_access_channels(websocketpp::log::alevel::all); | |
17 | + print_server.set_error_channels(websocketpp::log::elevel::all); | |
18 | + | |
19 | + print_server.init_asio(); | |
20 | + print_server.listen(9002); | |
21 | + print_server.start_accept(); | |
22 | + | |
23 | + print_server.run(); | |
24 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/scratch_client/SConscript
0 → 100644
1 | +## Scratch client example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | +Import('tls_libs') | |
10 | + | |
11 | +env = env.Clone () | |
12 | +env_cpp11 = env_cpp11.Clone () | |
13 | + | |
14 | +prgs = [] | |
15 | + | |
16 | +# if a C++11 environment is available build using that, otherwise use boost | |
17 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
18 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] + [tls_libs] | |
19 | + prgs += env_cpp11.Program('scratch_client', ["scratch_client.cpp"], LIBS = ALL_LIBS) | |
20 | +else: | |
21 | + ALL_LIBS = boostlibs(['system','random'],env) + [platform_libs] + [polyfill_libs] | |
22 | + prgs += env.Program('utility_client', ["utility_client.cpp"], LIBS = ALL_LIBS) | |
23 | + | |
24 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/scratch_client/scratch_client.cpp
0 → 100644
1 | +/* | |
2 | + * Copyright (c) 2014, Peter Thorson. All rights reserved. | |
3 | + * | |
4 | + * Redistribution and use in source and binary forms, with or without | |
5 | + * modification, are permitted provided that the following conditions are met: | |
6 | + * * Redistributions of source code must retain the above copyright | |
7 | + * notice, this list of conditions and the following disclaimer. | |
8 | + * * Redistributions in binary form must reproduce the above copyright | |
9 | + * notice, this list of conditions and the following disclaimer in the | |
10 | + * documentation and/or other materials provided with the distribution. | |
11 | + * * Neither the name of the WebSocket++ Project nor the | |
12 | + * names of its contributors may be used to endorse or promote products | |
13 | + * derived from this software without specific prior written permission. | |
14 | + * | |
15 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
16 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 | + * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY | |
19 | + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
20 | + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
21 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
22 | + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
24 | + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | + */ | |
26 | + | |
27 | +// **NOTE:** This file is a snapshot of the WebSocket++ utility client tutorial. | |
28 | +// Additional related material can be found in the tutorials/utility_client | |
29 | +// directory of the WebSocket++ repository. | |
30 | + | |
31 | +#include <websocketpp/config/asio_no_tls_client.hpp> | |
32 | +#include <websocketpp/client.hpp> | |
33 | + | |
34 | +#include <websocketpp/common/thread.hpp> | |
35 | +#include <websocketpp/common/memory.hpp> | |
36 | + | |
37 | +#include <cstdlib> | |
38 | +#include <iostream> | |
39 | +#include <map> | |
40 | +#include <string> | |
41 | +#include <sstream> | |
42 | + | |
43 | +typedef websocketpp::client<websocketpp::config::asio_client> client; | |
44 | + | |
45 | +class connection_metadata { | |
46 | +public: | |
47 | + typedef websocketpp::lib::shared_ptr<connection_metadata> ptr; | |
48 | + | |
49 | + connection_metadata(int id, websocketpp::connection_hdl hdl, std::string uri) | |
50 | + : m_id(id) | |
51 | + , m_hdl(hdl) | |
52 | + , m_status("Connecting") | |
53 | + , m_uri(uri) | |
54 | + , m_server("N/A") | |
55 | + {} | |
56 | + | |
57 | + void on_open(client * c, websocketpp::connection_hdl hdl) { | |
58 | + m_status = "Open"; | |
59 | + | |
60 | + client::connection_ptr con = c->get_con_from_hdl(hdl); | |
61 | + m_server = con->get_response_header("Server"); | |
62 | + } | |
63 | + | |
64 | + void on_fail(client * c, websocketpp::connection_hdl hdl) { | |
65 | + m_status = "Failed"; | |
66 | + | |
67 | + client::connection_ptr con = c->get_con_from_hdl(hdl); | |
68 | + m_server = con->get_response_header("Server"); | |
69 | + m_error_reason = con->get_ec().message(); | |
70 | + } | |
71 | + | |
72 | + void on_close(client * c, websocketpp::connection_hdl hdl) { | |
73 | + m_status = "Closed"; | |
74 | + client::connection_ptr con = c->get_con_from_hdl(hdl); | |
75 | + std::stringstream s; | |
76 | + s << "close code: " << con->get_remote_close_code() << " (" | |
77 | + << websocketpp::close::status::get_string(con->get_remote_close_code()) | |
78 | + << "), close reason: " << con->get_remote_close_reason(); | |
79 | + m_error_reason = s.str(); | |
80 | + } | |
81 | + | |
82 | + websocketpp::connection_hdl get_hdl() const { | |
83 | + return m_hdl; | |
84 | + } | |
85 | + | |
86 | + int get_id() const { | |
87 | + return m_id; | |
88 | + } | |
89 | + | |
90 | + std::string get_status() const { | |
91 | + return m_status; | |
92 | + } | |
93 | + | |
94 | + friend std::ostream & operator<< (std::ostream & out, connection_metadata const & data); | |
95 | +private: | |
96 | + int m_id; | |
97 | + websocketpp::connection_hdl m_hdl; | |
98 | + std::string m_status; | |
99 | + std::string m_uri; | |
100 | + std::string m_server; | |
101 | + std::string m_error_reason; | |
102 | +}; | |
103 | + | |
104 | +std::ostream & operator<< (std::ostream & out, connection_metadata const & data) { | |
105 | + out << "> URI: " << data.m_uri << "\n" | |
106 | + << "> Status: " << data.m_status << "\n" | |
107 | + << "> Remote Server: " << (data.m_server.empty() ? "None Specified" : data.m_server) << "\n" | |
108 | + << "> Error/close reason: " << (data.m_error_reason.empty() ? "N/A" : data.m_error_reason); | |
109 | + | |
110 | + return out; | |
111 | +} | |
112 | + | |
113 | +class websocket_endpoint { | |
114 | +public: | |
115 | + websocket_endpoint () : m_next_id(0) { | |
116 | + m_endpoint.clear_access_channels(websocketpp::log::alevel::all); | |
117 | + m_endpoint.clear_error_channels(websocketpp::log::elevel::all); | |
118 | + | |
119 | + m_endpoint.init_asio(); | |
120 | + m_endpoint.start_perpetual(); | |
121 | + | |
122 | + m_thread.reset(new websocketpp::lib::thread(&client::run, &m_endpoint)); | |
123 | + } | |
124 | + | |
125 | + ~websocket_endpoint() { | |
126 | + m_endpoint.stop_perpetual(); | |
127 | + | |
128 | + for (con_list::const_iterator it = m_connection_list.begin(); it != m_connection_list.end(); ++it) { | |
129 | + if (it->second->get_status() != "Open") { | |
130 | + // Only close open connections | |
131 | + continue; | |
132 | + } | |
133 | + | |
134 | + std::cout << "> Closing connection " << it->second->get_id() << std::endl; | |
135 | + | |
136 | + websocketpp::lib::error_code ec; | |
137 | + m_endpoint.close(it->second->get_hdl(), websocketpp::close::status::going_away, "", ec); | |
138 | + if (ec) { | |
139 | + std::cout << "> Error closing connection " << it->second->get_id() << ": " | |
140 | + << ec.message() << std::endl; | |
141 | + } | |
142 | + } | |
143 | + | |
144 | + m_thread->join(); | |
145 | + } | |
146 | + | |
147 | + int connect(std::string const & uri) { | |
148 | + websocketpp::lib::error_code ec; | |
149 | + | |
150 | + client::connection_ptr con = m_endpoint.get_connection(uri, ec); | |
151 | + | |
152 | + if (ec) { | |
153 | + std::cout << "> Connect initialization error: " << ec.message() << std::endl; | |
154 | + return -1; | |
155 | + } | |
156 | + | |
157 | + int new_id = m_next_id++; | |
158 | + connection_metadata::ptr metadata_ptr(new connection_metadata(new_id, con->get_handle(), uri)); | |
159 | + m_connection_list[new_id] = metadata_ptr; | |
160 | + | |
161 | + con->set_open_handler(websocketpp::lib::bind( | |
162 | + &connection_metadata::on_open, | |
163 | + metadata_ptr, | |
164 | + &m_endpoint, | |
165 | + websocketpp::lib::placeholders::_1 | |
166 | + )); | |
167 | + con->set_fail_handler(websocketpp::lib::bind( | |
168 | + &connection_metadata::on_fail, | |
169 | + metadata_ptr, | |
170 | + &m_endpoint, | |
171 | + websocketpp::lib::placeholders::_1 | |
172 | + )); | |
173 | + con->set_close_handler(websocketpp::lib::bind( | |
174 | + &connection_metadata::on_close, | |
175 | + metadata_ptr, | |
176 | + &m_endpoint, | |
177 | + websocketpp::lib::placeholders::_1 | |
178 | + )); | |
179 | + | |
180 | + m_endpoint.connect(con); | |
181 | + | |
182 | + return new_id; | |
183 | + } | |
184 | + | |
185 | + void close(int id, websocketpp::close::status::value code, std::string reason) { | |
186 | + websocketpp::lib::error_code ec; | |
187 | + | |
188 | + con_list::iterator metadata_it = m_connection_list.find(id); | |
189 | + if (metadata_it == m_connection_list.end()) { | |
190 | + std::cout << "> No connection found with id " << id << std::endl; | |
191 | + return; | |
192 | + } | |
193 | + | |
194 | + m_endpoint.close(metadata_it->second->get_hdl(), code, reason, ec); | |
195 | + if (ec) { | |
196 | + std::cout << "> Error initiating close: " << ec.message() << std::endl; | |
197 | + } | |
198 | + } | |
199 | + | |
200 | + connection_metadata::ptr get_metadata(int id) const { | |
201 | + con_list::const_iterator metadata_it = m_connection_list.find(id); | |
202 | + if (metadata_it == m_connection_list.end()) { | |
203 | + return connection_metadata::ptr(); | |
204 | + } else { | |
205 | + return metadata_it->second; | |
206 | + } | |
207 | + } | |
208 | +private: | |
209 | + typedef std::map<int,connection_metadata::ptr> con_list; | |
210 | + | |
211 | + client m_endpoint; | |
212 | + websocketpp::lib::shared_ptr<websocketpp::lib::thread> m_thread; | |
213 | + | |
214 | + con_list m_connection_list; | |
215 | + int m_next_id; | |
216 | +}; | |
217 | + | |
218 | +int main() { | |
219 | + bool done = false; | |
220 | + std::string input; | |
221 | + websocket_endpoint endpoint; | |
222 | + | |
223 | + while (!done) { | |
224 | + std::cout << "Enter Command: "; | |
225 | + std::getline(std::cin, input); | |
226 | + | |
227 | + if (input == "quit") { | |
228 | + done = true; | |
229 | + } else if (input == "help") { | |
230 | + std::cout | |
231 | + << "\nCommand List:\n" | |
232 | + << "connect <ws uri>\n" | |
233 | + << "close <connection id> [<close code:default=1000>] [<close reason>]\n" | |
234 | + << "show <connection id>\n" | |
235 | + << "help: Display this help text\n" | |
236 | + << "quit: Exit the program\n" | |
237 | + << std::endl; | |
238 | + } else if (input.substr(0,7) == "connect") { | |
239 | + int id = endpoint.connect(input.substr(8)); | |
240 | + if (id != -1) { | |
241 | + std::cout << "> Created connection with id " << id << std::endl; | |
242 | + } | |
243 | + } else if (input.substr(0,5) == "close") { | |
244 | + std::stringstream ss(input); | |
245 | + | |
246 | + std::string cmd; | |
247 | + int id; | |
248 | + int close_code = websocketpp::close::status::normal; | |
249 | + std::string reason; | |
250 | + | |
251 | + ss >> cmd >> id >> close_code; | |
252 | + std::getline(ss,reason); | |
253 | + | |
254 | + endpoint.close(id, close_code, reason); | |
255 | + } else if (input.substr(0,4) == "show") { | |
256 | + int id = atoi(input.substr(5).c_str()); | |
257 | + | |
258 | + connection_metadata::ptr metadata = endpoint.get_metadata(id); | |
259 | + if (metadata) { | |
260 | + std::cout << *metadata << std::endl; | |
261 | + } else { | |
262 | + std::cout << "> Unknown connection id " << id << std::endl; | |
263 | + } | |
264 | + } else { | |
265 | + std::cout << "> Unrecognized Command" << std::endl; | |
266 | + } | |
267 | + } | |
268 | + | |
269 | + return 0; | |
270 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/scratch_server/SConscript
0 → 100644
1 | +## Scratch server example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | +Import('tls_libs') | |
10 | + | |
11 | +env = env.Clone () | |
12 | +env_cpp11 = env_cpp11.Clone () | |
13 | + | |
14 | +prgs = [] | |
15 | + | |
16 | +# if a C++11 environment is available build using that, otherwise use boost | |
17 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
18 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] + [tls_libs] + ['z'] | |
19 | + prgs += env_cpp11.Program('scratch_server', ["scratch_server.cpp"], LIBS = ALL_LIBS) | |
20 | +else: | |
21 | + ALL_LIBS = boostlibs(['system','regex','random'],env) + [platform_libs] + [polyfill_libs] + [tls_libs] + ['z'] | |
22 | + prgs += env.Program('scratch_server', ["scratch_server.cpp"], LIBS = ALL_LIBS) | |
23 | + | |
24 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/scratch_server/scratch_server.cpp
0 → 100644
1 | +/** | |
2 | + * This example is presently used as a scratch space. It may or may not be broken | |
3 | + * at any given time. | |
4 | + */ | |
5 | + | |
6 | +#include <iostream> | |
7 | + | |
8 | +#include <websocketpp/config/debug_asio_no_tls.hpp> | |
9 | +#include <websocketpp/server.hpp> | |
10 | + | |
11 | +#include <websocketpp/extensions/permessage_deflate/enabled.hpp> | |
12 | + | |
13 | +struct deflate_config : public websocketpp::config::debug_core { | |
14 | + typedef deflate_config type; | |
15 | + typedef debug_core base; | |
16 | + | |
17 | + typedef base::concurrency_type concurrency_type; | |
18 | + | |
19 | + typedef base::request_type request_type; | |
20 | + typedef base::response_type response_type; | |
21 | + | |
22 | + typedef base::message_type message_type; | |
23 | + typedef base::con_msg_manager_type con_msg_manager_type; | |
24 | + typedef base::endpoint_msg_manager_type endpoint_msg_manager_type; | |
25 | + | |
26 | + typedef base::alog_type alog_type; | |
27 | + typedef base::elog_type elog_type; | |
28 | + | |
29 | + typedef base::rng_type rng_type; | |
30 | + | |
31 | + struct transport_config : public base::transport_config { | |
32 | + typedef type::concurrency_type concurrency_type; | |
33 | + typedef type::alog_type alog_type; | |
34 | + typedef type::elog_type elog_type; | |
35 | + typedef type::request_type request_type; | |
36 | + typedef type::response_type response_type; | |
37 | + typedef websocketpp::transport::asio::basic_socket::endpoint | |
38 | + socket_type; | |
39 | + }; | |
40 | + | |
41 | + typedef websocketpp::transport::asio::endpoint<transport_config> | |
42 | + transport_type; | |
43 | + | |
44 | + /// permessage_compress extension | |
45 | + struct permessage_deflate_config {}; | |
46 | + | |
47 | + typedef websocketpp::extensions::permessage_deflate::enabled | |
48 | + <permessage_deflate_config> permessage_deflate_type; | |
49 | +}; | |
50 | + | |
51 | +typedef websocketpp::server<deflate_config> server; | |
52 | + | |
53 | +typedef server::message_ptr message_ptr; | |
54 | + | |
55 | +// Define a callback to handle incoming messages | |
56 | +void on_message(server* s, websocketpp::connection_hdl hdl, message_ptr msg) { | |
57 | + /*std::cout << "on_message called with hdl: " << hdl.lock().get() | |
58 | + << " and message (" << msg->get_payload().size() << "): " << msg->get_payload() | |
59 | + << std::endl; | |
60 | + */ | |
61 | + try { | |
62 | + s->send(hdl, msg->get_payload(), msg->get_opcode()); | |
63 | + } catch (websocketpp::exception const & e) { | |
64 | + std::cout << "Echo failed because: " | |
65 | + << "(" << e.what() << ")" << std::endl; | |
66 | + } | |
67 | +} | |
68 | + | |
69 | +int main(int argc, char * argv[]) { | |
70 | + // Create a server endpoint | |
71 | + server echo_server; | |
72 | + | |
73 | + try { | |
74 | + // Set logging settings | |
75 | + if (argc > 1 && std::string(argv[1]) == "-d") { | |
76 | + echo_server.set_access_channels(websocketpp::log::alevel::all); | |
77 | + echo_server.set_error_channels(websocketpp::log::elevel::all); | |
78 | + } else { | |
79 | + echo_server.set_access_channels(websocketpp::log::alevel::none); | |
80 | + echo_server.set_error_channels(websocketpp::log::elevel::none); | |
81 | + } | |
82 | + | |
83 | + // Initialize ASIO | |
84 | + echo_server.init_asio(); | |
85 | + | |
86 | + // Register our message handler | |
87 | + using websocketpp::lib::placeholders::_1; | |
88 | + using websocketpp::lib::placeholders::_2; | |
89 | + echo_server.set_message_handler(bind(&on_message,&echo_server,_1,_2)); | |
90 | + | |
91 | + // Listen on port 9002 | |
92 | + echo_server.listen(9002); | |
93 | + | |
94 | + // Start the server accept loop | |
95 | + echo_server.start_accept(); | |
96 | + | |
97 | + // Start the ASIO io_service run loop | |
98 | + echo_server.run(); | |
99 | + } catch (websocketpp::exception const & e) { | |
100 | + std::cout << e.what() << std::endl; | |
101 | + } catch (const std::exception & e) { | |
102 | + std::cout << e.what() << std::endl; | |
103 | + } catch (...) { | |
104 | + std::cout << "other exception" << std::endl; | |
105 | + } | |
106 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/simple_broadcast_server/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +init_target (simple_broadcast_server) | |
6 | + | |
7 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
8 | + | |
9 | +link_boost () | |
10 | +final_target () | |
11 | + | |
12 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | ... | ... |
3rdparty/websocketpp-0.8.2/examples/simple_broadcast_server/simple_broadcast_server.cpp
0 → 100644
1 | +#include <set> | |
2 | +#include <websocketpp/config/asio_no_tls.hpp> | |
3 | +#include <websocketpp/server.hpp> | |
4 | + | |
5 | +typedef websocketpp::server<websocketpp::config::asio> server; | |
6 | + | |
7 | +using websocketpp::connection_hdl; | |
8 | +using websocketpp::lib::placeholders::_1; | |
9 | +using websocketpp::lib::placeholders::_2; | |
10 | +using websocketpp::lib::bind; | |
11 | + | |
12 | +class broadcast_server { | |
13 | +public: | |
14 | + broadcast_server() { | |
15 | + m_server.init_asio(); | |
16 | + | |
17 | + m_server.set_open_handler(bind(&broadcast_server::on_open,this,::_1)); | |
18 | + m_server.set_close_handler(bind(&broadcast_server::on_close,this,::_1)); | |
19 | + m_server.set_message_handler(bind(&broadcast_server::on_message,this,::_1,::_2)); | |
20 | + } | |
21 | + | |
22 | + void on_open(connection_hdl hdl) { | |
23 | + m_connections.insert(hdl); | |
24 | + } | |
25 | + | |
26 | + void on_close(connection_hdl hdl) { | |
27 | + m_connections.erase(hdl); | |
28 | + } | |
29 | + | |
30 | + void on_message(connection_hdl hdl, server::message_ptr msg) { | |
31 | + for (auto it : m_connections) { | |
32 | + m_server.send(it,msg); | |
33 | + } | |
34 | + } | |
35 | + | |
36 | + void run(uint16_t port) { | |
37 | + m_server.listen(port); | |
38 | + m_server.start_accept(); | |
39 | + m_server.run(); | |
40 | + } | |
41 | +private: | |
42 | + typedef std::set<connection_hdl,std::owner_less<connection_hdl>> con_list; | |
43 | + | |
44 | + server m_server; | |
45 | + con_list m_connections; | |
46 | +}; | |
47 | + | |
48 | +int main() { | |
49 | + broadcast_server server; | |
50 | + server.run(9002); | |
51 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/sip_client/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +init_target (sip_client) | |
6 | + | |
7 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
8 | + | |
9 | +link_boost () | |
10 | +final_target () | |
11 | + | |
12 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | ... | ... |
3rdparty/websocketpp-0.8.2/examples/sip_client/README.txt
0 → 100644
1 | + | |
2 | + | |
3 | +Checkout the project from git | |
4 | + | |
5 | +At the top level, run cmake: | |
6 | + | |
7 | + cmake -G 'Unix Makefiles' \ | |
8 | + -D BUILD_EXAMPLES=ON \ | |
9 | + -D WEBSOCKETPP_ROOT=/tmp/cm1 \ | |
10 | + -D ENABLE_CPP11=OFF . | |
11 | + | |
12 | +and then make the example: | |
13 | + | |
14 | + make -C examples/sip_client | |
15 | + | |
16 | +Now run it: | |
17 | + | |
18 | + bin/sip_client ws://ws-server:80 | |
19 | + | |
20 | +It has been tested against the repro SIP proxy from reSIProcate | |
21 | + | |
22 | + http://www.resiprocate.org/WebRTC_and_SIP_Over_WebSockets | ... | ... |
3rdparty/websocketpp-0.8.2/examples/sip_client/SConscript
0 → 100644
1 | +## SIP client example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | + | |
10 | +env = env.Clone () | |
11 | +env_cpp11 = env_cpp11.Clone () | |
12 | + | |
13 | +prgs = [] | |
14 | + | |
15 | +# if a C++11 environment is available build using that, otherwise use boost | |
16 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
17 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] | |
18 | + prgs += env_cpp11.Program('sip_client', ["sip_client.cpp"], LIBS = ALL_LIBS) | |
19 | +else: | |
20 | + ALL_LIBS = boostlibs(['system','random'],env) + [platform_libs] + [polyfill_libs] | |
21 | + prgs += env.Program('sip_client', ["sip_client.cpp"], LIBS = ALL_LIBS) | |
22 | + | |
23 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/sip_client/sip_client.cpp
0 → 100644
1 | +#include <condition_variable> | |
2 | + | |
3 | +#include <websocketpp/config/asio_no_tls_client.hpp> | |
4 | + | |
5 | +#include <websocketpp/client.hpp> | |
6 | + | |
7 | +#include <iostream> | |
8 | + | |
9 | +#include <boost/thread/thread.hpp> | |
10 | + | |
11 | +typedef websocketpp::client<websocketpp::config::asio_client> client; | |
12 | + | |
13 | +using websocketpp::lib::placeholders::_1; | |
14 | +using websocketpp::lib::placeholders::_2; | |
15 | +using websocketpp::lib::bind; | |
16 | + | |
17 | +// pull out the type of messages sent by our config | |
18 | +typedef websocketpp::config::asio_client::message_type::ptr message_ptr; | |
19 | + | |
20 | +// Create a server endpoint | |
21 | +client sip_client; | |
22 | + | |
23 | + | |
24 | +bool received; | |
25 | + | |
26 | +void on_open(client* c, websocketpp::connection_hdl hdl) { | |
27 | + // now it is safe to use the connection | |
28 | + std::cout << "connection ready" << std::endl; | |
29 | + | |
30 | + received=false; | |
31 | + // Send a SIP OPTIONS message to the server: | |
32 | + std::string SIP_msg="OPTIONS sip:carol@chicago.com SIP/2.0\r\nVia: SIP/2.0/WS df7jal23ls0d.invalid;rport;branch=z9hG4bKhjhs8ass877\r\nMax-Forwards: 70\r\nTo: <sip:carol@chicago.com>\r\nFrom: Alice <sip:alice@atlanta.com>;tag=1928301774\r\nCall-ID: a84b4c76e66710\r\nCSeq: 63104 OPTIONS\r\nContact: <sip:alice@pc33.atlanta.com>\r\nAccept: application/sdp\r\nContent-Length: 0\r\n\r\n"; | |
33 | + sip_client.send(hdl, SIP_msg.c_str(), websocketpp::frame::opcode::text); | |
34 | +} | |
35 | + | |
36 | +void on_message(client* c, websocketpp::connection_hdl hdl, message_ptr msg) { | |
37 | + client::connection_ptr con = sip_client.get_con_from_hdl(hdl); | |
38 | + | |
39 | + std::cout << "Received a reply:" << std::endl; | |
40 | + fwrite(msg->get_payload().c_str(), msg->get_payload().size(), 1, stdout); | |
41 | + received=true; | |
42 | +} | |
43 | + | |
44 | +int main(int argc, char* argv[]) { | |
45 | + | |
46 | + std::string uri = "ws://localhost:9001"; | |
47 | + | |
48 | + if (argc == 2) { | |
49 | + uri = argv[1]; | |
50 | + } | |
51 | + | |
52 | + try { | |
53 | + // We expect there to be a lot of errors, so suppress them | |
54 | + sip_client.clear_access_channels(websocketpp::log::alevel::all); | |
55 | + sip_client.clear_error_channels(websocketpp::log::elevel::all); | |
56 | + | |
57 | + // Initialize ASIO | |
58 | + sip_client.init_asio(); | |
59 | + | |
60 | + // Register our handlers | |
61 | + sip_client.set_open_handler(bind(&on_open,&sip_client,::_1)); | |
62 | + sip_client.set_message_handler(bind(&on_message,&sip_client,::_1,::_2)); | |
63 | + | |
64 | + websocketpp::lib::error_code ec; | |
65 | + client::connection_ptr con = sip_client.get_connection(uri, ec); | |
66 | + | |
67 | + // Specify the SIP subprotocol: | |
68 | + con->add_subprotocol("sip"); | |
69 | + | |
70 | + sip_client.connect(con); | |
71 | + | |
72 | + // Start the ASIO io_service run loop | |
73 | + sip_client.run(); | |
74 | + | |
75 | + while(!received) { | |
76 | + boost::this_thread::sleep(boost::posix_time::milliseconds(100)); | |
77 | + } | |
78 | + | |
79 | + std::cout << "done" << std::endl; | |
80 | + | |
81 | + } catch (websocketpp::exception const & e) { | |
82 | + std::cout << e.what() << std::endl; | |
83 | + } | |
84 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/subprotocol_server/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +init_target (subprotocol_server) | |
6 | + | |
7 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
8 | + | |
9 | +link_boost () | |
10 | +final_target () | |
11 | + | |
12 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | ... | ... |
3rdparty/websocketpp-0.8.2/examples/subprotocol_server/SConscript
0 → 100644
1 | +## Main development example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | + | |
10 | +env = env.Clone () | |
11 | +env_cpp11 = env_cpp11.Clone () | |
12 | + | |
13 | +prgs = [] | |
14 | + | |
15 | +# if a C++11 environment is available build using that, otherwise use boost | |
16 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
17 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] | |
18 | + prgs += env_cpp11.Program('subprotocol_server', ["subprotocol_server.cpp"], LIBS = ALL_LIBS) | |
19 | +else: | |
20 | + ALL_LIBS = boostlibs(['system'],env) + [platform_libs] + [polyfill_libs] | |
21 | + prgs += env.Program('subprotocol_server', ["subprotocol_server.cpp"], LIBS = ALL_LIBS) | |
22 | + | |
23 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/subprotocol_server/subprotocol_server.cpp
0 → 100644
1 | +#include <iostream> | |
2 | + | |
3 | +#include <websocketpp/config/asio_no_tls.hpp> | |
4 | +#include <websocketpp/server.hpp> | |
5 | + | |
6 | +typedef websocketpp::server<websocketpp::config::asio> server; | |
7 | + | |
8 | +using websocketpp::connection_hdl; | |
9 | +using websocketpp::lib::placeholders::_1; | |
10 | +using websocketpp::lib::placeholders::_2; | |
11 | +using websocketpp::lib::bind; | |
12 | +using websocketpp::lib::ref; | |
13 | + | |
14 | + | |
15 | +bool validate(server & s, connection_hdl hdl) { | |
16 | + server::connection_ptr con = s.get_con_from_hdl(hdl); | |
17 | + | |
18 | + std::cout << "Cache-Control: " << con->get_request_header("Cache-Control") << std::endl; | |
19 | + | |
20 | + const std::vector<std::string> & subp_requests = con->get_requested_subprotocols(); | |
21 | + std::vector<std::string>::const_iterator it; | |
22 | + | |
23 | + for (it = subp_requests.begin(); it != subp_requests.end(); ++it) { | |
24 | + std::cout << "Requested: " << *it << std::endl; | |
25 | + } | |
26 | + | |
27 | + if (subp_requests.size() > 0) { | |
28 | + con->select_subprotocol(subp_requests[0]); | |
29 | + } | |
30 | + | |
31 | + return true; | |
32 | +} | |
33 | + | |
34 | +int main() { | |
35 | + try { | |
36 | + server s; | |
37 | + | |
38 | + s.set_validate_handler(bind(&validate,ref(s),::_1)); | |
39 | + | |
40 | + s.init_asio(); | |
41 | + s.listen(9005); | |
42 | + s.start_accept(); | |
43 | + | |
44 | + s.run(); | |
45 | + } catch (websocketpp::exception const & e) { | |
46 | + std::cout << e.what() << std::endl; | |
47 | + } | |
48 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/telemetry_client/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +init_target (telemetry_client) | |
6 | + | |
7 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
8 | + | |
9 | +link_boost () | |
10 | +final_target () | |
11 | + | |
12 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | ... | ... |
3rdparty/websocketpp-0.8.2/examples/telemetry_client/SConscript
0 → 100644
1 | +## Telemetry client example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | + | |
10 | +env = env.Clone () | |
11 | +env_cpp11 = env_cpp11.Clone () | |
12 | + | |
13 | +prgs = [] | |
14 | + | |
15 | +# if a C++11 environment is available build using that, otherwise use boost | |
16 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
17 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] | |
18 | + prgs += env_cpp11.Program('telemetry_client', ["telemetry_client.cpp"], LIBS = ALL_LIBS) | |
19 | +else: | |
20 | + ALL_LIBS = boostlibs(['system','random'],env) + [platform_libs] + [polyfill_libs] | |
21 | + prgs += env.Program('telemetry_client', ["telemetry_client.cpp"], LIBS = ALL_LIBS) | |
22 | + | |
23 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/telemetry_client/telemetry_client.cpp
0 → 100644
1 | +#include <websocketpp/config/asio_no_tls_client.hpp> | |
2 | +#include <websocketpp/client.hpp> | |
3 | + | |
4 | +// This header pulls in the WebSocket++ abstracted thread support that will | |
5 | +// select between boost::thread and std::thread based on how the build system | |
6 | +// is configured. | |
7 | +#include <websocketpp/common/thread.hpp> | |
8 | + | |
9 | +/** | |
10 | + * Define a semi-cross platform helper method that waits/sleeps for a bit. | |
11 | + */ | |
12 | +void wait_a_bit() { | |
13 | +#ifdef WIN32 | |
14 | + Sleep(1000); | |
15 | +#else | |
16 | + sleep(1); | |
17 | +#endif | |
18 | +} | |
19 | + | |
20 | +/** | |
21 | + * The telemetry client connects to a WebSocket server and sends a message every | |
22 | + * second containing an integer count. This example can be used as the basis for | |
23 | + * programs where a client connects and pushes data for logging, stress/load | |
24 | + * testing, etc. | |
25 | + */ | |
26 | +class telemetry_client { | |
27 | +public: | |
28 | + typedef websocketpp::client<websocketpp::config::asio_client> client; | |
29 | + typedef websocketpp::lib::lock_guard<websocketpp::lib::mutex> scoped_lock; | |
30 | + | |
31 | + telemetry_client() : m_open(false),m_done(false) { | |
32 | + // set up access channels to only log interesting things | |
33 | + m_client.clear_access_channels(websocketpp::log::alevel::all); | |
34 | + m_client.set_access_channels(websocketpp::log::alevel::connect); | |
35 | + m_client.set_access_channels(websocketpp::log::alevel::disconnect); | |
36 | + m_client.set_access_channels(websocketpp::log::alevel::app); | |
37 | + | |
38 | + // Initialize the Asio transport policy | |
39 | + m_client.init_asio(); | |
40 | + | |
41 | + // Bind the handlers we are using | |
42 | + using websocketpp::lib::placeholders::_1; | |
43 | + using websocketpp::lib::bind; | |
44 | + m_client.set_open_handler(bind(&telemetry_client::on_open,this,_1)); | |
45 | + m_client.set_close_handler(bind(&telemetry_client::on_close,this,_1)); | |
46 | + m_client.set_fail_handler(bind(&telemetry_client::on_fail,this,_1)); | |
47 | + } | |
48 | + | |
49 | + // This method will block until the connection is complete | |
50 | + void run(const std::string & uri) { | |
51 | + // Create a new connection to the given URI | |
52 | + websocketpp::lib::error_code ec; | |
53 | + client::connection_ptr con = m_client.get_connection(uri, ec); | |
54 | + if (ec) { | |
55 | + m_client.get_alog().write(websocketpp::log::alevel::app, | |
56 | + "Get Connection Error: "+ec.message()); | |
57 | + return; | |
58 | + } | |
59 | + | |
60 | + // Grab a handle for this connection so we can talk to it in a thread | |
61 | + // safe manor after the event loop starts. | |
62 | + m_hdl = con->get_handle(); | |
63 | + | |
64 | + // Queue the connection. No DNS queries or network connections will be | |
65 | + // made until the io_service event loop is run. | |
66 | + m_client.connect(con); | |
67 | + | |
68 | + // Create a thread to run the ASIO io_service event loop | |
69 | + websocketpp::lib::thread asio_thread(&client::run, &m_client); | |
70 | + | |
71 | + // Create a thread to run the telemetry loop | |
72 | + websocketpp::lib::thread telemetry_thread(&telemetry_client::telemetry_loop,this); | |
73 | + | |
74 | + asio_thread.join(); | |
75 | + telemetry_thread.join(); | |
76 | + } | |
77 | + | |
78 | + // The open handler will signal that we are ready to start sending telemetry | |
79 | + void on_open(websocketpp::connection_hdl) { | |
80 | + m_client.get_alog().write(websocketpp::log::alevel::app, | |
81 | + "Connection opened, starting telemetry!"); | |
82 | + | |
83 | + scoped_lock guard(m_lock); | |
84 | + m_open = true; | |
85 | + } | |
86 | + | |
87 | + // The close handler will signal that we should stop sending telemetry | |
88 | + void on_close(websocketpp::connection_hdl) { | |
89 | + m_client.get_alog().write(websocketpp::log::alevel::app, | |
90 | + "Connection closed, stopping telemetry!"); | |
91 | + | |
92 | + scoped_lock guard(m_lock); | |
93 | + m_done = true; | |
94 | + } | |
95 | + | |
96 | + // The fail handler will signal that we should stop sending telemetry | |
97 | + void on_fail(websocketpp::connection_hdl) { | |
98 | + m_client.get_alog().write(websocketpp::log::alevel::app, | |
99 | + "Connection failed, stopping telemetry!"); | |
100 | + | |
101 | + scoped_lock guard(m_lock); | |
102 | + m_done = true; | |
103 | + } | |
104 | + | |
105 | + void telemetry_loop() { | |
106 | + uint64_t count = 0; | |
107 | + std::stringstream val; | |
108 | + websocketpp::lib::error_code ec; | |
109 | + | |
110 | + while(1) { | |
111 | + bool wait = false; | |
112 | + | |
113 | + { | |
114 | + scoped_lock guard(m_lock); | |
115 | + // If the connection has been closed, stop generating telemetry | |
116 | + if (m_done) {break;} | |
117 | + | |
118 | + // If the connection hasn't been opened yet wait a bit and retry | |
119 | + if (!m_open) { | |
120 | + wait = true; | |
121 | + } | |
122 | + } | |
123 | + | |
124 | + if (wait) { | |
125 | + wait_a_bit(); | |
126 | + continue; | |
127 | + } | |
128 | + | |
129 | + val.str(""); | |
130 | + val << "count is " << count++; | |
131 | + | |
132 | + m_client.get_alog().write(websocketpp::log::alevel::app, val.str()); | |
133 | + m_client.send(m_hdl,val.str(),websocketpp::frame::opcode::text,ec); | |
134 | + | |
135 | + // The most likely error that we will get is that the connection is | |
136 | + // not in the right state. Usually this means we tried to send a | |
137 | + // message to a connection that was closed or in the process of | |
138 | + // closing. While many errors here can be easily recovered from, | |
139 | + // in this simple example, we'll stop the telemetry loop. | |
140 | + if (ec) { | |
141 | + m_client.get_alog().write(websocketpp::log::alevel::app, | |
142 | + "Send Error: "+ec.message()); | |
143 | + break; | |
144 | + } | |
145 | + | |
146 | + wait_a_bit(); | |
147 | + } | |
148 | + } | |
149 | +private: | |
150 | + client m_client; | |
151 | + websocketpp::connection_hdl m_hdl; | |
152 | + websocketpp::lib::mutex m_lock; | |
153 | + bool m_open; | |
154 | + bool m_done; | |
155 | +}; | |
156 | + | |
157 | +int main(int argc, char* argv[]) { | |
158 | + telemetry_client c; | |
159 | + | |
160 | + std::string uri = "ws://localhost:9002"; | |
161 | + | |
162 | + if (argc == 2) { | |
163 | + uri = argv[1]; | |
164 | + } | |
165 | + | |
166 | + c.run(uri); | |
167 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/telemetry_server/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +init_target (telemetry_server) | |
6 | + | |
7 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
8 | + | |
9 | +link_boost () | |
10 | +final_target () | |
11 | + | |
12 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | ... | ... |
3rdparty/websocketpp-0.8.2/examples/telemetry_server/SConscript
0 → 100644
1 | +## Main development example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | + | |
10 | +env = env.Clone () | |
11 | +env_cpp11 = env_cpp11.Clone () | |
12 | + | |
13 | +prgs = [] | |
14 | + | |
15 | +# if a C++11 environment is available build using that, otherwise use boost | |
16 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
17 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] | |
18 | + prgs += env_cpp11.Program('telemetry_server', ["telemetry_server.cpp"], LIBS = ALL_LIBS) | |
19 | +else: | |
20 | + ALL_LIBS = boostlibs(['system'],env) + [platform_libs] + [polyfill_libs] | |
21 | + prgs += env.Program('telemetry_server', ["telemetry_server.cpp"], LIBS = ALL_LIBS) | |
22 | + | |
23 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/telemetry_server/index.html
0 → 100644
1 | +<!doctype html> | |
2 | +<html> | |
3 | +<head> | |
4 | +<title>WebSocket++ Telemetry Client</title> | |
5 | +</head> | |
6 | +<body> | |
7 | + | |
8 | +<script type="text/javascript"> | |
9 | +var ws; | |
10 | +var url; | |
11 | + | |
12 | +function connect() { | |
13 | + url = document.getElementById("server_url").value; | |
14 | + | |
15 | + if ("WebSocket" in window) { | |
16 | + ws = new WebSocket(url); | |
17 | + } else if ("MozWebSocket" in window) { | |
18 | + ws = new MozWebSocket(url); | |
19 | + } else { | |
20 | + document.getElementById("messages").innerHTML += "This Browser does not support WebSockets<br />"; | |
21 | + return; | |
22 | + } | |
23 | + ws.onopen = function(e) { | |
24 | + document.getElementById("messages").innerHTML += "Client: A connection to "+ws.url+" has been opened.<br />"; | |
25 | + | |
26 | + document.getElementById("server_url").disabled = true; | |
27 | + document.getElementById("toggle_connect").innerHTML = "Disconnect"; | |
28 | + }; | |
29 | + | |
30 | + ws.onerror = function(e) { | |
31 | + document.getElementById("messages").innerHTML += "Client: An error occured, see console log for more details.<br />"; | |
32 | + console.log(e); | |
33 | + }; | |
34 | + | |
35 | + ws.onclose = function(e) { | |
36 | + document.getElementById("messages").innerHTML += "Client: The connection to "+url+" was closed. ["+e.code+(e.reason != "" ? ","+e.reason : "")+"]<br />"; | |
37 | + cleanup_disconnect(); | |
38 | + }; | |
39 | + | |
40 | + ws.onmessage = function(e) { | |
41 | + document.getElementById("messages").innerHTML += "Server: "+e.data+"<br />"; | |
42 | + }; | |
43 | +} | |
44 | + | |
45 | +function disconnect() { | |
46 | + ws.close(); | |
47 | + cleanup_disconnect(); | |
48 | +} | |
49 | + | |
50 | +function cleanup_disconnect() { | |
51 | + document.getElementById("server_url").disabled = false; | |
52 | + document.getElementById("toggle_connect").innerHTML = "Connect"; | |
53 | +} | |
54 | + | |
55 | +function toggle_connect() { | |
56 | + if (document.getElementById("server_url").disabled === false) { | |
57 | + connect(); | |
58 | + } else { | |
59 | + disconnect(); | |
60 | + } | |
61 | +} | |
62 | +</script> | |
63 | + | |
64 | +<style> | |
65 | +body,html { | |
66 | + margin: 0px; | |
67 | + padding: 0px; | |
68 | +} | |
69 | +#controls { | |
70 | + float:right; | |
71 | + background-color: #999; | |
72 | +} | |
73 | + | |
74 | +</style> | |
75 | + | |
76 | +<div id="controls"> | |
77 | + <div id="server"> | |
78 | + <input type="text" name="server_url" id="server_url" value="ws://localhost:9002" /><br /> | |
79 | + <button id="toggle_connect" onclick="toggle_connect();">Connect</button> | |
80 | + </div> | |
81 | +</div> | |
82 | +<div id="messages"></div> | |
83 | + | |
84 | +</body> | |
85 | +</html> | ... | ... |
3rdparty/websocketpp-0.8.2/examples/telemetry_server/telemetry_server.cpp
0 → 100644
1 | +#include <websocketpp/config/asio_no_tls.hpp> | |
2 | + | |
3 | +#include <websocketpp/server.hpp> | |
4 | + | |
5 | +#include <fstream> | |
6 | +#include <iostream> | |
7 | +#include <set> | |
8 | +#include <streambuf> | |
9 | +#include <string> | |
10 | + | |
11 | +/** | |
12 | + * The telemetry server accepts connections and sends a message every second to | |
13 | + * each client containing an integer count. This example can be used as the | |
14 | + * basis for programs that expose a stream of telemetry data for logging, | |
15 | + * dashboards, etc. | |
16 | + * | |
17 | + * This example uses the timer based concurrency method and is self contained | |
18 | + * and singled threaded. Refer to telemetry client for an example of a similar | |
19 | + * telemetry setup using threads rather than timers. | |
20 | + * | |
21 | + * This example also includes an example simple HTTP server that serves a web | |
22 | + * dashboard displaying the count. This simple design is suitable for use | |
23 | + * delivering a small number of files to a small number of clients. It is ideal | |
24 | + * for cases like embedded dashboards that don't want the complexity of an extra | |
25 | + * HTTP server to serve static files. | |
26 | + * | |
27 | + * This design *will* fall over under high traffic or DoS conditions. In such | |
28 | + * cases you are much better off proxying to a real HTTP server for the http | |
29 | + * requests. | |
30 | + */ | |
31 | +class telemetry_server { | |
32 | +public: | |
33 | + typedef websocketpp::connection_hdl connection_hdl; | |
34 | + typedef websocketpp::server<websocketpp::config::asio> server; | |
35 | + | |
36 | + telemetry_server() : m_count(0) { | |
37 | + // set up access channels to only log interesting things | |
38 | + m_endpoint.clear_access_channels(websocketpp::log::alevel::all); | |
39 | + m_endpoint.set_access_channels(websocketpp::log::alevel::access_core); | |
40 | + m_endpoint.set_access_channels(websocketpp::log::alevel::app); | |
41 | + | |
42 | + // Initialize the Asio transport policy | |
43 | + m_endpoint.init_asio(); | |
44 | + | |
45 | + // Bind the handlers we are using | |
46 | + using websocketpp::lib::placeholders::_1; | |
47 | + using websocketpp::lib::bind; | |
48 | + m_endpoint.set_open_handler(bind(&telemetry_server::on_open,this,_1)); | |
49 | + m_endpoint.set_close_handler(bind(&telemetry_server::on_close,this,_1)); | |
50 | + m_endpoint.set_http_handler(bind(&telemetry_server::on_http,this,_1)); | |
51 | + } | |
52 | + | |
53 | + void run(std::string docroot, uint16_t port) { | |
54 | + std::stringstream ss; | |
55 | + ss << "Running telemetry server on port "<< port <<" using docroot=" << docroot; | |
56 | + m_endpoint.get_alog().write(websocketpp::log::alevel::app,ss.str()); | |
57 | + | |
58 | + m_docroot = docroot; | |
59 | + | |
60 | + // listen on specified port | |
61 | + m_endpoint.listen(port); | |
62 | + | |
63 | + // Start the server accept loop | |
64 | + m_endpoint.start_accept(); | |
65 | + | |
66 | + // Set the initial timer to start telemetry | |
67 | + set_timer(); | |
68 | + | |
69 | + // Start the ASIO io_service run loop | |
70 | + try { | |
71 | + m_endpoint.run(); | |
72 | + } catch (websocketpp::exception const & e) { | |
73 | + std::cout << e.what() << std::endl; | |
74 | + } | |
75 | + } | |
76 | + | |
77 | + void set_timer() { | |
78 | + m_timer = m_endpoint.set_timer( | |
79 | + 1000, | |
80 | + websocketpp::lib::bind( | |
81 | + &telemetry_server::on_timer, | |
82 | + this, | |
83 | + websocketpp::lib::placeholders::_1 | |
84 | + ) | |
85 | + ); | |
86 | + } | |
87 | + | |
88 | + void on_timer(websocketpp::lib::error_code const & ec) { | |
89 | + if (ec) { | |
90 | + // there was an error, stop telemetry | |
91 | + m_endpoint.get_alog().write(websocketpp::log::alevel::app, | |
92 | + "Timer Error: "+ec.message()); | |
93 | + return; | |
94 | + } | |
95 | + | |
96 | + std::stringstream val; | |
97 | + val << "count is " << m_count++; | |
98 | + | |
99 | + // Broadcast count to all connections | |
100 | + con_list::iterator it; | |
101 | + for (it = m_connections.begin(); it != m_connections.end(); ++it) { | |
102 | + m_endpoint.send(*it,val.str(),websocketpp::frame::opcode::text); | |
103 | + } | |
104 | + | |
105 | + // set timer for next telemetry check | |
106 | + set_timer(); | |
107 | + } | |
108 | + | |
109 | + void on_http(connection_hdl hdl) { | |
110 | + // Upgrade our connection handle to a full connection_ptr | |
111 | + server::connection_ptr con = m_endpoint.get_con_from_hdl(hdl); | |
112 | + | |
113 | + std::ifstream file; | |
114 | + std::string filename = con->get_resource(); | |
115 | + std::string response; | |
116 | + | |
117 | + m_endpoint.get_alog().write(websocketpp::log::alevel::app, | |
118 | + "http request1: "+filename); | |
119 | + | |
120 | + if (filename == "/") { | |
121 | + filename = m_docroot+"index.html"; | |
122 | + } else { | |
123 | + filename = m_docroot+filename.substr(1); | |
124 | + } | |
125 | + | |
126 | + m_endpoint.get_alog().write(websocketpp::log::alevel::app, | |
127 | + "http request2: "+filename); | |
128 | + | |
129 | + file.open(filename.c_str(), std::ios::in); | |
130 | + if (!file) { | |
131 | + // 404 error | |
132 | + std::stringstream ss; | |
133 | + | |
134 | + ss << "<!doctype html><html><head>" | |
135 | + << "<title>Error 404 (Resource not found)</title><body>" | |
136 | + << "<h1>Error 404</h1>" | |
137 | + << "<p>The requested URL " << filename << " was not found on this server.</p>" | |
138 | + << "</body></head></html>"; | |
139 | + | |
140 | + con->set_body(ss.str()); | |
141 | + con->set_status(websocketpp::http::status_code::not_found); | |
142 | + return; | |
143 | + } | |
144 | + | |
145 | + file.seekg(0, std::ios::end); | |
146 | + response.reserve(file.tellg()); | |
147 | + file.seekg(0, std::ios::beg); | |
148 | + | |
149 | + response.assign((std::istreambuf_iterator<char>(file)), | |
150 | + std::istreambuf_iterator<char>()); | |
151 | + | |
152 | + con->set_body(response); | |
153 | + con->set_status(websocketpp::http::status_code::ok); | |
154 | + } | |
155 | + | |
156 | + void on_open(connection_hdl hdl) { | |
157 | + m_connections.insert(hdl); | |
158 | + } | |
159 | + | |
160 | + void on_close(connection_hdl hdl) { | |
161 | + m_connections.erase(hdl); | |
162 | + } | |
163 | +private: | |
164 | + typedef std::set<connection_hdl,std::owner_less<connection_hdl>> con_list; | |
165 | + | |
166 | + server m_endpoint; | |
167 | + con_list m_connections; | |
168 | + server::timer_ptr m_timer; | |
169 | + | |
170 | + std::string m_docroot; | |
171 | + | |
172 | + // Telemetry data | |
173 | + uint64_t m_count; | |
174 | +}; | |
175 | + | |
176 | +int main(int argc, char* argv[]) { | |
177 | + telemetry_server s; | |
178 | + | |
179 | + std::string docroot; | |
180 | + uint16_t port = 9002; | |
181 | + | |
182 | + if (argc == 1) { | |
183 | + std::cout << "Usage: telemetry_server [documentroot] [port]" << std::endl; | |
184 | + return 1; | |
185 | + } | |
186 | + | |
187 | + if (argc >= 2) { | |
188 | + docroot = std::string(argv[1]); | |
189 | + } | |
190 | + | |
191 | + if (argc >= 3) { | |
192 | + int i = atoi(argv[2]); | |
193 | + if (i <= 0 || i > 65535) { | |
194 | + std::cout << "invalid port" << std::endl; | |
195 | + return 1; | |
196 | + } | |
197 | + | |
198 | + port = uint16_t(i); | |
199 | + } | |
200 | + | |
201 | + s.run(docroot, port); | |
202 | + return 0; | |
203 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/testee_client/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +if (ZLIB_FOUND) | |
6 | + | |
7 | +init_target (testee_client) | |
8 | + | |
9 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
10 | + | |
11 | +link_boost () | |
12 | +link_zlib() | |
13 | +final_target () | |
14 | + | |
15 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | |
16 | + | |
17 | +endif() | |
0 | 18 | \ No newline at end of file | ... | ... |
3rdparty/websocketpp-0.8.2/examples/testee_client/SConscript
0 → 100644
1 | +## Autobahn test client example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | + | |
10 | +env = env.Clone () | |
11 | +env_cpp11 = env_cpp11.Clone () | |
12 | + | |
13 | +prgs = [] | |
14 | + | |
15 | +# if a C++11 environment is available build using that, otherwise use boost | |
16 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
17 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] + ['z'] | |
18 | + prgs += env_cpp11.Program('testee_client', ["testee_client.cpp"], LIBS = ALL_LIBS) | |
19 | +else: | |
20 | + ALL_LIBS = boostlibs(['system','random'],env) + [platform_libs] + [polyfill_libs] + ['z'] | |
21 | + prgs += env.Program('testee_client', ["testee_client.cpp"], LIBS = ALL_LIBS) | |
22 | + | |
23 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/testee_client/testee_client.cpp
0 → 100644
1 | +/* | |
2 | + * Copyright (c) 2015, Peter Thorson. All rights reserved. | |
3 | + * | |
4 | + * Redistribution and use in source and binary forms, with or without | |
5 | + * modification, are permitted provided that the following conditions are met: | |
6 | + * * Redistributions of source code must retain the above copyright | |
7 | + * notice, this list of conditions and the following disclaimer. | |
8 | + * * Redistributions in binary form must reproduce the above copyright | |
9 | + * notice, this list of conditions and the following disclaimer in the | |
10 | + * documentation and/or other materials provided with the distribution. | |
11 | + * * Neither the name of the WebSocket++ Project nor the | |
12 | + * names of its contributors may be used to endorse or promote products | |
13 | + * derived from this software without specific prior written permission. | |
14 | + * | |
15 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
16 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 | + * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY | |
19 | + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
20 | + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
21 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
22 | + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
24 | + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | + * | |
26 | + */ | |
27 | + | |
28 | +#include <websocketpp/config/asio_no_tls_client.hpp> | |
29 | +#include <websocketpp/client.hpp> | |
30 | +#include <websocketpp/extensions/permessage_deflate/enabled.hpp> | |
31 | + | |
32 | +#include <iostream> | |
33 | + | |
34 | +struct deflate_config : public websocketpp::config::asio_client { | |
35 | + typedef deflate_config type; | |
36 | + typedef asio_client base; | |
37 | + | |
38 | + typedef base::concurrency_type concurrency_type; | |
39 | + | |
40 | + typedef base::request_type request_type; | |
41 | + typedef base::response_type response_type; | |
42 | + | |
43 | + typedef base::message_type message_type; | |
44 | + typedef base::con_msg_manager_type con_msg_manager_type; | |
45 | + typedef base::endpoint_msg_manager_type endpoint_msg_manager_type; | |
46 | + | |
47 | + typedef base::alog_type alog_type; | |
48 | + typedef base::elog_type elog_type; | |
49 | + | |
50 | + typedef base::rng_type rng_type; | |
51 | + | |
52 | + struct transport_config : public base::transport_config { | |
53 | + typedef type::concurrency_type concurrency_type; | |
54 | + typedef type::alog_type alog_type; | |
55 | + typedef type::elog_type elog_type; | |
56 | + typedef type::request_type request_type; | |
57 | + typedef type::response_type response_type; | |
58 | + typedef websocketpp::transport::asio::basic_socket::endpoint | |
59 | + socket_type; | |
60 | + }; | |
61 | + | |
62 | + typedef websocketpp::transport::asio::endpoint<transport_config> | |
63 | + transport_type; | |
64 | + | |
65 | + /// permessage_compress extension | |
66 | + struct permessage_deflate_config {}; | |
67 | + | |
68 | + typedef websocketpp::extensions::permessage_deflate::enabled | |
69 | + <permessage_deflate_config> permessage_deflate_type; | |
70 | +}; | |
71 | + | |
72 | +typedef websocketpp::client<deflate_config> client; | |
73 | + | |
74 | +using websocketpp::lib::placeholders::_1; | |
75 | +using websocketpp::lib::placeholders::_2; | |
76 | +using websocketpp::lib::bind; | |
77 | + | |
78 | +// pull out the type of messages sent by our config | |
79 | +typedef websocketpp::config::asio_client::message_type::ptr message_ptr; | |
80 | + | |
81 | +int case_count = 0; | |
82 | + | |
83 | +void on_message(client* c, websocketpp::connection_hdl hdl, message_ptr msg) { | |
84 | + client::connection_ptr con = c->get_con_from_hdl(hdl); | |
85 | + | |
86 | + if (con->get_resource() == "/getCaseCount") { | |
87 | + std::cout << "Detected " << msg->get_payload() << " test cases." | |
88 | + << std::endl; | |
89 | + case_count = atoi(msg->get_payload().c_str()); | |
90 | + } else { | |
91 | + c->send(hdl, msg->get_payload(), msg->get_opcode()); | |
92 | + } | |
93 | +} | |
94 | + | |
95 | +int main(int argc, char* argv[]) { | |
96 | + // Create a server endpoint | |
97 | + client c; | |
98 | + | |
99 | + std::string uri = "ws://localhost:9001"; | |
100 | + | |
101 | + if (argc == 2) { | |
102 | + uri = argv[1]; | |
103 | + } | |
104 | + | |
105 | + try { | |
106 | + // We expect there to be a lot of errors, so suppress them | |
107 | + c.clear_access_channels(websocketpp::log::alevel::all); | |
108 | + c.clear_error_channels(websocketpp::log::elevel::all); | |
109 | + | |
110 | + // Initialize ASIO | |
111 | + c.init_asio(); | |
112 | + | |
113 | + // Register our handlers | |
114 | + c.set_message_handler(bind(&on_message,&c,::_1,::_2)); | |
115 | + | |
116 | + websocketpp::lib::error_code ec; | |
117 | + client::connection_ptr con = c.get_connection(uri+"/getCaseCount", ec); | |
118 | + c.connect(con); | |
119 | + | |
120 | + // Start the ASIO io_service run loop | |
121 | + c.run(); | |
122 | + | |
123 | + std::cout << "case count: " << case_count << std::endl; | |
124 | + | |
125 | + for (int i = 1; i <= case_count; i++) { | |
126 | + c.reset(); | |
127 | + | |
128 | + std::stringstream url; | |
129 | + | |
130 | + url << uri << "/runCase?case=" << i << "&agent=" | |
131 | + << websocketpp::user_agent; | |
132 | + | |
133 | + con = c.get_connection(url.str(), ec); | |
134 | + | |
135 | + c.connect(con); | |
136 | + | |
137 | + c.run(); | |
138 | + } | |
139 | + | |
140 | + std::cout << "done" << std::endl; | |
141 | + | |
142 | + } catch (websocketpp::exception const & e) { | |
143 | + std::cout << e.what() << std::endl; | |
144 | + } | |
145 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/testee_server/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +if (ZLIB_FOUND) | |
6 | + | |
7 | +init_target (testee_server) | |
8 | + | |
9 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
10 | + | |
11 | +link_boost () | |
12 | +link_zlib() | |
13 | +final_target () | |
14 | + | |
15 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | |
16 | + | |
17 | +endif() | |
0 | 18 | \ No newline at end of file | ... | ... |
3rdparty/websocketpp-0.8.2/examples/testee_server/SConscript
0 → 100644
1 | +## Autobahn Testee Server | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | + | |
10 | +env = env.Clone () | |
11 | +env_cpp11 = env_cpp11.Clone () | |
12 | + | |
13 | +prgs = [] | |
14 | + | |
15 | +# if a C++11 environment is available build using that, otherwise use boost | |
16 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
17 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] + ['z'] | |
18 | + prgs += env_cpp11.Program('testee_server', ["testee_server.cpp"], LIBS = ALL_LIBS) | |
19 | +else: | |
20 | + ALL_LIBS = boostlibs(['system'],env) + [platform_libs] + [polyfill_libs] + ['z'] | |
21 | + prgs += env.Program('testee_server', ["testee_server.cpp"], LIBS = ALL_LIBS) | |
22 | + | |
23 | +Return('prgs') | ... | ... |
3rdparty/websocketpp-0.8.2/examples/testee_server/testee_server.cpp
0 → 100644
1 | +/* | |
2 | + * Copyright (c) 2015, Peter Thorson. All rights reserved. | |
3 | + * | |
4 | + * Redistribution and use in source and binary forms, with or without | |
5 | + * modification, are permitted provided that the following conditions are met: | |
6 | + * * Redistributions of source code must retain the above copyright | |
7 | + * notice, this list of conditions and the following disclaimer. | |
8 | + * * Redistributions in binary form must reproduce the above copyright | |
9 | + * notice, this list of conditions and the following disclaimer in the | |
10 | + * documentation and/or other materials provided with the distribution. | |
11 | + * * Neither the name of the WebSocket++ Project nor the | |
12 | + * names of its contributors may be used to endorse or promote products | |
13 | + * derived from this software without specific prior written permission. | |
14 | + * | |
15 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
16 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 | + * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY | |
19 | + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
20 | + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
21 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
22 | + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
24 | + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | + * | |
26 | + */ | |
27 | + | |
28 | +#include <websocketpp/config/asio_no_tls.hpp> | |
29 | +#include <websocketpp/server.hpp> | |
30 | +#include <websocketpp/extensions/permessage_deflate/enabled.hpp> | |
31 | +#include <iostream> | |
32 | + | |
33 | +struct testee_config : public websocketpp::config::asio { | |
34 | + // pull default settings from our core config | |
35 | + typedef websocketpp::config::asio core; | |
36 | + | |
37 | + typedef core::concurrency_type concurrency_type; | |
38 | + typedef core::request_type request_type; | |
39 | + typedef core::response_type response_type; | |
40 | + typedef core::message_type message_type; | |
41 | + typedef core::con_msg_manager_type con_msg_manager_type; | |
42 | + typedef core::endpoint_msg_manager_type endpoint_msg_manager_type; | |
43 | + | |
44 | + typedef core::alog_type alog_type; | |
45 | + typedef core::elog_type elog_type; | |
46 | + typedef core::rng_type rng_type; | |
47 | + typedef core::endpoint_base endpoint_base; | |
48 | + | |
49 | + static bool const enable_multithreading = true; | |
50 | + | |
51 | + struct transport_config : public core::transport_config { | |
52 | + typedef core::concurrency_type concurrency_type; | |
53 | + typedef core::elog_type elog_type; | |
54 | + typedef core::alog_type alog_type; | |
55 | + typedef core::request_type request_type; | |
56 | + typedef core::response_type response_type; | |
57 | + | |
58 | + static bool const enable_multithreading = true; | |
59 | + }; | |
60 | + | |
61 | + typedef websocketpp::transport::asio::endpoint<transport_config> | |
62 | + transport_type; | |
63 | + | |
64 | + static const websocketpp::log::level elog_level = | |
65 | + websocketpp::log::elevel::none; | |
66 | + static const websocketpp::log::level alog_level = | |
67 | + websocketpp::log::alevel::none; | |
68 | + | |
69 | + /// permessage_compress extension | |
70 | + struct permessage_deflate_config {}; | |
71 | + | |
72 | + typedef websocketpp::extensions::permessage_deflate::enabled | |
73 | + <permessage_deflate_config> permessage_deflate_type; | |
74 | +}; | |
75 | + | |
76 | +typedef websocketpp::server<testee_config> server; | |
77 | + | |
78 | +using websocketpp::lib::placeholders::_1; | |
79 | +using websocketpp::lib::placeholders::_2; | |
80 | +using websocketpp::lib::bind; | |
81 | + | |
82 | +// pull out the type of messages sent by our config | |
83 | +typedef server::message_ptr message_ptr; | |
84 | + | |
85 | +// Define a callback to handle incoming messages | |
86 | +void on_message(server* s, websocketpp::connection_hdl hdl, message_ptr msg) { | |
87 | + s->send(hdl, msg->get_payload(), msg->get_opcode()); | |
88 | +} | |
89 | + | |
90 | +void on_socket_init(websocketpp::connection_hdl, boost::asio::ip::tcp::socket & s) { | |
91 | + boost::asio::ip::tcp::no_delay option(true); | |
92 | + s.set_option(option); | |
93 | +} | |
94 | + | |
95 | +int main(int argc, char * argv[]) { | |
96 | + // Create a server endpoint | |
97 | + server testee_server; | |
98 | + | |
99 | + short port = 9002; | |
100 | + size_t num_threads = 1; | |
101 | + | |
102 | + if (argc == 3) { | |
103 | + port = atoi(argv[1]); | |
104 | + num_threads = atoi(argv[2]); | |
105 | + } | |
106 | + | |
107 | + try { | |
108 | + // Total silence | |
109 | + testee_server.clear_access_channels(websocketpp::log::alevel::all); | |
110 | + testee_server.clear_error_channels(websocketpp::log::alevel::all); | |
111 | + | |
112 | + // Initialize ASIO | |
113 | + testee_server.init_asio(); | |
114 | + testee_server.set_reuse_addr(true); | |
115 | + | |
116 | + // Register our message handler | |
117 | + testee_server.set_message_handler(bind(&on_message,&testee_server,::_1,::_2)); | |
118 | + testee_server.set_socket_init_handler(bind(&on_socket_init,::_1,::_2)); | |
119 | + | |
120 | + // Listen on specified port with extended listen backlog | |
121 | + testee_server.set_listen_backlog(8192); | |
122 | + testee_server.listen(port); | |
123 | + | |
124 | + // Start the server accept loop | |
125 | + testee_server.start_accept(); | |
126 | + | |
127 | + // Start the ASIO io_service run loop | |
128 | + if (num_threads == 1) { | |
129 | + testee_server.run(); | |
130 | + } else { | |
131 | + typedef websocketpp::lib::shared_ptr<websocketpp::lib::thread> thread_ptr; | |
132 | + std::vector<thread_ptr> ts; | |
133 | + for (size_t i = 0; i < num_threads; i++) { | |
134 | + ts.push_back(websocketpp::lib::make_shared<websocketpp::lib::thread>(&server::run, &testee_server)); | |
135 | + } | |
136 | + | |
137 | + for (size_t i = 0; i < num_threads; i++) { | |
138 | + ts[i]->join(); | |
139 | + } | |
140 | + } | |
141 | + | |
142 | + } catch (websocketpp::exception const & e) { | |
143 | + std::cout << "exception: " << e.what() << std::endl; | |
144 | + } | |
145 | +} | ... | ... |
3rdparty/websocketpp-0.8.2/examples/utility_client/CMakeLists.txt
0 → 100644
1 | + | |
2 | +file (GLOB SOURCE_FILES *.cpp) | |
3 | +file (GLOB HEADER_FILES *.hpp) | |
4 | + | |
5 | +init_target (utility_client) | |
6 | + | |
7 | +build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) | |
8 | + | |
9 | +link_boost () | |
10 | +final_target () | |
11 | + | |
12 | +set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "examples") | |
13 | + | ... | ... |
3rdparty/websocketpp-0.8.2/examples/utility_client/SConscript
0 → 100644
1 | +## Utility client example | |
2 | +## | |
3 | + | |
4 | +Import('env') | |
5 | +Import('env_cpp11') | |
6 | +Import('boostlibs') | |
7 | +Import('platform_libs') | |
8 | +Import('polyfill_libs') | |
9 | + | |
10 | +env = env.Clone () | |
11 | +env_cpp11 = env_cpp11.Clone () | |
12 | + | |
13 | +prgs = [] | |
14 | + | |
15 | +# if a C++11 environment is available build using that, otherwise use boost | |
16 | +if env_cpp11.has_key('WSPP_CPP11_ENABLED'): | |
17 | + ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] | |
18 | + prgs += env_cpp11.Program('utility_client', ["utility_client.cpp"], LIBS = ALL_LIBS) | |
19 | +else: | |
20 | + ALL_LIBS = boostlibs(['system','random'],env) + [platform_libs] + [polyfill_libs] | |
21 | + prgs += env.Program('utility_client', ["utility_client.cpp"], LIBS = ALL_LIBS) | |
22 | + | |
23 | +Return('prgs') | |
0 | 24 | \ No newline at end of file | ... | ... |
3rdparty/websocketpp-0.8.2/examples/utility_client/utility_client.cpp
0 → 100644
1 | +/* | |
2 | + * Copyright (c) 2014, Peter Thorson. All rights reserved. | |
3 | + * | |
4 | + * Redistribution and use in source and binary forms, with or without | |
5 | + * modification, are permitted provided that the following conditions are met: | |
6 | + * * Redistributions of source code must retain the above copyright | |
7 | + * notice, this list of conditions and the following disclaimer. | |
8 | + * * Redistributions in binary form must reproduce the above copyright | |
9 | + * notice, this list of conditions and the following disclaimer in the | |
10 | + * documentation and/or other materials provided with the distribution. | |
11 | + * * Neither the name of the WebSocket++ Project nor the | |
12 | + * names of its contributors may be used to endorse or promote products | |
13 | + * derived from this software without specific prior written permission. | |
14 | + * | |
15 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
16 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 | + * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY | |
19 | + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
20 | + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
21 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
22 | + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
24 | + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | + */ | |
26 | + | |
27 | +// **NOTE:** This file is a snapshot of the WebSocket++ utility client tutorial. | |
28 | +// Additional related material can be found in the tutorials/utility_client | |
29 | +// directory of the WebSocket++ repository. | |
30 | + | |
31 | +#include <websocketpp/config/asio_no_tls_client.hpp> | |
32 | +#include <websocketpp/client.hpp> | |
33 | + | |
34 | +#include <websocketpp/common/thread.hpp> | |
35 | +#include <websocketpp/common/memory.hpp> | |
36 | + | |
37 | +#include <cstdlib> | |
38 | +#include <iostream> | |
39 | +#include <map> | |
40 | +#include <string> | |
41 | +#include <sstream> | |
42 | + | |
43 | +typedef websocketpp::client<websocketpp::config::asio_client> client; | |
44 | + | |
45 | +class connection_metadata { | |
46 | +public: | |
47 | + typedef websocketpp::lib::shared_ptr<connection_metadata> ptr; | |
48 | + | |
49 | + connection_metadata(int id, websocketpp::connection_hdl hdl, std::string uri) | |
50 | + : m_id(id) | |
51 | + , m_hdl(hdl) | |
52 | + , m_status("Connecting") | |
53 | + , m_uri(uri) | |
54 | + , m_server("N/A") | |
55 | + {} | |
56 | + | |
57 | + void on_open(client * c, websocketpp::connection_hdl hdl) { | |
58 | + m_status = "Open"; | |
59 | + | |
60 | + client::connection_ptr con = c->get_con_from_hdl(hdl); | |
61 | + m_server = con->get_response_header("Server"); | |
62 | + } | |
63 | + | |
64 | + void on_fail(client * c, websocketpp::connection_hdl hdl) { | |
65 | + m_status = "Failed"; | |
66 | + | |
67 | + client::connection_ptr con = c->get_con_from_hdl(hdl); | |
68 | + m_server = con->get_response_header("Server"); | |
69 | + m_error_reason = con->get_ec().message(); | |
70 | + } | |
71 | + | |
72 | + void on_close(client * c, websocketpp::connection_hdl hdl) { | |
73 | + m_status = "Closed"; | |
74 | + client::connection_ptr con = c->get_con_from_hdl(hdl); | |
75 | + std::stringstream s; | |
76 | + s << "close code: " << con->get_remote_close_code() << " (" | |
77 | + << websocketpp::close::status::get_string(con->get_remote_close_code()) | |
78 | + << "), close reason: " << con->get_remote_close_reason(); | |
79 | + m_error_reason = s.str(); | |
80 | + } | |
81 | + | |
82 | + void on_message(websocketpp::connection_hdl, client::message_ptr msg) { | |
83 | + if (msg->get_opcode() == websocketpp::frame::opcode::text) { | |
84 | + m_messages.push_back("<< " + msg->get_payload()); | |
85 | + } else { | |
86 | + m_messages.push_back("<< " + websocketpp::utility::to_hex(msg->get_payload())); | |
87 | + } | |
88 | + } | |
89 | + | |
90 | + websocketpp::connection_hdl get_hdl() const { | |
91 | + return m_hdl; | |
92 | + } | |
93 | + | |
94 | + int get_id() const { | |
95 | + return m_id; | |
96 | + } | |
97 | + | |
98 | + std::string get_status() const { | |
99 | + return m_status; | |
100 | + } | |
101 | + | |
102 | + void record_sent_message(std::string message) { | |
103 | + m_messages.push_back(">> " + message); | |
104 | + } | |
105 | + | |
106 | + friend std::ostream & operator<< (std::ostream & out, connection_metadata const & data); | |
107 | +private: | |
108 | + int m_id; | |
109 | + websocketpp::connection_hdl m_hdl; | |
110 | + std::string m_status; | |
111 | + std::string m_uri; | |
112 | + std::string m_server; | |
113 | + std::string m_error_reason; | |
114 | + std::vector<std::string> m_messages; | |
115 | +}; | |
116 | + | |
117 | +std::ostream & operator<< (std::ostream & out, connection_metadata const & data) { | |
118 | + out << "> URI: " << data.m_uri << "\n" | |
119 | + << "> Status: " << data.m_status << "\n" | |
120 | + << "> Remote Server: " << (data.m_server.empty() ? "None Specified" : data.m_server) << "\n" | |
121 | + << "> Error/close reason: " << (data.m_error_reason.empty() ? "N/A" : data.m_error_reason) << "\n"; | |
122 | + out << "> Messages Processed: (" << data.m_messages.size() << ") \n"; | |
123 | + | |
124 | + std::vector<std::string>::const_iterator it; | |
125 | + for (it = data.m_messages.begin(); it != data.m_messages.end(); ++it) { | |
126 | + out << *it << "\n"; | |
127 | + } | |
128 | + | |
129 | + return out; | |
130 | +} | |
131 | + | |
132 | +class websocket_endpoint { | |
133 | +public: | |
134 | + websocket_endpoint () : m_next_id(0) { | |
135 | + m_endpoint.clear_access_channels(websocketpp::log::alevel::all); | |
136 | + m_endpoint.clear_error_channels(websocketpp::log::elevel::all); | |
137 | + | |
138 | + m_endpoint.init_asio(); | |
139 | + m_endpoint.start_perpetual(); | |
140 | + | |
141 | + m_thread = websocketpp::lib::make_shared<websocketpp::lib::thread>(&client::run, &m_endpoint); | |
142 | + } | |
143 | + | |
144 | + ~websocket_endpoint() { | |
145 | + m_endpoint.stop_perpetual(); | |
146 | + | |
147 | + for (con_list::const_iterator it = m_connection_list.begin(); it != m_connection_list.end(); ++it) { | |
148 | + if (it->second->get_status() != "Open") { | |
149 | + // Only close open connections | |
150 | + continue; | |
151 | + } | |
152 | + | |
153 | + std::cout << "> Closing connection " << it->second->get_id() << std::endl; | |
154 | + | |
155 | + websocketpp::lib::error_code ec; | |
156 | + m_endpoint.close(it->second->get_hdl(), websocketpp::close::status::going_away, "", ec); | |
157 | + if (ec) { | |
158 | + std::cout << "> Error closing connection " << it->second->get_id() << ": " | |
159 | + << ec.message() << std::endl; | |
160 | + } | |
161 | + } | |
162 | + | |
163 | + m_thread->join(); | |
164 | + } | |
165 | + | |
166 | + int connect(std::string const & uri) { | |
167 | + websocketpp::lib::error_code ec; | |
168 | + | |
169 | + client::connection_ptr con = m_endpoint.get_connection(uri, ec); | |
170 | + | |
171 | + if (ec) { | |
172 | + std::cout << "> Connect initialization error: " << ec.message() << std::endl; | |
173 | + return -1; | |
174 | + } | |
175 | + | |
176 | + int new_id = m_next_id++; | |
177 | + connection_metadata::ptr metadata_ptr = websocketpp::lib::make_shared<connection_metadata>(new_id, con->get_handle(), uri); | |
178 | + m_connection_list[new_id] = metadata_ptr; | |
179 | + | |
180 | + con->set_open_handler(websocketpp::lib::bind( | |
181 | + &connection_metadata::on_open, | |
182 | + metadata_ptr, | |
183 | + &m_endpoint, | |
184 | + websocketpp::lib::placeholders::_1 | |
185 | + )); | |
186 | + con->set_fail_handler(websocketpp::lib::bind( | |
187 | + &connection_metadata::on_fail, | |
188 | + metadata_ptr, | |
189 | + &m_endpoint, | |
190 | + websocketpp::lib::placeholders::_1 | |
191 | + )); | |
192 | + con->set_close_handler(websocketpp::lib::bind( | |
193 | + &connection_metadata::on_close, | |
194 | + metadata_ptr, | |
195 | + &m_endpoint, | |
196 | + websocketpp::lib::placeholders::_1 | |
197 | + )); | |
198 | + con->set_message_handler(websocketpp::lib::bind( | |
199 | + &connection_metadata::on_message, | |
200 | + metadata_ptr, | |
201 | + websocketpp::lib::placeholders::_1, | |
202 | + websocketpp::lib::placeholders::_2 | |
203 | + )); | |
204 | + | |
205 | + m_endpoint.connect(con); | |
206 | + | |
207 | + return new_id; | |
208 | + } | |
209 | + | |
210 | + void close(int id, websocketpp::close::status::value code, std::string reason) { | |
211 | + websocketpp::lib::error_code ec; | |
212 | + | |
213 | + con_list::iterator metadata_it = m_connection_list.find(id); | |
214 | + if (metadata_it == m_connection_list.end()) { | |
215 | + std::cout << "> No connection found with id " << id << std::endl; | |
216 | + return; | |
217 | + } | |
218 | + | |
219 | + m_endpoint.close(metadata_it->second->get_hdl(), code, reason, ec); | |
220 | + if (ec) { | |
221 | + std::cout << "> Error initiating close: " << ec.message() << std::endl; | |
222 | + } | |
223 | + } | |
224 | + | |
225 | + void send(int id, std::string message) { | |
226 | + websocketpp::lib::error_code ec; | |
227 | + | |
228 | + con_list::iterator metadata_it = m_connection_list.find(id); | |
229 | + if (metadata_it == m_connection_list.end()) { | |
230 | + std::cout << "> No connection found with id " << id << std::endl; | |
231 | + return; | |
232 | + } | |
233 | + | |
234 | + m_endpoint.send(metadata_it->second->get_hdl(), message, websocketpp::frame::opcode::text, ec); | |
235 | + if (ec) { | |
236 | + std::cout << "> Error sending message: " << ec.message() << std::endl; | |
237 | + return; | |
238 | + } | |
239 | + | |
240 | + metadata_it->second->record_sent_message(message); | |
241 | + } | |
242 | + | |
243 | + connection_metadata::ptr get_metadata(int id) const { | |
244 | + con_list::const_iterator metadata_it = m_connection_list.find(id); | |
245 | + if (metadata_it == m_connection_list.end()) { | |
246 | + return connection_metadata::ptr(); | |
247 | + } else { | |
248 | + return metadata_it->second; | |
249 | + } | |
250 | + } | |
251 | +private: | |
252 | + typedef std::map<int,connection_metadata::ptr> con_list; | |
253 | + | |
254 | + client m_endpoint; | |
255 | + websocketpp::lib::shared_ptr<websocketpp::lib::thread> m_thread; | |
256 | + | |
257 | + con_list m_connection_list; | |
258 | + int m_next_id; | |
259 | +}; | |
260 | + | |
261 | +int main() { | |
262 | + bool done = false; | |
263 | + std::string input; | |
264 | + websocket_endpoint endpoint; | |
265 | + | |
266 | + while (!done) { | |
267 | + std::cout << "Enter Command: "; | |
268 | + std::getline(std::cin, input); | |
269 | + | |
270 | + if (input == "quit") { | |
271 | + done = true; | |
272 | + } else if (input == "help") { | |
273 | + std::cout | |
274 | + << "\nCommand List:\n" | |
275 | + << "connect <ws uri>\n" | |
276 | + << "send <connection id> <message>\n" | |
277 | + << "close <connection id> [<close code:default=1000>] [<close reason>]\n" | |
278 | + << "show <connection id>\n" | |
279 | + << "help: Display this help text\n" | |
280 | + << "quit: Exit the program\n" | |
281 | + << std::endl; | |
282 | + } else if (input.substr(0,7) == "connect") { | |
283 | + int id = endpoint.connect(input.substr(8)); | |
284 | + if (id != -1) { | |
285 | + std::cout << "> Created connection with id " << id << std::endl; | |
286 | + } | |
287 | + } else if (input.substr(0,4) == "send") { | |
288 | + std::stringstream ss(input); | |
289 | + | |
290 | + std::string cmd; | |
291 | + int id; | |
292 | + std::string message; | |
293 | + | |
294 | + ss >> cmd >> id; | |
295 | + std::getline(ss,message); | |
296 | + | |
297 | + endpoint.send(id, message); | |
298 | + } else if (input.substr(0,5) == "close") { | |
299 | + std::stringstream ss(input); | |
300 | + | |
301 | + std::string cmd; | |
302 | + int id; | |
303 | + int close_code = websocketpp::close::status::normal; | |
304 | + std::string reason; | |
305 | + | |
306 | + ss >> cmd >> id >> close_code; | |
307 | + std::getline(ss,reason); | |
308 | + | |
309 | + endpoint.close(id, close_code, reason); | |
310 | + } else if (input.substr(0,4) == "show") { | |
311 | + int id = atoi(input.substr(5).c_str()); | |
312 | + | |
313 | + connection_metadata::ptr metadata = endpoint.get_metadata(id); | |
314 | + if (metadata) { | |
315 | + std::cout << *metadata << std::endl; | |
316 | + } else { | |
317 | + std::cout << "> Unknown connection id " << id << std::endl; | |
318 | + } | |
319 | + } else { | |
320 | + std::cout << "> Unrecognized Command" << std::endl; | |
321 | + } | |
322 | + } | |
323 | + | |
324 | + return 0; | |
325 | +} | |
0 | 326 | \ No newline at end of file | ... | ... |
3rdparty/websocketpp-0.8.2/readme.md
0 → 100644
1 | +WebSocket++ (0.8.2) | |
2 | +========================== | |
3 | + | |
4 | +WebSocket++ is a header only C++ library that implements RFC6455 The WebSocket | |
5 | +Protocol. It allows integrating WebSocket client and server functionality into | |
6 | +C++ programs. It uses interchangeable network transport modules including one | |
7 | +based on raw char buffers, one based on C++ iostreams, and one based on Asio | |
8 | +(either via Boost or standalone). End users can write additional transport | |
9 | +policies to support other networking or event libraries as needed. | |
10 | + | |
11 | +Major Features | |
12 | +============== | |
13 | +* Full support for RFC6455 | |
14 | +* Partial support for Hixie 76 / Hybi 00, 07-17 draft specs (server only) | |
15 | +* Message/event based interface | |
16 | +* Supports secure WebSockets (TLS), IPv6, and explicit proxies. | |
17 | +* Flexible dependency management (C++11 Standard Library or Boost) | |
18 | +* Interchangeable network transport modules (raw, iostream, Asio, or custom) | |
19 | +* Portable/cross platform (Posix/Windows, 32/64bit, Intel/ARM/PPC) | |
20 | +* Thread-safe | |
21 | + | |
22 | +Get Involved | |
23 | +============ | |
24 | + | |
25 | +[](https://travis-ci.org/zaphoyd/websocketpp) | |
26 | + | |
27 | +**Project Website** | |
28 | +http://www.zaphoyd.com/websocketpp/ | |
29 | + | |
30 | +**User Manual** | |
31 | +http://docs.websocketpp.org/ | |
32 | + | |
33 | +**GitHub Repository** | |
34 | +https://github.com/zaphoyd/websocketpp/ | |
35 | + | |
36 | +GitHub pull requests should be submitted to the `develop` branch. | |
37 | + | |
38 | +**Announcements Mailing List** | |
39 | +http://groups.google.com/group/websocketpp-announcements/ | |
40 | + | |
41 | +**IRC Channel** | |
42 | + #websocketpp (freenode) | |
43 | + | |
44 | +**Discussion / Development / Support Mailing List / Forum** | |
45 | +http://groups.google.com/group/websocketpp/ | |
46 | + | |
47 | +Author | |
48 | +====== | |
49 | +Peter Thorson - websocketpp@zaphoyd.com | ... | ... |
3rdparty/websocketpp-0.8.2/release/include/websocketpp/base64/base64.hpp
0 → 100644
1 | +/* | |
2 | + ****** | |
3 | + base64.hpp is a repackaging of the base64.cpp and base64.h files into a | |
4 | + single header suitable for use as a header only library. This conversion was | |
5 | + done by Peter Thorson (webmaster@zaphoyd.com) in 2012. All modifications to | |
6 | + the code are redistributed under the same license as the original, which is | |
7 | + listed below. | |
8 | + ****** | |
9 | + | |
10 | + base64.cpp and base64.h | |
11 | + | |
12 | + Copyright (C) 2004-2008 René Nyffenegger | |
13 | + | |
14 | + This source code is provided 'as-is', without any express or implied | |
15 | + warranty. In no event will the author be held liable for any damages | |
16 | + arising from the use of this software. | |
17 | + | |
18 | + Permission is granted to anyone to use this software for any purpose, | |
19 | + including commercial applications, and to alter it and redistribute it | |
20 | + freely, subject to the following restrictions: | |
21 | + | |
22 | + 1. The origin of this source code must not be misrepresented; you must not | |
23 | + claim that you wrote the original source code. If you use this source code | |
24 | + in a product, an acknowledgment in the product documentation would be | |
25 | + appreciated but is not required. | |
26 | + | |
27 | + 2. Altered source versions must be plainly marked as such, and must not be | |
28 | + misrepresented as being the original source code. | |
29 | + | |
30 | + 3. This notice may not be removed or altered from any source distribution. | |
31 | + | |
32 | + René Nyffenegger rene.nyffenegger@adp-gmbh.ch | |
33 | + | |
34 | +*/ | |
35 | + | |
36 | +#ifndef _BASE64_HPP_ | |
37 | +#define _BASE64_HPP_ | |
38 | + | |
39 | +#include <string> | |
40 | + | |
41 | +namespace websocketpp { | |
42 | + | |
43 | +static std::string const base64_chars = | |
44 | + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
45 | + "abcdefghijklmnopqrstuvwxyz" | |
46 | + "0123456789+/"; | |
47 | + | |
48 | +/// Test whether a character is a valid base64 character | |
49 | +/** | |
50 | + * @param c The character to test | |
51 | + * @return true if c is a valid base64 character | |
52 | + */ | |
53 | +static inline bool is_base64(unsigned char c) { | |
54 | + return (c == 43 || // + | |
55 | + (c >= 47 && c <= 57) || // /-9 | |
56 | + (c >= 65 && c <= 90) || // A-Z | |
57 | + (c >= 97 && c <= 122)); // a-z | |
58 | +} | |
59 | + | |
60 | +/// Encode a char buffer into a base64 string | |
61 | +/** | |
62 | + * @param input The input data | |
63 | + * @param len The length of input in bytes | |
64 | + * @return A base64 encoded string representing input | |
65 | + */ | |
66 | +inline std::string base64_encode(unsigned char const * input, size_t len) { | |
67 | + std::string ret; | |
68 | + int i = 0; | |
69 | + int j = 0; | |
70 | + unsigned char char_array_3[3]; | |
71 | + unsigned char char_array_4[4]; | |
72 | + | |
73 | + while (len--) { | |
74 | + char_array_3[i++] = *(input++); | |
75 | + if (i == 3) { | |
76 | + char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; | |
77 | + char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + | |
78 | + ((char_array_3[1] & 0xf0) >> 4); | |
79 | + char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + | |
80 | + ((char_array_3[2] & 0xc0) >> 6); | |
81 | + char_array_4[3] = char_array_3[2] & 0x3f; | |
82 | + | |
83 | + for(i = 0; (i <4) ; i++) { | |
84 | + ret += base64_chars[char_array_4[i]]; | |
85 | + } | |
86 | + i = 0; | |
87 | + } | |
88 | + } | |
89 | + | |
90 | + if (i) { | |
91 | + for(j = i; j < 3; j++) { | |
92 | + char_array_3[j] = '\0'; | |
93 | + } | |
94 | + | |
95 | + char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; | |
96 | + char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + | |
97 | + ((char_array_3[1] & 0xf0) >> 4); | |
98 | + char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + | |
99 | + ((char_array_3[2] & 0xc0) >> 6); | |
100 | + char_array_4[3] = char_array_3[2] & 0x3f; | |
101 | + | |
102 | + for (j = 0; (j < i + 1); j++) { | |
103 | + ret += base64_chars[char_array_4[j]]; | |
104 | + } | |
105 | + | |
106 | + while((i++ < 3)) { | |
107 | + ret += '='; | |
108 | + } | |
109 | + } | |
110 | + | |
111 | + return ret; | |
112 | +} | |
113 | + | |
114 | +/// Encode a string into a base64 string | |
115 | +/** | |
116 | + * @param input The input data | |
117 | + * @return A base64 encoded string representing input | |
118 | + */ | |
119 | +inline std::string base64_encode(std::string const & input) { | |
120 | + return base64_encode( | |
121 | + reinterpret_cast<const unsigned char *>(input.data()), | |
122 | + input.size() | |
123 | + ); | |
124 | +} | |
125 | + | |
126 | +/// Decode a base64 encoded string into a string of raw bytes | |
127 | +/** | |
128 | + * @param input The base64 encoded input data | |
129 | + * @return A string representing the decoded raw bytes | |
130 | + */ | |
131 | +inline std::string base64_decode(std::string const & input) { | |
132 | + size_t in_len = input.size(); | |
133 | + int i = 0; | |
134 | + int j = 0; | |
135 | + int in_ = 0; | |
136 | + unsigned char char_array_4[4], char_array_3[3]; | |
137 | + std::string ret; | |
138 | + | |
139 | + while (in_len-- && ( input[in_] != '=') && is_base64(input[in_])) { | |
140 | + char_array_4[i++] = input[in_]; in_++; | |
141 | + if (i ==4) { | |
142 | + for (i = 0; i <4; i++) { | |
143 | + char_array_4[i] = static_cast<unsigned char>(base64_chars.find(char_array_4[i])); | |
144 | + } | |
145 | + | |
146 | + char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); | |
147 | + char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); | |
148 | + char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; | |
149 | + | |
150 | + for (i = 0; (i < 3); i++) { | |
151 | + ret += char_array_3[i]; | |
152 | + } | |
153 | + i = 0; | |
154 | + } | |
155 | + } | |
156 | + | |
157 | + if (i) { | |
158 | + for (j = i; j <4; j++) | |
159 | + char_array_4[j] = 0; | |
160 | + | |
161 | + for (j = 0; j <4; j++) | |
162 | + char_array_4[j] = static_cast<unsigned char>(base64_chars.find(char_array_4[j])); | |
163 | + | |
164 | + char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); | |
165 | + char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); | |
166 | + char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; | |
167 | + | |
168 | + for (j = 0; (j < i - 1); j++) { | |
169 | + ret += static_cast<std::string::value_type>(char_array_3[j]); | |
170 | + } | |
171 | + } | |
172 | + | |
173 | + return ret; | |
174 | +} | |
175 | + | |
176 | +} // namespace websocketpp | |
177 | + | |
178 | +#endif // _BASE64_HPP_ | ... | ... |