Alex Bikfalvi
SimStream Documentation
LayerIgmp.h
00001 #pragma once 00002 00003 #include "Layer.h" 00004 #include "LayerIpMcastGroup.h" 00005 #include "LayerIpMcastMembership.h" 00006 #include "PacketIp.h" 00007 #include "PacketIgmp.h" 00008 00009 class CLayerIgmp : public CLayer 00010 { 00011 public: 00012 enum EIgmpType 00013 { 00014 IGMP_HOST = 0, 00015 IGMP_ROUTER = 1 00016 }; 00017 00018 private: 00019 CAddress address; 00020 __uint32 numGroups; 00021 EIgmpType type; 00022 00023 CLayerIpMcastMembership* memberships; // Group memberships initiated locally 00024 CLayerIpMcastGroup* groups; // Group memberships initiated remotely 00025 00026 Delegate2<CLayerIgmp, void, __uint32, CPacketIp*>* delegateRecv; 00027 00028 Delegate2<CLayerIgmp, void, CAddress, __uint32>* delegateJoin; 00029 Delegate1<CLayerIgmp, void, CAddress>* delegateLeave; 00030 00031 Event3<void, __uint32, CAddress, CLayerIpMcastGroup*>* eventJoin; 00032 Event3<void, __uint32, CAddress, CLayerIpMcastGroup*>* eventLeave; 00033 00034 Event2<void, __uint32, CAddress>* eventLocalJoin; 00035 Event2<void, __uint32, CAddress>* eventLocalLeave; 00036 00037 Event2<void, __uint32, CPacketIp*>* eventSend; 00038 00039 double statEntries; 00040 __uint32 statEntriesNum; 00041 __time statEntriesLast; 00042 00043 public: 00044 CLayerIgmp( 00045 CSimHandler* sim, 00046 CAddress address, 00047 __uint32 numGroups, 00048 EIgmpType type = IGMP_HOST 00049 ); 00050 virtual ~CLayerIgmp(); 00051 00052 inline IDelegate2<void, __uint32, CPacketIp*>* 00053 DelegateRecv() { return this->delegateRecv; } 00054 00055 inline IDelegate2<void, CAddress, __uint32>* 00056 DelegateJoin() { return this->delegateJoin; } 00057 inline IDelegate1<void, CAddress>* 00058 DelegateLeave() { return this->delegateLeave; } 00059 00060 inline Event2<void, __uint32, CPacketIp*>* 00061 EventSend() { return this->eventSend; } 00062 00063 inline Event3<void, __uint32, CAddress, CLayerIpMcastGroup*>* 00064 EventJoin() { return this->eventJoin; } 00065 inline Event3<void, __uint32, CAddress, CLayerIpMcastGroup*>* 00066 EventLeave() { return this->eventLeave; } 00067 00068 inline Event2<void, __uint32, CAddress>* 00069 EventLocalJoin() { return this->eventLocalJoin; } 00070 inline Event2<void, __uint32, CAddress>* 00071 EventLocalLeave() { return this->eventLocalLeave; } 00072 00073 inline double StatEntries() { return this->statEntries; } 00074 00075 virtual void Finalize(); 00076 00077 void Join(CAddress address, __uint32 entry); 00078 void Leave(CAddress address); 00079 00080 private: 00081 void Recv(__uint32 entry, CPacketIp* packet); 00082 void RecvIgmpAllSystems(__uint32 entry, CAddress src, CAddress dst, CPacketIgmp* packet); 00083 void RecvIgmpAllRouters(__uint32 entry, CAddress src, CAddress dst, CPacketIgmp* packet); 00084 void RecvIgmpOther(__uint32 entry, CAddress src, CAddress dst, CPacketIgmp* packet); 00085 void RecvIgmpJoinGroup(__uint32 entry, CAddress src, CAddress dst, CPacketIgmp* packet); 00086 void RecvIgmpLeaveGroup(__uint32 entry, CAddress src, CAddress dst, CPacketIgmp* packet); 00087 00088 void Send(__uint32 entry, CAddress dst, __byte ttl, CPacket* payload); 00089 };
Last updated: February 8, 2011