00001 /* 00002 * COPYRIGHT AND DISCLAIMER 00003 * 00004 * Copyright (C) 1996-1997 by the Regents of the University of California. 00005 * 00006 * IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR 00007 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT 00008 * OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, 00009 * EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00010 * 00011 * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 00012 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 00013 * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS 00014 * PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO 00015 * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 00016 * MODIFICATIONS. 00017 * 00018 * For inquiries email Steve Gribble <gribble@cs.berkeley.edu>. 00019 */ 00020 00021 /* 00022 * Author: Steve Gribble 00023 * Date: Nov. 23rd, 1996 00024 * File: logparse.h 00025 */ 00026 00027 #include <stdio.h> 00028 #include <stdlib.h> 00029 #include <string.h> 00030 #include <ctype.h> 00031 00032 #include "config.h" 00033 00034 #ifndef PB_LOGPARSE_H 00035 #define PB_LOGPARSE_H 00036 00037 /* 00038 EVERYTHING below is in NETWORK (yes, NETWORK) order. If something 00039 is undefined in the traces, it is represented by FF...FF. For 00040 example, an undefined client pragma is 0xFF, and an undefinfed 00041 server last response time is 0xFFFFFFFF. 00042 00043 Version 1 trace records do not have pragmas, modified dates, or expiry 00044 dates. Version 2 records have the PG_CLNT_NO_CACHE, PG_CLNT_KEEP_ALIVE 00045 pragmas, and no dates. Version 3 records have all pragmas and dates. 00046 */ 00047 00048 #define PB_CLNT_NO_CACHE 1 00049 #define PB_CLNT_KEEP_ALIVE 2 00050 #define PB_CLNT_CACHE_CNTRL 4 00051 #define PB_CLNT_IF_MOD_SINCE 8 00052 #define PB_CLNT_UNLESS 16 00053 00054 #define PB_SRVR_NO_CACHE 1 00055 #define PB_SRVR_CACHE_CNTRL 2 00056 #define PB_SRVR_EXPIRES 4 00057 #define PB_SRVR_LAST_MODIFIED 8 00058 00059 typedef struct lf_entry_st { 00060 unsigned char version; /* Trace record version */ 00061 UINT32 crs; /* client request seconds */ 00062 UINT32 cru; /* client request microseconds */ 00063 UINT32 srs; /* server first response byte seconds */ 00064 UINT32 sru; /* server first response byte microseconds */ 00065 UINT32 sls; /* server last response byte seconds */ 00066 UINT32 slu; /* server last response byte microseconds */ 00067 UINT32 cip; /* client IP address */ 00068 UINT16 cpt; /* client port */ 00069 UINT32 sip; /* server IP address */ 00070 UINT16 spt; /* server port */ 00071 unsigned char cprg; /* client headers/pragmas */ 00072 unsigned char sprg; /* server headers/pragmas */ 00073 /* If a date is FFFFFFFF, it was missing/unreadable/unapplicable in trace */ 00074 UINT32 cims; /* client IF-MODIFIED-SINCE date, if applicable */ 00075 UINT32 sexp; /* server EXPIRES date, if applicable */ 00076 UINT32 slmd; /* server LAST-MODIFIED, if applicable */ 00077 UINT32 rhl; /* response HTTP header length */ 00078 UINT32 rdl; /* response data length, not including header */ 00079 UINT16 urllen; /* url length, not including NULL term */ 00080 unsigned char *url; /* request url, e.g. "GET / HTTP/1.0", + '\0' */ 00081 } lf_entry; 00082 00083 //#ifdef __cplusplus 00084 //extern "C" { 00085 //#endif 00086 int lf_get_next_entry(int logfile_fd, lf_entry *nextentry, int vers); 00087 void lf_convert_order(lf_entry *convertme); 00088 int lf_write(FILE *outf, lf_entry *writeme); 00089 void lf_dump(FILE *dumpf, lf_entry *dumpme); 00090 void lf_ntoa(unsigned long addr, char *addrbuf); 00091 //#ifdef __cplusplus 00092 //} 00093 //#endif 00094 00095 #endif