-
Notifications
You must be signed in to change notification settings - Fork 9
/
ppsession.hh
80 lines (71 loc) · 2.5 KB
/
ppsession.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
PowerMail versatile mail receiver
Copyright (C) 2002 PowerDNS.COM BV
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PPSESSION_HH
#define PPSESSION_HH
#include "delivery.hh"
#include <string>
#include <vector>
using namespace std;
class PPState
{
public:
PPState();
bool isReadonly();
void setReadonly();
void unsetReadonly();
void setFull();
void unsetFull();
private:
string d_stateDir;
bool d_full;
};
class PPListenSession
{
public:
PPListenSession(string remote) : d_remote(remote),d_indata(false), d_failed(false), d_mode(unAuth) {}
enum quit_t {noQuit, quitNow,pleaseQuit, pleaseDie};
bool controlCommands(const string &line, string &response, quit_t &quit);
bool giveLine(string &line, string &response, quit_t &quit, int &fd, bool &more);
bool listResponse(const string &mbox, string &response);
bool putCommand(string &response);
bool pingCommand(string &response);
bool statCommand(string &response);
bool quitCommand(string &response, quit_t &quit);
bool passwordCommand(const string &password, string &response);
bool putLine(string &line, string &response);
bool rollBackCommand(string &response);
bool commitCommand(string &response);
bool rcptCommand(const string &mbox, const string &index, string &response);
bool getCommand(const string &mbox, const string &index, int *fd, string &response);
bool delCommand(const string &mbox, const string &index, string &response);
bool dirCommand(string &response, bool &more) ;
bool moreDir(string &response, bool &more) ;
bool nukeCommand(const string &mbox, string &response);
string getBanner();
private:
string d_remote;
bool d_indata;
bool d_failed;
string d_reason;
void strip(string &line);
void lowerCase(string &line);
int scanDir();
enum {blank, unAuth, inLimbo, preLimbo, inData, Dir} d_mode;
Delivery d_delivery;
string d_filename;
int d_fd;
PPState d_pps;
};
#endif /* PPSESSION_HH */