Fixing default constructor of int_vb to initalize values to 0 Implementing basic connect ACK Implemeting basic send function in session
37 lines
1.1 KiB
C++
37 lines
1.1 KiB
C++
#ifndef INCLUDE_NETWORK_CONTROL_PACKET_HPP_
|
|
#define INCLUDE_NETWORK_CONTROL_PACKET_HPP_
|
|
|
|
#include "fixed_header.hpp"
|
|
#include <exceptions.hpp>
|
|
#include <bit.hpp>
|
|
#include <types.hpp>
|
|
#include <variable_byte_int.hpp>
|
|
#include <vector>
|
|
|
|
class PacketInterface {
|
|
public:
|
|
PacketInterface(const std::vector<std::byte> &);
|
|
PacketInterface(PacketInterface &);
|
|
PacketInterface(){};
|
|
~PacketInterface() = default;
|
|
|
|
inline uint length() const { return sizeof(this->fixed_header) + this->fixed_header.remaining_length; }
|
|
|
|
inline PacketType get_packet_type() const { return this->fixed_header.packet_type; };
|
|
inline std::bitset<4> get_packet_flags() const { return this->fixed_header.packet_flags; };
|
|
|
|
virtual std::string as_string() const;
|
|
virtual std::vector<std::byte> as_bytes();
|
|
|
|
protected:
|
|
std::vector<std::byte> raw_data;
|
|
FixedHeader fixed_header;
|
|
|
|
virtual void parse_variable_header() { throw NotImplemented(); };
|
|
virtual void parse_payload() { throw NotImplemented(); };
|
|
|
|
std::vector<std::byte>::const_iterator variable_header_start_byte;
|
|
};
|
|
|
|
#endif // INCLUDE_NETWORK_CONTROL_PACKET_HPP_
|