Qsmtp  0.23svn
include/qsmtpd.h
Go to the documentation of this file.
00001 
00004 #ifndef QSMTPD_H
00005 #define QSMTPD_H
00006 #include <netinet/in.h>
00007 #include <sys/queue.h>
00008 #include <sys/types.h>
00009 #include "sstring.h"
00010 #include "qdns.h"
00011 
00015 struct smtpcomm {
00016         char            *name;          
00017         int             len;            
00018         long            mask;           
00019         int             (*func)(void);  
00020         long            state;          
00021         unsigned int    flags;          
00023 };
00024 
00029 struct xmitstat {
00030         unsigned int esmtp:1;           
00031         unsigned int ipv4conn:1;        
00032         unsigned int check2822:2;       
00033         unsigned int helostatus:3;      
00034         unsigned int datatype:1;        
00035         unsigned int spf:4;             
00036         int fromdomain:3;               
00037         unsigned int spacebug:1;        
00038         unsigned long thisbytes;        
00039         string mailfrom;                
00040         string authname;                
00041         char *tlsclient;                
00042         string remotehost;              
00043         char remoteip[INET6_ADDRSTRLEN];
00044         char *remoteinfo;               
00045         char *remoteport;               
00046         string helostr;                 
00048         struct in6_addr sremoteip;      
00049         char localip[INET6_ADDRSTRLEN]; 
00050         struct in6_addr slocalip;       
00051         struct ips *frommx;             
00052         char *spfexp;                   
00053         const char *spfmechanism;       
00054 };
00055 
00056 extern struct smtpcomm commands[];      
00058 extern struct xmitstat xmitstat;
00059 extern char *protocol;
00060 extern const char *auth_host;           
00061 extern const char *auth_check;          
00062 extern const char **auth_sub;           
00063 extern string heloname;                 
00064 extern string msgidhost;                        
00065 extern string liphost;                  
00066 extern unsigned int goodrcpt;           
00067 extern int badbounce;                   
00068 extern unsigned long sslauth;           
00069 extern unsigned long databytes;         
00070 extern int relayclient;                 
00071 extern long comstate;                   
00072 extern int authhide;                    
00073 extern int submission_mode;             
00075 extern int err_control(const char *);
00076 extern void freedata(void);
00077 extern pid_t fork_clean();
00078 void __attribute__ ((noreturn)) conn_cleanup(const int rc);
00079 extern int __attribute__ ((noreturn)) smtp_quit(void);
00080 
00081 #define EBOGUS 1002
00082 #define EDONE 1003
00083 
00084 TAILQ_HEAD(tailhead, recip) head;
00085 
00095 struct recip {
00096         TAILQ_ENTRY(recip) entries;     
00097         string to;                      
00098         int ok;                         
00099 };
00100 
00101 extern struct recip *thisrecip;
00102 
00103 #define HELOSTR (xmitstat.helostr.len ? xmitstat.helostr.s : xmitstat.remotehost.s)
00104 #define HELOLEN (xmitstat.helostr.len ? xmitstat.helostr.len : xmitstat.remotehost.len)
00105 
00106 #define MAILFROM (xmitstat.mailfrom.len ? xmitstat.mailfrom.s : "")
00107 
00108 static inline int
00109 connection_is_ipv4(void)
00110 {
00111 #ifdef IPV4ONLY
00112         return 1;
00113 #else /* IPV4ONLY */
00114         return xmitstat.ipv4conn;
00115 #endif /* IPV4ONLY */
00116 }
00117 
00118 #endif