2 #include "WebSocketCommon.h" 3 #include "ByteBuffer.h" 16 std::vector<byte>& getMask() {
20 return (byte)(finRsvOp & 0x0F);
26 int getPayloadLength() {
27 return data.bytesRemaining();
33 return (byte)(finRsvOp & 0x80) != 0;
35 void setFin(
bool fin) {
37 finRsvOp = (byte)((finRsvOp & 0x7F) | (fin ? 0x80 : 0x00));
39 void setMask(
const std::vector<byte>& maskingKey);
40 void setMask(
const byte* data,
int nCount=4);
41 void setMasked(
bool mask) {
44 void setOpCode(byte op) {
45 finRsvOp = (byte)((finRsvOp & 0xF0) | (op & 0x0F));
51 void append(
ByteBuffer& buffer,
int needed_len);;
52 void setRsv1(
bool rsv1) {
54 finRsvOp = (byte)((finRsvOp & 0xBF) | (rsv1 ? 0x40 : 0x00));
56 void setRsv2(
bool rsv2) {
58 finRsvOp = (byte)((finRsvOp & 0xDF) | (rsv2 ? 0x20 : 0x00));
60 void setRsv3(
bool rsv3) {
62 finRsvOp = (byte)((finRsvOp & 0xEF) | (rsv3 ? 0x10 : 0x00));
65 return (byte)(finRsvOp & 0x40) != 0;
68 return (byte)(finRsvOp & 0x20) != 0;
71 return (byte)(finRsvOp & 0x10) != 0;
74 return getPayloadLength() > 0;
79 void loadData(std::vector<byte>& outData);
80 int size() {
return data.bytesRemaining(); };
96 std::vector<byte> mask;
define this to enable debugging of NPL code in visual studio
Definition: INPL.h:9
Definition: ByteBuffer.h:47
uint32_t bytesRemaining()
Bytes Remaining Returns the number of bytes from the current read position till the end of the buffer...
Definition: ByteBuffer.cpp:71
Definition: WebSocketFrame.h:11