33 const Secrets & secrets , std::auto_ptr<ServerProtocol::Text> ptext ,
35 GNet::BufferedServerPeer(peer_info,crlf()) ,
38 m_protocol(*this,*this,store,secrets,*m_ptext.get(),peer_info.m_address,protocol_config)
44 const std::string & GPop::ServerPeer::crlf()
46 static const std::string s(
"\015\012" ) ;
52 G_LOG_S(
"GPop::ServerPeer: pop connection closed: " << reason << (reason.empty()?
"":
": ")
53 << peerAddress().second.displayString() ) ;
62 void GPop::ServerPeer::processLine(
const std::string & line )
64 m_protocol.apply( line ) ;
69 return send( line , offset ) ;
80 bool enabled = ssl != NULL && ssl->
enabled(
true) ;
81 G_DEBUG(
"ServerPeer::securityEnabled: ssl library " << (enabled?
"enabled":
"disabled") ) ;
98 GNet::MultiServer(
GNet::MultiServer::addressList(config.interfaces,config.port) , false ) ,
99 m_allow_remote(config.allow_remote) ,
113 serverReport(
"pop" ) ;
114 G_LOG_S(
"GPop::Server: pop authentication secrets from \"" << m_secrets.path() <<
"\"" ) ;
124 G_WARNING(
"GPop::Server: configured to reject non-local pop connection: " << reason ) ;
128 std::auto_ptr<ServerProtocol::Text> ptext( newProtocolText(peer_info.
m_address) ) ;
129 return new ServerPeer( peer_info , *
this , m_store , m_secrets ,
132 catch( std::exception & e )
134 G_WARNING(
"GPop::Server: exception from new connection: " << e.what() ) ;
147 allow_remote(false) ,
153 allow_remote(allow_remote_) ,
155 interfaces(interfaces_)
static Library * instance()
Returns a pointer to a library object, if any.
An abstract base class for the GNet::Server's connection to a remote client.
A simple interface to a store of secrets as used in authentication.
virtual bool onReceive(const std::string &)
Final override from GNet::BufferedServerPeer.
std::list< std::string > Strings
A std::list of std::strings.
The Address class encapsulates an IP transport address.
static bool isLocal(const Address &)
Returns true if the given address appears to be local.
void report() const
Generates helpful diagnostics after construction.
virtual void onSendComplete()
Final override from GNet::BufferedServerPeer.
A structure containing GPop::Server configuration parameters.
void init()
Starts the protocol.
virtual bool protocolSend(const std::string &line, size_t)
Final override from GPop::ServerProtocol::Sender.
virtual bool securityEnabled() const
Final override from GPop::ServerProtocol::Security.
A default implementation for the ServerProtocol::Text interface.
std::string displayString(bool with_port=true, bool with_scope_id=false) const
Returns a string which represents the address for debugging and diagnostics purposes.
An interface used by ServerProtocol to provide response text strings.
virtual void securityStart()
Final override from GPop::ServerProtocol::Security.
virtual ~Server()
Destructor.
A structure containing configuration parameters for ServerProtocol. NOT USED.
GNet::ServerPeer * newPeer(GNet::Server::PeerInfo)
From MultiServer.
ServerPeer(GNet::Server::PeerInfo, Server &, Store &, const Secrets &, std::auto_ptr< ServerProtocol::Text > ptext, ServerProtocol::Config)
Constructor.
A RAII class for initialising the underlying ssl library.
virtual void onSecure(const std::string &)
Final override from GNet::SocketProtocolSink.
bool enabled(bool for_serving=false) const
Returns true if this is a real and enabled ssl library.
Represents a connection from a POP client.
A structure used in GNet::Server::newPeer().
Server(Store &store, const Secrets &, Config)
Constructor. The 'secrets' reference is kept.
virtual void onDelete(const std::string &)
Final override from GNet::ServerPeer.