File: formsquid.cc

package info (click to toggle)
ns2 2.35%2Bdfsg-2.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 78,780 kB
  • ctags: 27,490
  • sloc: cpp: 172,923; tcl: 107,130; perl: 6,391; sh: 6,143; ansic: 5,846; makefile: 816; awk: 525; csh: 355
file content (46 lines) | stat: -rw-r--r-- 1,343 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdio.h>

#include "proxytrace.h"


/* emulates a query part of a URL */
const char *make_query(u_4bytes query) {
	static char buf[128];

	sprintf(buf, "?%d", query);

	return buf;
}

/* emulates a port part of a URL */
const char *make_port(u_4bytes port) {
	static char buf[128];

	sprintf(buf, ":%d", port);

	return buf;
}

void PrintEntry_Squid(FILE *out_file, TEntry *entry, int swap) {

	u_4bytes duration = ((entry -> head.event_duration+500)/1000); /* milliseconds */

	fprintf(stdout, "%9d.%06u %d %d %s/%d %d %s %s://%d%s/%s%d%s%s %s %s/%d\n",
		entry -> head.time_sec, entry -> head.time_usec,
		(( swap) ? entry -> head.client : duration),
		((!swap) ? entry -> head.client : duration),
		"NONE", /* Log Tag is missing */
		entry -> tail.status,
		entry -> head.size,
		MethodStr(entry -> tail.method),
        ProtocolStr(entry -> tail.protocol),
		entry -> head.server,
		((entry -> tail.flags & PORT_SPECIFIED_FLAG) ? make_port(entry -> head.port) : ""),
		((entry -> tail.flags & CGI_BIN_FLAG) ? "cgi_bin/" : ""),
		entry -> head.path,
		((entry -> tail.flags & EXTENSION_SPECIFIED_FLAG) ? ExtensionStr(entry -> tail.type) : ""),
		((entry -> tail.flags & QUERY_FOUND_FLAG) ? make_query(entry -> head.query) : ""),
		"-", /* Ident is missing */
		"DIRECT", /* assuming direct retrieval */
		entry -> head.server);
}