Sha256: 077ce86019a374e63d672c5393ccedca6de73605b7c1b44473ffb6d47f23adbb

Contents?: true

Size: 1.66 KB

Versions: 6

Compression:

Stored size: 1.66 KB

Contents

/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
 *   Copyright 2020-2021 Couchbase, Inc.
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */

#pragma once

#include <array>
#include <cstdint>
#include <vector>

namespace couchbase::core
{
namespace protocol
{
static const std::size_t header_size = 24;
using header_buffer = std::array<std::byte, header_size>;
} // namespace protocol

namespace io
{
struct binary_header {
    std::uint8_t magic;
    std::uint8_t opcode;
    std::uint16_t keylen;
    std::uint8_t extlen;
    std::uint8_t datatype;
    std::uint16_t specific;
    std::uint32_t bodylen;
    std::uint32_t opaque;
    std::uint64_t cas;

    [[nodiscard]] std::uint16_t status() const;
};

struct mcbp_message {
    binary_header header;
    std::vector<std::byte> body;

    mcbp_message(const mcbp_message& other) = delete;
    mcbp_message& operator=(const mcbp_message& other) = delete;
    mcbp_message(mcbp_message&& other) = default;
    mcbp_message& operator=(mcbp_message&& other) = default;

    [[nodiscard]] protocol::header_buffer header_data() const;
};
} // namespace io
} // namespace couchbase::core

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
couchbase-3.4.5 ext/couchbase/core/io/mcbp_message.hxx
couchbase-3.4.4 ext/couchbase/core/io/mcbp_message.hxx
couchbase-3.4.3 ext/couchbase/core/io/mcbp_message.hxx
couchbase-3.4.2 ext/couchbase/core/io/mcbp_message.hxx
couchbase-3.4.1 ext/couchbase/core/io/mcbp_message.hxx
couchbase-3.4.0 ext/couchbase/core/io/mcbp_message.hxx