Packet

The Packet class is a nested class of Reader

Public member functions

//Construct a new Packet
Packet(std::shared_ptr<Client> client, const Stream &data, int instruction);
//Destruct the Packet
~Packet();
//Get a pointer the client that send the packet
std::shared_ptr<Client> getClient() const;
//Get the instruction of the packet
int getInstruction() const;
//Get the data of the packet
Stream &getData();

Private attributes

//The client that send the packet
std::shared_ptr<Client> _client;
//The binary data
Stream _data;
//The instruction
int _instruction;

Member functions documentation

Constructor

Packet(std::shared_ptr<Client> client, const Stream &data, int instruction);

Parameters

  • client a shared pointer to the client that send the packet

  • data a binary Stream

  • instruction the packet instruction

getClient

return the pointer to the client that send the packet

std::shared_ptr<Client> getClient() const;

getinstruction

return the packet's intsruction

int getInstruction() const;

getData

return the packet's data

Stream &getData();

Last updated