Anope IRC Services  Version 1.8
smtp.h
Go to the documentation of this file.
1 /*
2  *
3  * (C) 2003-2014 Anope Team
4  * Contact us at team@anope.org
5  *
6  * Please read COPYING and README for further details.
7  *
8  * Based on the original code of Epona by Lara.
9  * Based on the original code of Services by Andy Church.
10  *
11  *
12  */
13 
14 #ifndef SMTP_H
15 #define SMTP_H
16 
17 /*************************************************************************/
18 
19 /* Some Linux boxes (or maybe glibc includes) require this for the
20  * prototype of strsignal(). */
21 #define _GNU_SOURCE
22 
23 #include <stdarg.h>
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <string.h>
27 
28 /* Windows does not have:
29  * unistd.h, grp.h,
30  * netdb.h, netinet/in.h,
31  * sys/socket.h, sys/time.h
32  * Windows requires:
33  * winsock.h
34  * -- codemastr
35  */
36 
37 #ifndef _WIN32
38 #include <unistd.h>
39 #endif
40 
41 #include <signal.h>
42 #include <time.h>
43 #include <errno.h>
44 #include <limits.h>
45 
46 #ifndef _WIN32
47 #include <netdb.h>
48 #include <netinet/in.h>
49 #include <sys/socket.h>
50 #include <arpa/inet.h>
51 #else
52 #include <winsock.h>
53 #include <windows.h>
54 #endif
55 
56 #include <sys/types.h>
57 
58 #ifndef _WIN32
59 #include <sys/time.h>
60 #endif
61 
62 #ifdef _AIX
63 extern int strcasecmp(const char *, const char *);
64 extern int strncasecmp(const char *, const char *, size_t);
65 # if 0 /* These break on some AIX boxes (4.3.1 reported). */
66 extern int socket(int, int, int);
67 extern int connect(int, struct sockaddr *, int);
68 # endif
69 #endif /* _AIX */
70 
71 /* Some SUN fixs */
72 #ifdef __sun
73 /* Solaris specific code, types that do not exist in Solaris'
74  * * sys/types.h
75  * **/
76 #ifndef INADDR_NONE
77 #define INADDR_NONE (-1)
78 #endif
79 
80 #endif
81 
82 
83 #ifdef _WIN32
84 #define PATH_MAX MAX_PATH
85 #define snprintf _snprintf
86 #endif
87 
88 
89 /*************************************************************************/
90 
91 #ifdef _WIN32
92 #include <winsock.h>
93 typedef SOCKET ano_socket_t;
94 #define ano_sockclose(fd) closesocket(fd)
95 #define ano_sockread(fd, buf, len) recv(fd, buf, len, 0)
96 #define ano_sockwrite(fd, buf, len) send(fd, buf, len, 0)
97 #else
98 typedef int ano_socket_t;
99 #define ano_sockclose(fd) close(fd)
100 #define ano_sockread(fd, buf, len) read(fd, buf, len)
101 #define ano_sockwrite(fd, buf, len) write(fd, buf, len)
102 #define SOCKET_ERROR -1
103 #endif
104 
105 
106 /* Data structures */
107 struct smtp_header {
108  char *header;
109  struct smtp_header *next;
110 };
111 
113  char *line;
115 };
116 
117 struct smtp_message {
120  char *from;
121  char *to;
123 };
124 
126 
127 /* set this to 1 if you want to get a log otherwise it runs silent */
128 int smtp_debug = 0;
129 
130 #endif /* SMTP_H */
struct smtp_body_line * smtp_body_tail
Definition: smtp.h:119
char * line
Definition: smtp.h:113
struct smtp_body_line * smtp_body
Definition: smtp.h:119
ano_socket_t sock
Definition: smtp.h:122
struct smtp_header * next
Definition: smtp.h:109
struct smtp_message mail
Definition: smtp.h:125
struct smtp_header * smtp_headers_tail
Definition: smtp.h:118
struct smtp_header * smtp_headers
Definition: smtp.h:118
int smtp_debug
Definition: smtp.h:128
char * from
Definition: smtp.h:120
int ano_socket_t
Definition: smtp.h:98
struct smtp_body_line * next
Definition: smtp.h:114
int ano_socket_t
Definition: sockets.h:32
char * header
Definition: smtp.h:108
char * to
Definition: smtp.h:121