#include "net/websockets/websocket_frame_parser.h"
#include <algorithm>
#include <ostream>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/check_op.h"
#include "base/containers/extend.h"
#include "base/containers/span.h"
#include "base/logging.h"
#include "base/numerics/byte_conversions.h"
#include "net/websockets/websocket_frame.h"
namespace {
constexpr uint8_t kFinalBit = …;
constexpr uint8_t kReserved1Bit = …;
constexpr uint8_t kReserved2Bit = …;
constexpr uint8_t kReserved3Bit = …;
constexpr uint8_t kOpCodeMask = …;
constexpr uint8_t kMaskBit = …;
constexpr uint8_t kPayloadLengthMask = …;
constexpr uint64_t kMaxPayloadLengthWithoutExtendedLengthField = …;
constexpr uint64_t kPayloadLengthWithTwoByteExtendedLengthField = …;
constexpr uint64_t kPayloadLengthWithEightByteExtendedLengthField = …;
constexpr size_t kMaximumFrameHeaderSize = …;
}
namespace net {
WebSocketFrameParser::WebSocketFrameParser() = default;
WebSocketFrameParser::~WebSocketFrameParser() = default;
bool WebSocketFrameParser::Decode(
base::span<const uint8_t> data_span,
std::vector<std::unique_ptr<WebSocketFrameChunk>>* frame_chunks) { … }
size_t WebSocketFrameParser::DecodeFrameHeader(base::span<const uint8_t> data) { … }
std::unique_ptr<WebSocketFrameChunk> WebSocketFrameParser::DecodeFramePayload(
bool first_chunk,
base::span<const uint8_t>* data) { … }
}