/* Distributed Checksum Clearinghouse * * DNS blacklist and external filter definitions * * Copyright (c) 2006 by Rhyolite Software, LLC * * This agreement is not applicable to any entity which sells anti-spam * solutions to others or provides an anti-spam solution as part of a * security solution sold to other entities, or to a private network * which employs the DCC or uses data provided by operation of the DCC * but does not provide corresponding data to other users. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * Parties not eligible to receive a license under this agreement can * obtain a commercial license to use DCC and permission to use * U.S. Patent 6,330,590 by contacting Commtouch at http://www.commtouch.com/ * or by email to nospam@commtouch.com. * * A commercial license would be for Distributed Checksum and Reputation * Clearinghouse software. That software includes additional features. This * free license for Distributed ChecksumClearinghouse Software does not in any * way grant permision to use Distributed Checksum and Reputation Clearinghouse * software * * THE SOFTWARE IS PROVIDED "AS IS" AND RHYOLITE SOFTWARE, LLC DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RHYOLITE SOFTWARE, LLC * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Rhyolite Software DCC 1.3.50-1.23 $Revision$ */ #ifndef HELPER_H #define HELPER_H #include "dcc_ck.h" #define HELPER_IDLE_STOP_SECS (60*5) /* helpers die of this much boredom */ #define HELPER_IDLE_RESTART (HELPER_IDLE_STOP_SECS-1) #define HELPER_AUTO_REAP 60 #define HELPER_PAT "helper=%u,%u,%u" typedef struct { u_int sn; /* serial # of parent */ u_int gen; /* generation of children */ u_int failures; /* failures in this generation */ int pipe_write; int pipe_read; /* save the socket and its port number obtained for the first child * to give to later children */ SOCKET soc; DCC_SOCKU su; int req_len; int argc; int free_args; char const **argv; pid_t *pids; int total_helpers; int max_helpers; int idle_helpers; int slow_helpers; /* hung or at least slow helpers */ int debug; time_t idle_restart; /* restart helpers after then */ struct timeval last_started; /* when last new helper started */ u_char is_child; } HELPER; extern HELPER helper; typedef struct { u_int magic; u_int sn; struct timeval start; time_t total_us; char id[DCC_MSG_ID_LEN+1]; } HELPER_REQ_HDR; typedef struct { u_int magic; u_int sn; } HELPER_RESP_HDR; #define HELPER_MAGIC_REQ 0xbeefdead #define HELPER_MAGIC_RESP 0xdeadbeef typedef struct { HELPER_REQ_HDR hdr; DNSBL_HIT hit; DNSBL_DOM tgt_dom; struct in6_addr tgt_addr; } DNSBL_REQ; typedef struct { HELPER_RESP_HDR hdr; DNSBL_HIT hit; DNSBL_DOM probe; DNSBL_HTYPE htype; int bl_num; } DNSBL_RESP; extern void NRATTRIB helper_child(SOCKET, int, int); extern void reap_helpers(u_char); extern u_char ask_helper(DCC_CLNT_CTXT *, void *, const struct timeval *, time_t, HELPER_REQ_HDR *, int, HELPER_RESP_HDR *, int); extern u_char dnsbl_work(const DNSBL_REQ *, DNSBL_RESP *); #endif /* HELPER_H */