Back to index

opendkim  2.6.6
async-resolv.h
Go to the documentation of this file.
00001 /*
00002 **  Copyright (c) 2004, 2005, 2008 Sendmail, Inc. and its suppliers.
00003 **    All rights reserved.
00004 **
00005 **  Copyright (c) 2009-2011, The OpenDKIM Project.  All rights reserved.
00006 */
00007 
00008 #ifndef _ASYNC_RESOLV_H_
00009 #define _ASYNC_RESOLV_H_
00010 
00011 #ifndef lint
00012 static char async_resolv_h_id[] = "@(#)$Id: ar.h,v 1.4 2010/09/02 05:10:57 cm-msk Exp $";
00013 #endif /* !lint */
00014 
00015 /* system includes */
00016 #include <sys/types.h>
00017 #include <sys/time.h>
00018 
00019 /* useful stuff */
00020 #ifndef NULL
00021 # define NULL 0
00022 #endif /* ! NULL */
00023 #ifndef FALSE
00024 # define FALSE       0
00025 #endif /* ! FALSE */
00026 #ifndef TRUE
00027 # define TRUE 1
00028 #endif /* ! TRUE */
00029 
00030 /* DATA TYPES */
00031 struct ar_libhandle;
00032 typedef struct ar_libhandle * AR_LIB;
00033 
00034 struct ar_query;
00035 typedef struct ar_query * AR_QUERY;
00036 
00037 /* TYPES */
00038 typedef void *ar_malloc_t(void *, size_t);
00039 typedef void ar_free_t(void *, void *);
00040 
00041 /* DEFINITIONS */
00042 #define       AR_FLAG_USETCP              0x01          /* use TCP instead of UDP */
00043 #define       AR_FLAG_DEAD         0x02          /* service now unavailable */
00044 #define       AR_FLAG_TRUNCCHECK   0x04          /* limited truncation checks */
00045 #define       AR_FLAG_RECONNECT    0x08          /* pending reconnect */
00046 #define       AR_FLAG_TRACELOGGING 0x10          /* debug logging */
00047 
00048 #define       AR_STAT_ERROR        (-1)          /* error in transit */
00049 #define       AR_STAT_SUCCESS             0             /* reply available */
00050 #define       AR_STAT_NOREPLY             1             /* reply not available (yet) */
00051 #define       AR_STAT_EXPIRED             2             /* no reply, query expired */
00052 
00053 #define QUERY_ERRNO_TOOBIG  (-1)          /* query too large */
00054 #define QUERY_ERRNO_RETRIES (-2)          /* too many retries */
00055 #define QUERY_ERRNO_SERVICE (-3)          /* lost contact with DNS */
00056 
00057 #define       AR_DEFREVIVIFY              2             /* how long to play dead */
00058 #define       AR_MAXTIMEOUT        10000000      /* max. allowed timeout (s) */
00059 
00060 /* PROTOTYPES */
00061 extern AR_QUERY ar_addquery(AR_LIB, char *, int, int, int, unsigned char *,
00062                             size_t, int *, struct timeval *);
00063 extern int ar_cancelquery(AR_LIB, AR_QUERY);
00064 extern char *ar_strerror(int);
00065 extern int ar_waitreply(AR_LIB, AR_QUERY, size_t *, struct timeval *);
00066 extern AR_LIB ar_init(ar_malloc_t *, ar_free_t *, void *, int);
00067 extern void ar_recycle(AR_LIB, AR_QUERY);
00068 extern int ar_resend(AR_LIB, AR_QUERY);
00069 extern void ar_setmaxretry(AR_LIB, int, int *);
00070 extern void ar_setretry(AR_LIB, struct timeval *, struct timeval *);
00071 extern int ar_shutdown(AR_LIB);
00072 
00073 #endif /* ! _ASYNC_RESOLV_H_ */