EtherBus::EtherBus(const Params *p)
: EtherObject(p), ticksPerByte(p->speed), loopback(p->loopback),
- event(this), sender(0), dump(p->dump)
+ event([this]{ txDone(); }, "ethernet bus completion"),
+ sender(0), dump(p->dump)
{
}
bool loopback;
protected:
- class DoneEvent : public Event
- {
- protected:
- EtherBus *bus;
-
- public:
- DoneEvent(EtherBus *b) : bus(b) {}
- virtual void process() { bus->txDone(); }
- virtual const char *description() const
- { return "ethernet bus completion"; }
- };
-
- DoneEvent event;
+ EventFunctionWrapper event;
EthPacketPtr packet;
EtherInt *sender;
EtherDump *dump;
EtherTapBase::EtherTapBase(const Params *p)
: EtherObject(p), buflen(p->bufsz), dump(p->dump), event(NULL),
- interface(NULL), txEvent(this)
+ interface(NULL),
+ txEvent([this]{ retransmit(); }, "EtherTapBase retransmit")
{
buffer = new uint8_t[buflen];
interface = new EtherTapInt(name() + ".interface", this);
protected:
std::queue<EthPacketPtr> packetBuffer;
void retransmit();
-
- class TxEvent : public Event
- {
- protected:
- EtherTapBase *tap;
-
- public:
- TxEvent(EtherTapBase *_tap) : tap(_tap) {}
- void process() { tap->retransmit(); }
- virtual const char *description() const
- { return "EtherTapBase retransmit"; }
- };
-
- friend class TxEvent;
- TxEvent txEvent;
+ EventFunctionWrapper txEvent;
};
class EtherTapInt : public EtherInt