21 #ifndef G_POP_SERVER_PROTOCOL_H
22 #define G_POP_SERVER_PROTOCOL_H
36 class ServerProtocol ;
37 class ServerProtocolText ;
51 G_EXCEPTION( ProtocolDone ,
"pop protocol done" ) ;
54 public:
virtual bool protocolSend(
const std::string & s ,
size_t offset ) = 0 ;
55 public:
virtual ~
Sender() ;
56 private:
void operator=(
const Sender & ) ;
60 public:
virtual std::string greeting()
const = 0 ;
61 public:
virtual std::string quit()
const = 0 ;
62 public:
virtual std::string capa()
const = 0 ;
63 public:
virtual std::string user(
const std::string &
id )
const = 0 ;
64 public:
virtual ~
Text() ;
65 private:
void operator=(
const Text & ) ;
74 public:
virtual bool securityEnabled()
const = 0 ;
75 public:
virtual void securityStart() = 0 ;
77 private:
void operator=(
const Security & ) ;
98 void apply(
const std::string & line ) ;
144 typedef const std::string & EventData ;
150 void doQuit(
const std::string & line ,
bool & ) ;
151 void doQuitEarly(
const std::string & line ,
bool & ) ;
152 void doStat(
const std::string & line ,
bool & ) ;
153 void doList(
const std::string & line ,
bool & ) ;
154 void doRetr(
const std::string & line ,
bool & ) ;
155 void doDele(
const std::string & line ,
bool & ) ;
156 void doRset(
const std::string & line ,
bool & ) ;
157 void doUser(
const std::string & line ,
bool & ) ;
158 void doPass(
const std::string & line ,
bool & ) ;
159 void doNoop(
const std::string & line ,
bool & ) ;
160 void doNothing(
const std::string & line ,
bool & ) ;
161 void doApop(
const std::string & line ,
bool & ) ;
162 void doTop(
const std::string & line ,
bool & ) ;
163 void doCapa(
const std::string & line ,
bool & ) ;
164 void doStls(
const std::string & line ,
bool & ) ;
165 void doAuth(
const std::string & line ,
bool & ) ;
166 void doAuthData(
const std::string & line ,
bool & ) ;
167 void doUidl(
const std::string & line ,
bool & ) ;
170 void sendError(
const std::string & ) ;
172 static const std::string & crlf() ;
173 Event commandEvent(
const std::string & )
const ;
174 int commandNumber(
const std::string & ,
int ,
size_t index = 1U )
const ;
175 void sendList(
const std::string & ,
bool ) ;
176 std::string commandWord(
const std::string & )
const ;
177 std::string commandParameter(
const std::string & ,
size_t index = 1U )
const ;
178 std::string commandPart(
const std::string & ,
size_t index )
const ;
180 bool sendContentLine( std::string & ,
bool & ) ;
181 void send( std::string ) ;
183 std::string mechanismsWithoutLogin()
const ;
184 bool mechanismsIncludePlain()
const ;
187 const Text & m_text ;
189 Security & m_security ;
191 StoreLock m_store_lock ;
192 const Secrets & m_secrets ;
197 unique_ptr<std::istream> m_content ;
212 virtual std::string
greeting()
const override ;
215 virtual std::string
quit()
const override ;
218 virtual std::string
capa()
const override ;
221 virtual std::string
user(
const std::string &
id )
const override ;
A simple interface to a store of secrets as used in authentication.
Implements the POP server-side protocol.
virtual std::string greeting() const override
Final override from GPop::ServerProtocol::Text.
The GNet::Address class encapsulates a TCP/UDP transport address.
virtual std::string user(const std::string &id) const override
Final override from GPop::ServerProtocol::Text.
void init()
Starts the protocol.
virtual ~ServerProtocol()
Destructor.
An interface used by ServerProtocol to send protocol replies.
An interface used by ServerProtocol to enable TLS.
ServerProtocolText(GNet::Address peer)
Constructor.
A default implementation for the ServerProtocol::Text interface.
An interface used by ServerProtocol to provide response text strings.
virtual std::string quit() const override
Final override from GPop::ServerProtocol::Text.
ServerProtocol(Sender &sender, Security &security, Store &store, const Secrets &secrets, const Text &text, GNet::Address peer_address, Config config)
Constructor.
A structure containing configuration parameters for ServerProtocol. NOT USED.
virtual std::string capa() const override
Final override from GPop::ServerProtocol::Text.
void secure()
Called when the server connection becomes secure.
void apply(const std::string &line)
Called on receipt of a string from the client.
void resume()
Called when the Sender can send again.