]> git.proxmox.com Git - ceph.git/blame - ceph/src/Beast/doc/overview.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / Beast / doc / overview.qbk
CommitLineData
7c673cae
FG
1[/
2 Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
3
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6]
7
8[section:overview Introduction]
9
10Beast is a header-only, cross-platform C++ library built on Boost.Asio and
11parts of Boost, containing two modules implementing widely used network
12protocols. Beast offers a universal HTTP message model, plus algorithms for
13parsing and serializing HTTP/1 messages. Beast.WebSocket provides a complete
14implementation of the WebSocket protocol. Their design achieves these goals:
15
16* [*Symmetry.] Interfaces are role-agnostic; the same interfaces can be
17used to build clients, servers, or both.
18
19* [*Ease of Use.] HTTP messages are modeled using simple, readily
20accessible objects. Functions and classes used to send and receive HTTP
21or WebSocket messages are designed to resemble Boost.Asio as closely as
22possible. Users familiar with Boost.Asio will be immediately comfortable
23using this library.
24
25* [*Flexibility.] Interfaces do not mandate specific implementation
26strategies; important decisions such as buffer or thread management are
27left to users of the library.
28
29* [*Performance.] The implementation performs competitively, making it a
30realistic choice for building high performance network servers.
31
32* [*Scalability.] Development of network applications that scale to thousands
33of concurrent connections is possible with the implementation.
34
35* [*Basis for further abstraction.] The interfaces facilitate the
36development of other libraries that provide higher levels of abstraction.
37
38The HTTP portion of Beast is designed to be a low-level building block for
39creating higher level libraries. It implements only the HTTP protocol, and
40does not handle domain specific features (for example: cookies, redirects, or
41deflate content encodings).
42
43[heading Requirements]
44
45Beast requires:
46
47* [*C++11.] A minimum of C++11 is needed.
48* [*Boost.] Beast is built on Boost, especially Boost.Asio.
49* [*OpenSSL.] If using TLS/Secure sockets (optional).
50
51[note Tested compilers: msvc-14+, gcc 5+, clang 3.6+]
52
53The library is [*header-only]. It is not necessary to add any .cpp files,
54or to add commands to your build script for building Beast. To link your
55program successfully, you'll need to add the Boost.System library to link
56with. If you use coroutines you'll also need the Boost.Coroutine library.
57Please visit the Boost documentation for instructions on how to do this for
58your particular build system.
59
60[heading Motivation]
61
62Beast is built on Boost.Asio. A proposal to add networking functionality to the
63C++ standard library, based on Boost.Asio, is under consideration by the
64committee and on track for standardization. Since the final approved networking
65interface for the C++ standard library will likely closely resemble the current
66interface of Boost.Asio, the choice of Boost.Asio as the network transport
67layer is prudent.
68
69The HTTP protocol is pervasive in network applications. As C++ is a logical
70choice for high performance network servers, there is great utility in solid
71building blocks for manipulating, sending, and receiving HTTP messages
72compliant with the Hypertext Transfer Protocol and the supplements that
73follow. Unfortunately reliable implementations or industry standards do not
74exist in C++. The development of higher level libraries is stymied by the
75lack of a common set of low-level algorithms and types for interacting with
76the HTTP protocol.
77
78Today's web applications increasingly rely on alternatives to standard HTTP
79to achieve performance and/or responsiveness. While WebSocket implementations
80are widely available in common web development languages such as Javascript,
81good implementations in C++ are scarce. A survey of existing C++ WebSocket
82solutions reveals interfaces which lack symmetry, impose performance penalties,
83and needlessly restrict implementation strategies.
84
85Beast.WebSocket takes advantage of Boost.Asio's extensible asynchronous
86model, handler allocation, and handler invocation hooks. Calls to
87Beast.WebSocket asynchronous initiation functions allow callers the choice
88of using a completion handler, stackful or stackless coroutines, futures,
89or user defined customizations (for example, Boost.Fiber). The
90implementation uses handler invocation hooks (__asio_handler_invoke__),
91providing execution guarantees on composed operations in a manner identical
92to Boost.Asio. The implementation also uses handler allocation hooks
93(__asio_handler_allocate__) when allocating memory internally for composed
94operations.
95
96There is no need for inheritance or virtual members in a
97[link beast.ref.websocket__stream `websocket::stream`].
98All operations are templated and transparent to the compiler, allowing for
99maximum inlining and optimization.
100
101[heading Credits]
102
103Boost.Asio is the inspiration behind which all of the interfaces and
104implementation strategies are built. Some parts of the documentation are
105written to closely resemble the wording and presentation of Boost.Asio
106documentation. Credit goes to Christopher Kohlhoff for the wonderful
107Asio library and the ideas upon which Beast is built.
108
109Beast would not be possible without the considerable time and patience
110contributed by David Schwartz, Edward Hennis, Howard Hinnant, Miguel Portilla,
111Nikolaos Bougalis, Scott Determan, Scott Schurr, and Ripple Labs for
112supporting its development.
113
114[endsect]