/* Call bprobe to get the bottleneck available bandwidth */ #include "smrt.h" #include #include #include #include #include #include /***** FUNCTION PROTOTYPES *****/ FILE *OpenFile2(char *fname, char *access_mode); /***** PROGRAM's MAIN DRIVER *****/ void BprobeCall(char *listFileName) { FILE *OUTFILE; FILE *Ifile; FILE *RFile; char sitename[100]; char Ln[300]; char PingInstruction[200]; char *sites[100]; float band[100]; float TripTime[100]; float min=0,average=0,max=0; float bandwidth; // available bandwidth float times; // round trip time int sitenum=0; int i=0; int retry=0; // how many times to probe Ifile = OpenFile2(listFileName, "r"); while (fscanf(Ifile,"%s %f %f\n",sitename,&bandwidth,×) != EOF) { printf("%s\n",sitename); sites[sitenum]= malloc(strlen(sitename)+1); strcpy(sites[sitenum],sitename); band[sitenum] = bandwidth; TripTime[sitenum] = times; // measure the bottleneck bandwidth bandwidth = -1.0; retry = 4; /* DISABLE RETRIES */ while ((bandwidth <= 0.0) && (retry++ < 5)) { bandwidth = bprobe(sitename); } if (bandwidth > 0.0 && (band[sitenum] < bandwidth)) { band[sitenum] = bandwidth; } sitenum++; } fclose(Ifile); OUTFILE = OpenFile2(listFileName, "w"); while (i