|
|
| version 1.2, 2004/02/11 15:33:15 | version 1.11, 2013/07/23 07:55:18 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: SMTP sender decl. | Parser: SMTP sender decl. |
| Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| */ | */ |
| static const char * const IDENT_SMTP_H="$Date$"; | #define IDENT_SMTP_H "$Id$" |
| #include "pa_string.h" | #include "pa_string.h" |
| #include <winsock.h> | #ifdef _MSC_VER |
| #include <windows.h> | |
| #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 | |
| ////////////////////////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////////////////////////// |
| Line 21 static const char * const IDENT_SMTP_H=" | Line 102 static const char * const IDENT_SMTP_H=" |
| #define ERR_CLOSING 4012 | #define ERR_CLOSING 4012 |
| #define WAIT_A_BIT 4013 | #define WAIT_A_BIT 4013 |
| #define MAXOUTLINE 255 | /// must be >=SOCKET_BUFFER_SIZE, thanks to Lev Walkin <vlm@netli.com> for pointing that out |
| #define MAXOUTLINE (SOCKET_BUFFER_SIZE*2) | |
| ////////////////////////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////////////////////////// |
| Line 61 public: | Line 143 public: |
| // smtp.C | // smtp.C |
| void Send(const char* , const char* , const char* , char *, char *); | 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 prepare_message(char *, char *, const char* , const char* ); |
| void open_socket(const char* , const char* ); | void open_socket(const char* , const char* ); |
| int get_line(void); | int get_line(void); |
| Line 74 public: | Line 156 public: |
| void SendLine(const char* , unsigned long); | void SendLine(const char* , unsigned long); |
| void SendBuffer(const char* , unsigned long); | void SendBuffer(const char* , unsigned long); |
| void FlushBuffer(); | void FlushBuffer(); |
| BOOL CloseConnect(); | bool CloseConnect(); |
| // comms.C | // comms.C |
| int IsAddressARawIpaddress(const char* ); | int IsAddressARawIpaddress(const char* ); |