basic ipset support for qos-free-zone
[svn/Prometheus-QoS/.git] / htmlandlogs.c
index 39a4286abd51192fbcfda7e3542588be5d66627d..798544db52b6e0480dbe4166625c5cb3228057fb 100644 (file)
@@ -14,7 +14,6 @@ extern const char *version;
 extern const char *stats_html_signature;\r
 extern char *jquery_url;\r
 extern int keywordcount;\r
-extern long long int line;\r
 extern int dry_run;\r
 extern int qos_proxy;\r
 extern char *title;\r
@@ -23,6 +22,7 @@ extern int found_lmsid;
 extern char *lms_url;\r
 extern char *log_dir;\r
 extern char *ip6prefix;\r
+extern int traffic_detected;\r
 \r
 const char *tr_odd_even(void);\r
 /* implemented in prometheus.c, shared with parselogs.c */\r
@@ -100,19 +100,19 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
    count++; \r
   }\r
 #ifdef DEBUG\r
-   printf("Total groups: %d Total bandwidth requested: %d kb/s\nAGGREGATION: 1/%d\n",\r
-          count, i, i/line);\r
+   printf("Total groups: %d Total bandwidth requested: %d kb/s\n",\r
+          count, i, i);\r
 #endif\r
    fprintf(f,"</tr></tbody>\n\\r
 <thead><tr>\n\\r
-<th colspan=\"2\" style=\"text-align: left\">Line %Ld kb/s</td>",line);\r
+<th colspan=\"2\" style=\"text-align: left\"></td>");\r
    fprintf(f,"<th style=\"text-align: right\">%d</td><th style=\"text-align: right\">%d kb/s</td>",total,i);\r
 \r
    for_each(keyword, keywords) if(keyword->ip_count)\r
    {\r
     fprintf(f,"<th style=\"text-align: right\">%d IPs</th>",keyword->ip_count);\r
    }\r
-   fprintf(f,"</tr><tr><th colspan=\"4\">Aggregation 1/%d</th>\n", (int)(0.5+i/line));\r
+   fprintf(f,"</tr><tr><th colspan=\"4\"></th>\n");\r
    fprintf(f,"<th colspan=\"%d\">%d traffic classes</th></tr>\n", keywordcount, total);\r
 \r
    fputs("</thead></table>\n",f);\r
@@ -130,7 +130,7 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
   int active_classes = 0;\r
 //  int colspan = 14;\r
   struct Sum {unsigned long long l; int i; list(Sum);} *sum,*sums = NULL;\r
-  int limit_count = 0, prio_count = 0;\r
+  int agreg_count = 0, limit_count = 0, prio_count = 0;\r
   int popup_button = 0;\r
   /* IPv6 vs. IPv4 stats */\r
   unsigned long long pkts4 =0, pkts6 = 0, bytes4 = 0, bytes6 = 0;\r
@@ -197,7 +197,13 @@ $(\'#pktsup_\'+n).show();\
    char *f1="", *f2="";\r
    i++;\r
 \r
-   if(ip->max < ip->desired) \r
+   if(ip->aggregated > 1)\r
+   {\r
+    f1 = "<span style=\"color:green\">";\r
+    f2 = "</span>";   \r
+    agreg_count++;\r
+   }\r
+   else if(ip->max < ip->desired) \r
    {\r
     f1 = "<span style=\"color:red\">";\r
     f2 = "</span>"; \r
@@ -232,8 +238,8 @@ $(\'#pktsup_\'+n).show();\
 \r
      for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && sharedip->v6) /* IPv6 only */\r
      {\r
-      fprintf(f, "<br /><a class=\"blue\" target=\"_blank\" href=\"%s%s.log\">%s/64</a>\n", \r
-                 log_url, sharedip->addr, sharedip->addr);\r
+      fprintf(f, "<br /><a class=\"blue\" target=\"_blank\" href=\"%s%s.log\">%s/%d</a>\n", \r
+                 log_url, sharedip->addr, sharedip->addr, sharedip->mask);\r
       popup_button++;\r
      }\r
 \r
@@ -259,7 +265,7 @@ style=\"cursor: pointer;\">+%d</a>]</span>",
     }\r
     else if(ip->lmsid == 0)\r
     {\r
-     fputs("-------",f);\r
+     fputs("------",f);\r
     }\r
     fputs("</td>\n",f);\r
    }\r
@@ -397,7 +403,7 @@ style=\"cursor: pointer;\">+%d</a>]</span>",
     insert(sum,sums,order_by,i);\r
    }\r
 \r
-   if(!just_preview)\r
+   if(!just_preview && traffic_detected)\r
    {\r
     append_log(ip);\r
     for_each(sharedip,ips) if(eq(ip->name, sharedip->sharing))\r
@@ -405,6 +411,10 @@ style=\"cursor: pointer;\">+%d</a>]</span>",
      append_log(sharedip);\r
     }\r
    }\r
+   else\r
+   {\r
+    printf(".");\r
+   }\r
   }\r
   fprintf(f, "</tbody><thead><tr>\n\\r
 <th colspan=\"5\" style=\"text-align: left\">%d CLASSES</th>", i);\r
@@ -419,9 +429,11 @@ style=\"cursor: pointer;\">+%d</a>]</span>",
 */\r
   fprintf(f, "<th style=\"text-align: right\">%Lu</th><th style=\"text-align: right\">%d</th>",\r
              total_direct, total_pktdown/i);\r
-  fprintf(f, "<th colspan=\"6\"><span style=\"color:red\">LIMIT %dx</span> \\r
-<span style=\"color:brown\">LOW-PRIO %dx</span></th></tr>\n</thead></table>\n",\r
-             limit_count, prio_count);\r
+  fprintf(f, "<th colspan=\"6\">\\r
+<span style=\"color:green\">AGR %dx</span> \\r
+<span style=\"color:red\">FUP %dx</span> \\r
+<span style=\"color:brown\">PRIO %dx</span></th></tr>\n</thead></table>\n",\r
+             agreg_count, limit_count, prio_count);\r
 \r
   if(ip6prefix)\r
   { \r
This page took 0.143423 seconds and 4 git commands to generate.