Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef SMTP_H
00015 #define SMTP_H
00016
00017
00018
00019
00020
00021 #define _GNU_SOURCE
00022
00023 #include <stdarg.h>
00024 #include <stdio.h>
00025 #include <stdlib.h>
00026 #include <string.h>
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef _WIN32
00038 #include <unistd.h>
00039 #endif
00040
00041 #include <signal.h>
00042 #include <time.h>
00043 #include <errno.h>
00044 #include <limits.h>
00045
00046 #ifndef _WIN32
00047 #include <netdb.h>
00048 #include <netinet/in.h>
00049 #include <sys/socket.h>
00050 #include <arpa/inet.h>
00051 #else
00052 #include <winsock.h>
00053 #include <windows.h>
00054 #endif
00055
00056 #include <sys/types.h>
00057
00058 #ifndef _WIN32
00059 #include <sys/time.h>
00060 #endif
00061
00062 #ifdef _AIX
00063 extern int strcasecmp(const char *, const char *);
00064 extern int strncasecmp(const char *, const char *, size_t);
00065 # if 0
00066 extern int socket(int, int, int);
00067 extern int connect(int, struct sockaddr *, int);
00068 # endif
00069 #endif
00070
00071
00072 #ifdef __sun
00073
00074
00075
00076 #ifndef INADDR_NONE
00077 #define INADDR_NONE (-1)
00078 #endif
00079
00080 #endif
00081
00082
00083 #ifdef _WIN32
00084 #define PATH_MAX MAX_PATH
00085 #define snprintf _snprintf
00086 #endif
00087
00088
00089
00090
00091 #ifdef _WIN32
00092 #include <winsock.h>
00093 typedef SOCKET ano_socket_t;
00094 #define ano_sockclose(fd) closesocket(fd)
00095 #define ano_sockread(fd, buf, len) recv(fd, buf, len, 0)
00096 #define ano_sockwrite(fd, buf, len) send(fd, buf, len, 0)
00097 #else
00098 typedef int ano_socket_t;
00099 #define ano_sockclose(fd) close(fd)
00100 #define ano_sockread(fd, buf, len) read(fd, buf, len)
00101 #define ano_sockwrite(fd, buf, len) write(fd, buf, len)
00102 #define SOCKET_ERROR -1
00103 #endif
00104
00105
00106
00107 struct smtp_header {
00108 char *header;
00109 struct smtp_header *next;
00110 };
00111
00112 struct smtp_body_line {
00113 char *line;
00114 struct smtp_body_line *next;
00115 };
00116
00117 struct smtp_message {
00118 struct smtp_header *smtp_headers, *smtp_headers_tail;
00119 struct smtp_body_line *smtp_body, *smtp_body_tail;
00120 char *from;
00121 char *to;
00122 ano_socket_t sock;
00123 };
00124
00125 struct smtp_message mail;
00126
00127
00128 int smtp_debug = 0;
00129
00130 #endif