Alex Bikfalvi
SimStream Documentation
ModelPushSelect.h
00001 #pragma once 00002 00003 #include "Model.h" 00004 #include "ModelBandwidth.h" 00005 #include "ModelChannel.h" 00006 #include "ModelSelect.h" 00007 00008 #include "Topo.h" 00009 #include "Route.h" 00010 #include "InfoPushSelect.h" 00011 #include "Router.h" 00012 #include "Link.h" 00013 #include "HostClientPushSelect.h" 00014 #include "HostServerPushSelect.h" 00015 #include "StreamSourceMpeg.h" 00016 #include "Data.h" 00017 00018 #define HOST_ID(index) (index) 00019 #define ROUTER_ID(index) (index) 00020 #define SERVER_ID(index) (index) 00021 00022 #define LINK_CORE_ID(index) (0x10000000 | index) 00023 #define LINK_ACCESS_ID(index) (0x20000000 | index) 00024 #define LINK_SERVER_ID(index) (0x30000000 | index) 00025 00026 #define HOST_INDEX_ADDRESS(index) (index + this->routeNodes) 00027 #define ROUTER_INDEX_ADDRESS(index) (index) 00028 #define SERVER_INDEX_ADDRESS(index) (index + this->routeNodes + this->numHosts) 00029 00030 #define HOST_ADDRESS_INDEX(addr) (addr - this->routeNodes) 00031 #define ROUTER_ADDRESS_INDEX(addr) (addr) 00032 00033 class CModelPushSelect : public CModel, public CRoute, public CInfoPushSelect 00034 { 00035 protected: 00036 // Models 00037 CModelBandwidth* modelBandwidthUplink; 00038 CModelBandwidth* modelBandwidthDownlink; 00039 CModelChannel* modelChannel; 00040 CModelSelect* modelSelect; 00041 00042 // Simulation 00043 CSimHandler* sim; 00044 char* name; 00045 CTopo* topology; 00046 __uint32 topologyNumber; 00047 00048 // Nodes 00049 __uint32 numHosts; 00050 __uint32 numServers; 00051 __uint32 numGateways; 00052 CHostClientPushSelect** hosts; 00053 CHostServerPushSelect* server; 00054 CRouter** routers; 00055 CLink** linksCore; 00056 CLink** linksAccess; 00057 CLink* linkServer; 00058 __uint32* gateways; 00059 __uint32 gatewayServer; 00060 __uint32* routerAccessLinks; 00061 00062 // Network 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 numLayers; 00082 __uint32 numLayersMin; 00083 00084 CChannel* channels; 00085 __bitrate channelBw; 00086 __byte channelFps; 00087 00088 // Stream 00089 CStreamSourceMpeg** streamSources; 00090 __byte mpegGopDistanceItoI; 00091 __byte mpegGopDistanceItoP; 00092 00093 __uint32 streamBufferSize; 00094 __uint32 streamBufferSizeHistory; 00095 __uint32 streamBufferSizeBuffering; 00096 __time streamBufferUnderrunTimeout; 00097 double streamBwMargin; 00098 00099 // Bootstrap 00100 __uint32 bootQueryMax; 00101 __uint32 bootRefreshThreshold; 00102 __time bootQueryTimeout; 00103 __time bootRegisterDelay; 00104 00105 // Data 00106 CData* data; 00107 00108 // Data : bandwidth 00109 __uint64 dataBwTotal; 00110 double dataBwAvg; 00111 00112 // Data : bandwidth core 00113 __uint64 dataBwCoreTotal; 00114 double dataBwCoreAvg; 00115 // Data : bandwidth access 00116 __uint64 dataBwAccessTotal; 00117 double dataBwAccessAvg; 00118 // Data : bandwidth access uplink 00119 __uint64 dataBwAccessUpTotal; 00120 double dataBwAccessUpAvg; 00121 // Data : bandwidth access downlink 00122 __uint64 dataBwAccessDownTotal; 00123 double dataBwAccessDownAvg; 00124 // Data : bandwidth server 00125 __uint64 dataBwServerTotal; 00126 double dataBwServerAvg; 00127 00128 // Data : bandwidth stream 00129 __uint64 dataBwStreamTotal; 00130 double dataBwStreamAvg; 00131 // Data : bandwidth core stream 00132 __uint64 dataBwCoreStreamTotal; 00133 double dataBwCoreStreamAvg; 00134 // Data : bandwidth access stream 00135 __uint64 dataBwAccessStreamTotal; 00136 double dataBwAccessStreamAvg; 00137 // Data : bandwidth access uplink stream 00138 __uint64 dataBwAccessUpStreamTotal; 00139 double dataBwAccessUpStreamAvg; 00140 // Data : bandwidth access downlink stream 00141 __uint64 dataBwAccessDownStreamTotal; 00142 double dataBwAccessDownStreamAvg; 00143 // Data : bandwidth server stream 00144 __uint64 dataBwServerStreamTotal; 00145 double dataBwServerStreamAvg; 00146 00147 // Data : bandwidth control 00148 __uint64 dataBwControlTotal; 00149 double dataBwControlAvg; 00150 // Data : bandwidth core control 00151 __uint64 dataBwCoreControlTotal; 00152 double dataBwCoreControlAvg; 00153 // Data : bandwidth access control 00154 __uint64 dataBwAccessControlTotal; 00155 double dataBwAccessControlAvg; 00156 // Data : bandwidth access uplink control 00157 __uint64 dataBwAccessUpControlTotal; 00158 double dataBwAccessUpControlAvg; 00159 // Data : bandwidth access downlink control 00160 __uint64 dataBwAccessDownControlTotal; 00161 double dataBwAccessDownControlAvg; 00162 // Data : bandwidth server control 00163 __uint64 dataBwServerControlTotal; 00164 double dataBwServerControlAvg; 00165 00166 // Data : host statistics 00167 __uint32 dataCoderEncodedPackets; 00168 __uint32 dataCoderDecodedPackets; 00169 __uint32 dataCoderDiscardedPackets; 00170 00171 __uint32 dataCoderEncodedFrames; 00172 __uint32 dataCoderDecodedFrames; 00173 __uint32 dataCoderDiscardedFrames; 00174 00175 __uint32 dataClientRecvFrames; 00176 __uint32 dataClientDiscardedFrames; 00177 __uint32 dataClientExpectedFrames; 00178 00179 public: 00180 CModelPushSelect( 00181 CModelBandwidth* modelBandwidthUplink, 00182 CModelBandwidth* modelBandwidthDownlink, 00183 CModelChannel* modelChannel, 00184 CModelSelect* modelSelect, 00185 char* name, 00186 __time maxTime, 00187 CTopo* topology, 00188 __uint32 topologyNumber, 00189 __uint32 numHosts, 00190 __uint32 numGateways, 00191 __time delayAccessUpLink, 00192 __time delayAccessDownLink, 00193 __bitrate bwServerUpLink, 00194 __bitrate bwServerDownLink, 00195 __time delayServerUpLink, 00196 __time delayServerDownLink, 00197 __uint32 queueLink, 00198 __uint32 queueLinkServer, 00199 __uint32 numChannels, 00200 __uint32 numLayers, 00201 __uint32 numLayersMin, 00202 __bitrate channelBw, 00203 __byte channelFps, 00204 __byte mpegGopDistanceItoI, 00205 __byte mpegGopDistanceItoP, 00206 __uint32 streamBufferSize, 00207 __uint32 streamBufferSizeHistory, 00208 __uint32 streamBufferSizeBuffering, 00209 __time streamBufferUnderrunTimeout, 00210 double streamBwMargin, 00211 __uint32 bootQueryMax, 00212 __uint32 bootRefreshThreshold, 00213 __time bootQueryTimeout, 00214 __time bootRegisterDelay 00215 ); 00216 virtual ~CModelPushSelect(); 00217 00218 virtual void Init(CSimHandler* sim); 00219 virtual __uint32 Events(); 00220 virtual CSimEvent* Event(__uint32 index, __time& time); 00221 00222 virtual void Finalize(); 00223 00224 virtual int Forward(CAddress router, CAddress dst); 00225 00226 virtual inline __uint32 NumGroups() { return 0; } 00227 00228 virtual inline __uint32 NumChannels() { return this->numChannels; } 00229 virtual inline __uint32 NumLayers() { return this->numLayers; } 00230 virtual inline __uint32 NumLayersMin() { return this->numLayersMin; } 00231 virtual inline __byte MpegGopSize() { return this->mpegGopDistanceItoI; } 00232 00233 virtual inline CChannel* Channel(__uint32 index); 00234 00235 virtual inline __uint32 PeerAddressToIndex(CAddress& address) { return HOST_ADDRESS_INDEX(address.Address()); } 00236 virtual inline CAddress PeerIndexToAddress(__uint32 index) { return CAddress(HOST_INDEX_ADDRESS(index)); } 00237 00238 virtual inline __uint32 StreamBufferSize() { return this->streamBufferSize; } 00239 virtual inline __uint32 StreamBufferSizeHistory() { return this->streamBufferSizeHistory; } 00240 virtual inline __uint32 StreamBufferSizeBuffering() { return this->streamBufferSizeBuffering; } 00241 virtual inline __time StreamBufferUnderrunTimeout() { return this->streamBufferUnderrunTimeout; } 00242 virtual inline double StreamBwMargin() { return this->streamBwMargin; } 00243 00244 virtual inline __uint32 BootQueryMax() { return this->bootQueryMax; } 00245 virtual inline __uint32 BootRefreshThreshold() { return this->bootRefreshThreshold; } 00246 virtual inline __time BootQueryTimeout() { return this->bootQueryTimeout; } 00247 virtual inline __time BootRegisterDelay() { return this->bootRegisterDelay; } 00248 00249 virtual inline __uint16 PortStream() { return 0; } 00250 virtual inline __uint16 PortControl() { return 1; } 00251 00252 virtual inline CModelChannel* ModelChannel() { return this->modelChannel; } 00253 00254 virtual inline CStreamSource* StreamSource(__uint32 index) { assert(index < this->numChannels); return this->streamSources[index]; } 00255 };
Last updated: February 8, 2011