formsquid.cc

Go to the documentation of this file.
00001 #include <stdio.h>
00002 
00003 #include "proxytrace.h"
00004 
00005 
00006 /* emulates a query part of a URL */
00007 const char *make_query(u_4bytes query) {
00008     static char buf[128];
00009 
00010     sprintf(buf, "?%d", query);
00011 
00012     return buf;
00013 }
00014 
00015 /* emulates a port part of a URL */
00016 const char *make_port(u_4bytes port) {
00017     static char buf[128];
00018 
00019     sprintf(buf, ":%d", port);
00020 
00021     return buf;
00022 }
00023 
00024 void PrintEntry_Squid(FILE *out_file, TEntry *entry, int swap) {
00025 
00026     u_4bytes duration = ((entry -> head.event_duration+500)/1000); /* milliseconds */
00027 
00028     fprintf(stdout, "%9d.%06u %d %d %s/%d %d %s %s://%d%s/%s%d%s%s %s %s/%d\n",
00029         entry -> head.time_sec, entry -> head.time_usec,
00030         (( swap) ? entry -> head.client : duration),
00031         ((!swap) ? entry -> head.client : duration),
00032         "NONE", /* Log Tag is missing */
00033         entry -> tail.status,
00034         entry -> head.size,
00035         MethodStr(entry -> tail.method),
00036         ProtocolStr(entry -> tail.protocol),
00037         entry -> head.server,
00038         ((entry -> tail.flags & PORT_SPECIFIED_FLAG) ? make_port(entry -> head.port) : ""),
00039         ((entry -> tail.flags & CGI_BIN_FLAG) ? "cgi_bin/" : ""),
00040         entry -> head.path,
00041         ((entry -> tail.flags & EXTENSION_SPECIFIED_FLAG) ? ExtensionStr(entry -> tail.type) : ""),
00042         ((entry -> tail.flags & QUERY_FOUND_FLAG) ? make_query(entry -> head.query) : ""),
00043         "-", /* Ident is missing */
00044         "DIRECT", /* assuming direct retrieval */
00045         entry -> head.server);
00046 }

Generated on Tue Mar 6 16:47:45 2007 for ns2 Network Simulator 2.29 by  doxygen 1.4.6