//This file outputs a ns file for a dumbell network to be used for //DDOS experiments. /*the input file is a script file which is read by the program to get the parameters of the network. A typical file example d (diameter of the network) H (hurtz parameter) n1 (no of incoming TCP nodes) rate (rate) n2 (no. of DDOS attackers in the subtree) master (0/1) rate (rate) */ #include #include #include "dosdbell.h" void set_Topology(FILE *filer); void TCL_Write_Initial(FILE *); void TCL_Write_Nodes(FILE *); void TCL_Write_Connections(FILE*); void TCL_Write_Agents(FILE *); void TCL_Write_DDOS_Agent(FILE*); void TCL_Write_Final(FILE*); struct Topology topo; int diameter; double TCP_start_time; double DDOS_start_time; double finish_time; double bw; int pack_size; float bn_delay; float bn_bw ; main(int argc, char **argv){ FILE *filer; if(argc !=3){ printf("USAGE: %s parameter_filename tcloutput_filename\n",argv[0]); exit(0); } else{ filer = fopen(argv[1],"r"); set_Topology(filer); fclose(filer); filer = fopen(argv[2],"w"); TCL_Write_Initial(filer); TCL_Write_Nodes(filer); TCL_Write_Connections(filer); TCL_Write_Agents(filer); TCL_Write_DDOS_Agent(filer); TCL_Write_Final(filer); fclose(filer); } } void set_Topology(FILE *filer){ double perT, perFTP, perCBR, perV; int i; double H; double rnd; int attackNo,master; double DDOSRate; double hop; fscanf(filer,"%d %f %f\n",&diameter,&bn_bw,&bn_delay); fscanf(filer,"%d %lf %lf\n",&topo.TCPNodes.NoNodes,&bw,&TCP_start_time); topo.TCPNodes.TCPNode = (struct TCP_Node_Info *)malloc(topo.TCPNodes.NoNodes*sizeof(struct TCP_Node_Info)); for(i=0;i