11 header.opcode = WebsocketFrame::Header::opcode_text;
14 header.opcode = WebsocketFrame::Header::opcode_binary;
17 header.opcode = WebsocketFrame::Header::opcode_close;
20 header.opcode = WebsocketFrame::Header::opcode_ping;
23 header.opcode = WebsocketFrame::Header::opcode_pong;
44 else if (
length <= std::numeric_limits<uint16_t>::max())
49 else if (
length <= std::numeric_limits<uint64_t>::max())
58 buffer.resize(header_size +
content.size());
66 else if (
length <= std::numeric_limits<uint16_t>::max())
68 buffer[2] = (
length >> 8) & 0xFF;
69 buffer[3] = (
length >> 0) & 0xFF;
71 else if (
length <= std::numeric_limits<uint64_t>::max())
73 buffer[2] = (
length >> 56) & 0xFF;
74 buffer[3] = (
length >> 48) & 0xFF;
75 buffer[4] = (
length >> 40) & 0xFF;
76 buffer[5] = (
length >> 32) & 0xFF;
77 buffer[6] = (
length >> 24) & 0xFF;
78 buffer[7] = (
length >> 16) & 0xFF;
79 buffer[8] = (
length >> 8) & 0xFF;
80 buffer[9] = (
length >> 0) & 0xFF;
103 return boost::indeterminate;
106 if (frame.
header.len < 126)
113 else if (frame.
length > 0)
118 else if (frame.
header.len == 126)
128 return boost::indeterminate;
131 frame.
length |= ((uint64_t)(input & 0xFF) << 56);
133 return boost::indeterminate;
135 frame.
length |= ((uint64_t)(input & 0xFF) << 48);
137 return boost::indeterminate;
139 frame.
length |= ((uint64_t)(input & 0xFF) << 40);
141 return boost::indeterminate;
143 frame.
length |= ((uint64_t)(input & 0xFF) << 32);
145 return boost::indeterminate;
147 frame.
length |= ((uint64_t)(input & 0xFF) << 24);
149 return boost::indeterminate;
151 frame.
length |= ((uint64_t)(input & 0xFF) << 16);
153 return boost::indeterminate;
155 frame.
length |= ((uint64_t)(input & 0xFF) << 8);
157 return boost::indeterminate;
159 frame.
length |= ((uint64_t)(input & 0xFF) << 0);
166 return boost::indeterminate;
169 frame.
mask[0] = input;
171 return boost::indeterminate;
173 frame.
mask[1] = input;
175 return boost::indeterminate;
177 frame.
mask[2] = input;
179 return boost::indeterminate;
181 frame.
mask[3] = input;
186 return boost::indeterminate;
191 return boost::indeterminate;
195 for (uint64_t i = 0; i < frame.
length; ++i)
211 if (frame.
header.opcode == WebsocketFrame::Header::opcode_continuation)
220 switch (frame.
header.opcode)
222 case WebsocketFrame::Header::opcode_text:
225 case WebsocketFrame::Header::opcode_binary:
228 case WebsocketFrame::Header::opcode_close:
231 case WebsocketFrame::Header::opcode_ping:
234 case WebsocketFrame::Header::opcode_pong:
246 return boost::indeterminate;