M2-PT-DRP/source/packets/base/Packet.hpp

29 lines
742 B
C++

#pragma once
#include <array>
#include <cstdint>
#include "PacketContent.hpp"
namespace drp::packet::base {
/**
* A generic packet that can be transmitted through the network.
* @param channel the channel of the packet. Two system can be created inside a same network by using different
* channels value. "0" is used for "broadcast" message across networks.
* @param securityMode the type of security used in the packet.
* @param _content the content of the packet. It is encrypted accordingly to the securityMode.
*/
struct Packet {
std::uint8_t channel;
std::uint8_t securityMode;
PacketContent _content;
[[nodiscard]] PacketContent getContent() const;
void setContent(const PacketContent& content);
};
}