Question: #include #include class Packet { private: int sourceId; int destId; std::string message; size _ t hash; public: Packet ( ) ; Packet ( int sourceId,
#include
#include
class Packet
private:
int sourceId;
int destId;
std::string message;
sizet hash;
public:
Packet;
Packetint sourceId, int destId, std::string message;
int getSourceId;
int getDestId;
std::string getMessage;
bool checkIntegrity;
void corrupt;
;
enum class MacPacketType
Empty,
Message,
Success,
Failure
;
class MacPacket
private:
MacPacketType type;
int macSourceId;
int macDestId;
std::vector path;
Packet packet;
public:
MacPacket;
MacPacketMacPacketType type, int macSourceId, int macDestId, std::vector& path, Packet& packet;
static MacPacket createMessagePacketint macSourceId, int macDestId, std::vector& path, Packet& packet;
static MacPacket createSuccessPacketint macSourceId, int macDestId, std::vector& path;
static MacPacket createFailurePacketint macSourceId, int macDestId, std::vector& path;
MacPacketType getType;
int getMacSourceId;
int getMacDestId;
std::vector& getPath;
Packet& getPacket;
;
class Node
private:
int id;
std::vector neighbors;
MacPacket buffer;
public:
Node;
Nodeint id std::vector& neighbors;
int getId;
std::vector& getNeighbors;
MacPacket receiveMacPacket packet;
;
class Network
private:
std::vector nodes;
float corruptionRate;
Node getNodeint id;
std::vector calculatePathint source, int destination;
public:
Networkfloat corruptionRate;
void addNodeint id std::vector& neighbors;
void removeNodeint id;
void simulatePacket packet;
;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
