Alex Bikfalvi
SimStream Documentation
ModelPush.h
00001 #pragma once 00002 00003 #include "Model.h" 00004 #include "Topo.h" 00005 #include "ModelChannel.h" 00006 #include "Route.h" 00007 #include "InfoPush.h" 00008 #include "Router.h" 00009 #include "Link.h" 00010 #include "HostClientPush.h" 00011 #include "HostServerPush.h" 00012 #include "StreamSourceMpeg.h" 00013 #include "Data.h" 00014 00015 #define HOST_ID(index) (index) 00016 #define ROUTER_ID(index) (index) 00017 #define SERVER_ID(index) (index) 00018 00019 #define HOST_INDEX(id) (id) 00020 #define ROUTER_INDEX(id) (id) 00021 #define SERVER_INDEX(id) (id) 00022 00023 #define LINK_CORE_ID(index) (0x10000000 | index) 00024 #define LINK_ACCESS_ID(index) (0x20000000 | index) 00025 #define LINK_SERVER_ID(index) (0x30000000 | index) 00026 00027 #define HOST_ADDR(index) (index + this->routeNodes) 00028 #define ROUTER_ADDR(index) (index) 00029 #define SERVER_ADDR(index) (index + this->routeNodes + this->numHosts) 00030 00031 #define ROUTE_ADDRESS_INDEX(addr) (addr) 00032 #define ROUTE_ROUTER_INDEX(id) (id) 00033 00034 class CModelPush : public CModel, public CRoute, public CInfoPush 00035 { 00036 protected: 00037 // Simulation 00038 char* name; 00039 CSimHandler* sim; 00040 CTopo* topology; 00041 __uint32 topologyNumber; 00042 CModelChannel* modelChannel; 00043 00044 // Nodes 00045 __uint32 numHosts; 00046 __uint32 numServers; 00047 __uint32 numGateways; 00048 CHostClientPush** hosts; 00049 CHostServerPush* server; 00050 CRouter** routers; 00051 CLink** linksCore; 00052 CLink** linksAccess; 00053 CLink* linkServer; 00054 __uint32* gateways; 00055 __uint32 gatewayServer; 00056 __uint32* routerAccessLinks; 00057 00058 // Network 00059 __uint32 bwAccessBins; 00060 __bitrate* bwAccessUpLink; 00061 __bitrate* bwAccessDownLink; 00062 double* bwAccessRatio; 00063 __bitrate* bwAccessHostUpLink; 00064 __bitrate* bwAccessHostDownLink; 00065 __time delayAccessUpLink; 00066 __time delayAccessDownLink; 00067 __bitrate bwServerUpLink; 00068 __bitrate bwServerDownLink; 00069 __time delayServerUpLink; 00070 __time delayServerDownLink; 00071 __uint32 queueLink; 00072 __uint32 queueLinkServer; 00073 00074 // Routing 00075 __uint32 routeNodes; 00076 __uint32 routeDst; 00077 int** route; 00078 00079 // Channels 00080 __uint32 numChannels; 00081 __uint32 numChannelsMcast; 00082 __uint32 numChannelsUcast; 00083 __bitrate channelBw; 00084 __byte channelFps; 00085 CChannel* channelsMcast; 00086 CChannel* channelsUcast; 00087 00088 // Multicast 00089 CAddress* mcastRp; 00090 00091 // Stream 00092 CStreamSourceMpeg** streamSources; 00093 00094 __uint32 streamBufferSize; 00095 __uint32 streamBufferSizeHistory; 00096 __uint32 streamBufferSizeBuffering; 00097 __time streamBufferUnderrunTimeout; 00098 double streamBwMargin; 00099 00100 // Bootstrap 00101 __uint32 bootQueryMax; 00102 __uint32 bootRefreshThreshold; 00103 __time bootQueryTimeout; 00104 __time bootRegisterDelay; 00105 00106 // Data 00107 CData* data; 00108 00109 // Multicast 00110 CMulticast* multicast; 00111 00112 // Data : bandwidth 00113 __uint64 dataBwTotal; 00114 double dataBwAvg; 00115 00116 // Data : bandwidth core 00117 __uint64 dataBwCoreTotal; 00118 double dataBwCoreAvg; 00119 // Data : bandwidth access 00120 __uint64 dataBwAccessTotal; 00121 double dataBwAccessAvg; 00122 // Data : bandwidth access uplink 00123 __uint64 dataBwAccessUpTotal; 00124 double dataBwAccessUpAvg; 00125 // Data : bandwidth access downlink 00126 __uint64 dataBwAccessDownTotal; 00127 double dataBwAccessDownAvg; 00128 // Data : bandwidth server 00129 __uint64 dataBwServerTotal; 00130 double dataBwServerAvg; 00131 00132 // Data : bandwidth stream 00133 __uint64 dataBwStreamTotal; 00134 double dataBwStreamAvg; 00135 // Data : bandwidth core stream 00136 __uint64 dataBwCoreStreamTotal; 00137 double dataBwCoreStreamAvg; 00138 // Data : bandwidth access stream 00139 __uint64 dataBwAccessStreamTotal; 00140 double dataBwAccessStreamAvg; 00141 // Data : bandwidth access uplink stream 00142 __uint64 dataBwAccessUpStreamTotal; 00143 double dataBwAccessUpStreamAvg; 00144 // Data : bandwidth access downlink stream 00145 __uint64 dataBwAccessDownStreamTotal; 00146 double dataBwAccessDownStreamAvg; 00147 // Data : bandwidth server stream 00148 __uint64 dataBwServerStreamTotal; 00149 double dataBwServerStreamAvg; 00150 00151 // Data : bandwidth control 00152 __uint64 dataBwControlTotal; 00153 double dataBwControlAvg; 00154 // Data : bandwidth core control 00155 __uint64 dataBwCoreControlTotal; 00156 double dataBwCoreControlAvg; 00157 // Data : bandwidth access control 00158 __uint64 dataBwAccessControlTotal; 00159 double dataBwAccessControlAvg; 00160 // Data : bandwidth access uplink control 00161 __uint64 dataBwAccessUpControlTotal; 00162 double dataBwAccessUpControlAvg; 00163 // Data : bandwidth access downlink control 00164 __uint64 dataBwAccessDownControlTotal; 00165 double dataBwAccessDownControlAvg; 00166 // Data : bandwidth server control 00167 __uint64 dataBwServerControlTotal; 00168 double dataBwServerControlAvg; 00169 00170 // Data : multicast entries 00171 double dataRouterMcastEntries; 00172 double dataRouterMcastEntriesIgmp; 00173 double dataRouterMcastEntriesPimSm; 00174 00175 public: 00176 CModelPush( 00177 char* name, 00178 __time maxTime, 00179 CTopo* topology, 00180 __uint32 topologyNumber, 00181 CModelChannel* modelChannel, 00182 __uint32 numHosts, 00183 __uint32 numGateways, 00184 __uint32 bwAccessBins, 00185 __bitrate* bwAccessUpLink, 00186 __bitrate* bwAccessDownLink, 00187 double* bwAccessRatio, 00188 __time delayAccessUpLink, 00189 __time delayAccessDownLink, 00190 __bitrate bwServerUpLink, 00191 __bitrate bwServerDownLink, 00192 __time delayServerUpLink, 00193 __time delayServerDownLink, 00194 __uint32 queueLink, 00195 __uint32 queueLinkServer, 00196 __uint32 numChannelsMcast, 00197 __uint32 numChannelsUcast, 00198 __bitrate channelBw, 00199 __byte channelFps, 00200 __byte mpegGopDistanceItoI, 00201 __byte mpegGopDistanceItoP, 00202 __uint32 streamBufferSize, 00203 __uint32 streamBufferSizeHistory, 00204 __uint32 streamBufferSizeBuffering, 00205 __time streamBufferUnderrunTimeout, 00206 double streamBwMargin, 00207 __uint32 bootQueryMax, 00208 __uint32 bootRefreshThreshold, 00209 __time bootQueryTimeout, 00210 __time bootRegisterDelay 00211 ); 00212 virtual ~CModelPush(); 00213 00214 virtual void Init(CSimHandler* sim); 00215 virtual __uint32 Events(); 00216 virtual CSimEvent* Event(__uint32 index, __time& time); 00217 00218 virtual void Finalize(); 00219 00220 virtual int Forward(CAddress router, CAddress dst); 00221 00222 virtual inline __uint32 NumGroups() { return this->numChannelsMcast; } 00223 00224 virtual inline __uint32 NumChannels() { return this->numChannels; } 00225 virtual inline __uint32 NumChannelsMulticast() { return this->numChannelsMcast; } 00226 virtual inline __uint32 NumChannelsUnicast() { return this->numChannelsUcast; } 00227 00228 virtual inline CChannel* Channel(__uint32 index); 00229 virtual inline CChannel* ChannelMulticast(__uint32 index) { assert(index < this->numChannelsMcast); return &this->channelsMcast[index]; } 00230 virtual inline CChannel* ChannelUnicast(__uint32 index) { assert(index < this->numChannelsUcast); return &this->channelsUcast[index]; } 00231 00232 virtual inline __uint32 IndexGlobalToMulticast(__uint32 index) { assert(index < this->numChannelsMcast); return index; } 00233 virtual inline __uint32 IndexGlobalToUnicast(__uint32 index) { assert(index < this->numChannels); assert(index >= this->numChannelsMcast); return index - this->numChannelsMcast; } 00234 virtual inline __uint32 IndexMulticastToGlobal(__uint32 index) { assert(index < this->numChannelsMcast); return index; } 00235 virtual inline __uint32 IndexUnicastToGlobal(__uint32 index) { assert(index < this->numChannelsUcast); return index + this->numChannelsMcast; } 00236 00237 virtual inline __uint32 StreamBufferSize() { return this->streamBufferSize; } 00238 virtual inline __uint32 StreamBufferSizeHistory() { return this->streamBufferSizeHistory; } 00239 virtual inline __uint32 StreamBufferSizeBuffering() { return this->streamBufferSizeBuffering; } 00240 virtual inline __time StreamBufferUnderrunTimeout() { return this->streamBufferUnderrunTimeout; } 00241 virtual inline double StreamBwMargin() { return this->streamBwMargin; } 00242 00243 virtual inline __uint32 BootQueryMax() { return this->bootQueryMax; } 00244 virtual inline __uint32 BootRefreshThreshold() { return this->bootRefreshThreshold; } 00245 virtual inline __time BootQueryTimeout() { return this->bootQueryTimeout; } 00246 virtual inline __time BootRegisterDelay() { return this->bootRegisterDelay; } 00247 00248 virtual inline __uint16 PortStream() { return 0; } 00249 virtual inline __uint16 PortControl() { return 1; } 00250 00251 virtual inline CModelChannel* ModelChannel() { return this->modelChannel; } 00252 00253 virtual inline CStreamSource* StreamSource(__uint32 index) { assert(index < this->numChannels); return this->streamSources[index]; } 00254 00255 #ifdef MULTICAST 00256 virtual void MulticastJoin(__uint32 host, __uint32 group); 00257 virtual void MulticastLeave(__uint32 host, __uint32 group); 00258 #endif 00259 };
Last updated: February 8, 2011