X-Git-Url: http://git.harvie.cz/?p=svn%2FPrometheus-QoS%2F.git;a=blobdiff_plain;f=htmlandlogs.c;h=431d044bf3d36fb53ada3ae48340152c5744c613;hp=b6f9cb66602c080c23b220dd177cd2076a95df98;hb=HEAD;hpb=9f552e96b7c3ed1b5af6578252c0154491132a10 diff --git a/htmlandlogs.c b/htmlandlogs.c index b6f9cb6..431d044 100644 --- a/htmlandlogs.c +++ b/htmlandlogs.c @@ -18,10 +18,11 @@ extern int dry_run; extern int qos_proxy; extern char *title; extern char *log_url; -extern int found_lmsid; +extern int found_code; extern char *lms_url; extern char *log_dir; extern char *ip6prefix; +extern int traffic_detected; const char *tr_odd_even(void); /* implemented in prometheus.c, shared with parselogs.c */ @@ -41,9 +42,9 @@ void append_log(struct IP *self) /*using global variables*/ f = fopen(str, "a"); if(f > 0) { - fprintf(f, "%ld\t%s\t%Lu\t%Lu\t%Lu\t%Lu\t%d\t%d\t%d\t%d\t%s", + fprintf(f, "%ld\t%s\t%Lu\t%Lu\t%Lu\t%Lu\t%d\t%d\t%d\t%s\t%s", time(NULL), self->name, self->traffic, self->direct, self->proxy, - self->upload, self->min, self->max, self->desired, self->lmsid, d); /* d = date*/ + self->upload, self->min, self->max, self->desired, self->code, d); /* d = date*/ fclose(f); } else @@ -124,7 +125,7 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview) i=0; if(f > 0) { - unsigned long long total_traffic=0, total_direct=0, total_proxy=0, total_upload=0, tmp_sum = 0; + unsigned long long total_traffic = 1 /* prevent divide by zero */ , total_direct=0, total_proxy=0, total_upload=0, tmp_sum = 0; unsigned long long total_pktup = 0, total_pktdown = 0; int active_classes = 0; // int colspan = 14; @@ -132,7 +133,7 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview) int agreg_count = 0, limit_count = 0, prio_count = 0; int popup_button = 0; /* IPv6 vs. IPv4 stats */ - unsigned long long pkts4 =0, pkts6 = 0, bytes4 = 0, bytes6 = 0; + unsigned long long pkts4 = 1, pkts6 = 1 /*prevent divide by zero */, bytes4 = 0, bytes6 = 0; int count4 = 0, count6 = 0; int mpkts; double perc6; @@ -254,15 +255,15 @@ style=\"cursor: pointer;\">+%d]", fputs("\n",f); /* ----------------------------------------------- */ - if(found_lmsid) + if(found_code) { fputs("",f); - if(ip->lmsid > 0) + if(ip->code[0]) { - fprintf(f, "%04d\n", - lms_url, ip->lmsid, ip->lmsid); + fprintf(f, "%s\n", + lms_url, ip->code, ip->code); } - else if(ip->lmsid == 0) + else if(ip->code[0] == 0) { fputs("------",f); } @@ -402,7 +403,7 @@ style=\"cursor: pointer;\">+%d]", insert(sum,sums,order_by,i); } - if(!just_preview) + if(!just_preview && traffic_detected) { append_log(ip); for_each(sharedip,ips) if(eq(ip->name, sharedip->sharing)) @@ -410,6 +411,10 @@ style=\"cursor: pointer;\">+%d]", append_log(sharedip); } } + else + { + printf("."); + } } fprintf(f, "\n\ %d CLASSES", i);