Skip to content

Commit 6d77f4d

Browse files
committed
Adding missing files.
1 parent a35361a commit 6d77f4d

File tree

4 files changed

+265
-0
lines changed

4 files changed

+265
-0
lines changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_ASYNC_MESSAGE_HPP_20100622
2+
#define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_ASYNC_MESSAGE_HPP_20100622
3+
4+
// Copyright 2010 (c) Dean Michael Berris
5+
// Copyright 2010 (c) Sinefunc, Inc.
6+
// Distributed under the Boost Software License, Version 1.0.
7+
// (See accompanying file LICENSE_1_0.txt or copy at
8+
// http://www.boost.org/LICENSE_1_0.txt)
9+
10+
#include <boost/thread/future.hpp>
11+
#include <boost/cstdint.hpp>
12+
13+
namespace boost { namespace network { namespace http {
14+
15+
template <class Tag>
16+
struct async_message {
17+
18+
typedef typename string<Tag>::type string_type;
19+
typedef typename headers_container<Tag>::type headers_container_type;
20+
21+
async_message()
22+
: status_message_(),
23+
status_(),
24+
version_(),
25+
source_(),
26+
destination_(),
27+
headers_(),
28+
body_()
29+
{}
30+
31+
async_message(async_message const & other)
32+
: status_message_(other.status_message_),
33+
status_(other.status_),
34+
version_(other.version_),
35+
source_(other.source_),
36+
destination_(other.destination_),
37+
headers_(other.destination_),
38+
body_(other.body_)
39+
{}
40+
41+
string_type const status_message() const {
42+
return status_message_.get();
43+
}
44+
45+
void status_message(boost::shared_future<string_type> const & future) const {
46+
status_message_ = future;
47+
}
48+
49+
string_type const version() const {
50+
return version_.get();
51+
}
52+
53+
void version(boost::shared_future<string_type> const & future) const {
54+
version_ = future;
55+
}
56+
57+
boost::uint16_t const status() const {
58+
return status_.get();
59+
}
60+
61+
void status(boost::shared_future<string_type> const & future) const {
62+
status_ = future;
63+
}
64+
65+
string_type const source() const {
66+
return source_.get();
67+
}
68+
69+
void source(boost::shared_future<string_type> const & future) const {
70+
source_ = future;
71+
}
72+
73+
string_type const destination() const {
74+
return destination_.get();
75+
}
76+
77+
void destination(boost::shared_future<string_type> const & future) const {
78+
destination_ = future;
79+
}
80+
81+
headers_container_type const headers() const {
82+
return headers_.get();
83+
}
84+
85+
void headers(boost::shared_future<headers_container_type> const & future) const {
86+
headers_ = future;
87+
}
88+
89+
string_type const body() const {
90+
return body_.get();
91+
}
92+
93+
void body(boost::shared_future<string_type> const & future) const {
94+
body_ = future;
95+
}
96+
97+
void swap(async_message & other) {
98+
std::swap(status_message_, other.status_message_);
99+
std::swap(status_, other.status_);
100+
std::swap(version_, other.version_);
101+
std::swap(source_, other.source_);
102+
std::swap(destination_, other.destination_);
103+
std::swap(headers_, other.headers_);
104+
std::swap(body_, other.body_);
105+
}
106+
107+
async_message & operator=(async_message other) {
108+
other.swap(*this);
109+
return *this;
110+
}
111+
112+
private:
113+
114+
mutable boost::shared_future<string_type> status_message_,
115+
version_, source_, destination_, body_;
116+
mutable boost::shared_future<boost::uint16_t> status_;
117+
mutable boost::shared_future<headers_container_type> headers_;
118+
119+
};
120+
121+
template <class Tag>
122+
inline void swap(async_message<Tag> & lhs, async_message<Tag> & rhs) {
123+
lhs.swap(rhs);
124+
}
125+
126+
} // namespace http
127+
128+
} // namespace network
129+
130+
} // namespace boost
131+
132+
#include <boost/network/protocol/http/message/wrappers/source.hpp>
133+
#include <boost/network/protocol/http/message/wrappers/body.hpp>
134+
135+
#endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_ASYNC_MESSAGE_HPP_20100622
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_BODY_HPP_20100622
2+
#define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_BODY_HPP_20100622
3+
4+
// Copyright 2010 (c) Dean Michael Berris
5+
// Distributed under the Boost Software License, Version 1.0.
6+
// (See accompanying file LICENSE_1_0.txt or copy at
7+
// http://www.boost.org/LICENSE_1_0.txt)
8+
9+
#include <boost/network/protocol/http/response_concept.hpp>
10+
#include <boost/concept/requires.hpp>
11+
12+
namespace boost { namespace network { namespace http {
13+
14+
template <class Tag>
15+
struct basic_response;
16+
17+
namespace impl {
18+
19+
template <class Tag>
20+
struct body_wrapper {
21+
typedef typename string<Tag>::type string_type;
22+
basic_response<Tag> const & message_;
23+
body_wrapper(basic_response<Tag> const & message)
24+
: message_(message) {}
25+
body_wrapper(body_wrapper const & other)
26+
: message_(other.message_) {}
27+
operator string_type const () {
28+
return message_.body();
29+
}
30+
};
31+
32+
} // namespace impl
33+
34+
template <class Tag>
35+
inline
36+
BOOST_CONCEPT_REQUIRES(((Response<basic_response<Tag> >)),
37+
(typename impl::body_wrapper<Tag>::string_type const))
38+
body(basic_response<Tag> const & message) {
39+
return impl::body_wrapper<Tag>(message);
40+
}
41+
42+
} // namespace http
43+
44+
} // namespace network
45+
46+
} // namespace boost
47+
48+
#endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_BODY_HPP_20100622
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_SOURCE_HPP_20100622
2+
#define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_SOURCE_HPP_20100622
3+
4+
// Copyright 2010 (c) Dean Michael Berris
5+
// Distributed under the Boost Software License, Version 1.0.
6+
// (See accompanying file LICENSE_1_0.txt or copy at
7+
// http://www.boost.org/LICENSE_1_0.txt)
8+
9+
#include <boost/network/protocol/http/response_concept.hpp>
10+
#include <boost/concept/requires.hpp>
11+
12+
namespace boost { namespace network { namespace http {
13+
14+
template <class Tag>
15+
struct basic_response;
16+
17+
namespace impl {
18+
19+
template <class Tag>
20+
struct source_wrapper {
21+
typedef typename string<Tag>::type string_type;
22+
basic_response<Tag> const & message_;
23+
source_wrapper(basic_response<Tag> const & message)
24+
: message_(message) {}
25+
source_wrapper(source_wrapper const & other)
26+
: message_(other.message_) {}
27+
operator string_type const () {
28+
return message_.source();
29+
}
30+
};
31+
32+
} // namespace impl
33+
34+
template <class Tag>
35+
inline
36+
BOOST_CONCEPT_REQUIRES(((Response<basic_response<Tag> >)),
37+
(impl::source_wrapper<Tag> const))
38+
source(basic_response<Tag> const & message) {
39+
return impl::source_wrapper<Tag>(message);
40+
}
41+
42+
} // namespace http
43+
44+
} // namespace network
45+
46+
} // namespace boost
47+
48+
#endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_SOURCE_HPP_20100622
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_POLICIES_ASYNC_RESOLVER_20100622
2+
#define BOOST_NETWORK_PROTOCOL_HTTP_POLICIES_ASYNC_RESOLVER_20100622
3+
4+
// Copyright Dean Michael Berris 2010.
5+
// Distributed under the Boost Software License, Version 1.0.
6+
// (See accompanying file LICENSE_1_0.txt or copy at
7+
// http://www.boost.org/LICENSE_1_0.txt)
8+
9+
namespace boost { namespace network { namespace http { namespace policies {
10+
11+
template <class Tag>
12+
struct async_resolver {
13+
typedef typename resolver<Tag>::type resolver_type;
14+
typedef typename resolver_type::iterator resolver_iterator;
15+
typedef typename resolver_type::query resolver_query;
16+
typedef std::pair<resolver_iterator, resolver_iterator> resolver_iterator_pair;
17+
18+
protected:
19+
bool cache_resolved_;
20+
21+
explicit async_resolver(bool cache_resolved)
22+
: cache_resolver_(cache_resolved)
23+
{}
24+
};
25+
26+
} // namespace policies
27+
28+
} // namespace http
29+
30+
} // namespace network
31+
32+
} // namespace boost
33+
34+
#endif // BOOST_NETWORK_PROTOCOL_HTTP_POLICIES_ASYNC_RESOLVER_20100622

0 commit comments

Comments
 (0)