1 /**
2  * \file servinfo.h
3  * \brief servinfo_t struct declaration
4  *
5  * \author Fernando J. Pereda <ferdy@ferdyx.org>
6  * \author Ricardo Cervera Navarro <ricardo@zonasiete.org>
7  *
8  * This is part of nbsmtp. nbsmtp is free software;
9  * you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * nbsmtp is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with nbsmtp; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22  *
23  * See COPYING for details.
24  */
25 
26 #ifndef SERVINFO_H_
27 #define SERVINFO_H_
28 
29 #ifdef HAVE_SSL
30 #include <openssl/crypto.h>
31 #include <openssl/x509.h>
32 #include <openssl/pem.h>
33 #include <openssl/ssl.h>
34 #include <openssl/err.h>
35 #endif
36 
37 /* Type declaration */
38 
39 typedef enum bool_e{False=0,True=1} bool_t;
40 
41 /**
42  * \brief Structure with data about the server, and the connection
43  */
44 struct servinfo {
45 	char *host;		/**< Name of the relay host */
46 	char *fromaddr;		/**< Address to use in the MAIL FROM command */
47 	char *domain;		/**< Domain to send in HELO/EHLO command */
48 	char *auth_user;	/**< User to use in SASL authentication */
49 	char *auth_pass;	/**< Password to use in SASL authentication */
50 	int auth_mech;		/**< Mechanism to use in SASL authentication */
51 	int port;		/**< Port to use to connect to the server */
52 	int sockfd;		/**< Socket descriptor */
53 	int num_rcpts;		/**< Number of recipients */
54 #ifdef HAVE_SSL
55 	bool_t use_tls;		/**< Whether we should use SSL/TLS or not */
56 	bool_t use_starttls;	/**< Whether to use STARTTLS or not */
57 	bool_t using_tls;	/**< Whether we started TLS or not */
58 	SSL *ssl;		/**< SSL/TLS descriptor */
59 #endif
60 };
61 
62 typedef struct servinfo servinfo_t;
63 
64 #define SERVINFO_RELEASE_OPTION(a) if (a != NULL) \
65 					{ \
66 						free(a); \
67 						a = NULL; \
68 					}
69 
70 #endif /* SERVINFO_H_ */
71