/* * Copyright (c) 2005, 2006 Sendmail, Inc. and its suppliers. * All rights reserved. * * By using this file, you agree to the terms and conditions set * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * * $Id: greyctl.h,v 1.6 2006/11/30 04:32:59 ca Exp $ */ #ifndef GREYCTL_H #define GREYCTL_H 1 #include "sm/generic.h" #include "sm/types.h" #include "sm/net.h" #include "sm/greyctl.h" #include "sm/bdb.h" #if MTA_USE_PTHREADS #include "sm/pthread.h" #endif #include "sm/greycnf.h" /* maximum key length: 256 for 2 mail addresses + 4 for IPv4 address */ #define GL_KEYLEN 516 enum grey_type_E { GREY_TYPE_NONE = 0, GREY_TYPE_GREY = 1, GREY_TYPE_WHITE = 2 }; typedef enum grey_type_E grey_type_T; struct greyentry_S { uchar ge_key[GL_KEYLEN]; uint ge_len; time_t ge_time; /* timestamp */ time_t ge_expire; /* expiration timestamp */ grey_type_T ge_type; }; typedef struct greyentry_S greyentry_T, *greyentry_P; struct greyctx_S { #if SM_GREYCTL_CHECK sm_magic_T sm_magic; #endif greycnf_T greyc_cnf; uint greyc_used; /* current # of entries */ DB *greyc_grey_db; DB *greyc_grey_sdb; #if MTA_USE_PTHREADS pthread_mutex_t greyc_mutex; #endif }; sm_ret_T sm_grey_rm(DB *_db, void *_key, uint _len); int sm_grey_compare(DB *_dbp, const DBT *_d1, const DBT *_d2); int sm_grey_si(DB *_db, const DBT *_pkey, const DBT *_pdata, DBT *_skey); #define SM_IS_GREYCTX(greyctx) SM_REQUIRE((greyctx) != NULL) #endif /* GREYCTL_H */