Skip to content

Commit ec2dd88

Browse files
author
mikhail_beris
committed
Initial import.
0 parents  commit ec2dd88

23 files changed

+444
-0
lines changed

Jamroot

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
# Copyright Dean Michael Berris 2007.
3+
# Distributed under the Boost Software License, Version 1.0.
4+
# (See accompanying file LICENSE_1_0.txt or copy at
5+
# http://www.boost.org/LICENSE_1_0.txt)
6+
7+
import modules ;
8+
9+
local BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
10+
11+
use-project /boost : $(BOOST_ROOT) ;
12+
13+
using testing ;

LICENSE_1_0.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Boost Software License - Version 1.0 - August 17th, 2003
2+
3+
Permission is hereby granted, free of charge, to any person or organization
4+
obtaining a copy of the software and accompanying documentation covered by
5+
this license (the "Software") to use, reproduce, display, distribute,
6+
execute, and transmit the Software, and to prepare derivative works of the
7+
Software, and to permit third-parties to whom the Software is furnished to
8+
do so, all subject to the following:
9+
10+
The copyright notices in the Software and this entire statement, including
11+
the above license grant, this restriction and the following disclaimer,
12+
must be included in all copies of the Software, in whole or in part, and
13+
all derivative works of the Software, unless such copies or derivative
14+
works are solely in the form of machine-executable object code generated by
15+
a source language processor.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
20+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
21+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
22+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23+
DEALINGS IN THE SOFTWARE.

README.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
C++ Network Library
2+
3+
This is a collection of network related routines/implementations
4+
geared towards providing a robust cross-platform networking library.
5+
This offers the following implementations:
6+
7+
o Common Message Type -- A generic message type which can be used
8+
to encapsulate and store message related information, used by all
9+
network implementations as the primary means of data exchange.
10+
o Network protocol message parsers -- A collection of parsers which
11+
generate message objects from strings.
12+
o Adapters and Wrappers -- A collection of Adapters and wrappers aimed
13+
towards making the message type STL friendly.
14+
15+
This library is released under the Boost Software License (please see
16+
http://boost.org/LICENSE_1_0.txt or the accompanying LICENSE_1_0.txt file
17+
for the full text.
18+
19+

boost/network.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
// Copyright Dean Michael Berris 2007.
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#ifndef __NETWORK_HPP__
8+
#define __NETWORK_HPP__
9+
10+
// Include all headers in network/
11+
// Author: Dean Michael Berris
12+
// Date: May 20, 2007
13+
14+
#include <boost/network/message.hpp> // message type implementation
15+
16+
#endif // __NETWORK_HPP__
17+

boost/network/.message.hpp.swp

12 KB
Binary file not shown.
12 KB
Binary file not shown.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
// Copyright Dean Michael Berris 2007.
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#ifndef __NETWORK_DETAIL_DIRECTIVE_BASE_HPP__
8+
#define __NETWORK_DETAIL_DIRECTIVE_BASE_HPP__
9+
10+
/** Defines the base type from which all directives inherit
11+
* to allow friend access to message and other types' internals.
12+
*/
13+
namespace boost { namespace network { namespace detail {
14+
15+
template <class Tag>
16+
struct directive_base {
17+
typedef Tag tag ;
18+
//explicit directive_base(basic_message<tag> & message_)
19+
// : _message(message_)
20+
protected:
21+
virtual ~directive_base()
22+
{ }; // can only be extended
23+
24+
// mutable basic_message<tag> & _message;
25+
};
26+
27+
}; // namespace detail
28+
29+
}; // namespace network
30+
31+
}; // namespace boost
32+
33+
#endif // __NETWORK_DETAIL_DIRECTIVE_BASE_HPP__
34+

boost/network/detail/wrapper_base.hpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
// Copyright Dean Michael Berris 2007.
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#ifndef __NETWORK_DETAIL_WRAPPER_BASE_HPP__
8+
#define __NETWORK_DETAIL_WRAPPER_BASE_HPP__
9+
10+
namespace boost { namespace network { namespace detail {
11+
12+
template <class Tag>
13+
struct wrapper_base {
14+
typedef Tag tag;
15+
explicit wrapper_base(basic_message<tag> & message_)
16+
: _message(message_)
17+
{ };
18+
19+
protected:
20+
virtual ~wrapper_base()
21+
{ }; // for extending only
22+
23+
mutable basic_message<tag> & _message;
24+
};
25+
26+
}; // namespace detail
27+
28+
}; // namespace network
29+
30+
}; // namespace boost
31+
32+
#endif // __NETWORK_DETAIL_WRAPPER_BASE_HPP__
33+

boost/network/message.hpp

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
2+
// Copyright Dean Michael Berris 2007.
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#ifndef __NETWORK_MESSAGE_HPP__
8+
#define __NETWORK_MESSAGE_HPP__
9+
10+
#include <map>
11+
#include <string>
12+
13+
// forward declarations
14+
namespace boost { namespace network {
15+
template <class tag>
16+
class basic_message;
17+
}; // namespace network
18+
19+
}; // namespace boost
20+
21+
#include <boost/network/detail/directive_base.hpp>
22+
#include <boost/network/detail/wrapper_base.hpp>
23+
24+
/** message.hpp
25+
*
26+
* This header file implements the common message type which
27+
* all networking implementations under the boost::network
28+
* namespace. The common message type allows for easy message
29+
* construction and manipulation suited for networked
30+
* application development.
31+
*/
32+
namespace boost { namespace network {
33+
34+
struct tags {
35+
struct default_ { };
36+
};
37+
38+
/** The common message type.
39+
*/
40+
template <class tag=tags::default_>
41+
class basic_message {
42+
public:
43+
typedef std::multimap<std::string, std::string> headers_container_type;
44+
45+
headers_container_type & headers() const {
46+
return _headers;
47+
};
48+
49+
private:
50+
51+
friend struct detail::directive_base<tag> ;
52+
friend struct detail::wrapper_base<tag> ;
53+
54+
mutable headers_container_type _headers;
55+
};
56+
57+
typedef basic_message<> message; // default message type
58+
59+
}; // namespace network
60+
}; // namespace boost
61+
62+
#include <boost/network/message/directives.hpp>
63+
// pull in directives header file
64+
65+
#include <boost/network/message/wrappers.hpp>
66+
// pull in wrappers header file
67+
68+
#endif // __NETWORK_MESSAGE_HPP__
69+

boost/network/message/directives.hpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
// Copyright Dean Michael Berris 2007.
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#ifndef __NETWORK_MESSAGE_DIRECTIVES_HPP__
8+
#define __NETWORK_MESSAGE_DIRECTIVES_HPP__
9+
10+
/** Include all the various directive headers.
11+
*/
12+
13+
#include <boost/network/message/directives/header.hpp>
14+
15+
namespace boost { namespace network {
16+
17+
template <class Tag, template <class> class Directive>
18+
inline basic_message<Tag> &
19+
operator<< (basic_message<Tag> & message_, Directive<Tag> const & directive) {
20+
directive(message_);
21+
return message_;
22+
};
23+
24+
}; // namespace network
25+
26+
}; // namespace boost
27+
28+
#endif // __NETWORK_MESSAGE_DIRECTIVES_HPP__
29+

0 commit comments

Comments
 (0)