Add WebSocket 04 interface.

* New WebSocket04 traits class implements strategies.
* New "websocket_version" configuration setting selects between 0.2 and 0.4.
This commit is contained in:
Tom Ritchford
2015-02-02 19:31:32 -05:00
parent e5b0b7e9a7
commit 9f64ad8d89
12 changed files with 782 additions and 10 deletions

View File

@@ -3460,7 +3460,11 @@
</ClCompile>
<ClCompile Include="..\..\src\ripple\unity\validators.cpp">
</ClCompile>
<ClCompile Include="..\..\src\ripple\unity\websocket.cpp">
<ClCompile Include="..\..\src\ripple\unity\websocket02.cpp">
</ClCompile>
<ClCompile Include="..\..\src\ripple\unity\websocket04.cpp">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='debug|x64'">..\..\src\websocketpp;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='release|x64'">..\..\src\websocketpp;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ClInclude Include="..\..\src\ripple\validators\Connection.h">
</ClInclude>
@@ -3495,10 +3499,14 @@
</ClCompile>
<ClInclude Include="..\..\src\ripple\websocket\AutoSocket.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\websocket\Config04.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\websocket\Connection.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\websocket\Handler.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\websocket\Logger.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\websocket\LogWebsockets.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
@@ -3516,6 +3524,11 @@
</ClCompile>
<ClInclude Include="..\..\src\ripple\websocket\WebSocket02.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\websocket\WebSocket04.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\ripple\websocket\WebSocket04.h">
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\db\builder.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
@@ -4123,6 +4136,128 @@
</ClCompile>
<ClInclude Include="..\..\src\snappy\snappy\snappy.h">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\base64\base64.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\close.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\connection_hdl.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\cpp11.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\functional.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\md5.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\memory.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\network.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\platforms.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\stdint.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\system_error.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\thread.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\time.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\concurrency\basic.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\config\core.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\connection.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\connection_base.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\endpoint.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\endpoint_base.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\error.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\extensions\extension.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\extensions\permessage_deflate\disabled.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\frame.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\http\constants.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\http\impl\parser.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\http\impl\request.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\http\impl\response.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\http\parser.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\http\request.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\http\response.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\impl\connection_impl.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\impl\endpoint_impl.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\impl\utilities_impl.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\logger\basic.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\logger\levels.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\message_buffer\alloc.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\message_buffer\message.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\processors\base.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\processors\hybi00.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\processors\hybi07.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\processors\hybi08.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\processors\hybi13.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\processors\processor.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\random\none.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\roles\server_endpoint.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\server.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\sha1\sha1.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\asio\base.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\asio\connection.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\asio\endpoint.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\asio\security\base.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\asio\security\none.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\base\connection.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\base\endpoint.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\iostream\base.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\iostream\connection.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\iostream\endpoint.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\uri.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\utf8_validator.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\utilities.hpp">
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\version.hpp">
</ClInclude>
<ClCompile Include="..\..\src\websocketpp_02\src\base64\base64.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>

View File

@@ -535,6 +535,72 @@
<Filter Include="snappy\snappy">
<UniqueIdentifier>{575659AE-C11F-C7F6-CEA1-3F2FBB560918}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp">
<UniqueIdentifier>{EE7AC8C9-27EB-C05E-C986-EECB0174B997}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp">
<UniqueIdentifier>{82EA1B18-1B3C-A058-A29E-551E0E3BDA99}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\base64">
<UniqueIdentifier>{29A5E69F-AA78-79AB-F509-A1A1EFBE725A}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\common">
<UniqueIdentifier>{5A5A5554-4F81-E30A-5762-36685DB6B830}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\concurrency">
<UniqueIdentifier>{07669BB9-CC76-88EA-A896-DB6DDDEC5775}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\config">
<UniqueIdentifier>{B025F0D4-8F1C-603C-7CB9-2811262B7D34}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\extensions">
<UniqueIdentifier>{59B59211-4F8B-987B-68C9-C1DF65402F54}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\extensions\permessage_deflate">
<UniqueIdentifier>{C4D65117-C601-4C4A-28C8-A2C6335827A4}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\http">
<UniqueIdentifier>{1E03BC08-90C7-A797-7110-F73E444EC993}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\http\impl">
<UniqueIdentifier>{7941142B-9703-B8C4-5A99-DAC5E77AECBD}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\impl">
<UniqueIdentifier>{54043FA6-EB94-D644-DFB4-BFBC1E08AA88}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\logger">
<UniqueIdentifier>{11160D17-D0E6-A183-A6FA-B456917DF5BA}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\message_buffer">
<UniqueIdentifier>{62EC8D39-1586-9F85-3B81-9C8A38F9397C}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\processors">
<UniqueIdentifier>{F631E25B-C7E3-C49F-CC36-8B6A4139B913}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\random">
<UniqueIdentifier>{35BD193C-5B38-B7D6-A741-F1AF2040BF79}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\roles">
<UniqueIdentifier>{2743C174-DF30-DFAE-07AA-87B2463B627A}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\sha1">
<UniqueIdentifier>{13533400-6F24-4CB2-D7C1-2B60F50CB4D8}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\transport">
<UniqueIdentifier>{07010CA1-64FF-FF0E-8A88-42E38AA0D2C6}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\transport\asio">
<UniqueIdentifier>{1AEC5C0F-E62A-57D6-AE10-5A10DCF0D7B9}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\transport\asio\security">
<UniqueIdentifier>{E65629D4-E694-40E7-9D58-94BFA058BF4C}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\transport\base">
<UniqueIdentifier>{1F7DCF89-909D-C1BD-AC32-CD1B77BE213B}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp\websocketpp\transport\iostream">
<UniqueIdentifier>{82587170-78E0-AB92-82E6-5EDBA57322E4}</UniqueIdentifier>
</Filter>
<Filter Include="websocketpp_02">
<UniqueIdentifier>{96CE200F-2670-323E-3B37-B90DBC0EDA11}</UniqueIdentifier>
</Filter>
@@ -4173,7 +4239,10 @@
<ClCompile Include="..\..\src\ripple\unity\validators.cpp">
<Filter>ripple\unity</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ripple\unity\websocket.cpp">
<ClCompile Include="..\..\src\ripple\unity\websocket02.cpp">
<Filter>ripple\unity</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ripple\unity\websocket04.cpp">
<Filter>ripple\unity</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\validators\Connection.h">
@@ -4218,12 +4287,18 @@
<ClInclude Include="..\..\src\ripple\websocket\AutoSocket.h">
<Filter>ripple\websocket</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\websocket\Config04.h">
<Filter>ripple\websocket</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\websocket\Connection.h">
<Filter>ripple\websocket</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\websocket\Handler.h">
<Filter>ripple\websocket</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\websocket\Logger.h">
<Filter>ripple\websocket</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\websocket\LogWebsockets.cpp">
<Filter>ripple\websocket</Filter>
</ClCompile>
@@ -4245,6 +4320,12 @@
<ClInclude Include="..\..\src\ripple\websocket\WebSocket02.h">
<Filter>ripple\websocket</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\websocket\WebSocket04.cpp">
<Filter>ripple\websocket</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\websocket\WebSocket04.h">
<Filter>ripple\websocket</Filter>
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\db\builder.cc">
<Filter>rocksdb2\db</Filter>
</ClCompile>
@@ -4995,6 +5076,189 @@
<ClInclude Include="..\..\src\snappy\snappy\snappy.h">
<Filter>snappy\snappy</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\base64\base64.hpp">
<Filter>websocketpp\websocketpp\base64</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\close.hpp">
<Filter>websocketpp\websocketpp</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\connection_hdl.hpp">
<Filter>websocketpp\websocketpp\common</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\cpp11.hpp">
<Filter>websocketpp\websocketpp\common</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\functional.hpp">
<Filter>websocketpp\websocketpp\common</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\md5.hpp">
<Filter>websocketpp\websocketpp\common</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\memory.hpp">
<Filter>websocketpp\websocketpp\common</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\network.hpp">
<Filter>websocketpp\websocketpp\common</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\platforms.hpp">
<Filter>websocketpp\websocketpp\common</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\stdint.hpp">
<Filter>websocketpp\websocketpp\common</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\system_error.hpp">
<Filter>websocketpp\websocketpp\common</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\thread.hpp">
<Filter>websocketpp\websocketpp\common</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\common\time.hpp">
<Filter>websocketpp\websocketpp\common</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\concurrency\basic.hpp">
<Filter>websocketpp\websocketpp\concurrency</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\config\core.hpp">
<Filter>websocketpp\websocketpp\config</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\connection.hpp">
<Filter>websocketpp\websocketpp</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\connection_base.hpp">
<Filter>websocketpp\websocketpp</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\endpoint.hpp">
<Filter>websocketpp\websocketpp</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\endpoint_base.hpp">
<Filter>websocketpp\websocketpp</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\error.hpp">
<Filter>websocketpp\websocketpp</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\extensions\extension.hpp">
<Filter>websocketpp\websocketpp\extensions</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\extensions\permessage_deflate\disabled.hpp">
<Filter>websocketpp\websocketpp\extensions\permessage_deflate</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\frame.hpp">
<Filter>websocketpp\websocketpp</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\http\constants.hpp">
<Filter>websocketpp\websocketpp\http</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\http\impl\parser.hpp">
<Filter>websocketpp\websocketpp\http\impl</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\http\impl\request.hpp">
<Filter>websocketpp\websocketpp\http\impl</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\http\impl\response.hpp">
<Filter>websocketpp\websocketpp\http\impl</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\http\parser.hpp">
<Filter>websocketpp\websocketpp\http</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\http\request.hpp">
<Filter>websocketpp\websocketpp\http</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\http\response.hpp">
<Filter>websocketpp\websocketpp\http</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\impl\connection_impl.hpp">
<Filter>websocketpp\websocketpp\impl</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\impl\endpoint_impl.hpp">
<Filter>websocketpp\websocketpp\impl</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\impl\utilities_impl.hpp">
<Filter>websocketpp\websocketpp\impl</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\logger\basic.hpp">
<Filter>websocketpp\websocketpp\logger</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\logger\levels.hpp">
<Filter>websocketpp\websocketpp\logger</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\message_buffer\alloc.hpp">
<Filter>websocketpp\websocketpp\message_buffer</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\message_buffer\message.hpp">
<Filter>websocketpp\websocketpp\message_buffer</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\processors\base.hpp">
<Filter>websocketpp\websocketpp\processors</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\processors\hybi00.hpp">
<Filter>websocketpp\websocketpp\processors</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\processors\hybi07.hpp">
<Filter>websocketpp\websocketpp\processors</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\processors\hybi08.hpp">
<Filter>websocketpp\websocketpp\processors</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\processors\hybi13.hpp">
<Filter>websocketpp\websocketpp\processors</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\processors\processor.hpp">
<Filter>websocketpp\websocketpp\processors</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\random\none.hpp">
<Filter>websocketpp\websocketpp\random</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\roles\server_endpoint.hpp">
<Filter>websocketpp\websocketpp\roles</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\server.hpp">
<Filter>websocketpp\websocketpp</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\sha1\sha1.hpp">
<Filter>websocketpp\websocketpp\sha1</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\asio\base.hpp">
<Filter>websocketpp\websocketpp\transport\asio</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\asio\connection.hpp">
<Filter>websocketpp\websocketpp\transport\asio</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\asio\endpoint.hpp">
<Filter>websocketpp\websocketpp\transport\asio</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\asio\security\base.hpp">
<Filter>websocketpp\websocketpp\transport\asio\security</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\asio\security\none.hpp">
<Filter>websocketpp\websocketpp\transport\asio\security</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\base\connection.hpp">
<Filter>websocketpp\websocketpp\transport\base</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\base\endpoint.hpp">
<Filter>websocketpp\websocketpp\transport\base</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\iostream\base.hpp">
<Filter>websocketpp\websocketpp\transport\iostream</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\iostream\connection.hpp">
<Filter>websocketpp\websocketpp\transport\iostream</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\transport\iostream\endpoint.hpp">
<Filter>websocketpp\websocketpp\transport\iostream</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\uri.hpp">
<Filter>websocketpp\websocketpp</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\utf8_validator.hpp">
<Filter>websocketpp\websocketpp</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\utilities.hpp">
<Filter>websocketpp\websocketpp</Filter>
</ClInclude>
<ClInclude Include="..\..\src\websocketpp\websocketpp\version.hpp">
<Filter>websocketpp\websocketpp</Filter>
</ClInclude>
<ClCompile Include="..\..\src\websocketpp_02\src\base64\base64.cpp">
<Filter>websocketpp_02\src\base64</Filter>
</ClCompile>

View File

@@ -673,7 +673,7 @@ for tu_style in ['classic', 'unity']:
'src/ripple/unity/rpcx.cpp',
'src/ripple/unity/server.cpp',
'src/ripple/unity/validators.cpp',
'src/ripple/unity/websocket.cpp'
'src/ripple/unity/websocket02.cpp'
)
object_builder.add_source_files(
@@ -712,6 +712,11 @@ for tu_style in ['classic', 'unity']:
]
)
object_builder.add_source_files(
'src/ripple/unity/websocket04.cpp',
CPPPATH='src/websocketpp',
)
if toolchain == "clang" and Beast.system.osx:
object_builder.add_source_files('src/ripple/unity/beastobjc.mm')

View File

@@ -810,7 +810,7 @@ public:
if (! port.websockets())
continue;
auto server = websocket::makeServer (
{port, *m_resourceManager, getOPs(), m_journal,
{port, *m_resourceManager, getOPs(), m_journal, getConfig(),
*m_collectorManager});
if (!server)
{

View File

@@ -0,0 +1,29 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2012, 2013 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#include <BeastConfig.h>
#ifdef _MSC_VER
# ifndef _WEBSOCKETPP_CONSTEXPR_TOKEN_
# define _WEBSOCKETPP_CONSTEXPR_TOKEN_
# endif
#endif
#define _WEBSOCKETPP_CPP11_STL_
#include <ripple/websocket/WebSocket04.cpp>

View File

@@ -0,0 +1,74 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2012, 2013 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef RIPPLED_RIPPLE_WEBSOCKET_CONFIG04_H
#define RIPPLED_RIPPLE_WEBSOCKET_CONFIG04_H
#include <ripple/websocket/AutoSocket.h>
#include <ripple/websocket/Logger.h>
#include <websocketpp/config/core.hpp>
#include <websocketpp/server.hpp>
#include <websocketpp/transport/asio/endpoint.hpp>
namespace ripple {
namespace websocket {
/** This is a config traits class, copied from
websocketpp/websocketpp/config/asio_no_tls.hpp*/
using ConfigBase04 = websocketpp::config::core;
struct Config04 : ConfigBase04 {
typedef ConfigBase04 base;
typedef Config04 type;
typedef base::concurrency_type concurrency_type;
typedef base::request_type request_type;
typedef base::response_type response_type;
typedef base::message_type message_type;
typedef base::con_msg_manager_type con_msg_manager_type;
typedef base::endpoint_msg_manager_type endpoint_msg_manager_type;
typedef Logger <LoggerType::access> alog_type;
typedef Logger <LoggerType::error> elog_type;
typedef base::rng_type rng_type;
struct transport_config : public base::transport_config {
typedef type::concurrency_type concurrency_type;
typedef type::alog_type alog_type;
typedef type::elog_type elog_type;
typedef type::request_type request_type;
typedef type::response_type response_type;
// typedef AutoSocket<con_type, std::error_code>
typedef websocketpp::transport::asio::basic_socket::endpoint
socket_type;
};
typedef websocketpp::transport::asio::endpoint<transport_config>
transport_type;
};
} // websocket
} // ripple
#endif

View File

@@ -18,6 +18,7 @@
//==============================================================================
#include <BeastConfig.h>
#include <ripple/basics/BasicConfig.h>
#include <ripple/websocket/MakeServer.h>
#include <ripple/websocket/WebSocket.h>
@@ -26,13 +27,16 @@ namespace websocket {
std::unique_ptr<beast::Stoppable> makeServer (ServerDescription const& desc)
{
static std::string const version = "0.2";
auto version = get<std::string> (
desc.config["server"], "websocket_version");
if (version.empty())
version = WebSocket02::versionName();
WriteLog (lsWARNING, WebSocket) << "Websocket version " << version;
if (version == WebSocket02::versionName())
return makeServer02 (desc);
assert (false);
return {};
assert (version == "04");
return makeServer04 (desc);
}
} // websocket

View File

@@ -28,6 +28,8 @@ namespace beast { class Stoppable; }
namespace ripple {
class BasicConfig;
namespace Resource { class Manager; }
namespace websocket {
@@ -38,6 +40,7 @@ struct ServerDescription
Resource::Manager& resourceManager;
InfoSub::Source& source;
beast::Journal& journal;
BasicConfig const& config;
CollectorManager& collectorManager;
};

View File

@@ -35,8 +35,8 @@ class Server
{
private:
// TODO: why is this recursive?
using LockType = typename std::recursive_mutex;
using ScopedLockType = typename std::lock_guard <LockType>;
using LockType = std::recursive_mutex;
using ScopedLockType = std::lock_guard <LockType>;
ServerDescription desc_;
LockType m_endpointLock;

View File

@@ -0,0 +1,152 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2012, 2013 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#include <ripple/websocket/WebSocket04.h>
#include <ripple/websocket/Handler.h>
#include <ripple/websocket/Server.h>
#include <boost/make_shared.hpp>
namespace ripple {
namespace websocket {
char const* WebSocket04::versionName()
{
return "websocketpp 0.40";
}
void WebSocket04::handleDisconnect (Connection& connection)
{
connection.close (websocketpp::close::status::protocol_error,
"overload");
}
void WebSocket04::closeTooSlowClient (
Connection& connection,
unsigned int timeout,
std::string const& message)
{
connection.close (
websocketpp::close::status::value (timeout), message);
}
bool WebSocket04::isTextMessage (Message const& message)
{
return message.get_opcode () == websocketpp::frame::opcode::text;
}
using HandlerPtr04 = WebSocket04::HandlerPtr;
using EndpointPtr04 = WebSocket04::EndpointPtr;
HandlerPtr04 WebSocket04::makeHandler (ServerDescription const& desc)
{
return std::make_shared <HandlerImpl <WebSocket04>> (desc);
}
EndpointPtr04 WebSocket04::makeEndpoint (HandlerPtr&& handler)
{
auto endpoint = std::make_shared <Endpoint> (std::move (handler));
endpoint->set_open_handler (
[endpoint] (websocketpp::connection_hdl hdl) {
if (auto conn = endpoint->get_con_from_hdl(hdl))
endpoint->handler()->on_open (conn);
});
endpoint->set_close_handler (
[endpoint] (websocketpp::connection_hdl hdl) {
if (auto conn = endpoint->get_con_from_hdl(hdl))
endpoint->handler()->on_close (conn);
});
endpoint->set_fail_handler (
[endpoint] (websocketpp::connection_hdl hdl) {
if (auto conn = endpoint->get_con_from_hdl(hdl))
endpoint->handler()->on_fail (conn);
});
endpoint->set_pong_handler (
[endpoint] (websocketpp::connection_hdl hdl, std::string data) {
if (auto conn = endpoint->get_con_from_hdl(hdl))
endpoint->handler()->on_pong (conn, data);
});
endpoint->set_http_handler (
[endpoint] (websocketpp::connection_hdl hdl) {
if (auto conn = endpoint->get_con_from_hdl(hdl))
endpoint->handler()->http (conn);
});
endpoint->set_message_handler (
[endpoint] (websocketpp::connection_hdl hdl,
MessagePtr msg) {
if (auto conn = endpoint->get_con_from_hdl(hdl))
endpoint->handler()->on_message (conn, msg);
});
endpoint->set_send_empty_handler (
[endpoint] (websocketpp::connection_hdl hdl) {
if (auto conn = endpoint->get_con_from_hdl(hdl))
endpoint->handler()->on_send_empty (conn);
});
endpoint->init_asio();
return endpoint;
}
template <>
void ConnectionImpl <WebSocket04>::setPingTimer ()
{
if (auto con = m_connection.lock ())
{
auto t = boost::posix_time::seconds (getConfig ().WEBSOCKET_PING_FREQ);
auto ms = t.total_milliseconds();
con->set_timer (
ms,
[this] (WebSocket04::ErrorCode const& e)
{
this->pingTimer (e);
});
}
}
boost::asio::io_service::strand& WebSocket04::getStrand (Connection& con)
{
return *con.get_strand();
}
template <>
void Server <WebSocket04>::listen()
{
m_endpoint->listen (desc_.port.ip, desc_.port.port);
m_endpoint->start_accept();
auto c = m_endpoint->get_io_service ().run ();
WriteLog (lsWARNING, WebSocket)
<< "Server run with: '" << c;
}
std::unique_ptr<beast::Stoppable> makeServer04 (ServerDescription const& desc)
{
return std::make_unique <Server <WebSocket04>> (desc);
}
} // websocket
} // ripple

View File

@@ -0,0 +1,106 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2012, 2013 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef RIPPLED_RIPPLE_WEBSOCKET_WEBSOCKET04_H
#define RIPPLED_RIPPLE_WEBSOCKET_WEBSOCKET04_H
#include <ripple/websocket/Config04.h>
#include <ripple/websocket/WebSocket.h>
namespace ripple {
namespace websocket {
struct WebSocket04
{
using EndpointBase = websocketpp::server <Config04>;
using Connection = EndpointBase::connection_type;
using ConnectionPtr = std::shared_ptr<Connection>;
using ConnectionWeakPtr = std::weak_ptr<Connection>;
using ErrorCode = std::error_code;
using Message = Connection::message_type;
using MessagePtr = Message::ptr;
class Handler
{
public:
virtual void on_open (ConnectionPtr) = 0;
virtual void on_close (ConnectionPtr) = 0;
virtual void on_fail (ConnectionPtr) = 0;
virtual void on_pong (ConnectionPtr, std::string data) = 0;
virtual bool http (ConnectionPtr) = 0;
virtual void on_message (ConnectionPtr, MessagePtr) = 0;
// This is a new method added by Ripple.
virtual void on_send_empty (ConnectionPtr) = 0;
};
using HandlerPtr = std::shared_ptr<Handler>;
class Endpoint : public EndpointBase
{
public:
using ptr = std::shared_ptr<Endpoint>;
Endpoint (HandlerPtr handler) : handler_ (handler)
{
}
HandlerPtr const& handler() { return handler_; }
private:
HandlerPtr handler_;
};
using EndpointPtr = std::shared_ptr<Endpoint>;
/** The name of this WebSocket version. */
static
char const* versionName();
/** Handle a connection that was cut off from the other side. */
static
void handleDisconnect (Connection&);
/** Close a client that is too slow to respond. */
static
void closeTooSlowClient (
Connection&,
unsigned int timeout,
std::string const& message = "Client is too slow.");
/** Return true if the WebSocket message is a TEXT message. */
static
bool isTextMessage (Message const&);
/** Create a new Handler. */
static
HandlerPtr makeHandler (ServerDescription const&);
/** Make a connection endpoint from a handler. */
static
EndpointPtr makeEndpoint (HandlerPtr&&);
/** Get the ASIO strand that this connection lives on. */
static
boost::asio::io_service::strand& getStrand (Connection&);
};
} // websocket
} // ripple
#endif