2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
28#ifndef WEBSOCKETPP_MESSAGE_BUFFER_ALLOC_HPP
29#define WEBSOCKETPP_MESSAGE_BUFFER_ALLOC_HPP
31#include <websocketpp/common/memory.hpp>
36namespace message_buffer {
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
78
79
80
81
82
84void message_deleter(T* msg) {
86 if (!msg->recycle()) {
97
98
99
100template <
typename con_msg_manager>
103 typedef lib::shared_ptr<message> ptr;
105 typedef typename con_msg_manager::weak_ptr con_msg_man_ptr;
107 message(con_msg_man_ptr manager, size_t size = 128)
111 frame::opcode::value get_opcode()
const {
114 const std::string& get_header()
const {
117 const std::string& get_extension_data()
const {
118 return m_extension_data;
120 const std::string& get_payload()
const {
126
127
128
129
130
131
132
133
134
135
136
138 typename con_msg_manager::ptr shared = m_manager.lock();
141 return shared->(recycle(
this));
147 con_msg_man_ptr m_manager;
149 frame::opcode::value m_opcode;
150 std::string m_header;
151 std::string m_extension_data;
152 std::string m_payload;
159template <
typename message>
165 typedef typename message::ptr message_ptr;
169
170
171
172
174 return lib::make_shared<message>(size);
179
180
181
182
183
184
185
186
194template <
typename con_msg_manager>
197 typedef typename con_msg_manager::ptr con_msg_man_ptr;
201
202
204 return lib::make_shared<con_msg_manager>();
message_ptr get_message(size_t size) const
Get a message buffer with specified size.
bool recycle(message *)
Recycle a message.
con_msg_man_ptr get_manager() const
Get a pointer to a connection message manager.
bool recycle()
Recycle the message.
Namespace for the WebSocket++ project.