Back to index

courier  0.68.2
Classes | Defines | Functions
duphash.h File Reference
#include "msghash.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  duphashinfo
struct  duphashmsginfo
struct  duphash

Defines

#define MAXMSGIDSIZE   128 /* Max size of message ID */

Functions

void duphash_init (struct duphash *, unsigned, unsigned)
int duphash_check (struct duphash *, MD5_DIGEST *, const char *, int, void(*)(const char *))

Class Documentation

struct duphashinfo

Definition at line 18 of file duphash.h.

Collaboration diagram for duphashinfo:
Class Members
struct duphashmsginfo * firstmsg
struct duphashmsginfo * lastmsg
MD5_DIGEST md5
unsigned ndupmsgs
struct duphashinfo * next
unsigned nmsgs
struct duphashinfo * prev
struct duphashmsginfo

Definition at line 36 of file duphash.h.

Collaboration diagram for duphashmsginfo:
Class Members
char cancelled
char dupmsg
struct duphashinfo * hash
char msgid
struct duphashmsginfo * next
struct duphashmsginfo * prev
struct duphash

Definition at line 47 of file duphash.h.

Collaboration diagram for duphash:
Class Members
unsigned duphashbufsize
unsigned duplevel
struct duphashinfo * freelist
struct duphashinfo * hashbuckets
struct duphashinfo * hashesbuf
unsigned head
struct duphashmsginfo * msgsbuf
unsigned tail

Define Documentation

#define MAXMSGIDSIZE   128 /* Max size of message ID */

Definition at line 14 of file duphash.h.


Function Documentation

int duphash_check ( struct duphash ,
MD5_DIGEST ,
const char *  ,
int  ,
void(*)(const char *)   
)

Definition at line 162 of file duphash.c.

{
struct duphashmsginfo *msgp=dup_addhead(p, d, is_submit_dupe);
int    cancelled=0;

       /* Finish initialized msgp */

       msgp->cancelled=0;
       msgp->msgid[0]=0;
       strncat(msgp->msgid, msgid, sizeof(msgp->msgid)-1);

       if ((msgp->next && msgp->next->cancelled) ||
              (msgp->prev && msgp->prev->cancelled))
       {
              msgp->cancelled=cancelled=1;       /* Message being cancelled */
       }
       else if (msgp->hash->nmsgs -
              msgp->hash->ndupmsgs >= p->duplevel) /* New dupe detected */
       {
              msgp->cancelled=cancelled=1;
              for (msgp=msgp->hash->firstmsg; msgp; msgp=msgp->next)
              {
                     if (!msgp->cancelled)
                            (*cancelfunc)(msgp->msgid);
              }
       }
       return (cancelled);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void duphash_init ( struct duphash ,
unsigned  ,
unsigned   
)

Definition at line 22 of file duphash.c.

{
struct duphashinfo *di;
int    i;

       h->duphashbufsize=n;
       h->duplevel=d;

       if ((h->msgsbuf=(struct duphashmsginfo *)
              malloc( sizeof(struct duphashmsginfo)*n)) == 0 ||
              (h->hashesbuf=(struct duphashinfo *)
                     malloc(sizeof(struct duphashinfo)*n)) == 0)
       {
              perror("malloc");
              exit(1);
       }

       h->head=h->tail=0;
       h->freelist=0;
       for (i=0; i<n; i++)
       {
              di= h->hashesbuf + i;
              di->next=h->freelist;
              h->freelist=di;
       }

       for (i=0; i < 256; i++)
              h->hashbuckets[i]=0;
}

Here is the caller graph for this function: