M2-PT-DRP/source/packets/base/PacketContent.cpp

31 lines
666 B
C++

#include "PacketContent.hpp"
#include <stdexcept>
#include "Packet.hpp"
#include "SecurityMode.hpp"
namespace drp::packet::base {
void Packet::setContent(const PacketContent &content) {
// TODO(Faraphel): implement RSA and AES
switch (static_cast<SecurityMode>(this->securityMode)) {
case SecurityMode::PLAIN:
this->_content = content;
return;
case SecurityMode::AES:
throw std::runtime_error("Not implemented.");
case SecurityMode::RSA:
throw std::runtime_error("Not implemented.");
default:
throw std::runtime_error("Unsupported security mode.");
}
}
}