00001
#ifndef TEST_CACHING_PROXY_H
00002
#define TEST_CACHING_PROXY_H
00003
00004
#include <config.h>
00005
00006
#include "MNRTSPServer.h"
00007
#include "MNTimer.h"
00008
#include "MNTimerCall.h"
00009
#include "MNString.h"
00010
00011
class ControlBase;
00012
00013 class TestCachingProxy :
public MNRTSPServer
00014 {
00015
class Probability;
00016
00017
ControlBase* _dummyUplink;
00018 size_t _no_of_requests;
00019 Probability* _prob;
00020
00021
MNTimer _timer;
00022
struct timeval _interarrival_time;
00023
00024
TimerCall<TestCachingProxy> _new_request;
00025
00026
public:
00027
TestCachingProxy();
00028
~TestCachingProxy();
00029
00032
void ListenClient();
00033
00038
virtual ControlBase*
getFillBufferTo(
const MNString& serverUrl );
00039
00040
private:
00041
void newRequest(
void* data,
TimerCallBase*
self );
00042
00043
private:
00044
class Probability
00045 {
00046
public:
00047
virtual int draw( ) = 0;
00048 };
00049
00050
class ProbabilityCycle :
public Probability
00051 {
00052
const int _num;
00053
int _current;
00054
00055
public:
00056 ProbabilityCycle(
int num );
00057
virtual int draw( );
00058 };
00059
00060
class ProbabilityZipf :
public Probability
00061 {
00065
double* _probabilities;
00066
00067
public:
00068 ProbabilityZipf(
int num );
00069
virtual ~ProbabilityZipf( );
00070
virtual int draw( );
00071 };
00072
00073
class ProbabilityUnified :
public Probability
00074 {
00075
const int _num;
00076
double _share;
00077
00078
public:
00079 ProbabilityUnified(
int num );
00080
virtual int draw( );
00081 };
00082 };
00083
00084
#endif
00085