-
Notifications
You must be signed in to change notification settings - Fork 403
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #741 from ApexAI/iox-#14-make-gateway-aware-of-lar…
…ge-payload-alignments Iox #14 make gateway aware of large payload alignments
- Loading branch information
Showing
21 changed files
with
538 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
iceoryx_dds/include/iceoryx_dds/dds/iox_chunk_datagram_header.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// 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_utils/cxx/vector.hpp" | ||
|
||
#include <cstdint> | ||
|
||
namespace iox | ||
{ | ||
namespace dds | ||
{ | ||
/// @brief the endianess of the serialized data | ||
enum class Endianess : uint8_t | ||
{ | ||
UNDEFINED, | ||
LITTLE, | ||
BIG, | ||
MIXED, | ||
}; | ||
|
||
constexpr const char* EndianessString[] = {"UNDEFINED", "LITTLE", "BIG", "MIXED"}; | ||
|
||
/// @brief Detects the endianness of the system | ||
Endianess getEndianess(); | ||
|
||
/// @brief The datagram header with chunk metadata for user-header and user-payload | ||
struct IoxChunkDatagramHeader | ||
{ | ||
using Serialized_t = iox::cxx::vector<uint8_t, 16U>; | ||
|
||
/// @brief Serializes a IoxChunkDatagramHeader into a vector of uint8_t | ||
/// @param[in] datagramHeader to serialize | ||
/// @return the serialized IoxChunkDatagramHeader | ||
static Serialized_t serialize(const IoxChunkDatagramHeader& datagramHeader); | ||
|
||
/// @brief Deserializes a vector of uint8_t into a IoxChunkDatagramHeader | ||
/// @param[in] serializedDatagram is the serialized IoxChunkDatagramHeader | ||
/// @return the deserialized IoxChunkDatagramHeader | ||
static IoxChunkDatagramHeader deserialize(const Serialized_t& serializedDatagramHeader); | ||
|
||
/// @brief From the 1.0 release onward, this must be incremented for each incompatible change, e.g. | ||
/// - data width of members changes | ||
/// - members are rearranged | ||
/// - semantic meaning of a member changes | ||
static constexpr uint8_t DATAGRAM_VERSION{1U}; | ||
|
||
/// @note This must always be the first member and always 1 bytes in order to prevent issues with endianess when | ||
/// deserialized or incorrectly detected versions due to different size | ||
uint8_t datagramVersion{DATAGRAM_VERSION}; | ||
/// @note This must always be 1 byte in order to prevent issues with endianess when deserialized | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.