Skip to content

Commit c34fd77

Browse files
committed
Nicer contents layout.
1 parent cda9643 commit c34fd77

17 files changed

+170
-6
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.

libs/network/doc/rst/directives.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Directives
2+
==========
3+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Generic message
2+
===============
3+

libs/network/doc/rst/getting_started.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ development versions Git must be installed on your system.
2525
Using the command line, the command to get the latest code is:
2626

2727
::
28+
2829
shell$ git clone git://github.com/mikhailberis/cpp-netlib.git
2930

3031
This should be enough information get to started. To do more complex

libs/network/doc/rst/in_depth.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
An in-depth look at the :mod:`cpp-netlib`
2+
=========================================
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
7+
message.rst
8+
uri.rst
9+
protocol.rst

libs/network/doc/rst/index.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
Dean Michael Berris <mikhailberis@gmail.com>
1212
:Date: Jun 16, 2010
1313
:Version: 0.7
14-
:Description: Complete user documentation, with examples, for the cpp-netlib.
14+
:Description: Complete user documentation, with examples, for the :mod:`cpp-netlib`.
1515
:Copyright: Copyright Glyn Matthews, Dean Michael Berris 2008-2010.
1616
Distributed under the Boost Software License, Version
1717
1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -24,12 +24,10 @@ Contents
2424
:maxdepth: 2
2525

2626
getting_started.rst
27-
http_client.rst
28-
hello_world_server.rst
29-
hello_world_client.rst
30-
xmpp_client.rst
27+
tutorials.rst
28+
in_depth.rst
29+
techniques.rst
3130
.. uri.rst
32-
.. techniques.rst
3331
.. install.rst
3432
.. motivation.rst
3533
.. objectives.rst

libs/network/doc/rst/message.rst

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
The message template
2+
====================
3+
4+
One of the core components in the library is the concept and the implementation
5+
of a common message type. In most (not all) network protocols, the concept of a
6+
message is central to the definition of the protocol. In HTTP, SMTP, XMPP, and
7+
even other protocols like SNMP and ICMP, there is a common notion of a "packet"
8+
or a message. In cpp-netlib we chose to implement the concept of a message that
9+
has the following common parts:
10+
11+
* **Source** - every message has a source identifier which varies from
12+
protocol to protocol.
13+
14+
* **Destination** - every message has a destination identifier which varies
15+
from protocol to protocol.
16+
17+
* **Headers** - each message is assumed to contain headers, which may be empty
18+
in cases where the protocol does not support it, but is nonetheless
19+
supported by cpp-netlib messages.
20+
21+
* **Body** - the content area of a message which varies from protocol to
22+
protocol (also sometimes referred to as payload).
23+
24+
This division is purely logical -- in the underlying implementation, the message
25+
type can choose to have different means of storing the data, dependinn on the
26+
type used to tag the message. This section covers the `Message Concept`_ as well
27+
as the `Basic Message`_ implementation.
28+
29+
Message Concept
30+
```````````````
31+
32+
The Message Concept specifies what the valid operations on a message are as well
33+
as what messages look like semantically. The following table summarize the
34+
operations and syntactic as well as semantic properties of messages.
35+
36+
**Legend**
37+
38+
:M: The message type.
39+
:m,n: An instance of **M**.
40+
:S: A string type.
41+
:s,k,v: An instance of **S**.
42+
43+
+------------------------+----------------------+-------------------------------------+
44+
| Construct | Result | Description |
45+
+========================+======================+=====================================+
46+
| M() | Instance of M | Default constructible. |
47+
+------------------------+----------------------+-------------------------------------+
48+
| M(m) | Instance of M | Copy constructible. |
49+
+------------------------+----------------------+-------------------------------------+
50+
| m = n; | Reference to m | Assignable. |
51+
+------------------------+----------------------+-------------------------------------+
52+
| swap(m, n); | ``void`` | Swappable. |
53+
+------------------------+----------------------+-------------------------------------+
54+
| source(m); | unspecified | Retrieve the source of m. |
55+
+------------------------+----------------------+-------------------------------------+
56+
| destination(m); | unspecified | Retrieve the destination of m. |
57+
+------------------------+----------------------+-------------------------------------+
58+
| headers(m); | ``Range<Pair<S,S>>`` | Get the range of headers of m. |
59+
+------------------------+----------------------+-------------------------------------+
60+
| body(m); | unspecified | Retrieve the body of m. |
61+
+------------------------+----------------------+-------------------------------------+
62+
| m << source(s); | ``M &`` | Set the source of m. |
63+
+------------------------+----------------------+-------------------------------------+
64+
| m << destination(s); | ``M &`` | Set the destination of m. |
65+
+------------------------+----------------------+-------------------------------------+
66+
| m << header(k, v); | ``M &`` | Add a header to m. |
67+
+------------------------+----------------------+-------------------------------------+
68+
| m << remove_header(k); | ``M &`` | Remove a header from m. |
69+
+------------------------+----------------------+-------------------------------------+
70+
| m << body(s); | ``M &`` | Set the body of m. |
71+
+------------------------+----------------------+-------------------------------------+
72+
73+
Types that model the Message Concept are meant to encapsulate data that has a
74+
source, a destination, one or more named headers, and a body/payload. Because
75+
the accessors and the directives are not required to be part of the message type
76+
that models the Message Concept, a message can be implemented as a POD type and
77+
have all manipulations performed in the directive implementations, as well as
78+
value transformations done in the accessors.
79+
80+
Basic Message
81+
`````````````
82+
The default implementation of a simple type that models the Message Concept is
83+
available in cpp-netlib. This default implementation is named ``basic_message``
84+
which supports a ``Tag`` template parameter. The definition of ``basic_message``
85+
looks like this:
86+
87+
::
88+
89+
template <class Tag>
90+
struct basic_message;
91+
92+
The ``basic_message`` template requires that the following tag-dispatched
93+
metafunctions are defined for the type ``Tag``:
94+
95+
::
96+
97+
template <class Tag>
98+
struct string;
99+
100+
template <class Tag>
101+
struct headers_container;
102+
103+
All the operations defined by the message concept are implemented by this basic
104+
message type. Other message implementations can either use this common message
105+
type or specialize it according to whether they want to use different containers
106+
or whether it's going to be just a POD type.

libs/network/doc/rst/polymorphism.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Static and dynamic polymorphism
2+
===============================
3+

0 commit comments

Comments
 (0)