2023-03-31 11:22:01 -04:00
|
|
|
/*
|
|
|
|
citp.h
|
|
|
|
|
|
|
|
Copyright (c) 2023 Kevin Matz (kevin.matz@gmail.com)
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
|
|
copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
SOFTWARE.
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
2023-03-31 19:51:42 -04:00
|
|
|
/**
|
2023-04-25 12:14:03 -04:00
|
|
|
* \cite CITP 3 CITP base layer
|
2023-03-31 19:51:42 -04:00
|
|
|
*
|
|
|
|
* The base layer as such does not define any packages, it merely adds a header that
|
|
|
|
* encapsulate all messages.
|
|
|
|
*/
|
2023-03-31 11:22:01 -04:00
|
|
|
namespace CITP {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief \cite CITP 3.1.1 The CITP header
|
|
|
|
*
|
|
|
|
* The CITP layer provides a standard, single, header used at the start of all CITP packets.
|
|
|
|
*/
|
|
|
|
struct CITP_Header
|
|
|
|
{
|
|
|
|
uint32_t Cookie; ///< Set to "CITP".
|
|
|
|
uint8_t VersionMajor; ///< Set to 1.
|
|
|
|
uint8_t VersionMinor; ///< Set to 0.
|
|
|
|
union {
|
2023-03-31 19:51:42 -04:00
|
|
|
uint16_t RequestIndex; ///< Senders request index. Set to 0 to "ignore"
|
|
|
|
uint16_t InResponseTo; ///< Responders copy of the RequestIndex
|
2023-03-31 11:22:01 -04:00
|
|
|
};
|
|
|
|
uint32_t MessageSize; ///< The size of the entire message, including this header.
|
|
|
|
uint16_t MessagePartCount; ///< Number of message fragments.
|
|
|
|
uint16_t MessagePart; ///< Index of this message fragment (0-based).
|
|
|
|
uint32_t ContentType; ///< Cookie identifying the type of the second layer.
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace CITP
|