// // This file is part of an OMNeT++/OMNEST simulation example. // // Copyright (C) 1992-2015 Andras Varga // // This file is distributed WITHOUT ANY WARRANTY. See the file // `license' for details on this and other legal matters. // #ifndef __ALOHA_HOST_H_ #define __ALOHA_HOST_H_ #include using namespace omnetpp; namespace aloha { /** * Aloha host; see NED file for more info. */ class Host : public cSimpleModule { private: // parameters simtime_t radioDelay; double txRate; cPar *iaTime; cPar *pkLenBits; simtime_t slotTime; bool isSlotted; // state variables, event pointers etc cModule *server; cMessage *endTxEvent; enum { IDLE = 0, TRANSMIT = 1 } state; int pkCounter; public: Host(); virtual ~Host(); protected: virtual void initialize() override; virtual void handleMessage(cMessage *msg) override; simtime_t getNextTransmissionTime(); }; }; //namespace #endif