X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=htmlandlogs.c;h=431d044bf3d36fb53ada3ae48340152c5744c613;hb=296d0585b23ee7c91267d0cb9238dce836106180;hp=2cb7898b5431cb44a02dff5d9dfbdc34ebffe87f;hpb=3856be6ab5f6ada6c64a059a61da74d65122592e;p=svn%2FPrometheus-QoS%2F.git
diff --git a/htmlandlogs.c b/htmlandlogs.c
index 2cb7898..431d044 100644
--- a/htmlandlogs.c
+++ b/htmlandlogs.c
@@ -14,15 +14,15 @@ extern const char *version;
extern const char *stats_html_signature;
extern char *jquery_url;
extern int keywordcount;
-extern long long int line;
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 */
@@ -42,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
@@ -100,19 +100,19 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
count++;
}
#ifdef DEBUG
- printf("Total groups: %d Total bandwidth requested: %d kb/s\nAGGREGATION: 1/%d\n",
- count, i, i/line);
+ printf("Total groups: %d Total bandwidth requested: %d kb/s\n",
+ count, i, i);
#endif
fprintf(f,"\n\
\n\
- Line %Ld kb/s",line);
+ ");
fprintf(f," %d %d kb/s",total,i);
for_each(keyword, keywords) if(keyword->ip_count)
{
fprintf(f," %d IPs ",keyword->ip_count);
}
- fprintf(f,"Aggregation 1/%d \n", (int)(0.5+i/line));
+ fprintf(f," \n", keywordcount, total);
fputs("\n",f);
@@ -125,15 +125,15 @@ 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;
struct Sum {unsigned long long l; int i; list(Sum);} *sum,*sums = NULL;
- int limit_count = 0, prio_count = 0;
+ 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;
@@ -197,7 +197,13 @@ $(\'#pktsup_\'+n).show();\
char *f1="", *f2="";
i++;
- if(ip->max < ip->desired)
+ if(ip->aggregated > 1)
+ {
+ f1 = "";
+ f2 = "";
+ agreg_count++;
+ }
+ else if(ip->max < ip->desired)
{
f1 = "";
f2 = "";
@@ -249,15 +255,15 @@ style=\"cursor: pointer;\">+%d]",
fputs("\n",f);
/* ----------------------------------------------- */
- if(found_lmsid)
+ if(found_code)
{
fputs("\n");
fprintf(f," %d traffic classes