Skip to content

iceoryx_dds/dds/iox_chunk_datagram_header.hpp🔗

Namespaces🔗

Name
iox
iox::dds

Classes🔗

Name
struct iox::dds::IoxChunkDatagramHeader
The datagram header with chunk metadata for user-header and user-payload.

Source code🔗

// Copyright (c) 2021 by Apex.AI Inc. All rights reserved.
//
// 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.
//
// SPDX-License-Identifier: Apache-2.0

#ifndef IOX_DDS_DDS_IOX_CHUNK_DATAGRAM_HEADER_HPP
#define IOX_DDS_DDS_IOX_CHUNK_DATAGRAM_HEADER_HPP

#include "iceoryx_hoofs/cxx/vector.hpp"

#include <cstdint>

namespace iox
{
namespace dds
{
enum class Endianess : uint8_t
{
    UNDEFINED,
    LITTLE,
    BIG,
    MIXED,
};

constexpr const char* EndianessString[] = {"UNDEFINED", "LITTLE", "BIG", "MIXED"};

Endianess getEndianess();

struct IoxChunkDatagramHeader
{
    using Serialized_t = iox::cxx::vector<uint8_t, 16U>;

    static Serialized_t serialize(const IoxChunkDatagramHeader& datagramHeader);

    static IoxChunkDatagramHeader deserialize(const Serialized_t& serializedDatagramHeader);

    static constexpr uint8_t DATAGRAM_VERSION{1U};

    uint8_t datagramVersion{DATAGRAM_VERSION};
    Endianess endianness{Endianess::UNDEFINED};
    uint16_t userHeaderId{0xFFFF};
    uint32_t userHeaderSize{0U};
    uint32_t userPayloadSize{0U};
    uint32_t userPayloadAlignment{0U};
};

} // namespace dds
} // namespace iox

#endif // IOX_DDS_DDS_IOX_CHUNK_DATAGRAM_HEADER_HPP

Updated on 18 December 2023 at 13:11:43 CET