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