IPv6 support: step 1. prometheus.conf + hosts parsing
[svn/Prometheus-QoS/.git] / htmlandlogs.c
index f624a48442c56c3d508c1b01f149de98f8b9d061..8bcfe71f2e36832e0633eae6ac79e895ab543a02 100644 (file)
@@ -50,7 +50,7 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
 {\r
  int i;\r
  char *str;\r
 {\r
  int i;\r
  char *str;\r
- FILE *f=fopen(html,"w");\r
+ FILE *f=fopen(html, "w");\r
 \r
  string(str,STRLEN); \r
  if(f > 0)\r
 \r
  string(str,STRLEN); \r
  if(f > 0)\r
@@ -58,10 +58,6 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
   int count=1;\r
   i=0;\r
 \r
   int count=1;\r
   i=0;\r
 \r
-  /*-----------------------------------------------------------------*/\r
-  printf("Writing statistics summary into HTML page %s ...\n", html);\r
-  /*-----------------------------------------------------------------*/\r
-\r
   if(use_jquery_popups)\r
   {\r
    fprintf(f,"<script type=\"text/javascript\" src=\"%s\"></script>\n", jquery_url);\r
   if(use_jquery_popups)\r
   {\r
    fprintf(f,"<script type=\"text/javascript\" src=\"%s\"></script>\n", jquery_url);\r
@@ -195,11 +191,16 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
    {\r
      fprintf(f,"<span id=\"sharing_%d\" style=\"display:none\">",i);\r
      popup_button=0;\r
    {\r
      fprintf(f,"<span id=\"sharing_%d\" style=\"display:none\">",i);\r
      popup_button=0;\r
-     for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing))\r
+     for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && !strchr(sharedip->addr,':')) /* IPv4 only */\r
      {\r
       fprintf(f,"<br /><a class=\"blue\" target=\"_blank\" href=\"%s%s.log\">%s</a>\n", log_url, sharedip->name, sharedip->name);\r
       popup_button++;\r
      }\r
      {\r
       fprintf(f,"<br /><a class=\"blue\" target=\"_blank\" href=\"%s%s.log\">%s</a>\n", log_url, sharedip->name, sharedip->name);\r
       popup_button++;\r
      }\r
+     for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && !strchr(sharedip->addr,'.')) /* IPv6 only */\r
+     {\r
+      fprintf(f,"<br /><a class=\"blue\" target=\"_blank\" href=\"%s%s.log\">%s</a>\n", log_url, sharedip->name, sharedip->addr);\r
+      popup_button++;\r
+     }\r
      fputs("</span>\n",f);\r
      if(popup_button)\r
      {\r
      fputs("</span>\n",f);\r
      if(popup_button)\r
      {\r
@@ -225,8 +226,7 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
    }\r
    fprintf(f,"<td style=\"text-align: right\">%Lu</td>\n", ip->credit);\r
    fprintf(f,"<td style=\"text-align: right\"><span style=\"color:#%s\">%Lu</span></td>",\r
    }\r
    fprintf(f,"<td style=\"text-align: right\">%Lu</td>\n", ip->credit);\r
    fprintf(f,"<td style=\"text-align: right\"><span style=\"color:#%s\">%Lu</span></td>",\r
-             ip->keyword->html_color,\r
-             ip->credit+(ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20)));\r
+             ip->keyword->html_color, ip->realquota);\r
    fprintf(f,"<td style=\"text-align: right\">%s%Lu%s", f1, ip->traffic, f2);\r
 \r
    /* download --------------------------------------- */\r
    fprintf(f,"<td style=\"text-align: right\">%s%Lu%s", f1, ip->traffic, f2);\r
 \r
    /* download --------------------------------------- */\r
@@ -234,7 +234,11 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
    if(use_jquery_popups)\r
    {\r
      fprintf(f,"<span id=\"download_%d\" style=\"display:none\">",i);\r
    if(use_jquery_popups)\r
    {\r
      fprintf(f,"<span id=\"download_%d\" style=\"display:none\">",i);\r
-     for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing))\r
+     for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && !strchr(sharedip->addr,':')) /* IPv4 only */\r
+     {\r
+      fprintf(f,"<br />%Lu", sharedip->direct);\r
+     }\r
+     for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && !strchr(sharedip->addr,'.')) /* IPv6 only */\r
      {\r
       fprintf(f,"<br />%Lu", sharedip->direct);\r
      }\r
      {\r
       fprintf(f,"<br />%Lu", sharedip->direct);\r
      }\r
@@ -252,7 +256,11 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
    if(use_jquery_popups)\r
    {\r
      fprintf(f,"<span id=\"upload_%d\" style=\"display:none\">",i);\r
    if(use_jquery_popups)\r
    {\r
      fprintf(f,"<span id=\"upload_%d\" style=\"display:none\">",i);\r
-     for_each(sharedip,ips) if(eq(ip->name, sharedip->sharing))\r
+     for_each(sharedip,ips) if(eq(ip->name, sharedip->sharing) && !strchr(sharedip->addr,':')) /* IPv4 only */\r
+     {\r
+      fprintf(f,"<br />%Lu", sharedip->upload);\r
+     }\r
+     for_each(sharedip,ips) if(eq(ip->name, sharedip->sharing) && !strchr(sharedip->addr,'.')) /* IPv6 only */\r
      {\r
       fprintf(f,"<br />%Lu", sharedip->upload);\r
      }\r
      {\r
       fprintf(f,"<br />%Lu", sharedip->upload);\r
      }\r
This page took 0.120544 seconds and 4 git commands to generate.