• Main Page
  • Classes
  • Files
  • File List

/Users/yzchen/ns/ns-allinone-2.33/ns-2.33/indep-utils/webtrace-conv/dec/proxytrace.h

00001 #ifndef _PROXYTRACE_H_
00002 #define _PROXYTRACE_H_
00003 
00004 #include <stdio.h>
00005 #include <sys/types.h>
00006 
00007 typedef  unsigned int u_4bytes;       /* unsigned number - 4 bytes */
00008 typedef  unsigned short int u_2bytes; /* unsigned number - 2 bytes */
00009 
00010 typedef int method_t;
00011 
00012 const int METHOD_NONE= 0,
00013         METHOD_GET = 1,
00014         METHOD_POST = 2,
00015         METHOD_HEAD = 3,
00016         METHOD_CONNECT = 4;
00017 
00018 typedef int protocol_t;
00019 const int PROTO_NONE = 0,
00020         PROTO_HTTP = 1,
00021         PROTO_FTP = 2,
00022         PROTO_GOPHER= 3,
00023         PROTO_WAIS = 4, 
00024         PROTO_CACHEOBJ = 5,
00025         PROTO_MAX = 6;
00026 
00027 typedef int pagetype_t;
00028 const int EXT_NONE = 0,
00029         EXT_HTML = 1,
00030         EXT_GIF = 2,
00031         EXT_CGI = 3,
00032         EXT_DATA = 4,
00033         EXT_CLASS = 5,
00034         EXT_MAP = 6,
00035         EXT_JPEG = 7,
00036         EXT_MPEG = 8, 
00037         EXT_OTHER = 9;
00038 
00039 const char *MethodStr(int method);
00040 const char *ProtocolStr(int protocol);
00041 const char *ExtensionStr(int type);     /* the extension (e.g. ".html") */
00042 const char *ExtensionTypeStr(int type); /* the type (e.g. "HTML") */
00043 
00044 /* entry flags */
00045 
00046 #define  NO_PATH_FLAG 1    /* path consists of only / */
00047 #define  PORT_SPECIFIED_FLAG 2
00048 #define  NULL_PATH_ADDED_FLAG 4
00049 #define  QUERY_FOUND_FLAG 8
00050 #define  EXTENSION_SPECIFIED_FLAG 16 
00051 #define  CGI_BIN_FLAG 32
00052 
00053 struct TEntryHeader {
00054         u_4bytes  event_duration;
00055         u_4bytes  server_duration;
00056         u_4bytes  last_mod;
00057         u_4bytes  time_sec;
00058         u_4bytes  time_usec;
00059 
00060         u_4bytes  client;
00061         u_4bytes  server;
00062         u_4bytes  port;
00063         u_4bytes  path;
00064         u_4bytes  query;
00065         u_4bytes  size;
00066 };
00067 
00068 struct TEntryTail {
00069         unsigned short  status;
00070         unsigned  char  type;
00071         unsigned  char  flags;
00072         method_t        method;
00073         protocol_t      protocol;
00074 };
00075 
00076 struct TEntry {
00077         TEntryHeader head;
00078         u_4bytes     url;    /* missing in v1 format */
00079         TEntryTail   tail;
00080 };
00081 
00082 #define  TRACE_HEADER_SIZE 8192
00083 
00084 size_t ReadHeader(FILE *in_file, void *userBuf);
00085 size_t ReadEntry(FILE *in_file, TEntry *entry);
00086 size_t ReadEntryV1(FILE *in_file, TEntry *entry);
00087 
00088 struct URL {
00089         URL(int i, int sd, int sz) : access(1), id(i), sid(sd), size(sz) {}
00090         int access;     // access counts
00091         int id;
00092         int sid, size;
00093 };
00094 
00095 struct ReqLog {
00096         ReqLog() {}
00097         ReqLog(double t, unsigned int c, unsigned int s, unsigned int u) :
00098                 time(t), cid(c), sid(s), url(u) {}
00099         double time;
00100         unsigned int cid, sid, url;
00101 };
00102 
00103 #endif // proxytrace.h
00104 

Generated on Tue Aug 10 2010 16:16:07 for ns-2.33 by  doxygen 1.7.1