1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
#include "dostraffic.h"
void CBRTrafficGen(int NetworkDia, double H, int NoAttackers, int Master, double rate, struct DDOS_Traffic *traffic){
struct flow_list *listroot = NULL;
int no_hops;
double flow,delay,total_bw;
int i,cntr;
for(i=0;i<NoAttackers;i++){
no_hops = Power_law_no_hops(NetworkDia,H);
if(Master==1)
no_hops+=Power_law_no_hops(NetworkDia,H);
delay = (double) no_hops;
flow = rate;
flow_list_insert(delay,flow,&listroot);
cntr++;
}
traffic->Events = get_all_events(listroot);
traffic->NoEvents = get_no_events(listroot);
}
void CBRTrafficInet(int NetworkDia, int NoAttackers, int Master, double rate, struct DDOS_Traffic *traffic){
struct flow_list *listroot = NULL;
int no_hops;
double flow,delay,total_bw;
int i,cntr;
for(i=0;i<NoAttackers;i++){
no_hops = Inet_default_no_hops(NetworkDia);
if(Master==1)
no_hops+=Inet_default_no_hops(NetworkDia);
delay = (double) no_hops;
flow = rate;
flow_list_insert(delay,flow,&listroot);
cntr++;
}
traffic->Events = get_all_events(listroot);
traffic->NoEvents = get_no_events(listroot);
}
|