From c777c8d9aa7cd5c2e9a399727a7fa9985a77fb1c Mon Sep 17 00:00:00 2001 From: sjaz Date: Thu, 1 Jan 2009 12:00:20 +0000 Subject: Anope Stable Branch git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/stable@1902 5417fbe8-f217-4b02-8779-1006273d7864 --- src/tools/smtp.h | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 src/tools/smtp.h (limited to 'src/tools/smtp.h') diff --git a/src/tools/smtp.h b/src/tools/smtp.h new file mode 100644 index 000000000..7a30cc0fe --- /dev/null +++ b/src/tools/smtp.h @@ -0,0 +1,130 @@ +/* + * + * (C) 2003-2008 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for furhter details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ + +#ifndef SMTP_H +#define SMTP_H + +/*************************************************************************/ + +/* Some Linux boxes (or maybe glibc includes) require this for the + * prototype of strsignal(). */ +#define _GNU_SOURCE + +#include +#include +#include +#include + +/* Windows does not have: + * unistd.h, grp.h, + * netdb.h, netinet/in.h, + * sys/socket.h, sys/time.h + * Windows requires: + * winsock.h + * -- codemastr + */ + +#ifndef _WIN32 +#include +#endif + +#include +#include +#include +#include + +#ifndef _WIN32 +#include +#include +#include +#include +#else +#include +#include +#endif + +#include + +#ifndef _WIN32 +#include +#endif + +#ifdef _AIX +extern int strcasecmp(const char *, const char *); +extern int strncasecmp(const char *, const char *, size_t); +# if 0 /* These break on some AIX boxes (4.3.1 reported). */ +extern int socket(int, int, int); +extern int connect(int, struct sockaddr *, int); +# endif +#endif /* _AIX */ + +/* Some SUN fixs */ +#ifdef __sun +/* Solaris specific code, types that do not exist in Solaris' + * * sys/types.h + * **/ +#ifndef INADDR_NONE +#define INADDR_NONE (-1) +#endif + +#endif + + +#ifdef _WIN32 +#define PATH_MAX MAX_PATH +#define snprintf _snprintf +#endif + + +/*************************************************************************/ + +#ifdef _WIN32 +#include +typedef SOCKET ano_socket_t; +#define ano_sockclose(fd) closesocket(fd) +#define ano_sockread(fd, buf, len) recv(fd, buf, len, 0) +#define ano_sockwrite(fd, buf, len) send(fd, buf, len, 0) +#else +typedef int ano_socket_t; +#define ano_sockclose(fd) close(fd) +#define ano_sockread(fd, buf, len) read(fd, buf, len) +#define ano_sockwrite(fd, buf, len) write(fd, buf, len) +#define SOCKET_ERROR -1 +#endif + + +/* Data structures */ +struct smtp_header { + char *header; + struct smtp_header *next; +}; + +struct smtp_body_line { + char *line; + struct smtp_body_line *next; +}; + +struct smtp_message { + struct smtp_header *smtp_headers, *smtp_headers_tail; + struct smtp_body_line *smtp_body, *smtp_body_tail; + char *from; + char *to; + ano_socket_t sock; +}; + +struct smtp_message mail; + +/* set this to 1 if you want to get a log otherwise it runs silent */ +int smtp_debug = 0; + +#endif /* SMTP_H */ -- cgit