Back to index

courier  0.68.2
msghash.h
Go to the documentation of this file.
00001 /*
00002 ** Copyright 1998 - 2000 Double Precision, Inc.
00003 ** See COPYING for distribution information.
00004 */
00005 
00006 #ifndef       msghash_h
00007 #define       msghash_h
00008 
00009 #define       MD5_INTERNAL
00010 #include      <md5/md5.h>
00011 
00012 /* Hash parameters: */
00013 
00014 #define       MSGHASH_MARGIN       3             /* First/last N lines of message which
00015                                    ** are ignored for partial hashes
00016                                    */
00017 #define       MSGHASH_LINESIZE 256        /* Fixed size of the line buffer */
00018 
00019 #define       MSGHASH_HIMARGIN 5
00020        /* Ignore first/last MSGHASH_MARGIN lines for
00021        ** messages larger than MSGHASH_HIMSGHASH_MARGIN */
00022 
00023 
00024 struct msghashinfo {
00025        int    inheader;     /* Flag - in the header */
00026 
00027        unsigned numlines;   /* Num of stripped lines in the message */
00028 
00029        /* Three MD5 hashes are calculated: */
00030 
00031        struct MD5_CONTEXT   c_entire;     /* Entire message */
00032        unsigned long c_entire_cnt;
00033 
00034        struct MD5_CONTEXT   c_top;        /* All but last three lines */
00035        unsigned long c_top_cnt;
00036 
00037        struct MD5_CONTEXT   c_bot;        /* All but top three lines */
00038        unsigned long c_bot_cnt;
00039 
00040        char   linebuf[MSGHASH_MARGIN][MSGHASH_LINESIZE];
00041        char   headerlinebuf[MSGHASH_LINESIZE];
00042        char   cur_header[16];
00043        unsigned linebuf_head, linebuf_tail;
00044        unsigned headerlinebuf_size;
00045        MD5_DIGEST    md1, md2;
00046        } ;
00047 
00048 void msghash_init(struct msghashinfo *);
00049 void msghash_line(struct msghashinfo *, const char *);
00050 void msghash_finish(struct msghashinfo *);
00051 
00052 #endif