21 #ifndef G_POP_SERVER_PROTOCOL_H
22 #define G_POP_SERVER_PROTOCOL_H
38 class ServerProtocol ;
39 class ServerProtocolText ;
57 public:
virtual bool protocolSend(
const std::string & s ,
size_t offset ) = 0 ;
59 private:
void operator=(
const Sender & ) ;
64 public:
virtual std::string
greeting()
const = 0 ;
65 public:
virtual std::string
quit()
const = 0 ;
66 public:
virtual std::string
capa()
const = 0 ;
67 public:
virtual std::string
user(
const std::string &
id )
const = 0 ;
68 public:
virtual ~Text() ;
69 private:
void operator=(
const Text & ) ;
83 private:
void operator=(
const Security & ) ;
104 void apply(
const std::string & line ) ;
155 void doQuit(
const std::string & line ,
bool & ) ;
156 void doQuitEarly(
const std::string & line ,
bool & ) ;
157 void doStat(
const std::string & line ,
bool & ) ;
158 void doList(
const std::string & line ,
bool & ) ;
159 void doRetr(
const std::string & line ,
bool & ) ;
160 void doDele(
const std::string & line ,
bool & ) ;
161 void doRset(
const std::string & line ,
bool & ) ;
162 void doUser(
const std::string & line ,
bool & ) ;
163 void doPass(
const std::string & line ,
bool & ) ;
164 void doNoop(
const std::string & line ,
bool & ) ;
165 void doNothing(
const std::string & line ,
bool & ) ;
166 void doApop(
const std::string & line ,
bool & ) ;
167 void doTop(
const std::string & line ,
bool & ) ;
168 void doCapa(
const std::string & line ,
bool & ) ;
169 void doStls(
const std::string & line ,
bool & ) ;
170 void doAuth(
const std::string & line ,
bool & ) ;
171 void doAuthData(
const std::string & line ,
bool & ) ;
172 void doUidl(
const std::string & line ,
bool & ) ;
175 void sendError(
const std::string & ) ;
177 static const std::string & crlf() ;
178 Event commandEvent(
const std::string & )
const ;
179 int commandNumber(
const std::string & ,
int ,
size_t index = 1U )
const ;
180 void sendList(
const std::string & ,
bool ) ;
181 std::string commandWord(
const std::string & )
const ;
182 std::string commandParameter(
const std::string & ,
size_t index = 1U )
const ;
183 std::string commandPart(
const std::string & ,
size_t index )
const ;
185 bool sendContentLine( std::string & ,
bool & ) ;
186 void send( std::string ) ;
188 std::string mechanismsWithoutLogin()
const ;
189 bool mechanismsIncludePlain()
const ;
192 const Text & m_text ;
194 Security & m_security ;
196 StoreLock m_store_lock ;
197 const Secrets & m_secrets ;
202 std::auto_ptr<std::istream> m_content ;
218 virtual std::string
greeting()
const ;
221 virtual std::string
quit()
const ;
224 virtual std::string
capa()
const ;
227 virtual std::string
user(
const std::string &
id )
const ;
virtual bool securityEnabled() const =0
A simple interface to a store of secrets as used in authentication.
Implements the POP server-side protocol.
virtual std::string quit() const
Final override from GPop::ServerProtocol::Text.
virtual std::string greeting() const
Final override from GPop::ServerProtocol::Text.
virtual std::string quit() const =0
The Address class encapsulates an IP transport address.
virtual std::string capa() const
Final override from GPop::ServerProtocol::Text.
virtual std::string greeting() const =0
virtual std::string user(const std::string &id) const =0
void init()
Starts the protocol.
virtual ~ServerProtocol()
Destructor.
An interface used by ServerProtocol to send protocol replies.
virtual bool protocolSend(const std::string &s, size_t offset)=0
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 user(const std::string &id) const
Final override from GPop::ServerProtocol::Text.
virtual std::string capa() const =0
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.
#define G_EXCEPTION(class_name, description)
define as a function rather than a type if optimising for size
void secure()
Called when the server connection becomes secure.
void apply(const std::string &line)
Called on receipt of a string from the client.
virtual void securityStart()=0
void resume()
Called when the Sender can send again.