Annotation of parser3/src/classes/smtp/smtp.h, revision 1.3
1.1 paf 1: /** @file
2: Parser: SMTP sender decl.
3:
4: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
5:
6: Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
7:
1.3 ! paf 8: $Id: smtp.h,v 1.2 2001/04/10 06:57:24 paf Exp $
1.1 paf 9: */
10:
11: #include <winsock.h>
12:
13: #include "pa_pool.h"
14: #include "pa_string.h"
15:
16: //////////////////////////////////////////////////////////////////////////////
17:
18: #define SOCKET_BUFFER_SIZE 512
19:
20: #define ERR_SENDING_DATA 4002
21: #define ERR_NOT_A_SOCKET 4010
22: #define ERR_CLOSING 4012
23: #define WAIT_A_BIT 4013
24:
25: #define MAXOUTLINE 255
26:
27: //////////////////////////////////////////////////////////////////////////////
28:
1.3 ! paf 29: /// SIMPLE MAIL TRANSPORT PROTOCOL Win32 realization
1.1 paf 30: class SMTP : public Pooled {
31: char *in_buffer;
32: char *out_buffer;
33: unsigned int in_index;
34: unsigned int out_index;
35: unsigned int in_buffer_total;
36: unsigned int out_buffer_total;
37: unsigned int last_winsock_error;
38: fd_set fds;
39: struct timeval timeout;
40:
41: SOCKET the_socket;
42:
43: char my_hostname[1024];
44:
45: CHAR ServerProtocol[100];
46: CHAR RemoteAddress[100];
47: CHAR RemoteHost[100];
48: CHAR RemoteUser[100];
49: CHAR HttpAccept[100];
50: CHAR HttpUserAgent[256];
51:
52: CHAR FirstName[100];
53: CHAR LastName[100];
54: CHAR WebUse[100];
55: CHAR EMail[100];
56: CHAR HomePage[100];
57: CHAR text[500];
58:
59: const String& origin_string;
60:
61: public:
62: SMTP(Pool& pool, const String& aorigin_string);
63:
64: // smtp.C
1.2 paf 65: void Send(const char *, const char *, const char *, char *, char *);
1.1 paf 66: BOOL MakeSmtpHeader(char *, char *, char *, char *);
1.2 paf 67: void prepare_message(char *, char *, const char *, const char *);
68: void open_socket(const char *, const char *);
1.1 paf 69: int get_line(void);
70: void SendSmtpError(const char *);
71: void transform_and_send_edit_data(const char *);
72: void send_data(const char *);
1.2 paf 73: void ConnectToHost(const char *, const char *);
1.1 paf 74: int GetBuffer(int);
75: int GetChar(int, char *);
76: void SendLine(const char *, unsigned long);
77: void SendBuffer(const char *, unsigned long);
78: void FlushBuffer();
79: BOOL CloseConnect();
80:
81: // comms.C
1.2 paf 82: int IsAddressARawIpaddress(const char *);
83: int ResolveService(const char *, int *);
84: int ResolveHostname(const char *, struct sockaddr_in *);
1.1 paf 85: int GetAndSetTheSocket(SOCKET *);
86: int GetConnection(SOCKET, struct sockaddr_in *);
87: void MiscSocketSetup(SOCKET, fd_set *, struct timeval *);
88: };
89:
E-mail: