--- parser3/src/lib/smtp/smtp.h 2004/02/11 15:33:15 1.2 +++ parser3/src/lib/smtp/smtp.h 2026/04/25 13:38:46 1.18 @@ -1,16 +1,97 @@ /** @file Parser: SMTP sender decl. - Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexandr Petrosian (http://paf.design.ru) + Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com) + Authors: Konstantin Morshnev , Alexandr Petrosian */ -static const char * const IDENT_SMTP_H="$Date: 2004/02/11 15:33:15 $"; +#define IDENT_SMTP_H "$Id: smtp.h,v 1.18 2026/04/25 13:38:46 moko Exp $" #include "pa_string.h" -#include +#ifdef _MSC_VER + +#include + +#else //_MSC_VER + +typedef char CHAR; +typedef u_int SOCKET; +#define closesocket close +inline int WSAGetLastError() { return errno; } + +#ifdef EPROTONOSUPPORT +# define WSAEPROTONOSUPPORT EPROTONOSUPPORT +#else +# define WSAEPROTONOSUPPORT (10000) +#endif + +#ifdef ESOCKTNOSUPPORT +# define WSAESOCKTNOSUPPORT ESOCKTNOSUPPORT +#else +# define WSAESOCKTNOSUPPORT (10001) +#endif + +#ifdef ENOTCONN +# define WSAENOTCONN ENOTCONN +#else +# define WSAENOTCONN (10002) +#endif + +#ifdef ESHUTDOWN +# define WSAENETDOWN ESHUTDOWN +#else +# define WSAENETDOWN (10003) +#endif + +#ifdef EHOSTUNREACH +# define WSAENETUNREACH EHOSTUNREACH +#else +# define WSAENETUNREACH (10004) +#endif + +#ifdef ENETRESET +# define WSAENETRESET ENETRESET +#else +# define WSAENETRESET (10005) +#endif + +#ifdef ECONNABORTED +# define WSAECONNABORTED ECONNABORTED +#else +# define WSAECONNABORTED (10006) +#endif + +#ifdef ECONNRESET +# define WSAECONNRESET ECONNRESET +#else +# define WSAECONNRESET (10007) +#endif + +#ifdef EWOULDBLOCK +# define WSAEWOULDBLOCK EWOULDBLOCK +#else +# define WSAEWOULDBLOCK (10008) +#endif + +#ifdef ECONNREFUSED +# define WSAECONNREFUSED ECONNREFUSED +#else +# define WSAECONNREFUSED (10009) +#endif + +#define WSAHOST_NOT_FOUND (10010) + +#ifndef INADDR_NONE +# define INADDR_NONE ((unsigned long) -1) +#endif + +#ifndef INVALID_SOCKET +# define INVALID_SOCKET (SOCKET)(~0) +#endif + +#endif //_MSC_VER ////////////////////////////////////////////////////////////////////////////// @@ -21,7 +102,8 @@ static const char * const IDENT_SMTP_H=" #define ERR_CLOSING 4012 #define WAIT_A_BIT 4013 -#define MAXOUTLINE 255 +/// must be >=SOCKET_BUFFER_SIZE, thanks to Lev Walkin for pointing that out +#define MAXOUTLINE (SOCKET_BUFFER_SIZE*2) ////////////////////////////////////////////////////////////////////////////// @@ -61,7 +143,7 @@ public: // smtp.C void Send(const char* , const char* , const char* , char *, char *); - BOOL MakeSmtpHeader(char *, char *, char *, char *); + bool MakeSmtpHeader(char *, char *, char *, char *); void prepare_message(char *, char *, const char* , const char* ); void open_socket(const char* , const char* ); int get_line(void); @@ -74,7 +156,7 @@ public: void SendLine(const char* , unsigned long); void SendBuffer(const char* , unsigned long); void FlushBuffer(); - BOOL CloseConnect(); + bool CloseConnect(); // comms.C int IsAddressARawIpaddress(const char* );