logparse.h
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:4k
源码类别:

通讯编程

开发平台:

Visual C++

  1. /* 
  2.  * COPYRIGHT AND DISCLAIMER
  3.  * 
  4.  * Copyright (C) 1996-1997 by the Regents of the University of California.
  5.  *
  6.  * IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
  7.  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
  8.  * OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
  9.  * EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  10.  * 
  11.  * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
  12.  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
  13.  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS
  14.  * PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO
  15.  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
  16.  * MODIFICATIONS.
  17.  *
  18.  * For inquiries email Steve Gribble <gribble@cs.berkeley.edu>.
  19.  */
  20. /*
  21.  *     Author: Steve Gribble
  22.  *       Date: Nov. 23rd, 1996
  23.  *       File: logparse.h
  24.  */
  25. #include <stdio.h>
  26. #include <stdlib.h>
  27. #include <string.h>
  28. #include <ctype.h>
  29. #include "config.h"
  30. #ifndef PB_LOGPARSE_H
  31. #define PB_LOGPARSE_H
  32. /* 
  33.    EVERYTHING below is in NETWORK (yes, NETWORK) order.  If something
  34.    is undefined in the traces, it is represented by FF...FF.  For
  35.    example, an undefined client pragma is 0xFF, and an undefinfed
  36.    server last response time is 0xFFFFFFFF.
  37.    Version 1 trace records do not have pragmas, modified dates, or expiry
  38.    dates.  Version 2 records have the PG_CLNT_NO_CACHE, PG_CLNT_KEEP_ALIVE
  39.    pragmas, and no dates.  Version 3 records have all pragmas and dates.
  40. */
  41. #define PB_CLNT_NO_CACHE       1
  42. #define PB_CLNT_KEEP_ALIVE     2
  43. #define PB_CLNT_CACHE_CNTRL    4
  44. #define PB_CLNT_IF_MOD_SINCE   8
  45. #define PB_CLNT_UNLESS         16
  46. #define PB_SRVR_NO_CACHE       1
  47. #define PB_SRVR_CACHE_CNTRL    2
  48. #define PB_SRVR_EXPIRES        4
  49. #define PB_SRVR_LAST_MODIFIED  8
  50. typedef struct lf_entry_st {
  51.   unsigned char  version; /* Trace record version */
  52.   UINT32 crs;             /* client request seconds */
  53.   UINT32 cru;             /* client request microseconds */
  54.   UINT32 srs;             /* server first response byte seconds */
  55.   UINT32 sru;             /* server first response byte microseconds */
  56.   UINT32 sls;             /* server last response byte seconds */
  57.   UINT32 slu;             /* server last response byte microseconds */
  58.   UINT32 cip;             /* client IP address */
  59.   UINT16 cpt;             /* client port */
  60.   UINT32 sip;             /* server IP address */
  61.   UINT16 spt;             /* server port */
  62.   unsigned char  cprg;    /* client headers/pragmas */
  63.   unsigned char  sprg;    /* server headers/pragmas */
  64.   /* If a date is FFFFFFFF, it was missing/unreadable/unapplicable in trace */
  65.   UINT32 cims;            /* client IF-MODIFIED-SINCE date, if applicable */
  66.   UINT32 sexp;            /* server EXPIRES date, if applicable */
  67.   UINT32 slmd;            /* server LAST-MODIFIED, if applicable */
  68.   UINT32 rhl;             /* response HTTP header length */
  69.   UINT32 rdl;             /* response data length, not including header */
  70.   UINT16 urllen;          /* url length, not including NULL term */
  71.   unsigned char *url;     /* request url, e.g. "GET / HTTP/1.0", + '' */
  72. } lf_entry;
  73. //#ifdef __cplusplus
  74. //extern "C" {
  75. //#endif
  76. int  lf_get_next_entry(int logfile_fd, lf_entry *nextentry, int vers);
  77. void lf_convert_order(lf_entry *convertme);
  78. int  lf_write(FILE *outf, lf_entry *writeme);
  79. void lf_dump(FILE *dumpf, lf_entry *dumpme);
  80. void lf_ntoa(unsigned long addr, char *addrbuf);
  81. //#ifdef __cplusplus
  82. //}
  83. //#endif
  84. #endif