├── .gitignore ├── LICENSE ├── README.md ├── app ├── build │ ├── oculus-bridge-osx.zip │ └── oculus-bridge-windows.zip └── src │ ├── blocks │ └── Cinder-WebSocketPP │ │ ├── lib │ │ ├── macosx │ │ │ ├── libboost_random.a │ │ │ └── libboost_regex.a │ │ └── msw │ │ │ ├── libboost_random-vc110-mt-s-1_53.lib │ │ │ └── libboost_random-vc110-mt-sgd-1_53.lib │ │ └── src │ │ ├── WebSocketClient.cpp │ │ ├── WebSocketClient.h │ │ ├── WebSocketConnection.cpp │ │ ├── WebSocketConnection.h │ │ ├── WebSocketServer.cpp │ │ ├── WebSocketServer.h │ │ └── websocketpp │ │ ├── COPYING │ │ ├── base64 │ │ ├── base64.cpp │ │ ├── base64.h │ │ └── base64.hpp │ │ ├── client.hpp │ │ ├── close.hpp │ │ ├── common │ │ ├── chrono.hpp │ │ ├── connection_hdl.hpp │ │ ├── cpp11.hpp │ │ ├── functional.hpp │ │ ├── md5.hpp │ │ ├── memory.hpp │ │ ├── network.hpp │ │ ├── platforms.hpp │ │ ├── random.hpp │ │ ├── regex.hpp │ │ ├── stdint.hpp │ │ ├── system_error.hpp │ │ └── thread.hpp │ │ ├── concurrency │ │ ├── basic.hpp │ │ └── none.hpp │ │ ├── config │ │ ├── asio.hpp │ │ ├── asio_client.hpp │ │ ├── asio_no_tls.hpp │ │ ├── asio_no_tls_client.hpp │ │ ├── boost_config.hpp │ │ ├── core.hpp │ │ ├── core_client.hpp │ │ ├── debug.hpp │ │ ├── debug_asio.hpp │ │ └── debug_asio_no_tls.hpp │ │ ├── connection.hpp │ │ ├── connection_base.hpp │ │ ├── endpoint.hpp │ │ ├── endpoint_base.hpp │ │ ├── error.hpp │ │ ├── error_container.hpp │ │ ├── extensions │ │ ├── extension.hpp │ │ └── permessage_deflate │ │ │ ├── disabled.hpp │ │ │ └── enabled.hpp │ │ ├── frame.hpp │ │ ├── http │ │ ├── constants.hpp │ │ ├── impl │ │ │ ├── parser.hpp │ │ │ ├── request.hpp │ │ │ └── response.hpp │ │ ├── parser.hpp │ │ ├── request.hpp │ │ └── response.hpp │ │ ├── impl │ │ ├── connection_impl.hpp │ │ ├── endpoint_impl.hpp │ │ └── utilities_impl.hpp │ │ ├── logger │ │ ├── basic.hpp │ │ ├── levels.hpp │ │ └── stub.hpp │ │ ├── message_buffer │ │ ├── alloc.hpp │ │ ├── message.hpp │ │ └── pool.hpp │ │ ├── processors │ │ ├── base.hpp │ │ ├── hybi00.hpp │ │ ├── hybi07.hpp │ │ ├── hybi08.hpp │ │ ├── hybi13.hpp │ │ └── processor.hpp │ │ ├── random │ │ ├── none.hpp │ │ └── random_device.hpp │ │ ├── roles │ │ ├── client_endpoint.hpp │ │ └── server_endpoint.hpp │ │ ├── server.hpp │ │ ├── sha1 │ │ ├── license.txt │ │ └── sha1.hpp │ │ ├── transport │ │ ├── asio │ │ │ ├── base.hpp │ │ │ ├── connection.hpp │ │ │ ├── endpoint.hpp │ │ │ └── security │ │ │ │ ├── base.hpp │ │ │ │ ├── none.hpp │ │ │ │ └── tls.hpp │ │ ├── base │ │ │ ├── connection.hpp │ │ │ └── endpoint.hpp │ │ └── iostream │ │ │ ├── base.hpp │ │ │ ├── connection.hpp │ │ │ └── endpoint.hpp │ │ ├── uri.hpp │ │ ├── utf8_validator.hpp │ │ ├── utilities.hpp │ │ └── version.hpp │ ├── include │ └── Resources.h │ ├── resources │ ├── cinder_app_icon.ico │ ├── oculus_bridge.icns │ ├── oculus_bridge.ico │ └── status.jpg │ ├── src │ ├── Oculus.cpp │ ├── Oculus.h │ └── OculusSocketServerApp.cpp │ ├── vc11 │ ├── OculusSocketServer.sln │ ├── OculusSocketServer.vcxproj │ ├── OculusSocketServer.vcxproj.filters │ ├── OculusSocketServer.vcxproj.user │ └── Resources.rc │ └── xcode │ ├── Info.plist │ ├── OculusSocketServer.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── OculusSocketServer_Prefix.pch ├── docs ├── build_instructions.md ├── first_person_movement.md └── javascript_docs.md ├── examples ├── connect.html ├── css │ ├── distort.vs │ ├── passthrough.fs │ └── style.css ├── css_shaders.html ├── first_person.html ├── img │ ├── grid.jpg │ ├── oculus_bridge.png │ └── oculus_bridge_offline.png ├── js │ ├── connect.js │ └── first_person.js ├── lib │ ├── OrbitControls.js │ ├── RiftCamera.js │ └── three.min.js └── textures │ ├── blue_blue.jpg │ ├── purple_blue.jpg │ └── tile.jpg └── web ├── GruntFile.js ├── build └── OculusBridge.min.js ├── package.json └── src └── OculusBridge.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | *.pbxuser 4 | *.perspective 5 | *.perspectivev3 6 | app/src/vc11/Debug/* 7 | app/src/vc11/Build/* 8 | app/src/xcode/build/* 9 | *.xcodeproj/xcuserdata/*.xcuserdatad 10 | *.xcworkspace 11 | xcuserdata 12 | 13 | 14 | *.vssscc 15 | *_i.c 16 | *_p.c 17 | *.ncb 18 | *.suo 19 | *.tlb 20 | *.tlh 21 | *.bak 22 | *.[Cc]ache 23 | *.ilk 24 | *.log 25 | *.sbr 26 | *.sdf 27 | *.opensdf 28 | *.unsuccessfulbuild 29 | ipch/ 30 | obj/ 31 | [Bb]in 32 | [Dd]ebug*/ 33 | [Rr]elease*/ 34 | 35 | web/node_modules/* 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2012 Instrument Marketing Inc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | oculus-bridge 2 | ============= 3 | 4 | 5 | A simple desktop app and javaScript library to link the Oculus Rift with the web. 6 | 7 | __Important Bits:__ 8 | 9 | - Host App: [Windows](https://github.com/Instrument/oculus-bridge/blob/master/app/build/oculus-bridge-windows.zip?raw=true) | [Mac OSX](https://github.com/Instrument/oculus-bridge/blob/master/app/build/oculus-bridge-osx.zip?raw=true) 10 | - [JS library](https://github.com/Instrument/oculus-bridge/tree/master/web/build) 11 | - [Documentation](https://github.com/Instrument/oculus-bridge/tree/master/docs) 12 | 13 | 14 | The goal of this project is to provide a flexible, simple way to access the tracking data and display configuration for the Oculus Rift for use with webGL or any other browser-based content. This is not the first websocket based utility for the Oculus Rift, but the cross platform code base and modularity of the JavaScript has been built to support changes in the hardware and ease of integration on the JavaScript side. 15 | 16 | 17 | ## Requirements 18 | 19 | - An Oculus Rift 20 | - A browser that supports websockets 21 | - The OculusBrige host application : [Windows](https://github.com/Instrument/oculus-bridge/blob/master/app/build/oculus-bridge-windows.zip?raw=true) | [Mac OSX](https://github.com/Instrument/oculus-bridge/blob/master/app/build/oculus-bridge-osx.zip?raw=true) 22 | 23 | 24 | ## Basic Usage 25 | 26 | - Download and launch the OculusBrige host application 27 | - Open one of the example pages: 28 | - [Basic Connection Test](http://instrument.github.io/oculus-bridge/examples/connect.html) 29 | - [First Person Example](http://instrument.github.io/oculus-bridge/examples/first_person.html) 30 | - [CSS Shader Example](http://instrument.github.io/oculus-bridge/examples/css_shaders.html) 31 | - Plug in your Oculus Rift (you probably already did this already..) 32 | 33 | The order in which these things occur isn't important. The app and JavaScript are built to handle loosing connectivity, having the hardware connected and disconnected randomly at runtime, etc. 34 | 35 | 36 | ## Browser/Platform Support 37 | 38 | ##### JavaScript library 39 | 40 | The JavaScript library has been tested with the following browsers: 41 | 42 | - Chrome 28 43 | - Safari 6 44 | - Firefox 22 45 | 46 | Example content is currently using THREE.js r59 47 | 48 | 49 | ##### OculusBridge Application 50 | 51 | The bridge application has been compiled for MacOS Mountain Lion and Windows 7. 52 | 53 | 54 | ## Using the JavaScript Library 55 | 56 | To add Oculus Rift support to your web project, download and include [OculusBridge.min.js](https://github.com/Instrument/oculus-bridge/tree/master/web/build) in your HTML. The bridge is purely a way to access data from the rift hardware and does not make any assumptions about the renderer. It is especially easy to use the bridge with THREE.js but there is no specific dependancy on THREE.js at this time. Check out the documentation and example code for more detailed explaination. 57 | 58 | // rotate a THREE.js object based on the orientation of the Oculus Rift 59 | 60 | var bridge = new OculusBridge({ 61 | "onOrientationUpdate" : function(quatValues) { 62 | giantSquid.quaternion.set(quatValues.x, quatValues.y, quatValues.z, quatValues.w); 63 | } 64 | }); 65 | 66 | bridge.connect(); 67 | 68 | 69 | ## Documentation 70 | 71 | - [OculusBridge JavaScript](https://github.com/Instrument/oculus-bridge/blob/master/docs/javascript_docs.md) 72 | - [Implementing typical FPS movement](https://github.com/Instrument/oculus-bridge/blob/master/docs/first_person_movement.md) 73 | - [Building the host app](https://github.com/Instrument/oculus-bridge/blob/master/docs/build_instructions.md) 74 | 75 | ## Credits 76 | 77 | Thanks to the following libraries and people who make this project possible. Credit and copyright belong to the respective parties: 78 | 79 | - [Cinder](http://libcinder.org/) - [license](https://github.com/cinder/Cinder/blob/master/docs/COPYING) 80 | - [Websocket++](http://www.zaphoyd.com/websocketpp) - [license](https://github.com/zaphoyd/websocketpp/blob/master/COPYING) 81 | - [Websocket++ Cinder Block](https://github.com/BanTheRewind/Cinder-WebSocketPP) 82 | - [THREE.js](http://threejs.org/) - [license](https://github.com/mrdoob/three.js/blob/master/LICENSE) 83 | - [RiftCamera](https://github.com/troffmo5/OculusStreetView) for THREE.js 84 | - [Oculus Rift SDK](http://developer.oculusvr.com) -------------------------------------------------------------------------------- /app/build/oculus-bridge-osx.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Instrument/oculus-bridge/29ef33ca7bc91c26d9b7b7299af2469d9cca7b87/app/build/oculus-bridge-osx.zip -------------------------------------------------------------------------------- /app/build/oculus-bridge-windows.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Instrument/oculus-bridge/29ef33ca7bc91c26d9b7b7299af2469d9cca7b87/app/build/oculus-bridge-windows.zip -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/lib/macosx/libboost_random.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Instrument/oculus-bridge/29ef33ca7bc91c26d9b7b7299af2469d9cca7b87/app/src/blocks/Cinder-WebSocketPP/lib/macosx/libboost_random.a -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/lib/macosx/libboost_regex.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Instrument/oculus-bridge/29ef33ca7bc91c26d9b7b7299af2469d9cca7b87/app/src/blocks/Cinder-WebSocketPP/lib/macosx/libboost_regex.a -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/lib/msw/libboost_random-vc110-mt-s-1_53.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Instrument/oculus-bridge/29ef33ca7bc91c26d9b7b7299af2469d9cca7b87/app/src/blocks/Cinder-WebSocketPP/lib/msw/libboost_random-vc110-mt-s-1_53.lib -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/lib/msw/libboost_random-vc110-mt-sgd-1_53.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Instrument/oculus-bridge/29ef33ca7bc91c26d9b7b7299af2469d9cca7b87/app/src/blocks/Cinder-WebSocketPP/lib/msw/libboost_random-vc110-mt-sgd-1_53.lib -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/WebSocketClient.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, Ban the Rewind, Wieden+Kennedy 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or 6 | * without modification, are permitted provided that the following 7 | * conditions are met: 8 | * 9 | * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * Neither the name of the Ban the Rewind nor the names of its 17 | * contributors may be used to endorse or promote products 18 | * derived from this software without specific prior written 19 | * permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 32 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | */ 35 | 36 | #include "WebSocketClient.h" 37 | 38 | using namespace std; 39 | 40 | using websocketpp::lib::placeholders::_1; 41 | using websocketpp::lib::placeholders::_2; 42 | using websocketpp::lib::bind; 43 | 44 | WebSocketClient::WebSocketClient() 45 | { 46 | mClient.clear_access_channels( websocketpp::log::alevel::all ); 47 | mClient.clear_error_channels( websocketpp::log::elevel::all ); 48 | 49 | mClient.init_asio(); 50 | 51 | mClient.set_close_handler( websocketpp::lib::bind( &WebSocketClient::onDisconnect, this, &mClient, ::_1 ) ); 52 | mClient.set_interrupt_handler( websocketpp::lib::bind( &WebSocketClient::onInterrupt, this, &mClient, ::_1 ) ); 53 | mClient.set_open_handler( websocketpp::lib::bind( &WebSocketClient::onConnect, this, &mClient, ::_1 ) ); 54 | mClient.set_pong_handler( websocketpp::lib::bind( &WebSocketClient::onPing, this, &mClient, ::_1, ::_2 ) ); 55 | mClient.set_message_handler( websocketpp::lib::bind( &WebSocketClient::onRead, this, &mClient, ::_1, ::_2 ) ); 56 | mClient.set_fail_handler( websocketpp::lib::bind( &WebSocketClient::onFail, this, &mClient, ::_1 ) ); 57 | } 58 | 59 | WebSocketClient::~WebSocketClient() 60 | { 61 | if ( !mClient.stopped() ) { 62 | disconnect(); 63 | mClient.stop(); 64 | } 65 | } 66 | 67 | void WebSocketClient::connect( const std::string& uri ) 68 | { 69 | try { 70 | websocketpp::lib::error_code err; 71 | Client::connection_ptr conn = mClient.get_connection( uri, err ); 72 | if ( err ) { 73 | mSignalError( err.message() ); 74 | } else { 75 | if ( conn ) { 76 | mClient.connect( conn ); 77 | } else { 78 | mSignalError( "Unable to resolve address." ); 79 | } 80 | } 81 | } catch ( const std::exception& ex ) { 82 | mSignalError( ex.what() ); 83 | } catch ( websocketpp::lib::error_code err ) { 84 | mSignalError( err.message() ); 85 | } catch ( ... ) { 86 | mSignalError( "An unknown exception occurred." ); 87 | } 88 | } 89 | 90 | void WebSocketClient::disconnect() 91 | { 92 | websocketpp::lib::error_code err; 93 | mClient.close( mHandle, websocketpp::close::status::going_away, "", err ); 94 | if ( err ) { 95 | mSignalError( err.message() ); 96 | } 97 | } 98 | 99 | void WebSocketClient::ping( const string& msg ) 100 | { 101 | try { 102 | mClient.get_con_from_hdl( mHandle )->ping( msg ); 103 | } catch( ... ) { 104 | mSignalError( "Ping failed." ); 105 | } 106 | } 107 | 108 | void WebSocketClient::poll() 109 | { 110 | mClient.poll(); 111 | } 112 | 113 | void WebSocketClient::write( const std::string& msg ) 114 | { 115 | if ( msg.empty() ) { 116 | mSignalError( "Cannot send empty message." ); 117 | } else { 118 | websocketpp::lib::error_code err; 119 | mClient.send( mHandle, msg, websocketpp::frame::opcode::TEXT, err ); 120 | if ( err ) { 121 | mSignalError( err.message() ); 122 | } else { 123 | mSignalWrite(); 124 | } 125 | } 126 | } 127 | 128 | void WebSocketClient::onConnect( Client* client, websocketpp::connection_hdl handle ) 129 | { 130 | mHandle = handle; 131 | mSignalConnect(); 132 | } 133 | 134 | void WebSocketClient::onDisconnect( Client* client, websocketpp::connection_hdl handle ) 135 | { 136 | mSignalDisconnect(); 137 | } 138 | 139 | void WebSocketClient::onFail( Client* client, websocketpp::connection_hdl handle ) 140 | { 141 | mHandle = handle; 142 | mSignalError( "Transfer failed." ); 143 | } 144 | 145 | void WebSocketClient::onInterrupt( Client* client, websocketpp::connection_hdl handle ) 146 | { 147 | mHandle = handle; 148 | mSignalInterrupt(); 149 | } 150 | 151 | void WebSocketClient::onPing( Client* client, websocketpp::connection_hdl handle, string msg ) 152 | { 153 | mHandle = handle; 154 | mSignalPing( msg ); 155 | } 156 | 157 | void WebSocketClient::onRead( Client* client, websocketpp::connection_hdl handle, MessageRef msg ) 158 | { 159 | mHandle = handle; 160 | mSignalRead( msg->get_payload() ); 161 | } 162 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/WebSocketClient.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, Ban the Rewind, Wieden+Kennedy 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or 6 | * without modification, are permitted provided that the following 7 | * conditions are met: 8 | * 9 | * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * Neither the name of the Ban the Rewind nor the names of its 17 | * contributors may be used to endorse or promote products 18 | * derived from this software without specific prior written 19 | * permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 32 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | */ 35 | 36 | #pragma once 37 | 38 | #include "websocketpp/config/asio_no_tls_client.hpp" 39 | #include "websocketpp/client.hpp" 40 | 41 | #include "WebSocketConnection.h" 42 | 43 | class WebSocketClient : public WebSocketConnection 44 | { 45 | public: 46 | WebSocketClient(); 47 | ~WebSocketClient(); 48 | 49 | void connect( const std::string& uri ); 50 | void disconnect(); 51 | void ping( const std::string& msg = "" ); 52 | void poll(); 53 | void write( const std::string& msg ); 54 | protected: 55 | typedef websocketpp::client Client; 56 | typedef websocketpp::config::asio_client::message_type::ptr MessageRef; 57 | 58 | Client mClient; 59 | 60 | void onConnect( Client* client, websocketpp::connection_hdl handle ); 61 | void onDisconnect( Client* client, websocketpp::connection_hdl handle ); 62 | void onFail( Client* client, websocketpp::connection_hdl handle ); 63 | void onInterrupt( Client* client, websocketpp::connection_hdl handle ); 64 | void onPing( Client* client, websocketpp::connection_hdl handle, std::string msg ); 65 | void onRead( Client* client, websocketpp::connection_hdl handle, MessageRef msg ); 66 | }; 67 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/WebSocketConnection.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, Ban the Rewind, Wieden+Kennedy 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or 6 | * without modification, are permitted provided that the following 7 | * conditions are met: 8 | * 9 | * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * Neither the name of the Ban the Rewind nor the names of its 17 | * contributors may be used to endorse or promote products 18 | * derived from this software without specific prior written 19 | * permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 32 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | */ 35 | 36 | #include "WebSocketConnection.h" 37 | 38 | void WebSocketConnection::removeCallback( uint32_t id ) 39 | { 40 | if ( mCallbacks.find( id ) != mCallbacks.end() ) { 41 | mCallbacks.find( id )->second->disconnect(); 42 | mCallbacks.erase( id ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/WebSocketConnection.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, Ban the Rewind, Wieden+Kennedy 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or 6 | * without modification, are permitted provided that the following 7 | * conditions are met: 8 | * 9 | * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * Neither the name of the Ban the Rewind nor the names of its 17 | * contributors may be used to endorse or promote products 18 | * derived from this software without specific prior written 19 | * permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 32 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | */ 35 | 36 | #pragma once 37 | 38 | #include "boost/signals2.hpp" 39 | #include "websocketpp/common/connection_hdl.hpp" 40 | 41 | class WebSocketConnection 42 | { 43 | public: 44 | virtual void ping( const std::string& msg ) = 0; 45 | virtual void poll() = 0; 46 | virtual void write( const std::string& msg ) = 0; 47 | 48 | template 49 | inline uint32_t addConnectCallback( T callback, Y *callbackObject ) 50 | { 51 | uint32_t id = mCallbacks.empty() ? 0 : mCallbacks.rbegin()->first + 1; 52 | mCallbacks.insert( std::make_pair( id, CallbackRef( new Callback( mSignalConnect.connect( std::bind( callback, callbackObject ) ) ) ) ) ); 53 | return id; 54 | } 55 | 56 | template 57 | inline uint32_t addDisconnectCallback( T callback, Y *callbackObject ) 58 | { 59 | uint32_t id = mCallbacks.empty() ? 0 : mCallbacks.rbegin()->first + 1; 60 | mCallbacks.insert( std::make_pair( id, CallbackRef( new Callback( mSignalDisconnect.connect( std::bind( callback, callbackObject ) ) ) ) ) ); 61 | return id; 62 | } 63 | 64 | template 65 | inline uint32_t addErrorCallback( T callback, Y *callbackObject ) 66 | { 67 | uint32_t id = mCallbacks.empty() ? 0 : mCallbacks.rbegin()->first + 1; 68 | mCallbacks.insert( std::make_pair( id, CallbackRef( new Callback( mSignalError.connect( std::bind( callback, callbackObject, std::placeholders::_1 ) ) ) ) ) ); 69 | return id; 70 | } 71 | 72 | template 73 | inline uint32_t addInterruptCallback( T callback, Y *callbackObject ) 74 | { 75 | uint32_t id = mCallbacks.empty() ? 0 : mCallbacks.rbegin()->first + 1; 76 | mCallbacks.insert( std::make_pair( id, CallbackRef( new Callback( mSignalInterrupt.connect( std::bind( callback, callbackObject ) ) ) ) ) ); 77 | return id; 78 | } 79 | 80 | template 81 | inline uint32_t addPingCallback( T callback, Y *callbackObject ) 82 | { 83 | uint32_t id = mCallbacks.empty() ? 0 : mCallbacks.rbegin()->first + 1; 84 | mCallbacks.insert( std::make_pair( id, CallbackRef( new Callback( mSignalPing.connect( std::bind( callback, callbackObject, std::placeholders::_1 ) ) ) ) ) ); 85 | return id; 86 | } 87 | 88 | template 89 | inline uint32_t addReadCallback( T callback, Y *callbackObject ) 90 | { 91 | uint32_t id = mCallbacks.empty() ? 0 : mCallbacks.rbegin()->first + 1; 92 | mCallbacks.insert( std::make_pair( id, CallbackRef( new Callback( mSignalRead.connect( std::bind( callback, callbackObject, std::placeholders::_1 ) ) ) ) ) ); 93 | return id; 94 | } 95 | 96 | void removeCallback( uint32_t id ); 97 | protected: 98 | typedef boost::signals2::connection Callback; 99 | typedef std::shared_ptr CallbackRef; 100 | typedef std::map CallbackList; 101 | 102 | websocketpp::connection_hdl mHandle; 103 | 104 | CallbackList mCallbacks; 105 | boost::signals2::signal mSignalConnect; 106 | boost::signals2::signal mSignalDisconnect; 107 | boost::signals2::signal mSignalError; 108 | boost::signals2::signal mSignalInterrupt; 109 | boost::signals2::signal mSignalPing; 110 | boost::signals2::signal mSignalRead; 111 | boost::signals2::signal mSignalWrite; 112 | }; 113 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/WebSocketServer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, Ban the Rewind, Wieden+Kennedy 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or 6 | * without modification, are permitted provided that the following 7 | * conditions are met: 8 | * 9 | * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * Neither the name of the Ban the Rewind nor the names of its 17 | * contributors may be used to endorse or promote products 18 | * derived from this software without specific prior written 19 | * permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 32 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | */ 35 | 36 | #pragma once 37 | 38 | #include "websocketpp/config/asio_no_tls.hpp" 39 | #include "websocketpp/server.hpp" 40 | #include "websocketpp/error.hpp" 41 | 42 | #include "WebSocketConnection.h" 43 | 44 | class WebSocketServer : public WebSocketConnection 45 | { 46 | public: 47 | WebSocketServer(); 48 | ~WebSocketServer(); 49 | 50 | std::string getClientAddress(); 51 | 52 | void close(); 53 | void cancel(); 54 | void listen( uint16_t port = 80 ); 55 | void ping( const std::string& msg = "" ); 56 | void poll(); 57 | void write( const std::string& msg ); 58 | 59 | 60 | private: 61 | typedef websocketpp::server Server; 62 | typedef Server::message_ptr MessageRef; 63 | 64 | Server mServer; 65 | 66 | void onConnect( Server* server, websocketpp::connection_hdl handle ); 67 | void onDisconnect( Server* server, websocketpp::connection_hdl handle ); 68 | void onFail( Server* server, websocketpp::connection_hdl handle ); 69 | void onInterrupt( Server* server, websocketpp::connection_hdl handle ); 70 | bool onPing( Server* server, websocketpp::connection_hdl handle, std::string msg ); 71 | void onRead( Server* server, websocketpp::connection_hdl handle, MessageRef msg ); 72 | }; 73 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Peter Thorson. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | * Redistributions of source code must retain the above copyright 6 | notice, this list of conditions and the following disclaimer. 7 | * Redistributions in binary form must reproduce the above copyright 8 | notice, this list of conditions and the following disclaimer in the 9 | documentation and/or other materials provided with the distribution. 10 | * Neither the name of the WebSocket++ Project nor the 11 | names of its contributors may be used to endorse or promote products 12 | derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY 18 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/base64/base64.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | base64.cpp and base64.h 3 | 4 | Copyright (C) 2004-2008 René Nyffenegger 5 | 6 | This source code is provided 'as-is', without any express or implied 7 | warranty. In no event will the author be held liable for any damages 8 | arising from the use of this software. 9 | 10 | Permission is granted to anyone to use this software for any purpose, 11 | including commercial applications, and to alter it and redistribute it 12 | freely, subject to the following restrictions: 13 | 14 | 1. The origin of this source code must not be misrepresented; you must not 15 | claim that you wrote the original source code. If you use this source code 16 | in a product, an acknowledgment in the product documentation would be 17 | appreciated but is not required. 18 | 19 | 2. Altered source versions must be plainly marked as such, and must not be 20 | misrepresented as being the original source code. 21 | 22 | 3. This notice may not be removed or altered from any source distribution. 23 | 24 | René Nyffenegger rene.nyffenegger@adp-gmbh.ch 25 | 26 | */ 27 | 28 | #include "base64.h" 29 | #include 30 | 31 | static const std::string base64_chars = 32 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 33 | "abcdefghijklmnopqrstuvwxyz" 34 | "0123456789+/"; 35 | 36 | 37 | static inline bool is_base64(unsigned char c) { 38 | return (isalnum(c) || (c == '+') || (c == '/')); 39 | } 40 | 41 | std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) { 42 | std::string ret; 43 | int i = 0; 44 | int j = 0; 45 | unsigned char char_array_3[3]; 46 | unsigned char char_array_4[4]; 47 | 48 | while (in_len--) { 49 | char_array_3[i++] = *(bytes_to_encode++); 50 | if (i == 3) { 51 | char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; 52 | char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); 53 | char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); 54 | char_array_4[3] = char_array_3[2] & 0x3f; 55 | 56 | for(i = 0; (i <4) ; i++) 57 | ret += base64_chars[char_array_4[i]]; 58 | i = 0; 59 | } 60 | } 61 | 62 | if (i) 63 | { 64 | for(j = i; j < 3; j++) 65 | char_array_3[j] = '\0'; 66 | 67 | char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; 68 | char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); 69 | char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); 70 | char_array_4[3] = char_array_3[2] & 0x3f; 71 | 72 | for (j = 0; (j < i + 1); j++) 73 | ret += base64_chars[char_array_4[j]]; 74 | 75 | while((i++ < 3)) 76 | ret += '='; 77 | 78 | } 79 | 80 | return ret; 81 | 82 | } 83 | 84 | std::string base64_decode(std::string const& encoded_string) { 85 | size_t in_len = encoded_string.size(); 86 | int i = 0; 87 | int j = 0; 88 | int in_ = 0; 89 | unsigned char char_array_4[4], char_array_3[3]; 90 | std::string ret; 91 | 92 | while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) { 93 | char_array_4[i++] = encoded_string[in_]; in_++; 94 | if (i ==4) { 95 | for (i = 0; i <4; i++) 96 | char_array_4[i] = static_cast(base64_chars.find(char_array_4[i])); 97 | 98 | char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); 99 | char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); 100 | char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; 101 | 102 | for (i = 0; (i < 3); i++) 103 | ret += char_array_3[i]; 104 | i = 0; 105 | } 106 | } 107 | 108 | if (i) { 109 | for (j = i; j <4; j++) 110 | char_array_4[j] = 0; 111 | 112 | for (j = 0; j <4; j++) 113 | char_array_4[j] = static_cast(base64_chars.find(char_array_4[j])); 114 | 115 | char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); 116 | char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); 117 | char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; 118 | 119 | for (j = 0; (j < i - 1); j++) ret += char_array_3[j]; 120 | } 121 | 122 | return ret; 123 | } 124 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/base64/base64.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | std::string base64_encode(unsigned char const* , unsigned int len); 4 | std::string base64_decode(std::string const& s); 5 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/base64/base64.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | ****** 3 | base64.hpp is a repackaging of the base64.cpp and base64.h files into a 4 | single headersuitable 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 40 | 41 | static const std::string base64_chars = 42 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 43 | "abcdefghijklmnopqrstuvwxyz" 44 | "0123456789+/"; 45 | 46 | static inline bool is_base64(unsigned char c) { 47 | return (c == 43 || // + 48 | (c >= 47 && c <= 57) || // /-9 49 | (c >= 65 && c <= 90) || // A-Z 50 | (c >= 97 && c <= 122)); // a-z 51 | } 52 | 53 | inline std::string base64_encode(unsigned char const* bytes_to_encode, unsigned 54 | int in_len) 55 | { 56 | std::string ret; 57 | int i = 0; 58 | int j = 0; 59 | unsigned char char_array_3[3]; 60 | unsigned char char_array_4[4]; 61 | 62 | while (in_len--) { 63 | char_array_3[i++] = *(bytes_to_encode++); 64 | if (i == 3) { 65 | char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; 66 | char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + 67 | ((char_array_3[1] & 0xf0) >> 4); 68 | char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + 69 | ((char_array_3[2] & 0xc0) >> 6); 70 | char_array_4[3] = char_array_3[2] & 0x3f; 71 | 72 | for(i = 0; (i <4) ; i++) { 73 | ret += base64_chars[char_array_4[i]]; 74 | } 75 | i = 0; 76 | } 77 | } 78 | 79 | if (i) { 80 | for(j = i; j < 3; j++) { 81 | char_array_3[j] = '\0'; 82 | } 83 | 84 | char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; 85 | char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + 86 | ((char_array_3[1] & 0xf0) >> 4); 87 | char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + 88 | ((char_array_3[2] & 0xc0) >> 6); 89 | char_array_4[3] = char_array_3[2] & 0x3f; 90 | 91 | for (j = 0; (j < i + 1); j++) { 92 | ret += base64_chars[char_array_4[j]]; 93 | } 94 | 95 | while((i++ < 3)) { 96 | ret += '='; 97 | } 98 | } 99 | 100 | return ret; 101 | } 102 | 103 | inline std::string base64_encode(const std::string & data) { 104 | return base64_encode(reinterpret_cast(data.data()),data.size()); 105 | } 106 | 107 | inline std::string base64_decode(std::string const& encoded_string) { 108 | size_t in_len = encoded_string.size(); 109 | int i = 0; 110 | int j = 0; 111 | int in_ = 0; 112 | unsigned char char_array_4[4], char_array_3[3]; 113 | std::string ret; 114 | 115 | while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) { 116 | char_array_4[i++] = encoded_string[in_]; in_++; 117 | if (i ==4) { 118 | for (i = 0; i <4; i++) { 119 | char_array_4[i] = static_cast(base64_chars.find(char_array_4[i])); 120 | } 121 | 122 | char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); 123 | char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); 124 | char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; 125 | 126 | for (i = 0; (i < 3); i++) { 127 | ret += char_array_3[i]; 128 | } 129 | i = 0; 130 | } 131 | } 132 | 133 | if (i) { 134 | for (j = i; j <4; j++) 135 | char_array_4[j] = 0; 136 | 137 | for (j = 0; j <4; j++) 138 | char_array_4[j] = static_cast(base64_chars.find(char_array_4[j])); 139 | 140 | char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); 141 | char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); 142 | char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; 143 | 144 | for (j = 0; (j < i - 1); j++) { 145 | ret += static_cast(char_array_3[j]); 146 | } 147 | } 148 | 149 | return ret; 150 | } 151 | 152 | #endif // _BASE64_HPP_ 153 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/client.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_CLIENT_HPP 29 | #define WEBSOCKETPP_CLIENT_HPP 30 | 31 | #include 32 | 33 | #endif //WEBSOCKETPP_CLIENT_HPP 34 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/common/chrono.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_COMMON_CHRONO_HPP 29 | #define WEBSOCKETPP_COMMON_CHRONO_HPP 30 | 31 | #if defined _WEBSOCKETPP_CPP11_STL_ && !defined _WEBSOCKETPP_NO_CPP11_CHRONO_ 32 | #ifndef _WEBSOCKETPP_CPP11_CHRONO_ 33 | #define _WEBSOCKETPP_CPP11_CHRONO_ 34 | #endif 35 | #endif 36 | 37 | #ifdef _WEBSOCKETPP_CPP11_CHRONO_ 38 | #include 39 | #else 40 | #include 41 | #endif 42 | 43 | namespace websocketpp { 44 | namespace lib { 45 | 46 | #ifdef _WEBSOCKETPP_CPP11_CHRONO_ 47 | using std::chrono::system_clock; 48 | #else 49 | using boost::chrono::system_clock; 50 | #endif 51 | 52 | } // namespace lib 53 | } // namespace websocketpp 54 | 55 | #endif // WEBSOCKETPP_COMMON_CHRONO_HPP 56 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/common/connection_hdl.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_COMMON_CONNECTION_HDL_HPP 29 | #define WEBSOCKETPP_COMMON_CONNECTION_HDL_HPP 30 | 31 | #include 32 | 33 | namespace websocketpp { 34 | 35 | typedef lib::weak_ptr connection_hdl; 36 | 37 | } // namespace websocketpp 38 | 39 | #endif // WEBSOCKETPP_COMMON_CONNECTION_HDL_HPP 40 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/common/cpp11.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_COMMON_CPP11_HPP 29 | #define WEBSOCKETPP_COMMON_CPP11_HPP 30 | 31 | /** 32 | * This header sets up some constants based on the state of C++11 support 33 | */ 34 | 35 | // Hide clang feature detection from other compilers 36 | #ifndef __has_feature // Optional of course. 37 | #define __has_feature(x) 0 // Compatibility with non-clang compilers. 38 | #endif 39 | #ifndef __has_extension 40 | #define __has_extension __has_feature // Compatibility with pre-3.0 compilers. 41 | #endif 42 | 43 | 44 | #ifdef _WEBSOCKETPP_CPP11_STL_ 45 | // This flag indicates that all of the C++11 language features are available 46 | // to us. 47 | #ifndef _WEBSOCKETPP_NOEXCEPT_TOKEN_ 48 | #define _WEBSOCKETPP_NOEXCEPT_TOKEN_ noexcept 49 | #endif 50 | #ifndef _WEBSOCKETPP_CONSTEXPR_TOKEN_ 51 | #define _WEBSOCKETPP_CONSTEXPR_TOKEN_ constexpr 52 | #endif 53 | #ifndef _WEBSOCKETPP_INITIALIZER_LISTS_ 54 | #define _WEBSOCKETPP_INITIALIZER_LISTS_ 55 | #endif 56 | #else 57 | // Test for noexcept 58 | #ifndef _WEBSOCKETPP_NOEXCEPT_TOKEN_ 59 | #ifdef _WEBSOCKETPP_NOEXCEPT_ 60 | // build system says we have noexcept 61 | #define _WEBSOCKETPP_NOEXCEPT_TOKEN_ noexcept 62 | #else 63 | #if __has_feature(cxx_noexcept) 64 | // clang feature detect says we have noexcept 65 | #define _WEBSOCKETPP_NOEXCEPT_TOKEN_ noexcept 66 | #else 67 | // assume we don't have noexcept 68 | #define _WEBSOCKETPP_NOEXCEPT_TOKEN_ 69 | #endif 70 | #endif 71 | #endif 72 | 73 | // Test for constexpr 74 | #ifndef _WEBSOCKETPP_CONSTEXPR_TOKEN_ 75 | #ifdef _WEBSOCKETPP_CONSTEXPR_ 76 | // build system says we have constexpr 77 | #define _WEBSOCKETPP_CONSTEXPR_TOKEN_ constexpr 78 | #else 79 | #if __has_feature(cxx_constexpr) 80 | // clang feature detect says we have constexpr 81 | #define _WEBSOCKETPP_CONSTEXPR_TOKEN_ constexpr 82 | #else 83 | // assume we don't have constexpr 84 | #define _WEBSOCKETPP_CONSTEXPR_TOKEN_ 85 | #endif 86 | #endif 87 | #endif 88 | 89 | // Enable initializer lists on clang when available. 90 | #if __has_feature(cxx_generalized_initializers) && !defined(_WEBSOCKETPP_INITIALIZER_LISTS_) 91 | #define _WEBSOCKETPP_INITIALIZER_LISTS_ 92 | #endif 93 | #endif 94 | 95 | #endif // WEBSOCKETPP_COMMON_CPP11_HPP 96 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/common/functional.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_COMMON_FUNCTIONAL_HPP 29 | #define WEBSOCKETPP_COMMON_FUNCTIONAL_HPP 30 | 31 | #if defined _WEBSOCKETPP_CPP11_STL_ && !defined _WEBSOCKETPP_NO_CPP11_FUNCTIONAL_ 32 | #ifndef _WEBSOCKETPP_CPP11_FUNCTIONAL_ 33 | #define _WEBSOCKETPP_CPP11_FUNCTIONAL_ 34 | #endif 35 | #endif 36 | 37 | #ifdef _WEBSOCKETPP_CPP11_FUNCTIONAL_ 38 | #include 39 | #else 40 | #include 41 | #include 42 | #endif 43 | 44 | namespace websocketpp { 45 | namespace lib { 46 | 47 | #ifdef _WEBSOCKETPP_CPP11_FUNCTIONAL_ 48 | using std::function; 49 | using std::bind; 50 | using std::ref; 51 | namespace placeholders = std::placeholders; 52 | #else 53 | using boost::function; 54 | using boost::bind; 55 | using boost::ref; 56 | namespace placeholders { 57 | /// \todo this feels hacky, is there a better way? 58 | using ::_1; 59 | using ::_2; 60 | } 61 | #endif 62 | 63 | } // namespace lib 64 | } // namespace websocketpp 65 | 66 | #endif // WEBSOCKETPP_COMMON_FUNCTIONAL_HPP 67 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/common/memory.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_COMMON_MEMORY_HPP 29 | #define WEBSOCKETPP_COMMON_MEMORY_HPP 30 | 31 | #if defined _WEBSOCKETPP_CPP11_STL_ && !defined _WEBSOCKETPP_NO_CPP11_MEMORY_ 32 | #ifndef _WEBSOCKETPP_CPP11_MEMORY_ 33 | #define _WEBSOCKETPP_CPP11_MEMORY_ 34 | #endif 35 | #endif 36 | 37 | #ifdef _WEBSOCKETPP_CPP11_MEMORY_ 38 | #include 39 | #else 40 | #include 41 | #include 42 | #include 43 | #include 44 | #endif 45 | 46 | namespace websocketpp { 47 | namespace lib { 48 | 49 | #ifdef _WEBSOCKETPP_CPP11_MEMORY_ 50 | using std::shared_ptr; 51 | using std::weak_ptr; 52 | using std::enable_shared_from_this; 53 | using std::static_pointer_cast; 54 | 55 | typedef std::unique_ptr unique_ptr_uchar_array; 56 | #else 57 | using boost::shared_ptr; 58 | using boost::weak_ptr; 59 | using boost::enable_shared_from_this; 60 | using boost::static_pointer_cast; 61 | 62 | typedef boost::scoped_array unique_ptr_uchar_array; 63 | #endif 64 | 65 | } // namespace lib 66 | } // namespace websocketpp 67 | 68 | #endif // WEBSOCKETPP_COMMON_MEMORY_HPP 69 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/common/network.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_COMMON_NETWORK_HPP 29 | #define WEBSOCKETPP_COMMON_NETWORK_HPP 30 | 31 | // For ntohs and htons 32 | #if defined(WIN32) 33 | #include 34 | #else 35 | //#include 36 | #include 37 | #endif 38 | 39 | namespace websocketpp { 40 | namespace lib { 41 | namespace net { 42 | 43 | inline bool is_little_endian() { 44 | short int val = 0x1; 45 | char *ptr = (char*)&val; 46 | return (ptr[0] == 1); 47 | } 48 | 49 | #define TYP_INIT 0 50 | #define TYP_SMLE 1 51 | #define TYP_BIGE 2 52 | 53 | inline uint64_t htonll(uint64_t src) { 54 | static int typ = TYP_INIT; 55 | unsigned char c; 56 | union { 57 | uint64_t ull; 58 | unsigned char c[8]; 59 | } x; 60 | if (typ == TYP_INIT) { 61 | x.ull = 0x01; 62 | typ = (x.c[7] == 0x01ULL) ? TYP_BIGE : TYP_SMLE; 63 | } 64 | if (typ == TYP_BIGE) 65 | return src; 66 | x.ull = src; 67 | c = x.c[0]; x.c[0] = x.c[7]; x.c[7] = c; 68 | c = x.c[1]; x.c[1] = x.c[6]; x.c[6] = c; 69 | c = x.c[2]; x.c[2] = x.c[5]; x.c[5] = c; 70 | c = x.c[3]; x.c[3] = x.c[4]; x.c[4] = c; 71 | return x.ull; 72 | } 73 | 74 | inline uint64_t ntohll(uint64_t src) { 75 | return htonll(src); 76 | } 77 | 78 | } // net 79 | } // lib 80 | } // websocketpp 81 | 82 | #endif // WEBSOCKETPP_COMMON_NETWORK_HPP 83 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/common/platforms.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_COMMON_PLATFORMS_HPP 29 | #define WEBSOCKETPP_COMMON_PLATFORMS_HPP 30 | 31 | /** 32 | * This header contains any platform specific preprocessor adjustments that 33 | * don't fit somewhere else better. 34 | */ 35 | 36 | #if defined(WIN32) && !defined(NOMINMAX) 37 | // don't define min and max macros that conflict with std::min and std::max 38 | #define NOMINMAX 39 | #endif 40 | 41 | #endif // WEBSOCKETPP_COMMON_PLATFORMS_HPP 42 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/common/random.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_COMMON_RANDOM_DEVICE_HPP 29 | #define WEBSOCKETPP_COMMON_RANDOM_DEVICE_HPP 30 | 31 | #if defined _WEBSOCKETPP_CPP11_STL_ && !defined _WEBSOCKETPP_NO_CPP11_RANDOM_DEVICE_ 32 | #ifndef _WEBSOCKETPP_CPP11_RANDOM_DEVICE_ 33 | #define _WEBSOCKETPP_CPP11_RANDOM_DEVICE_ 34 | #endif 35 | #endif 36 | 37 | #ifdef _WEBSOCKETPP_CPP11_RANDOM_DEVICE_ 38 | #include 39 | #else 40 | #include 41 | 42 | #if (BOOST_VERSION/100000) == 1 && ((BOOST_VERSION/100)%1000) > 46 43 | #include 44 | #include 45 | #elif (BOOST_VERSION/100000) == 1 && ((BOOST_VERSION/100)%1000) >= 43 46 | #include 47 | #else 48 | // TODO: static_assert(false, "Could not find a suitable random_device") 49 | #endif 50 | #endif 51 | 52 | namespace websocketpp { 53 | namespace lib { 54 | 55 | #ifdef _WEBSOCKETPP_CPP11_RANDOM_DEVICE_ 56 | using std::random_device; 57 | using std::uniform_int_distribution; 58 | #else 59 | using boost::random::random_device; 60 | using boost::random::uniform_int_distribution; 61 | #endif 62 | 63 | } // namespace lib 64 | } // namespace websocketpp 65 | 66 | #endif // WEBSOCKETPP_COMMON_RANDOM_DEVICE_HPP 67 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/common/regex.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_COMMON_REGEX_HPP 29 | #define WEBSOCKETPP_COMMON_REGEX_HPP 30 | 31 | #if defined _WEBSOCKETPP_CPP11_STL_ && !defined _WEBSOCKETPP_NO_CPP11_REGEX_ 32 | #ifndef _WEBSOCKETPP_CPP11_REGEX_ 33 | #define _WEBSOCKETPP_CPP11_REGEX_ 34 | #endif 35 | #endif 36 | 37 | #ifdef _WEBSOCKETPP_CPP11_REGEX_ 38 | #include 39 | #else 40 | #include 41 | #endif 42 | 43 | namespace websocketpp { 44 | namespace lib { 45 | 46 | #ifdef _WEBSOCKETPP_CPP11_REGEX_ 47 | using std::cmatch; 48 | using std::regex; 49 | using std::regex_match; 50 | #else 51 | using boost::cmatch; 52 | using boost::regex; 53 | using boost::regex_match; 54 | #endif 55 | 56 | } // namespace lib 57 | } // namespace websocketpp 58 | 59 | #endif // WEBSOCKETPP_COMMON_REGEX_HPP 60 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/common/stdint.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_COMMON_STDINT_HPP 29 | #define WEBSOCKETPP_COMMON_STDINT_HPP 30 | 31 | #ifndef __STDC_LIMIT_MACROS 32 | #define __STDC_LIMIT_MACROS 1 33 | #endif 34 | 35 | #if WIN32 && (_MSC_VER < 1600) 36 | #include 37 | 38 | using boost::int8_t; 39 | using boost::int_least8_t; 40 | using boost::int_fast8_t; 41 | using boost::uint8_t; 42 | using boost::uint_least8_t; 43 | using boost::uint_fast8_t; 44 | 45 | using boost::int16_t; 46 | using boost::int_least16_t; 47 | using boost::int_fast16_t; 48 | using boost::uint16_t; 49 | using boost::uint_least16_t; 50 | using boost::uint_fast16_t; 51 | 52 | using boost::int32_t; 53 | using boost::int_least32_t; 54 | using boost::int_fast32_t; 55 | using boost::uint32_t; 56 | using boost::uint_least32_t; 57 | using boost::uint_fast32_t; 58 | 59 | #ifndef BOOST_NO_INT64_T 60 | using boost::int64_t; 61 | using boost::int_least64_t; 62 | using boost::int_fast64_t; 63 | using boost::uint64_t; 64 | using boost::uint_least64_t; 65 | using boost::uint_fast64_t; 66 | #endif 67 | using boost::intmax_t; 68 | using boost::uintmax_t; 69 | #else 70 | #include 71 | #endif 72 | 73 | #endif // WEBSOCKETPP_COMMON_STDINT_HPP 74 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/common/system_error.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_COMMON_SYSTEM_ERROR_HPP 29 | #define WEBSOCKETPP_COMMON_SYSTEM_ERROR_HPP 30 | 31 | #if defined _WEBSOCKETPP_CPP11_STL_ && !defined _WEBSOCKETPP_NO_CPP11_SYSTEM_ERROR_ 32 | #ifndef _WEBSOCKETPP_CPP11_SYSTEM_ERROR_ 33 | #define _WEBSOCKETPP_CPP11_SYSTEM_ERROR_ 34 | #endif 35 | #endif 36 | 37 | #ifdef _WEBSOCKETPP_CPP11_SYSTEM_ERROR_ 38 | #include 39 | #else 40 | #include 41 | #include 42 | #endif 43 | 44 | namespace websocketpp { 45 | namespace lib { 46 | 47 | #ifdef _WEBSOCKETPP_CPP11_SYSTEM_ERROR_ 48 | using std::error_code; 49 | using std::error_category; 50 | using std::error_condition; 51 | using std::system_error; 52 | #define _WEBSOCKETPP_ERROR_CODE_ENUM_NS_START_ namespace std { 53 | #define _WEBSOCKETPP_ERROR_CODE_ENUM_NS_END_ } 54 | #else 55 | using boost::system::error_code; 56 | using boost::system::error_category; 57 | using boost::system::error_condition; 58 | using boost::system::system_error; 59 | #define _WEBSOCKETPP_ERROR_CODE_ENUM_NS_START_ namespace boost { namespace system { 60 | #define _WEBSOCKETPP_ERROR_CODE_ENUM_NS_END_ }} 61 | #endif 62 | 63 | } // namespace lib 64 | } // namespace websocketpp 65 | 66 | #endif // WEBSOCKETPP_COMMON_SYSTEM_ERROR_HPP 67 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/common/thread.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_COMMON_THREAD_HPP 29 | #define WEBSOCKETPP_COMMON_THREAD_HPP 30 | 31 | #if defined _WEBSOCKETPP_CPP11_STL_ && !defined _WEBSOCKETPP_NO_CPP11_THREAD_ 32 | #ifndef _WEBSOCKETPP_CPP11_THREAD_ 33 | #define _WEBSOCKETPP_CPP11_THREAD_ 34 | #endif 35 | #endif 36 | 37 | #ifdef _WEBSOCKETPP_CPP11_THREAD_ 38 | #include 39 | #include 40 | #include 41 | #else 42 | #include 43 | #include 44 | #include 45 | #endif 46 | 47 | namespace websocketpp { 48 | namespace lib { 49 | 50 | #ifdef _WEBSOCKETPP_CPP11_THREAD_ 51 | using std::mutex; 52 | using std::lock_guard; 53 | using std::thread; 54 | using std::unique_lock; 55 | using std::condition_variable; 56 | #else 57 | using boost::mutex; 58 | using boost::lock_guard; 59 | using boost::thread; 60 | using boost::unique_lock; 61 | using boost::condition_variable; 62 | #endif 63 | 64 | } // namespace lib 65 | } // namespace websocketpp 66 | 67 | #endif // WEBSOCKETPP_COMMON_THREAD_HPP 68 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/concurrency/basic.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_CONCURRENCY_BASIC_HPP 29 | #define WEBSOCKETPP_CONCURRENCY_BASIC_HPP 30 | 31 | #include 32 | 33 | namespace websocketpp { 34 | namespace concurrency { 35 | 36 | /// Concurrency policy that uses std::mutex / boost::mutex 37 | class basic { 38 | public: 39 | typedef lib::mutex mutex_type; 40 | typedef lib::lock_guard scoped_lock_type; 41 | }; 42 | 43 | } // namespace concurrency 44 | } // namespace websocketpp 45 | 46 | #endif // WEBSOCKETPP_CONCURRENCY_BASIC_HPP 47 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/concurrency/none.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_CONCURRENCY_NONE_HPP 29 | #define WEBSOCKETPP_CONCURRENCY_NONE_HPP 30 | 31 | namespace websocketpp { 32 | namespace concurrency { 33 | 34 | namespace none_impl { 35 | class fake_mutex { 36 | public: 37 | fake_mutex() {} 38 | ~fake_mutex() {} 39 | }; 40 | 41 | class fake_lock_guard { 42 | public: 43 | explicit fake_lock_guard(fake_mutex foo) {} 44 | ~fake_lock_guard() {} 45 | }; 46 | } // namespace none_impl 47 | 48 | /// Stub Concurrency policy to remove locking in single threaded projects 49 | class none { 50 | public: 51 | typedef none_impl::fake_mutex mutex_type; 52 | typedef none_impl::fake_lock_guard scoped_lock_type; 53 | }; 54 | 55 | } // namespace concurrency 56 | } // namespace websocketpp 57 | 58 | #endif // WEBSOCKETPP_CONCURRENCY_ASYNC_HPP 59 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/config/asio.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_CONFIG_ASIO_TLS_HPP 29 | #define WEBSOCKETPP_CONFIG_ASIO_TLS_HPP 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | // Pull in non-tls config 36 | #include 37 | 38 | // Define TLS config 39 | namespace websocketpp { 40 | namespace config { 41 | 42 | /// Server config with asio transport and TLS enabled 43 | struct asio_tls : public core { 44 | typedef asio_tls type; 45 | typedef core base; 46 | 47 | typedef base::concurrency_type concurrency_type; 48 | 49 | typedef base::request_type request_type; 50 | typedef base::response_type response_type; 51 | 52 | typedef base::message_type message_type; 53 | typedef base::con_msg_manager_type con_msg_manager_type; 54 | typedef base::endpoint_msg_manager_type endpoint_msg_manager_type; 55 | 56 | typedef base::alog_type alog_type; 57 | typedef base::elog_type elog_type; 58 | 59 | typedef base::rng_type rng_type; 60 | 61 | struct transport_config : public base::transport_config { 62 | typedef type::concurrency_type concurrency_type; 63 | typedef type::alog_type alog_type; 64 | typedef type::elog_type elog_type; 65 | typedef type::request_type request_type; 66 | typedef type::response_type response_type; 67 | typedef websocketpp::transport::asio::tls_socket::endpoint socket_type; 68 | }; 69 | 70 | typedef websocketpp::transport::asio::endpoint 71 | transport_type; 72 | }; 73 | 74 | } // namespace config 75 | } // namespace websocketpp 76 | 77 | #endif // WEBSOCKETPP_CONFIG_ASIO_TLS_HPP 78 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/config/asio_client.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_CONFIG_ASIO_TLS_CLIENT_HPP 29 | #define WEBSOCKETPP_CONFIG_ASIO_TLS_CLIENT_HPP 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | // Pull in non-tls config 36 | #include 37 | 38 | // Define TLS config 39 | namespace websocketpp { 40 | namespace config { 41 | 42 | /// Client config with asio transport and TLS enabled 43 | struct asio_tls_client : public core_client { 44 | typedef asio_tls_client type; 45 | typedef core_client base; 46 | 47 | typedef base::concurrency_type concurrency_type; 48 | 49 | typedef base::request_type request_type; 50 | typedef base::response_type response_type; 51 | 52 | typedef base::message_type message_type; 53 | typedef base::con_msg_manager_type con_msg_manager_type; 54 | typedef base::endpoint_msg_manager_type endpoint_msg_manager_type; 55 | 56 | typedef base::alog_type alog_type; 57 | typedef base::elog_type elog_type; 58 | 59 | typedef base::rng_type rng_type; 60 | 61 | struct transport_config : public base::transport_config { 62 | typedef type::concurrency_type concurrency_type; 63 | typedef type::alog_type alog_type; 64 | typedef type::elog_type elog_type; 65 | typedef type::request_type request_type; 66 | typedef type::response_type response_type; 67 | typedef websocketpp::transport::asio::tls_socket::endpoint socket_type; 68 | }; 69 | 70 | typedef websocketpp::transport::asio::endpoint 71 | transport_type; 72 | }; 73 | 74 | } // namespace config 75 | } // namespace websocketpp 76 | 77 | #endif // WEBSOCKETPP_CONFIG_ASIO_TLS_CLIENT_HPP 78 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/config/asio_no_tls.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_CONFIG_ASIO_HPP 29 | #define WEBSOCKETPP_CONFIG_ASIO_HPP 30 | 31 | #include 32 | #include 33 | 34 | namespace websocketpp { 35 | namespace config { 36 | 37 | /// Server config with asio transport and TLS disabled 38 | struct asio : public core { 39 | typedef asio type; 40 | typedef core base; 41 | 42 | typedef base::concurrency_type concurrency_type; 43 | 44 | typedef base::request_type request_type; 45 | typedef base::response_type response_type; 46 | 47 | typedef base::message_type message_type; 48 | typedef base::con_msg_manager_type con_msg_manager_type; 49 | typedef base::endpoint_msg_manager_type endpoint_msg_manager_type; 50 | 51 | typedef base::alog_type alog_type; 52 | typedef base::elog_type elog_type; 53 | 54 | typedef base::rng_type rng_type; 55 | 56 | struct transport_config : public base::transport_config { 57 | typedef type::concurrency_type concurrency_type; 58 | typedef type::alog_type alog_type; 59 | typedef type::elog_type elog_type; 60 | typedef type::request_type request_type; 61 | typedef type::response_type response_type; 62 | typedef websocketpp::transport::asio::basic_socket::endpoint 63 | socket_type; 64 | }; 65 | 66 | typedef websocketpp::transport::asio::endpoint 67 | transport_type; 68 | }; 69 | 70 | } // namespace config 71 | } // namespace websocketpp 72 | 73 | #endif // WEBSOCKETPP_CONFIG_ASIO_HPP 74 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/config/asio_no_tls_client.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_CONFIG_ASIO_CLIENT_HPP 29 | #define WEBSOCKETPP_CONFIG_ASIO_CLIENT_HPP 30 | 31 | #include 32 | #include 33 | 34 | namespace websocketpp { 35 | namespace config { 36 | 37 | /// Client config with asio transport and TLS disabled 38 | struct asio_client : public core_client { 39 | typedef asio_client type; 40 | typedef core_client base; 41 | 42 | typedef base::concurrency_type concurrency_type; 43 | 44 | typedef base::request_type request_type; 45 | typedef base::response_type response_type; 46 | 47 | typedef base::message_type message_type; 48 | typedef base::con_msg_manager_type con_msg_manager_type; 49 | typedef base::endpoint_msg_manager_type endpoint_msg_manager_type; 50 | 51 | typedef base::alog_type alog_type; 52 | typedef base::elog_type elog_type; 53 | 54 | typedef base::rng_type rng_type; 55 | 56 | struct transport_config : public base::transport_config { 57 | typedef type::concurrency_type concurrency_type; 58 | typedef type::alog_type alog_type; 59 | typedef type::elog_type elog_type; 60 | typedef type::request_type request_type; 61 | typedef type::response_type response_type; 62 | typedef websocketpp::transport::asio::basic_socket::endpoint 63 | socket_type; 64 | }; 65 | 66 | typedef websocketpp::transport::asio::endpoint 67 | transport_type; 68 | }; 69 | 70 | } // namespace config 71 | } // namespace websocketpp 72 | 73 | #endif // WEBSOCKETPP_CONFIG_ASIO_CLIENT_HPP 74 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/config/boost_config.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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 | // This header defines WebSocket++ macros for C++11 compatibility based on the Boost.Config library. 29 | // This will correctly configure most target platforms simply by including this header before 30 | // any other WebSocket++ header. 31 | 32 | #ifndef WEBSOCKETPP_CONFIG_BOOST_CONFIG_HPP 33 | #define WEBSOCKETPP_CONFIG_BOOST_CONFIG_HPP 34 | 35 | #include 36 | 37 | // _WEBSOCKETPP_CPP11_MEMORY_ and _WEBSOCKETPP_CPP11_FUNCTIONAL_ presently 38 | // only work if either both or neither is defined. 39 | #if !defined BOOST_NO_CXX11_SMART_PTR && !defined BOOST_NO_CXX11_HDR_FUNCTIONAL 40 | #define _WEBSOCKETPP_CPP11_MEMORY_ 41 | #define _WEBSOCKETPP_CPP11_FUNCTIONAL_ 42 | #endif 43 | 44 | #ifndef BOOST_ASIO_HAS_STD_CHRONO 45 | #define _WEBSOCKETPP_CPP11_CHRONO_ 46 | #endif 47 | 48 | #ifndef BOOST_NO_CXX11_HDR_RANDOM 49 | #define _WEBSOCKETPP_CPP11_RANDOM_DEVICE_ 50 | #endif 51 | 52 | #ifndef BOOST_NO_CXX11_HDR_REGEX 53 | #define _WEBSOCKETPP_CPP11_REGEX_ 54 | #endif 55 | 56 | #ifndef BOOST_NO_CXX11_HDR_SYSTEM_ERROR 57 | #define _WEBSOCKETPP_CPP11_SYSTEM_ERROR_ 58 | #endif 59 | 60 | #ifndef BOOST_NO_CXX11_HDR_THREAD 61 | #define _WEBSOCKETPP_CPP11_THREAD_ 62 | #endif 63 | 64 | #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST 65 | #define _WEBSOCKETPP_INITIALIZER_LISTS_ 66 | #endif 67 | 68 | #define _WEBSOCKETPP_NOEXCEPT_TOKEN_ BOOST_NOEXCEPT 69 | #define _WEBSOCKETPP_CONSTEXPR_TOKEN_ BOOST_CONSTEXPR 70 | 71 | #endif // WEBSOCKETPP_CONFIG_BOOST_CONFIG_HPP 72 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/config/debug_asio.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_CONFIG_ASIO_TLS_DEBUG_HPP 29 | #define WEBSOCKETPP_CONFIG_ASIO_TLS_DEBUG_HPP 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | // Pull in non-tls config 36 | #include 37 | 38 | // Define TLS config 39 | namespace websocketpp { 40 | namespace config { 41 | 42 | /// Client/Server debug config with asio transport and TLS enabled 43 | struct debug_asio_tls : public debug_core { 44 | typedef debug_asio_tls type; 45 | typedef debug_core base; 46 | 47 | typedef base::concurrency_type concurrency_type; 48 | 49 | typedef base::request_type request_type; 50 | typedef base::response_type response_type; 51 | 52 | typedef base::message_type message_type; 53 | typedef base::con_msg_manager_type con_msg_manager_type; 54 | typedef base::endpoint_msg_manager_type endpoint_msg_manager_type; 55 | 56 | typedef base::alog_type alog_type; 57 | typedef base::elog_type elog_type; 58 | 59 | typedef base::rng_type rng_type; 60 | 61 | struct transport_config : public base::transport_config { 62 | typedef type::concurrency_type concurrency_type; 63 | typedef type::alog_type alog_type; 64 | typedef type::elog_type elog_type; 65 | typedef type::request_type request_type; 66 | typedef type::response_type response_type; 67 | typedef websocketpp::transport::asio::tls_socket::endpoint socket_type; 68 | }; 69 | 70 | typedef websocketpp::transport::asio::endpoint 71 | transport_type; 72 | }; 73 | 74 | } // namespace config 75 | } // namespace websocketpp 76 | 77 | #endif // WEBSOCKETPP_CONFIG_ASIO_TLS_DEBUG_HPP 78 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/config/debug_asio_no_tls.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_CONFIG_ASIO_DEBUG_HPP 29 | #define WEBSOCKETPP_CONFIG_ASIO_DEBUG_HPP 30 | 31 | #include 32 | #include 33 | 34 | namespace websocketpp { 35 | namespace config { 36 | 37 | /// Client/Server debug config with asio transport and TLS disabled 38 | struct debug_asio : public debug_core { 39 | typedef debug_asio type; 40 | typedef debug_core base; 41 | 42 | typedef base::concurrency_type concurrency_type; 43 | 44 | typedef base::request_type request_type; 45 | typedef base::response_type response_type; 46 | 47 | typedef base::message_type message_type; 48 | typedef base::con_msg_manager_type con_msg_manager_type; 49 | typedef base::endpoint_msg_manager_type endpoint_msg_manager_type; 50 | 51 | typedef base::alog_type alog_type; 52 | typedef base::elog_type elog_type; 53 | 54 | typedef base::rng_type rng_type; 55 | 56 | struct transport_config : public base::transport_config { 57 | typedef type::concurrency_type concurrency_type; 58 | typedef type::alog_type alog_type; 59 | typedef type::elog_type elog_type; 60 | typedef type::request_type request_type; 61 | typedef type::response_type response_type; 62 | typedef websocketpp::transport::asio::basic_socket::endpoint 63 | socket_type; 64 | }; 65 | 66 | typedef websocketpp::transport::asio::endpoint 67 | transport_type; 68 | }; 69 | 70 | } // namespace config 71 | } // namespace websocketpp 72 | 73 | #endif // WEBSOCKETPP_CONFIG_ASIO_DEBUG_HPP 74 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/connection_base.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_CONNECTION_BASE_HPP 29 | #define WEBSOCKETPP_CONNECTION_BASE_HPP 30 | 31 | namespace websocketpp { 32 | 33 | /// Stub for user supplied base class. 34 | class connection_base {}; 35 | 36 | } // namespace websocketpp 37 | 38 | #endif // WEBSOCKETPP_CONNECTION_BASE_HPP 39 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/endpoint_base.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_ENDPOINT_BASE_HPP 29 | #define WEBSOCKETPP_ENDPOINT_BASE_HPP 30 | 31 | namespace websocketpp { 32 | 33 | /// Stub for user supplied base class. 34 | class endpoint_base {}; 35 | 36 | } // namespace websocketpp 37 | 38 | #endif // WEBSOCKETPP_ENDPOINT_BASE_HPP 39 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/error_container.hpp: -------------------------------------------------------------------------------- 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_ERROR_MESSAGE_HPP 29 | #define WEBSOCKETPP_ERROR_MESSAGE_HPP 30 | 31 | namespace websocketpp { 32 | 33 | /** 34 | * The transport::security::* classes are a set of security/socket related 35 | * policies and support code for the ASIO transport types. 36 | */ 37 | class error_msg { 38 | public: 39 | const std::string& get_msg() const { 40 | return m_error_msg; 41 | } 42 | 43 | void set_msg(const std::string& msg) { 44 | m_error_msg = msg; 45 | } 46 | 47 | void append_msg(const std::string& msg) { 48 | m_error_msg.append(msg); 49 | } 50 | 51 | template 52 | void set_msg(const T& thing) { 53 | std::stringsteam val; 54 | val << thing; 55 | this->set_msg(val.str()); 56 | } 57 | 58 | template 59 | void append_msg(const T& thing) { 60 | std::stringsteam val; 61 | val << thing; 62 | this->append_msg(val.str()); 63 | } 64 | private: 65 | // error resources 66 | std::string m_error_msg; 67 | }; 68 | 69 | } // namespace websocketpp 70 | 71 | #endif // WEBSOCKETPP_ERROR_MESSAGE_HPP 72 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/extensions/extension.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_EXTENSION_HPP 29 | #define WEBSOCKETPP_EXTENSION_HPP 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | 37 | namespace websocketpp { 38 | 39 | /** 40 | * Some generic information about extensions 41 | * 42 | * Each extension object has an implemented flag. It can be retrieved by calling 43 | * is_implemented(). This compile time flag indicates whether or not the object 44 | * in question actually implements the extension or if it is a placeholder stub 45 | * 46 | * Each extension object also has an enabled flag. It can be retrieved by 47 | * calling is_enabled(). This runtime flag indicates whether or not the 48 | * extension has been negotiated for this connection. 49 | */ 50 | namespace extensions { 51 | 52 | namespace error { 53 | enum value { 54 | /// Catch all 55 | general = 1, 56 | 57 | /// Extension disabled 58 | disabled 59 | }; 60 | 61 | class category : public lib::error_category { 62 | public: 63 | category() {} 64 | 65 | const char *name() const _WEBSOCKETPP_NOEXCEPT_TOKEN_ { 66 | return "websocketpp.extension"; 67 | } 68 | 69 | std::string message(int value) const { 70 | switch(value) { 71 | case general: 72 | return "Generic extension error"; 73 | case disabled: 74 | return "Use of methods from disabled extension"; 75 | default: 76 | return "Unknown permessage-compress error"; 77 | } 78 | } 79 | }; 80 | 81 | inline const lib::error_category& get_category() { 82 | static category instance; 83 | return instance; 84 | } 85 | 86 | inline lib::error_code make_error_code(error::value e) { 87 | return lib::error_code(static_cast(e), get_category()); 88 | } 89 | 90 | } // namespace error 91 | } // namespace extensions 92 | } // namespace websocketpp 93 | 94 | _WEBSOCKETPP_ERROR_CODE_ENUM_NS_START_ 95 | template<> struct is_error_code_enum 96 | 97 | { 98 | static const bool value = true; 99 | }; 100 | _WEBSOCKETPP_ERROR_CODE_ENUM_NS_END_ 101 | 102 | #endif // WEBSOCKETPP_EXTENSION_HPP 103 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/extensions/permessage_deflate/disabled.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_EXTENSION_PERMESSAGE_DEFLATE_DISABLED_HPP 29 | #define WEBSOCKETPP_EXTENSION_PERMESSAGE_DEFLATE_DISABLED_HPP 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | 37 | #include 38 | #include 39 | #include 40 | 41 | namespace websocketpp { 42 | namespace extensions { 43 | namespace permessage_deflate { 44 | 45 | /// Stub class for use when disabling permessage_deflate extension 46 | /** 47 | * This class is a stub that implements the permessage_deflate interface 48 | * with minimal dependencies. It is used to disable permessage_deflate 49 | * functionality at compile time without loading any unnecessary code. 50 | */ 51 | template 52 | class disabled { 53 | typedef std::pair err_str_pair; 54 | 55 | public: 56 | err_str_pair negotiate(http::attribute_list const & attributes) { 57 | return make_pair(make_error_code(error::disabled),std::string()); 58 | } 59 | 60 | /// Returns true if the extension is capable of providing 61 | /// permessage_deflate functionality 62 | bool is_implemented() const { 63 | return false; 64 | } 65 | 66 | /// Returns true if permessage_deflate functionality is active for this 67 | /// connection 68 | bool is_enabled() const { 69 | return false; 70 | } 71 | 72 | lib::error_code compress(std::string const & in, std::string & out) { 73 | return make_error_code(error::disabled); 74 | } 75 | 76 | lib::error_code decompress(uint8_t const * buf, size_t len, 77 | std::string & out) 78 | { 79 | return make_error_code(error::disabled); 80 | } 81 | 82 | lib::error_code decompress(std::string const & in, std::string & out) { 83 | return make_error_code(error::disabled); 84 | } 85 | }; 86 | 87 | } // namespace permessage_deflate 88 | } // namespace extensions 89 | } // namespace websocketpp 90 | 91 | #endif // WEBSOCKETPP_EXTENSION_PERMESSAGE_DEFLATE_DISABLED_HPP 92 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/http/impl/parser.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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 HTTP_PARSER_IMPL_HPP 29 | #define HTTP_PARSER_IMPL_HPP 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | namespace websocketpp { 36 | namespace http { 37 | namespace parser { 38 | 39 | inline void parser::set_version(std::string const & version) { 40 | m_version = version; 41 | } 42 | 43 | inline std::string const & parser::get_header(std::string const & key) const { 44 | header_list::const_iterator h = m_headers.find(key); 45 | 46 | if (h == m_headers.end()) { 47 | return empty_header; 48 | } else { 49 | return h->second; 50 | } 51 | } 52 | 53 | inline bool parser::get_header_as_plist(std::string const & key, 54 | parameter_list & out) const 55 | { 56 | header_list::const_iterator it = m_headers.find(key); 57 | 58 | if (it == m_headers.end() || it->second.size() == 0) { 59 | return false; 60 | } 61 | 62 | return this->parse_parameter_list(it->second,out); 63 | } 64 | 65 | inline void parser::append_header(std::string const & key, std::string const & 66 | val) 67 | { 68 | if (std::find_if(key.begin(),key.end(),is_not_token_char) != key.end()) { 69 | throw exception("Invalid header name",status_code::bad_request); 70 | } 71 | 72 | if (this->get_header(key) == "") { 73 | m_headers[key] = val; 74 | } else { 75 | m_headers[key] += ", " + val; 76 | } 77 | } 78 | 79 | inline void parser::replace_header(std::string const & key, std::string const & 80 | val) 81 | { 82 | m_headers[key] = val; 83 | } 84 | 85 | inline void parser::remove_header(std::string const & key) { 86 | m_headers.erase(key); 87 | } 88 | 89 | inline void parser::set_body(std::string const & value) { 90 | if (value.size() == 0) { 91 | remove_header("Content-Length"); 92 | m_body = ""; 93 | return; 94 | } 95 | 96 | std::stringstream len; 97 | len << value.size(); 98 | replace_header("Content-Length", len.str()); 99 | m_body = value; 100 | } 101 | 102 | inline bool parser::parse_parameter_list(std::string const & in, 103 | parameter_list & out) const 104 | { 105 | if (in.size() == 0) { 106 | return false; 107 | } 108 | 109 | std::string::const_iterator it; 110 | it = extract_parameters(in.begin(),in.end(),out); 111 | return (it == in.begin()); 112 | } 113 | 114 | inline bool parser::parse_headers(std::istream & s) { 115 | std::string header; 116 | std::string::size_type end; 117 | 118 | // get headers 119 | while (std::getline(s, header) && header != "\r") { 120 | if (header[header.size()-1] != '\r') { 121 | continue; // ignore malformed header lines? 122 | } else { 123 | header.erase(header.end()-1); 124 | } 125 | 126 | end = header.find(header_separator,0); 127 | 128 | if (end != std::string::npos) { 129 | append_header(header.substr(0,end),header.substr(end+2)); 130 | } 131 | } 132 | 133 | return true; 134 | } 135 | 136 | inline void parser::process_header(std::string::iterator begin, 137 | std::string::iterator end) 138 | { 139 | std::string::iterator cursor = std::search( 140 | begin, 141 | end, 142 | header_separator, 143 | header_separator + sizeof(header_separator) - 1 144 | ); 145 | 146 | if (cursor == end) { 147 | throw exception("Invalid header line",status_code::bad_request); 148 | } 149 | 150 | append_header(std::string(begin,cursor), 151 | std::string(cursor+sizeof(header_separator)-1,end)); 152 | } 153 | 154 | inline std::string parser::raw_headers() const { 155 | std::stringstream raw; 156 | 157 | header_list::const_iterator it; 158 | for (it = m_headers.begin(); it != m_headers.end(); it++) { 159 | raw << it->first << ": " << it->second << "\r\n"; 160 | } 161 | 162 | return raw.str(); 163 | } 164 | 165 | 166 | 167 | } // namespace parser 168 | } // namespace http 169 | } // namespace websocketpp 170 | 171 | #endif // HTTP_PARSER_IMPL_HPP 172 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/http/request.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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 HTTP_PARSER_REQUEST_HPP 29 | #define HTTP_PARSER_REQUEST_HPP 30 | 31 | #include 32 | #include 33 | 34 | namespace websocketpp { 35 | namespace http { 36 | namespace parser { 37 | 38 | /// Stores, parses, and manipulates HTTP requests 39 | /** 40 | * http::request provides the following functionality for working with HTTP 41 | * requests. 42 | * 43 | * - Initialize request via manually setting each element 44 | * - Initialize request via reading raw bytes and parsing 45 | * - Once initialized, access individual parsed elements 46 | * - Once initialized, read entire request as raw bytes 47 | */ 48 | class request : public parser { 49 | public: 50 | typedef request type; 51 | typedef lib::shared_ptr ptr; 52 | 53 | request() 54 | : m_buf(new std::string()) 55 | , m_ready(false) {} 56 | 57 | /// DEPRECATED parse a complete header (\r\n\r\n MUST be in the istream) 58 | bool parse_complete(std::istream& s); 59 | 60 | /// Process bytes in the input buffer 61 | /** 62 | * Process up to len bytes from input buffer buf. Returns the number of 63 | * bytes processed. Bytes left unprocessed means bytes left over after the 64 | * final header delimiters. 65 | * 66 | * Consume is a streaming processor. It may be called multiple times on one 67 | * request and the full headers need not be available before processing can 68 | * begin. If the end of the request was reached during this call to consume 69 | * the ready flag will be set. Further calls to consume once ready will be 70 | * ignored. 71 | * 72 | * Consume will throw an http::exception in the case of an error. Typical 73 | * error reasons include malformed requests, incomplete requests, and max 74 | * header size being reached. 75 | * 76 | * @param buf Pointer to byte buffer 77 | * @param len Size of byte buffer 78 | * @return Number of bytes processed. 79 | */ 80 | size_t consume(const char *buf, size_t len); 81 | 82 | /// Returns whether or not the request is ready for reading. 83 | bool ready() const { 84 | return m_ready; 85 | } 86 | 87 | /// Returns the full raw request 88 | std::string raw(); 89 | 90 | /// Set the HTTP method. Must be a valid HTTP token 91 | void set_method(const std::string& method); 92 | 93 | /// Return the request method 94 | const std::string& get_method() const { 95 | return m_method; 96 | } 97 | 98 | /// Set the HTTP uri. Must be a valid HTTP uri 99 | void set_uri(const std::string& uri); 100 | 101 | /// Return the requested URI 102 | const std::string& get_uri() const { 103 | return m_uri; 104 | } 105 | 106 | private: 107 | /// Helper function for message::consume. Process request line 108 | void process(std::string::iterator begin, std::string::iterator end); 109 | 110 | lib::shared_ptr m_buf; 111 | std::string m_method; 112 | std::string m_uri; 113 | bool m_ready; 114 | }; 115 | 116 | } // namespace parser 117 | } // namespace http 118 | } // namespace websocketpp 119 | 120 | #include 121 | 122 | #endif // HTTP_PARSER_REQUEST_HPP 123 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/impl/utilities_impl.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_UTILITIES_IMPL_HPP 29 | #define WEBSOCKETPP_UTILITIES_IMPL_HPP 30 | 31 | namespace websocketpp { 32 | namespace utility { 33 | 34 | inline std::string to_lower(std::string const & in) { 35 | std::string out = in; 36 | std::transform(out.begin(),out.end(),out.begin(),::tolower); 37 | return out; 38 | } 39 | 40 | inline std::string to_hex(const std::string& input) { 41 | std::string output; 42 | std::string hex = "0123456789ABCDEF"; 43 | 44 | for (size_t i = 0; i < input.size(); i++) { 45 | output += hex[(input[i] & 0xF0) >> 4]; 46 | output += hex[input[i] & 0x0F]; 47 | output += " "; 48 | } 49 | 50 | return output; 51 | } 52 | 53 | inline std::string to_hex(const uint8_t* input,size_t length) { 54 | std::string output; 55 | std::string hex = "0123456789ABCDEF"; 56 | 57 | for (size_t i = 0; i < length; i++) { 58 | output += hex[(input[i] & 0xF0) >> 4]; 59 | output += hex[input[i] & 0x0F]; 60 | output += " "; 61 | } 62 | 63 | return output; 64 | } 65 | 66 | inline std::string to_hex(const char* input,size_t length) { 67 | return to_hex(reinterpret_cast(input),length); 68 | } 69 | 70 | inline std::string string_replace_all(std::string subject, const std::string& 71 | search, const std::string& replace) 72 | { 73 | size_t pos = 0; 74 | while((pos = subject.find(search, pos)) != std::string::npos) { 75 | subject.replace(pos, search.length(), replace); 76 | pos += replace.length(); 77 | } 78 | return subject; 79 | } 80 | 81 | } // namespace utility 82 | } // namespace websocketpp 83 | 84 | #endif // WEBSOCKETPP_UTILITIES_IMPL_HPP 85 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/logger/basic.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_LOGGER_BASIC_HPP 29 | #define WEBSOCKETPP_LOGGER_BASIC_HPP 30 | 31 | /* Need a way to print a message to the log 32 | * 33 | * - timestamps 34 | * - channels 35 | * - thread safe 36 | * - output to stdout or file 37 | * - selective output channels, both compile time and runtime 38 | * - named channels 39 | * - ability to test whether a log message will be printed at compile time 40 | * 41 | */ 42 | 43 | #include 44 | #include 45 | #include 46 | 47 | #include 48 | #include 49 | 50 | namespace websocketpp { 51 | namespace log { 52 | 53 | /// Basic logger that outputs to an ostream 54 | template 55 | class basic { 56 | public: 57 | basic(std::ostream* out = &std::cout) 58 | : m_static_channels(0xffffffff) 59 | , m_dynamic_channels(0) 60 | , m_out(out) {} 61 | 62 | basic(level c, std::ostream* out = &std::cout) 63 | : m_static_channels(c) 64 | , m_dynamic_channels(0) 65 | , m_out(out) {} 66 | 67 | void set_ostream(std::ostream* out) { 68 | m_out = out; 69 | } 70 | 71 | void set_channels(level channels) { 72 | if (channels == names::none) { 73 | clear_channels(names::all); 74 | return; 75 | } 76 | 77 | scoped_lock_type lock(m_lock); 78 | m_dynamic_channels |= (channels & m_static_channels); 79 | } 80 | 81 | void clear_channels(level channels) { 82 | scoped_lock_type lock(m_lock); 83 | m_dynamic_channels &= ~channels; 84 | } 85 | 86 | void write(level channel, const std::string& msg) { 87 | scoped_lock_type lock(m_lock); 88 | if (!this->dynamic_test(channel)) { return; } 89 | *m_out << "[" << timestamp << "] " 90 | << "[" << names::channel_name(channel) << "] " 91 | << msg << "\n"; 92 | m_out->flush(); 93 | } 94 | 95 | void write(level channel, const char* msg) { 96 | scoped_lock_type lock(m_lock); 97 | if (!this->dynamic_test(channel)) { return; } 98 | *m_out << "[" << timestamp << "] " 99 | << "[" << names::channel_name(channel) << "] " 100 | << msg << "\n"; 101 | m_out->flush(); 102 | } 103 | 104 | bool static_test(level channel) const { 105 | return ((channel & m_static_channels) != 0); 106 | } 107 | 108 | bool dynamic_test(level channel) { 109 | return ((channel & m_dynamic_channels) != 0); 110 | } 111 | private: 112 | typedef typename concurrency::scoped_lock_type scoped_lock_type; 113 | typedef typename concurrency::mutex_type mutex_type; 114 | 115 | // The timestamp does not include the time zone, because on Windows with the 116 | // default registry settings, the time zone would be written out in full, 117 | // which would be obnoxiously verbose. 118 | // 119 | // TODO: find a workaround for this or make this format user settable 120 | static std::ostream& timestamp(std::ostream& os) { 121 | std::time_t t = std::time(NULL); 122 | std::tm* lt = std::localtime(&t); 123 | #ifdef _WEBSOCKETPP_CPP11_CHRONO_ 124 | return os << std::put_time(lt,"%Y-%m-%d %H:%M:%S"); 125 | #else // Falls back to strftime, which requires a temporary copy of the string. 126 | char buffer[20]; 127 | std::strftime(buffer,sizeof(buffer),"%Y-%m-%d %H:%M:%S",lt); 128 | return os << buffer; 129 | #endif 130 | } 131 | 132 | mutex_type m_lock; 133 | 134 | const level m_static_channels; 135 | level m_dynamic_channels; 136 | std::ostream* m_out; 137 | }; 138 | 139 | } // log 140 | } // websocketpp 141 | 142 | #endif // WEBSOCKETPP_LOGGER_BASIC_HPP 143 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/logger/stub.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_LOGGER_STUB_HPP 29 | #define WEBSOCKETPP_LOGGER_STUB_HPP 30 | 31 | #include 32 | 33 | #include 34 | 35 | namespace websocketpp { 36 | namespace log { 37 | 38 | /// Stub logger that ignores all input 39 | class stub { 40 | public: 41 | stub(std::ostream* out = &std::cout) {} 42 | stub(level c, std::ostream* out = &std::cout) {} 43 | 44 | void set_channels(level channels) {} 45 | void clear_channels(level channels) {} 46 | 47 | void write(level channel, const std::string& msg) {} 48 | void write(level channel, const char* msg) {} 49 | 50 | bool static_test(level channel) const {return false;} 51 | bool dynamic_test(level channel) {return false;} 52 | }; 53 | 54 | } // log 55 | } // websocketpp 56 | 57 | #endif // WEBSOCKETPP_LOGGER_STUB_HPP 58 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/message_buffer/alloc.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_MESSAGE_BUFFER_ALLOC_HPP 29 | #define WEBSOCKETPP_MESSAGE_BUFFER_ALLOC_HPP 30 | 31 | #include 32 | #include 33 | 34 | namespace websocketpp { 35 | namespace message_buffer { 36 | namespace alloc { 37 | 38 | /// A connection message manager that allocates a new message for each 39 | /// request. 40 | template 41 | class con_msg_manager 42 | : public lib::enable_shared_from_this > 43 | { 44 | public: 45 | typedef con_msg_manager type; 46 | typedef lib::shared_ptr ptr; 47 | typedef lib::weak_ptr weak_ptr; 48 | 49 | typedef typename message::ptr message_ptr; 50 | 51 | /// Get an empty message buffer 52 | /** 53 | * @return A shared pointer to an empty new message 54 | */ 55 | message_ptr get_message() { 56 | return message_ptr(new message(type::shared_from_this())); 57 | } 58 | 59 | /// Get a message buffer with specified size and opcode 60 | /** 61 | * @param op The opcode to use 62 | * @param size Minimum size in bytes to request for the message payload. 63 | * 64 | * @return A shared pointer to a new message with specified size. 65 | */ 66 | message_ptr get_message(frame::opcode::value op,size_t size) { 67 | return message_ptr(new message(type::shared_from_this(),op,size)); 68 | } 69 | 70 | /// Recycle a message 71 | /** 72 | * This method shouldn't be called. If it is, return false to indicate an 73 | * error. The rest of the method recycle chain should notice this and free 74 | * the memory. 75 | * 76 | * @param msg The message to be recycled. 77 | * 78 | * @return true if the message was successfully recycled, false otherwse. 79 | */ 80 | bool recycle(message * msg) { 81 | return false; 82 | } 83 | }; 84 | 85 | /// An endpoint message manager that allocates a new manager for each 86 | /// connection. 87 | template 88 | class endpoint_msg_manager { 89 | public: 90 | typedef typename con_msg_manager::ptr con_msg_man_ptr; 91 | 92 | /// Get a pointer to a connection message manager 93 | /** 94 | * @return A pointer to the requested connection message manager. 95 | */ 96 | con_msg_man_ptr get_manager() const { 97 | return con_msg_man_ptr(new con_msg_manager()); 98 | } 99 | }; 100 | 101 | } // namespace alloc 102 | } // namespace message_buffer 103 | } // namespace websocketpp 104 | 105 | #endif // WEBSOCKETPP_MESSAGE_BUFFER_ALLOC_HPP 106 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/processors/hybi07.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_PROCESSOR_HYBI07_HPP 29 | #define WEBSOCKETPP_PROCESSOR_HYBI07_HPP 30 | 31 | #include 32 | 33 | namespace websocketpp { 34 | namespace processor { 35 | 36 | /// Processor for Hybi Draft version 07 37 | /** 38 | * The primary difference between 07 and 08 is a version number. 39 | */ 40 | template 41 | class hybi07 : public hybi08 { 42 | public: 43 | typedef typename config::request_type request_type; 44 | 45 | typedef typename config::con_msg_manager_type::ptr msg_manager_ptr; 46 | typedef typename config::rng_type rng_type; 47 | 48 | explicit hybi07(bool secure, bool server, msg_manager_ptr manager, 49 | rng_type& rng) 50 | : hybi08(secure, server, manager, rng) {} 51 | 52 | // outgoing client connection processing is not supported for this version 53 | lib::error_code client_handshake_request(request_type & req, uri_ptr uri, 54 | std::vector const & subprotocols) const 55 | { 56 | return error::make_error_code(error::no_protocol_support); 57 | } 58 | 59 | int get_version() const { 60 | return 7; 61 | } 62 | private: 63 | }; 64 | 65 | } // namespace processor 66 | } // namespace websocketpp 67 | 68 | #endif //WEBSOCKETPP_PROCESSOR_HYBI07_HPP 69 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/processors/hybi08.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_PROCESSOR_HYBI08_HPP 29 | #define WEBSOCKETPP_PROCESSOR_HYBI08_HPP 30 | 31 | #include 32 | 33 | namespace websocketpp { 34 | namespace processor { 35 | 36 | /// Processor for Hybi Draft version 08 37 | /** 38 | * The primary difference between 08 and 13 is a different origin header name 39 | */ 40 | template 41 | class hybi08 : public hybi13 { 42 | public: 43 | typedef hybi08 type; 44 | typedef typename config::request_type request_type; 45 | 46 | typedef typename config::con_msg_manager_type::ptr msg_manager_ptr; 47 | typedef typename config::rng_type rng_type; 48 | 49 | explicit hybi08(bool secure, bool server, msg_manager_ptr manager, 50 | rng_type& rng) 51 | : hybi13(secure, server, manager, rng) {} 52 | 53 | // outgoing client connection processing is not supported for this version 54 | lib::error_code client_handshake_request(request_type& req, uri_ptr uri, 55 | std::vector const & subprotocols) const 56 | { 57 | return error::make_error_code(error::no_protocol_support); 58 | } 59 | 60 | int get_version() const { 61 | return 8; 62 | } 63 | 64 | const std::string& get_origin(request_type const & r) const { 65 | return r.get_header("Sec-WebSocket-Origin"); 66 | } 67 | private: 68 | }; 69 | 70 | } // namespace processor 71 | } // namespace websocketpp 72 | 73 | #endif //WEBSOCKETPP_PROCESSOR_HYBI08_HPP 74 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/random/none.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_RANDOM_NONE_HPP 29 | #define WEBSOCKETPP_RANDOM_NONE_HPP 30 | 31 | namespace websocketpp { 32 | namespace random { 33 | /// Stub RNG policy that always returns 0 34 | namespace none { 35 | 36 | /// Thread safe stub "random" integer generator. 37 | /** 38 | * This template class provides a random integer stub. The interface mimics the 39 | * WebSocket++ RNG generator classes but the generater function always returns 40 | * zero. This can be used to stub out the RNG for unit and performance testing. 41 | * 42 | * Call operator() to generate the next number 43 | */ 44 | template 45 | class int_generator { 46 | public: 47 | int_generator() {} 48 | 49 | /// advances the engine's state and returns the generated value 50 | int_type operator()() { 51 | return 0; 52 | } 53 | }; 54 | 55 | } // namespace none 56 | } // namespace random 57 | } // namespace websocketpp 58 | 59 | #endif //WEBSOCKETPP_RANDOM_NONE_HPP 60 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/random/random_device.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_RANDOM_RANDOM_DEVICE_HPP 29 | #define WEBSOCKETPP_RANDOM_RANDOM_DEVICE_HPP 30 | 31 | #include 32 | 33 | namespace websocketpp { 34 | namespace random { 35 | /// RNG policy based on std::random_device or boost::random_device 36 | namespace random_device { 37 | 38 | /// Thread safe non-deterministic random integer generator. 39 | /** 40 | * This template class provides thread safe non-deterministic random integer 41 | * generation. Numbers are produced in a uniformly distributed range from the 42 | * smallest to largest value that int_type can store. 43 | * 44 | * Thread-safety is provided via locking based on the concurrency template 45 | * parameter. 46 | * 47 | * Non-deterministic RNG is provided via websocketpp::lib which uses either 48 | * C++11 or Boost 1.47+'s random_device class. 49 | * 50 | * Call operator() to generate the next number 51 | */ 52 | template 53 | class int_generator { 54 | public: 55 | typedef typename concurrency::scoped_lock_type scoped_lock_type; 56 | typedef typename concurrency::mutex_type mutex_type; 57 | 58 | /// constructor 59 | //mac TODO: figure out if signed types present a range problem 60 | int_generator() {} 61 | 62 | /// advances the engine's state and returns the generated value 63 | int_type operator()() { 64 | scoped_lock_type guard(m_lock); 65 | return m_dis(m_rng); 66 | } 67 | private: 68 | 69 | 70 | lib::random_device m_rng; 71 | lib::uniform_int_distribution m_dis; 72 | 73 | mutex_type m_lock; 74 | }; 75 | 76 | } // namespace random_device 77 | } // namespace random 78 | } // namespace websocketpp 79 | 80 | #endif //WEBSOCKETPP_RANDOM_RANDOM_DEVICE_HPP 81 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/roles/server_endpoint.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_SERVER_ENDPOINT_HPP 29 | #define WEBSOCKETPP_SERVER_ENDPOINT_HPP 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | 36 | namespace websocketpp { 37 | 38 | 39 | /// Server endpoint role based on the given config 40 | /** 41 | * 42 | */ 43 | template 44 | class server : public endpoint,config> { 45 | public: 46 | /// Type of this endpoint 47 | typedef server type; 48 | 49 | /// Type of the endpoint concurrency component 50 | typedef typename config::concurrency_type concurrency_type; 51 | /// Type of the endpoint transport component 52 | typedef typename config::transport_type transport_type; 53 | 54 | /// Type of the connections this server will create 55 | typedef connection connection_type; 56 | /// Type of a shared pointer to the connections this server will create 57 | typedef typename connection_type::ptr connection_ptr; 58 | 59 | /// Type of the connection transport component 60 | typedef typename transport_type::transport_con_type transport_con_type; 61 | /// Type of a shared pointer to the connection transport component 62 | typedef typename transport_con_type::ptr transport_con_ptr; 63 | 64 | /// Type of the endpoint component of this server 65 | typedef endpoint endpoint_type; 66 | 67 | 68 | // TODO: clean up these types 69 | 70 | explicit server() : endpoint_type(true) 71 | { 72 | endpoint_type::m_alog.write(log::alevel::devel, 73 | "server constructor"); 74 | } 75 | 76 | // return an initialized connection_ptr. Call start() on this object to 77 | // begin the processing loop. 78 | connection_ptr get_connection() { 79 | connection_ptr con = endpoint_type::create_connection(); 80 | 81 | return con; 82 | } 83 | 84 | // Starts the server's async connection acceptance loop. 85 | void start_accept() { 86 | connection_ptr con = get_connection(); 87 | 88 | transport_type::async_accept( 89 | lib::static_pointer_cast(con), 90 | lib::bind( 91 | &type::handle_accept, 92 | this, 93 | lib::placeholders::_1, 94 | lib::placeholders::_2 95 | ) 96 | ); 97 | } 98 | 99 | void handle_accept(connection_hdl hdl, const lib::error_code& ec) { 100 | lib::error_code hdl_ec; 101 | connection_ptr con = endpoint_type::get_con_from_hdl(hdl,hdl_ec); 102 | 103 | if (hdl_ec == error::bad_connection) { 104 | // The connection we were trying to connect went out of scope 105 | // This really shouldn't happen 106 | endpoint_type::m_elog.write(log::elevel::fatal, 107 | "handle_accept got an invalid handle back"); 108 | //con->terminate(); 109 | } else if (hdl_ec) { 110 | // There was some other unknown error attempting to convert the hdl 111 | // to a connection. 112 | endpoint_type::m_elog.write(log::elevel::fatal, 113 | "handle_accept error in get_con_from_hdl: "+hdl_ec.message()); 114 | //con->terminate(); 115 | } else { 116 | if (ec) { 117 | con->terminate(ec); 118 | 119 | endpoint_type::m_elog.write(log::elevel::rerror, 120 | "handle_accept error: "+ec.message()); 121 | } else { 122 | con->start(); 123 | } 124 | } 125 | 126 | // TODO: are there cases where we should terminate this loop? 127 | start_accept(); 128 | } 129 | private: 130 | }; 131 | 132 | } // namespace websocketpp 133 | 134 | #endif //WEBSOCKETPP_SERVER_ENDPOINT_HPP 135 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/server.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_SERVER_HPP 29 | #define WEBSOCKETPP_SERVER_HPP 30 | 31 | #include 32 | 33 | #endif //WEBSOCKETPP_SERVER_HPP 34 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/sha1/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 1998, 2009 2 | Paul E. Jones 3 | 4 | Freeware Public License (FPL) 5 | 6 | This software is licensed as "freeware." Permission to distribute 7 | this software in source and binary forms, including incorporation 8 | into other products, is hereby granted without a fee. THIS SOFTWARE 9 | IS PROVIDED 'AS IS' AND WITHOUT ANY EXPRESSED OR IMPLIED WARRANTIES, 10 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 11 | AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHOR SHALL NOT BE HELD 12 | LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE, EITHER 13 | DIRECTLY OR INDIRECTLY, INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA 14 | OR DATA BEING RENDERED INACCURATE. 15 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/transport/asio/base.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_TRANSPORT_ASIO_BASE_HPP 29 | #define WEBSOCKETPP_TRANSPORT_ASIO_BASE_HPP 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #include 36 | 37 | #include 38 | 39 | namespace websocketpp { 40 | namespace transport { 41 | /// Transport policy that uses boost::asio 42 | /** 43 | * This policy uses a single boost::asio io_service to provide transport 44 | * services to a WebSocket++ endpoint. 45 | */ 46 | namespace asio { 47 | 48 | typedef lib::function 49 | socket_shutdown_handler; 50 | 51 | /// Asio transport errors 52 | namespace error { 53 | enum value { 54 | /// Catch-all error for transport policy errors that don't fit in other 55 | /// categories 56 | general = 1, 57 | 58 | /// async_read_at_least call requested more bytes than buffer can store 59 | invalid_num_bytes, 60 | 61 | /// there was an error in the underlying transport library 62 | pass_through, 63 | 64 | /// The connection to the requested proxy server failed 65 | proxy_failed, 66 | 67 | /// Invalid Proxy URI 68 | proxy_invalid, 69 | 70 | /// Invalid host or service 71 | invalid_host_service 72 | }; 73 | 74 | /// Asio transport error category 75 | class category : public lib::error_category { 76 | public: 77 | char const * name() const _WEBSOCKETPP_NOEXCEPT_TOKEN_ { 78 | return "websocketpp.transport.asio"; 79 | } 80 | 81 | std::string message(int value) const { 82 | switch(value) { 83 | case error::general: 84 | return "Generic asio transport policy error"; 85 | case error::invalid_num_bytes: 86 | return "async_read_at_least call requested more bytes than buffer can store"; 87 | case error::pass_through: 88 | return "Underlying Transport Error"; 89 | case error::proxy_failed: 90 | return "Proxy connection failed"; 91 | case error::proxy_invalid: 92 | return "Invalid proxy URI"; 93 | case error::invalid_host_service: 94 | return "Invalid host or service"; 95 | default: 96 | return "Unknown"; 97 | } 98 | } 99 | }; 100 | 101 | /// Get a reference to a static copy of the asio transport error category 102 | inline lib::error_category const & get_category() { 103 | static category instance; 104 | return instance; 105 | } 106 | 107 | /// Create an error code with the given value and the asio transport category 108 | inline lib::error_code make_error_code(error::value e) { 109 | return lib::error_code(static_cast(e), get_category()); 110 | } 111 | 112 | } // namespace error 113 | } // namespace asio 114 | } // namespace transport 115 | } // namespace websocketpp 116 | 117 | _WEBSOCKETPP_ERROR_CODE_ENUM_NS_START_ 118 | template<> struct is_error_code_enum 119 | { 120 | static bool const value = true; 121 | }; 122 | _WEBSOCKETPP_ERROR_CODE_ENUM_NS_END_ 123 | #endif // WEBSOCKETPP_TRANSPORT_ASIO_HPP 124 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/transport/asio/security/base.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_TRANSPORT_ASIO_SOCKET_BASE_HPP 29 | #define WEBSOCKETPP_TRANSPORT_ASIO_SOCKET_BASE_HPP 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include 38 | 39 | #include 40 | #include 41 | 42 | // Interface that sockets/security policies must implement 43 | 44 | /* 45 | * Endpoint Interface 46 | * 47 | * bool is_secure() const; 48 | * @return Whether or not the endpoint creates secure connections 49 | * 50 | * lib::error_code init(socket_con_ptr scon); 51 | * Called by the transport after a new connection is created to initialize 52 | * the socket component of the connection. 53 | * @param scon Pointer to the socket component of the connection 54 | * @return Error code (empty on success) 55 | */ 56 | 57 | 58 | // Connection 59 | // TODO 60 | // pre_init(init_handler); 61 | // post_init(init_handler); 62 | 63 | namespace websocketpp { 64 | namespace transport { 65 | namespace asio { 66 | namespace socket { 67 | 68 | /** 69 | * The transport::asio::socket::* classes are a set of security/socket related 70 | * policies and support code for the ASIO transport types. 71 | */ 72 | 73 | /// Errors related to asio transport sockets 74 | namespace error { 75 | enum value { 76 | /// Catch-all error for security policy errors that don't fit in other 77 | /// categories 78 | security = 1, 79 | 80 | /// Catch-all error for socket component errors that don't fit in other 81 | /// categories 82 | socket, 83 | 84 | /// A function was called in a state that it was illegal to do so. 85 | invalid_state, 86 | 87 | /// The application was prompted to provide a TLS context and it was 88 | /// empty or otherwise invalid 89 | invalid_tls_context, 90 | 91 | /// TLS Handshake Timeout 92 | tls_handshake_timeout, 93 | 94 | /// pass_through from underlying library 95 | pass_through, 96 | 97 | /// Required tls_init handler not present 98 | missing_tls_init_handler 99 | }; 100 | } // namespace error 101 | 102 | /// Error category related to asio transport socket policies 103 | class socket_category : public lib::error_category { 104 | public: 105 | const char *name() const _WEBSOCKETPP_NOEXCEPT_TOKEN_ { 106 | return "websocketpp.transport.asio.socket"; 107 | } 108 | 109 | std::string message(int value) const { 110 | switch(value) { 111 | case error::security: 112 | return "Security policy error"; 113 | case error::socket: 114 | return "Socket component error"; 115 | case error::invalid_state: 116 | return "Invalid state"; 117 | case error::invalid_tls_context: 118 | return "Invalid or empty TLS context supplied"; 119 | case error::tls_handshake_timeout: 120 | return "TLS handshake timed out"; 121 | case error::pass_through: 122 | return "Pass through from underlying library"; 123 | case error::missing_tls_init_handler: 124 | return "Required tls_init handler not present."; 125 | default: 126 | return "Unknown"; 127 | } 128 | } 129 | }; 130 | 131 | inline const lib::error_category& get_socket_category() { 132 | static socket_category instance; 133 | return instance; 134 | } 135 | 136 | inline lib::error_code make_error_code(error::value e) { 137 | return lib::error_code(static_cast(e), get_socket_category()); 138 | } 139 | 140 | /// Type of asio transport socket policy initialization handlers 141 | typedef lib::function init_handler; 142 | 143 | } // namespace socket 144 | } // namespace asio 145 | } // namespace transport 146 | } // namespace websocketpp 147 | 148 | #endif // WEBSOCKETPP_TRANSPORT_ASIO_SOCKET_BASE_HPP 149 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/transport/base/endpoint.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_TRANSPORT_BASE_HPP 29 | #define WEBSOCKETPP_TRANSPORT_BASE_HPP 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include 38 | 39 | namespace websocketpp { 40 | /// Transport policies provide network connectivity and timers 41 | /** 42 | * ### Endpoint Interface 43 | * 44 | * Transport endpoint components needs to provide: 45 | * 46 | * **init**\n 47 | * `lib::error_code init(transport_con_ptr tcon)`\n 48 | * init is called by an endpoint once for each newly created connection. 49 | * It's purpose is to give the transport policy the chance to perform any 50 | * transport specific initialization that couldn't be done via the default 51 | * constructor. 52 | */ 53 | namespace transport { 54 | 55 | /// The type and signature of the callback passed to the accept method 56 | typedef lib::function 57 | accept_handler; 58 | 59 | /// The type and signature of the callback passed to the connect method 60 | typedef lib::function 61 | connect_handler; 62 | 63 | } // namespace transport 64 | } // namespace websocketpp 65 | 66 | #endif // WEBSOCKETPP_TRANSPORT_BASE_HPP 67 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/transport/iostream/base.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_TRANSPORT_IOSTREAM_BASE_HPP 29 | #define WEBSOCKETPP_TRANSPORT_IOSTREAM_BASE_HPP 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | 36 | namespace websocketpp { 37 | namespace transport { 38 | /// Transport policy that uses STL iostream for I/O and does not support timers 39 | namespace iostream { 40 | 41 | /// iostream transport errors 42 | namespace error { 43 | enum value { 44 | /// Catch-all error for transport policy errors that don't fit in other 45 | /// categories 46 | general = 1, 47 | 48 | /// async_read_at_least call requested more bytes than buffer can store 49 | invalid_num_bytes, 50 | 51 | /// async_read called while another async_read was in progress 52 | double_read, 53 | 54 | /// An operation that requires an output stream was attempted before 55 | /// setting one. 56 | output_stream_required, 57 | 58 | /// stream error 59 | bad_stream 60 | }; 61 | 62 | /// iostream transport error category 63 | class category : public lib::error_category { 64 | public: 65 | category() {} 66 | 67 | char const * name() const _WEBSOCKETPP_NOEXCEPT_TOKEN_ { 68 | return "websocketpp.transport.iostream"; 69 | } 70 | 71 | std::string message(int value) const { 72 | switch(value) { 73 | case general: 74 | return "Generic iostream transport policy error"; 75 | case invalid_num_bytes: 76 | return "async_read_at_least call requested more bytes than buffer can store"; 77 | case double_read: 78 | return "Async read already in progress"; 79 | case output_stream_required: 80 | return "An output stream to be set before async_write can be used"; 81 | case bad_stream: 82 | return "A stream operation returned ios::bad"; 83 | default: 84 | return "Unknown"; 85 | } 86 | } 87 | }; 88 | 89 | /// Get a reference to a static copy of the iostream transport error category 90 | inline lib::error_category const & get_category() { 91 | static category instance; 92 | return instance; 93 | } 94 | 95 | /// Get an error code with the given value and the iostream transport category 96 | inline lib::error_code make_error_code(error::value e) { 97 | return lib::error_code(static_cast(e), get_category()); 98 | } 99 | 100 | } // namespace error 101 | } // namespace iostream 102 | } // namespace transport 103 | } // namespace websocketpp 104 | _WEBSOCKETPP_ERROR_CODE_ENUM_NS_START_ 105 | template<> struct is_error_code_enum 106 | { 107 | static bool const value = true; 108 | }; 109 | _WEBSOCKETPP_ERROR_CODE_ENUM_NS_END_ 110 | 111 | #endif // WEBSOCKETPP_TRANSPORT_IOSTREAM_BASE_HPP 112 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/utf8_validator.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2008-2009 Bjoern Hoehrmann 2 | // See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details. 3 | 4 | #ifndef UTF8_VALIDATOR_HPP 5 | #define UTF8_VALIDATOR_HPP 6 | 7 | #include 8 | 9 | namespace websocketpp { 10 | namespace utf8_validator { 11 | 12 | static const unsigned int UTF8_ACCEPT = 0; 13 | static const unsigned int UTF8_REJECT = 1; 14 | 15 | static const uint8_t utf8d[] = { 16 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 00..1f 17 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 20..3f 18 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 40..5f 19 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 60..7f 20 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, // 80..9f 21 | 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, // a0..bf 22 | 8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // c0..df 23 | 0xa,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x4,0x3,0x3, // e0..ef 24 | 0xb,0x6,0x6,0x6,0x5,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8, // f0..ff 25 | 0x0,0x1,0x2,0x3,0x5,0x8,0x7,0x1,0x1,0x1,0x4,0x6,0x1,0x1,0x1,0x1, // s0..s0 26 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,1, // s1..s2 27 | 1,2,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1, // s3..s4 28 | 1,2,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,3,1,1,1,1,1,1, // s5..s6 29 | 1,3,1,1,1,1,1,3,1,3,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // s7..s8 30 | }; 31 | 32 | uint32_t inline 33 | decode(uint32_t* state, uint32_t* codep, uint8_t byte) { 34 | uint32_t type = utf8d[byte]; 35 | 36 | *codep = (*state != UTF8_ACCEPT) ? 37 | (byte & 0x3fu) | (*codep << 6) : 38 | (0xff >> type) & (byte); 39 | 40 | *state = utf8d[256 + *state*16 + type]; 41 | return *state; 42 | } 43 | 44 | /// Provides streaming UTF8 validation functionality 45 | class validator { 46 | public: 47 | validator() : m_state(UTF8_ACCEPT),m_codepoint(0) {} 48 | 49 | bool consume (uint32_t byte) { 50 | if (utf8_validator::decode(&m_state,&m_codepoint,static_cast(byte)) == UTF8_REJECT) { 51 | return false; 52 | } 53 | return true; 54 | } 55 | 56 | template 57 | bool decode (iterator_type b, iterator_type e) { 58 | for (iterator_type i = b; i != e; i++) { 59 | if (utf8_validator::decode(&m_state,&m_codepoint,static_cast(*i)) == UTF8_REJECT) { 60 | return false; 61 | } 62 | } 63 | return true; 64 | } 65 | 66 | bool complete() { 67 | return m_state == UTF8_ACCEPT; 68 | } 69 | 70 | void reset() { 71 | m_state = UTF8_ACCEPT; 72 | m_codepoint = 0; 73 | } 74 | private: 75 | uint32_t m_state; 76 | uint32_t m_codepoint; 77 | }; 78 | 79 | // convenience function that creates a validator, validates a complete string 80 | // and returns the result. 81 | // TODO: should this be inline? 82 | inline bool validate(const std::string& s) { 83 | validator v; 84 | if (!v.decode(s.begin(),s.end())) { 85 | return false; 86 | } 87 | return v.complete(); 88 | } 89 | 90 | } // namespace utf8_validator 91 | } // namespace websocketpp 92 | 93 | #endif // UTF8_VALIDATOR_HPP 94 | -------------------------------------------------------------------------------- /app/src/blocks/Cinder-WebSocketPP/src/websocketpp/version.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 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_VERSION_HPP 29 | #define WEBSOCKETPP_VERSION_HPP 30 | 31 | /// Namespace for the WebSocket++ project 32 | namespace websocketpp { 33 | 34 | /* 35 | other places where version information is kept 36 | - readme.md 37 | - changelog.md 38 | - Doxyfile 39 | - CMakeLists.txt 40 | */ 41 | 42 | /// Library major version number 43 | static int const major_version = 0; 44 | /// Library minor version number 45 | static int const minor_version = 3; 46 | /// Library patch version number 47 | static int const patch_version = 0; 48 | /// Library pre-release flag 49 | /** 50 | * This is a textual flag indicating the type and number for pre-release 51 | * versions (dev, alpha, beta, rc). This will be blank for release versions. 52 | */ 53 | static char const prerelease_flag[] = "alpha3"; 54 | 55 | /// Default user agent string 56 | static char const user_agent[] = "WebSocket++/0.3.0-alpha3"; 57 | 58 | } // namespace websocketpp 59 | 60 | #endif // WEBSOCKETPP_VERSION_HPP 61 | -------------------------------------------------------------------------------- /app/src/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | #define RES_APP_ICON CINDER_RESOURCE( ../resources/, cinder_app_icon.ico, 1, ICON ) 5 | #define RES_BACKGROUND_TEX CINDER_RESOURCE( ../resources/, status.jpg, 128, IMAGE ) 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Instrument/oculus-bridge/29ef33ca7bc91c26d9b7b7299af2469d9cca7b87/app/src/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /app/src/resources/oculus_bridge.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Instrument/oculus-bridge/29ef33ca7bc91c26d9b7b7299af2469d9cca7b87/app/src/resources/oculus_bridge.icns -------------------------------------------------------------------------------- /app/src/resources/oculus_bridge.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Instrument/oculus-bridge/29ef33ca7bc91c26d9b7b7299af2469d9cca7b87/app/src/resources/oculus_bridge.ico -------------------------------------------------------------------------------- /app/src/resources/status.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Instrument/oculus-bridge/29ef33ca7bc91c26d9b7b7299af2469d9cca7b87/app/src/resources/status.jpg -------------------------------------------------------------------------------- /app/src/src/Oculus.h: -------------------------------------------------------------------------------- 1 | // 2 | // Oculus.h 3 | // OculusSocketServer 4 | // 5 | // Created by Ben Purdy on 7/15/13. 6 | // 7 | 8 | 9 | #ifndef __OculusSocketServer__Oculus__ 10 | #define __OculusSocketServer__Oculus__ 11 | 12 | #include 13 | #include "OVR.h" 14 | 15 | using namespace OVR; 16 | 17 | typedef std::shared_ptr< class Oculus > OculusRef; 18 | 19 | class Oculus : public MessageHandler 20 | { 21 | public: 22 | // ! Returns an empty ptr if we can't initialize correctly the HMD device 23 | static OculusRef create(); 24 | ~Oculus(); 25 | 26 | void destroy(); 27 | 28 | float getIPD() const; 29 | float getFov(); 30 | float getEyeToScreenDistance() const; 31 | float getProjectionCenterOffset(); 32 | float getDistortionScale(); 33 | ci::Vec4f getDistortionParams() const; 34 | ci::Quatf getOrientation(); 35 | ci::Vec3f getAcceleration(); 36 | float getLensSeparationDistance(); 37 | ci::Vec2f getScreenSize(); 38 | ci::Vec2f getScreenResolution(); 39 | 40 | virtual void OnMessage(const Message&); 41 | void handleMessages(); 42 | 43 | bool isConnected() { return mHMD && mSensorDevice && !mHMD->IsDisconnected(); }; 44 | 45 | protected: 46 | Oculus(); 47 | 48 | OVR::Ptr mManager; 49 | OVR::Ptr mHMD; 50 | OVR::HMDInfo mHMDInfo; 51 | OVR::SensorFusion* mSensorFusion; 52 | OVR::Ptr mSensorDevice; 53 | OVR::Util::Render::StereoConfig mStereoConfig; 54 | 55 | bool mIsConnected; 56 | 57 | struct DeviceStatusNotificationDesc 58 | { 59 | DeviceHandle Handle; 60 | MessageType Action; 61 | 62 | DeviceStatusNotificationDesc():Action(Message_None) {} 63 | DeviceStatusNotificationDesc(MessageType mt, const DeviceHandle& dev) : Handle(dev), Action(mt) {} 64 | }; 65 | 66 | Array DeviceStatusNotificationsQueue; 67 | }; 68 | 69 | #endif /* defined(__OculusSocketServer__Oculus__) */ 70 | -------------------------------------------------------------------------------- /app/src/vc11/OculusSocketServer.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Express 2012 for Windows Desktop 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OculusSocketServer", "OculusSocketServer.vcxproj", "{9CBB67BE-CDC3-4EEA-8324-E1C4F216CC8D}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {9CBB67BE-CDC3-4EEA-8324-E1C4F216CC8D}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {9CBB67BE-CDC3-4EEA-8324-E1C4F216CC8D}.Debug|Win32.Build.0 = Debug|Win32 14 | {9CBB67BE-CDC3-4EEA-8324-E1C4F216CC8D}.Release|Win32.ActiveCfg = Release|Win32 15 | {9CBB67BE-CDC3-4EEA-8324-E1C4F216CC8D}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /app/src/vc11/OculusSocketServer.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/vc11/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | RES_APP_ICON 4 | RES_BACKGROUND_TEX -------------------------------------------------------------------------------- /app/src/xcode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | oculus_bridge.icns 11 | CFBundleIdentifier 12 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 Instrument. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/xcode/OculusSocketServer.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/xcode/OculusSocketServer_Prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #if defined( __cplusplus ) 6 | #include "cinder/Cinder.h" 7 | 8 | #include "cinder/app/AppBasic.h" 9 | 10 | #include "cinder/gl/gl.h" 11 | 12 | #include "cinder/CinderMath.h" 13 | #include "cinder/Matrix.h" 14 | #include "cinder/Vector.h" 15 | #include "cinder/Quaternion.h" 16 | #endif 17 | -------------------------------------------------------------------------------- /docs/build_instructions.md: -------------------------------------------------------------------------------- 1 | Building the OculusBridge Application 2 | ===================================== 3 | 4 | 5 | ## Prerequisites 6 | 7 | - [Cinder 0.8.5](http://libcinder.org/) 8 | - [Oculus Rift SDK](https://developer.oculusvr.com/) 9 | 10 | 11 | ## XCode 12 | 13 | - Open the xcode project 14 | - Open the build settings 15 | - Change the two user-defined values for `CINDER_PATH` and `OCULUS_SDK` to point to the respective folders on your computer. Note: You may need to re-build the Oculus Rift libraries with `C++ Runtime Types` enabled to avoid errors when linking. 16 | 17 | 18 | ## VisualStudio 2012 19 | 20 | - Open the solution 21 | - Open the project properties 22 | - Update all references to cinder and the oculus SDK to point to the respective folders on your computer -------------------------------------------------------------------------------- /docs/first_person_movement.md: -------------------------------------------------------------------------------- 1 | First Person Controls 2 | ===================== 3 | 4 | Using the Oculus Rift to control the direction of movement makes it much easier and more natural to explore virtual environments. The following example code illustrates a method of tracking the view direction along the x/z plane, making it possible for the user to move in the direction that they are facing. 5 | 6 | In this example, we keep track of a base "body angle" which is combined with the orientation of the Oculus Rift. By keeping track of the body angle, we can use keyboard or gamepad controls to modify the body angle in conjunction with the user's head movement. Without a system like this, the user would potentailly have to physically rotate their body all the way around in order to navigate in the virtual environment. 7 | 8 | This technique is exactly how the `first_person.html` example works, and is modeled after the behavior from the Tuscany demo (included with the Oculus SDK) as well as other first person games that use the Oculus Rift (HalfLife 2, etc). 9 | 10 | **Note:** this example is based on integration with THREE.js, but any library that implements quaternions and vectors would work with this technique. 11 | 12 | 13 | ## Initial Setup 14 | 15 | As stated before, this technique is used to move the player along a particular plane, and makes the assumption that the player's virtual body will always be "standing" on that plane. In this example, we use the XZ plane for the "ground" and the Y axis is the up/down axis. 16 | 17 | In our code, we must keep track of the angle that the player is facing if they are not turning their head. We'll call this `bodyAngle` and it will be modified via the keyboard controls to turn left or right. 18 | 19 | For movement in the XZ plane, we will use another value which we'll call `viewAngle` and will represent the current direction that the player is actually looking, along the XZ plane. The `viewAngle` value represents a combination of the player's `bodyAngle` and the angle of their head as reported from the Oculus Bridge. 20 | 21 | 22 | ## What Direction Are They Facing? 23 | 24 | The following code will determine the current `viewAngle` when the `onOrientationUpdate` callback is invoked. 25 | 26 | function bridgeOrientationUpdated(quatValues) { 27 | 28 | var bodyAxis = new THREE.Vector3(0, 1, 0); 29 | 30 | // make a quaternion for the the body angle rotated about the Y axis 31 | var bodyQuat = new THREE.Quaternion(); 32 | bodyQuat.setFromAxisAngle(bodyAxis, bodyAngle); 33 | 34 | // make a quaternion for the current orientation of the Rift 35 | var riftQuat = new THREE.Quaternion(quatValues.x, quatValues.y, quatValues.z, quatValues.w); 36 | 37 | // multiply the body rotation by the Rift rotation. 38 | bodyQuat.multiply(riftQuat); 39 | 40 | 41 | // Make a vector pointing along the Z axis and rotate it 42 | // according to the combined look+body angle. 43 | var xzVector = new THREE.Vector3(0, 0, 1); 44 | xzVector.applyQuaternion(bodyQuat); 45 | 46 | // Compute the X/Z angle based on the combined look/body angle. 47 | viewAngle = Math.atan2(xzVector.z, xzVector.x) + Math.PI; 48 | 49 | // Update the camera so it matches the current view orientation 50 | camera.quaternion.copy(bodyQuat); 51 | } 52 | 53 | ## Handling Movement 54 | 55 | Once you know the body angle, and view angle, you can move the player around in your virtual space quite easily. The following example assumes `bodyPosition` is a `THREE.Vector3` and that the current keyboard states are stored in an array called `keys`. 56 | 57 | This example function also uses a time delta value to scale the movement and rotation increments, which is a very standard way to ensure smooth motion in interative applications like this. 58 | 59 | 60 | function updateInput(deltaTime) { 61 | 62 | var step = 25 * deltaTime; // 25 units per second 63 | var turn_speed = (55 * deltaTime) * Math.PI / 180; // 55 degrees per second 64 | 65 | // Forward/backward 66 | 67 | if(keys[FORWARD]){ 68 | bodyPosition.x += Math.cos(viewAngle) * step; 69 | bodyPosition.z += Math.sin(viewAngle) * step; 70 | } 71 | if(keys[BACKWARD]){ 72 | bodyPosition.x -= Math.cos(viewAngle) * step; 73 | bodyPosition.z -= Math.sin(viewAngle) * step; 74 | } 75 | 76 | // Turn - all you have to do is change bodyAngle 77 | 78 | if(keys[TURN_RIGHT]){ // E 79 | bodyAngle += turn_speed; 80 | } 81 | 82 | if(keys[TURN_LEFT]){ // Q 83 | bodyAngle -= turn_speed; 84 | } 85 | 86 | // Straif - move the player 90 degrees offset to the current view angle. 87 | 88 | if(keys[STRAIF_LEFT]){ 89 | bodyPosition.x -= Math.cos(viewAngle + Math.PI/2) * step; 90 | bodyPosition.z -= Math.sin(viewAngle + Math.PI/2) * step; 91 | } 92 | 93 | if(keys[STRAIF_RIGHT]){ 94 | bodyPosition.x += Math.cos(viewAngle+Math.PI/2) * step; 95 | bodyPosition.z += Math.sin(viewAngle+Math.PI/2) * step; 96 | } 97 | } -------------------------------------------------------------------------------- /docs/javascript_docs.md: -------------------------------------------------------------------------------- 1 | OculusBridge.js 2 | =============== 3 | 4 | 5 | ## Configuraion Options 6 | 7 | The OculusBridge object accepts a single configuration object that may contain any of the following properties. All configuration values are optional. 8 | 9 | 10 | `onConnect` - **function**, a callback that will be invoked when a connection is estabilshed. 11 | 12 | `onDisconnect` - **function**, a callback invoked when the connection is lost. 13 | 14 | `onConfigUpdate` - **function**, a callback invoked when configuration data is recieved from the server. A single argument is passed to this callback, it is a map of the metrics for the head mounted display. These metrics are needed when rendering any images for use on the Oculus Rift. 15 | 16 | `onOrientationUpdate` - **function**, invoked whenever new orientation values are sent from the server (around 60 Hz). A single object is passed to this callback, containing the quaternion values in the same format as the `getOrientation` method. 17 | 18 | `onAccelerationUpdate` - **function**, just like the orientation update, this function is invoked whenever new acceleration values are sent from the server (around 60 Hz). A single object is passed to this callback with the same format as the `getAcceleration` method. 19 | 20 | `debug` - **boolean**, default is false, this parameter 21 | 22 | `port` - **number**, default is 9005, changing this value is not advised if you are planning to make your content public since anyone else using the bridge app will not be expecting the non-default port. 23 | 24 | `address` - **string**, default is "localhost". IMPORTANT: currently the bridge app will refuse any websocket connection that doesn't originate from localhost. This may change in the future but until then you should leave this parameter alone unless you're going to make a custom build of the app. 25 | 26 | `retryInterval` - **number**, default is 1, the number of seconds to wait between connection attempts. 27 | 28 | 29 | ## Using the Callbacks 30 | 31 | var bridge = new OculusBridge( { 32 | "onConnect" : function() { 33 | console.log("we are connected!"); 34 | }, 35 | "onDisconnect" : function() { 36 | console.log("good bye Oculus."); 37 | }, 38 | "onConfigUpdate" : function(config) { 39 | console.log("Field of view: " + config.FOV); 40 | }, 41 | "onOrientationUpdate" : function(quatValues){ 42 | var values = [quatValues.x, quatValues.y, quatValues.z, quatValues.w]; 43 | console.log("Orientation: " + values.join(", ")); 44 | } 45 | "onAccelerationUpdate" : function(accelValues){ 46 | var values = [accelValues.x, accelValues.y, accelValues.z]; 47 | console.log("Acceleration: " + values.join(", ")); 48 | } 49 | }); 50 | 51 | bridge.connect(); 52 | 53 | 54 | ## Methods 55 | 56 | `connect` - attempt to connect to the bridge server. 57 | 58 | `disconnect` - disconnect from the bridge server 59 | 60 | `isConnected` - returns a boolean indicating connection status 61 | 62 | `getOrientation` - an alternative to using the `onOrientationUpdate` callback, this method returns the last known quaternion values sent from the server. 63 | 64 | Example orientation object: 65 | 66 | { 67 | "x" : 0.2329875, 68 | "y" : 1.1288273, 69 | "z" : 0.1837934, 70 | "w" : 0.0439387 71 | } 72 | 73 | `getAcceleration` - an alternative to using the `onAccelerationUpdate` callback, this method returns the last known accelerometer values sent from the server. Acceleration values represent standard G's with the y-axis representing up and down. In other words, if the headset is sitting motionless on a level surface you will see 9.8 in the y axis with zeros for x and z. 74 | 75 | Example acceleration object: 76 | 77 | { 78 | "x" : 0, 79 | "y" : 9.8, 80 | "z" : 0 81 | } 82 | 83 | `getConfiguration` - an alternative to using the `onConfigUpdate` callback, this method returns the metrics for the head mounted display. If a connection has not been made, the values will default to the metrics for the currently released development hardware. 84 | 85 | Example configuration object: 86 | 87 | { 88 | "FOV" : 125.871, 89 | "hScreenSize" : 0.14976, 90 | "vScreenSize" : 0.0935, 91 | "vScreenCenter" : 0.0468, 92 | "eyeToScreenDistance" : 0.041, 93 | "lensSeparationDistance" : 0.067, 94 | "interpupillaryDistance" : 0.0675, 95 | "hResolution" : 1280, 96 | "vResolution" : 720, 97 | "distortionK" : [1, .22, .24, 0], 98 | "chromaAbParameter" : [0.996, -0.004, 1.014, 0] 99 | } -------------------------------------------------------------------------------- /examples/connect.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | OculusBridge Example 5 | 6 | 7 | 8 | 9 | 27 | 28 | 29 | 30 | 31 | 32 |
33 |
34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /examples/css/distort.vs: -------------------------------------------------------------------------------- 1 | precision mediump float; 2 | 3 | attribute vec4 a_position; 4 | 5 | uniform mat4 u_projectionMatrix; 6 | uniform float lensShift; 7 | //uniform float scale 8 | 9 | void main() { 10 | 11 | vec2 scaleIn = vec2(1.2, 1.225); 12 | vec2 lensCenter = vec2(lensShift / 2.0, 0.0); 13 | 14 | vec2 uv = vec2(a_position.x, a_position.y);//range from [0,1] to [-1,1] 15 | vec2 theta = (uv - lensCenter) * scaleIn; 16 | 17 | vec4 hmdWarpParam = vec4(1.0, 0.22, 0.24, 0.0); 18 | 19 | 20 | float rSq = theta.x * theta.x + theta.y * theta.y; 21 | vec2 rvector = theta/(hmdWarpParam.x + hmdWarpParam.y*rSq + hmdWarpParam.z*rSq*rSq + hmdWarpParam.w*rSq*rSq*rSq); 22 | 23 | gl_Position = u_projectionMatrix * vec4(rvector.x, rvector.y, a_position.z, a_position.w); 24 | } -------------------------------------------------------------------------------- /examples/css/passthrough.fs: -------------------------------------------------------------------------------- 1 | precision mediump float; 2 | 3 | void main() { 4 | 5 | float r = 1.0; 6 | float g = 1.0; 7 | float b = 1.0; 8 | float a = 1.0; 9 | 10 | css_ColorMatrix = mat4( r, 0.0, 0.0, 0.0, 11 | 0.0, g, 0.0, 0.0, 12 | 0.0, 0.0, b, 0.0, 13 | 0.0, 0.0, 0.0, a ); 14 | } -------------------------------------------------------------------------------- /examples/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: 'Strait', sans-serif; 3 | background-color: #161616; 4 | color: #fff; 5 | margin: 0px; 6 | overflow: hidden; 7 | letter-spacing:1px; 8 | font-size:13px; 9 | } 10 | 11 | #logo { 12 | width:50px; 13 | height:50px; 14 | padding:10px; 15 | position:absolute; 16 | top:0px; 17 | right:0px; 18 | cursor:pointer; 19 | background-color:rgba(0,0,0,0.4); 20 | background-image:url(../img/oculus_bridge.png); 21 | background-repeat:no-repeat; 22 | background-position:10px 10px; 23 | } 24 | 25 | #logo.offline{ 26 | background-image:url(../img/oculus_bridge_offline.png); 27 | } 28 | 29 | .button { 30 | font: 'Strait', sans-serif; 31 | cursor:pointer; 32 | display:inline-block; 33 | background:#404040; 34 | padding:10px; 35 | color:#a0a0a0; 36 | } 37 | 38 | .button:hover{ 39 | color:white; 40 | } -------------------------------------------------------------------------------- /examples/css_shaders.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 68 | 69 | 70 | 71 | 72 |
73 |
74 | Click anywhere to enable/disable CSS shader.

75 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas dapibus interdum sapien, et vestibulum orci rutrum vitae. Donec nulla nulla, condimentum eget diam sed, egestas pulvinar massa. In tellus ante, eleifend in ante sit amet, bibendum faucibus lacus. Nunc vel feugiat mauris. In hendrerit rutrum ante, non rhoncus mi luctus nec. Pellentesque risus mi, luctus in urna non, molestie pulvinar metus. Proin condimentum augue at nisi elementum tempor nec vitae ante. Praesent odio odio, hendrerit a magna sit amet, adipiscing semper tortor. Ut mollis eu ligula ut convallis. In et felis a nunc eleifend convallis blandit nec nulla. Quisque semper dolor nec ligula posuere, molestie ultricies orci ultrices. Phasellus et leo a leo malesuada auctor a condimentum ante. 76 |
77 |
78 | 79 |
80 |
81 | Click anywhere to enable/disable CSS shader.

82 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas dapibus interdum sapien, et vestibulum orci rutrum vitae. Donec nulla nulla, condimentum eget diam sed, egestas pulvinar massa. In tellus ante, eleifend in ante sit amet, bibendum faucibus lacus. Nunc vel feugiat mauris. In hendrerit rutrum ante, non rhoncus mi luctus nec. Pellentesque risus mi, luctus in urna non, molestie pulvinar metus. Proin condimentum augue at nisi elementum tempor nec vitae ante. Praesent odio odio, hendrerit a magna sit amet, adipiscing semper tortor. Ut mollis eu ligula ut convallis. In et felis a nunc eleifend convallis blandit nec nulla. Quisque semper dolor nec ligula posuere, molestie ultricies orci ultrices. Phasellus et leo a leo malesuada auctor a condimentum ante. 83 |
84 |
85 | 86 | 140 | 141 | -------------------------------------------------------------------------------- /examples/first_person.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | OculusBridge - VR Scene 5 | 6 | 7 | 8 | 9 | 47 | 48 | 49 | 50 | 51 | 52 |
53 |
toggle render mode
help
54 | 82 |
83 | 84 |
85 |
86 |

This file must be served via HTTP to support the use of textures.

87 |

Please host this content via a web server of some kind and try again.

88 |
89 |
90 |

Oh dang, something went wrong while trying to render the scene.

91 |

Exception:

92 |
93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /examples/img/grid.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Instrument/oculus-bridge/29ef33ca7bc91c26d9b7b7299af2469d9cca7b87/examples/img/grid.jpg -------------------------------------------------------------------------------- /examples/img/oculus_bridge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Instrument/oculus-bridge/29ef33ca7bc91c26d9b7b7299af2469d9cca7b87/examples/img/oculus_bridge.png -------------------------------------------------------------------------------- /examples/img/oculus_bridge_offline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Instrument/oculus-bridge/29ef33ca7bc91c26d9b7b7299af2469d9cca7b87/examples/img/oculus_bridge_offline.png -------------------------------------------------------------------------------- /examples/textures/blue_blue.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Instrument/oculus-bridge/29ef33ca7bc91c26d9b7b7299af2469d9cca7b87/examples/textures/blue_blue.jpg -------------------------------------------------------------------------------- /examples/textures/purple_blue.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Instrument/oculus-bridge/29ef33ca7bc91c26d9b7b7299af2469d9cca7b87/examples/textures/purple_blue.jpg -------------------------------------------------------------------------------- /examples/textures/tile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Instrument/oculus-bridge/29ef33ca7bc91c26d9b7b7299af2469d9cca7b87/examples/textures/tile.jpg -------------------------------------------------------------------------------- /web/GruntFile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | // Project configuration. 4 | grunt.initConfig({ 5 | pkg: grunt.file.readJSON('package.json'), 6 | uglify: { 7 | options: { 8 | banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' 9 | }, 10 | build: { 11 | src: 'src/<%= pkg.name %>.js', 12 | dest: 'build/<%= pkg.name %>.min.js' 13 | } 14 | } 15 | }); 16 | 17 | // Load the plugin that provides the "uglify" task. 18 | grunt.loadNpmTasks('grunt-contrib-uglify'); 19 | 20 | // Default task(s). 21 | grunt.registerTask('default', ['uglify']); 22 | 23 | }; -------------------------------------------------------------------------------- /web/build/OculusBridge.min.js: -------------------------------------------------------------------------------- 1 | /*! OculusBridge 2014-02-18 */ 2 | var OculusBridge=function(a){var b,c=null,d=!0,e=a.hasOwnProperty("address")?a.address:"localhost",f=a.hasOwnProperty("port")?a.port:9005,g=a.hasOwnProperty("retryInterval")?a.retryInterval:1,h=a.hasOwnProperty("debug")?a.debug:!1,i={x:0,y:0,z:0,w:0},j={x:0,y:0,z:0},k={FOV:125.871,hScreenSize:.14976,vScreenSize:.0935,vScreenCenter:.04675,eyeToScreenDistance:.041,lensSeparationDistance:.067,interpupillaryDistance:.0675,hResolution:1280,vResolution:720,distortionK:[1,.22,.24,0],chromaAbParameter:[.996,-.004,1.014,0]},l={onOrientationUpdate:null,onAccelerationUpdate:null,onConfigUpdate:null,onConnect:null,onDisconnect:null};for(var m in l)"function"==typeof a[m]&&(l[m]=a[m]);var n=function(a){a.o&&4==a.o.length&&(i.x=Number(a.o[1]),i.y=Number(a.o[2]),i.z=Number(a.o[3]),i.w=Number(a.o[0]),l.onOrientationUpdate&&l.onOrientationUpdate(i))},o=function(a){a.a&&3==a.a.length&&(j.x=Number(a.a[0]),j.y=Number(a.a[1]),j.z=Number(a.a[2]),l.onAccelerationUpdate&&l.onAccelerationUpdate(j))},p=function(a){k.hScreenSize=a.screenSize[0],k.vScreenSize=a.screenSize[1],k.vScreenCenter=a.screenSize[1]/2,k.eyeToScreenDistance=a.eyeToScreen,k.lensSeparationDistance=a.lensDistance,k.interpupillaryDistance=a.interpupillaryDistance,k.hResolution=a.screenResolution[0],k.vResolution=a.screenResolution[1],k.distortionK=[a.distortion[0],a.distortion[1],a.distortion[2],a.distortion[3]],k.FOV=a.fov,l.onConfigUpdate&&l.onConfigUpdate(k)},q=function(){d=!0;var a="ws://"+e+":"+f+"/";b=new WebSocket(a),r("Attempting to connect: "+a),b.onopen=function(){r("Connected!"),l.onConnect&&l.onConnect()},b.onerror=function(){r("Socket error.")},b.onmessage=function(a){var b=JSON.parse(a.data),c=b.m;switch(c){case"config":p(b);break;case"orientation":n(b);break;case"update":n(b),o(b);break;default:r("Unknown message received from server: "+a.data),t()}},b.onclose=function(){l.onDisconnect&&l.onDisconnect(),d&&(r("Connection failed, retrying in 1 second..."),c=window.setTimeout(s,1e3*g))}},r=function(a){h&&console.log("OculusBridge: "+a)},s=function(){q()},t=function(){d=!1,window.clearTimeout(c),b.close()},u=function(){return k},v=function(){return i},w=function(){return 1==b.readyState};return{isConnected:w,disconnect:t,connect:q,getOrientation:v,getConfiguration:u}}; -------------------------------------------------------------------------------- /web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "OculusBridge", 3 | "version": "0.0.1", 4 | "devDependencies": { 5 | "grunt": "~0.4.1", 6 | "grunt-contrib-uglify": "~0.2.2" 7 | } 8 | } 9 | --------------------------------------------------------------------------------