44 class AdminServerImp ;
60 const std::string & remote ,
const G::StringMap & info_commands ,
61 bool with_terminate ) ;
70 void notify(
const std::string & s0 ,
const std::string & s1 ,
const std::string & s2 ,
const std::string & s3 ) ;
75 void onSendComplete()
override ;
76 bool onReceive(
const char * , std::size_t , std::size_t , std::size_t ,
char )
override ;
77 void onDelete(
const std::string & )
override ;
78 void onSecure(
const std::string & ,
const std::string & ,
const std::string & )
override ;
87 void clientDone(
const std::string & ) ;
88 static bool is( std::string_view , std::string_view ) ;
89 static std::pair<bool,std::string> find( std::string_view ,
const G::StringMap & map ) ;
94 void sendMessageIds(
const std::vector<GStore::MessageId> & ) ;
95 void sendLine( std::string && ) ;
96 void sendLineCopy( std::string ) ;
100 std::string eol()
const ;
102 void sendImp(
const std::string & ) ;
106 AdminServerImp & m_server_imp ;
107 std::string m_prompt ;
108 bool m_blocked {
false} ;
109 std::string m_remote_address ;
111 bool m_notifying {
false} ;
113 bool m_with_terminate ;
114 unsigned int m_error_limit {30U} ;
115 unsigned int m_error_count {0U} ;
124 G_EXCEPTION( NotImplemented ,
tx(
"admin server not implemented") )
127 unsigned int port {10026U} ;
128 bool with_terminate {
false} ;
129 bool allow_remote {
false} ;
130 std::string remote_address ;
136 Config & set_port(
unsigned int ) noexcept ;
137 Config & set_with_terminate(
bool =
true ) noexcept ;
138 Config & set_allow_remote(
bool =
true ) noexcept ;
139 Config & set_remote_address(
const std::string & ) ;
157 const Config & config ) ;
167 void report(
const std::string & group = {} )
const ;
190 void notify(
const std::string & s0 ,
const std::string & s1 ,
const std::string & s2 ,
const std::string & s3 ) ;
201 std::unique_ptr<AdminServerImp> m_imp ;
204inline GSmtp::AdminServer::Config & GSmtp::AdminServer::Config::set_port(
unsigned int n )
noexcept { port = n ;
return *this ; }
205inline GSmtp::AdminServer::Config & GSmtp::AdminServer::Config::set_with_terminate(
bool b )
noexcept { with_terminate = b ;
return *this ; }
206inline GSmtp::AdminServer::Config & GSmtp::AdminServer::Config::set_allow_remote(
bool b )
noexcept { allow_remote = b ;
return *this ; }
207inline GSmtp::AdminServer::Config & GSmtp::AdminServer::Config::set_remote_address(
const std::string & s ) { remote_address = s ;
return *this ; }
209inline GSmtp::AdminServer::Config & GSmtp::AdminServer::Config::set_smtp_client_config(
const Client::Config & c ) { smtp_client_config = c ;
return *this ; }
An interface used by GAuth::SaslClient to obtain a client id and its authentication secret.
The EventStateUnbound class is used as a device to force factory methods to plumb-in an ExceptionSour...
A lightweight object containing an ExceptionHandler pointer, optional ExceptionSource pointer and opt...
A move-only structure used in GNet::Server::newPeer() and containing the new socket.
An abstract base class for the GNet::Server's connection to a remote client.
A derivation of ServerPeer for the administration interface.
bool notifying() const
Returns true if the remote user has asked for notifications.
AdminServerPeer(GNet::EventStateUnbound, GNet::ServerPeerInfo &&, AdminServerImp &, const std::string &remote, const G::StringMap &info_commands, bool with_terminate)
Constructor.
~AdminServerPeer() override
Destructor.
void notify(const std::string &s0, const std::string &s1, const std::string &s2, const std::string &s3)
Called when something happens which the remote admin user might be interested in.
A server class which implements the emailrelay administration interface.
static bool enabled()
Returns true if the server is enabled.
~AdminServer()
Destructor.
G::Slot::Signal< Command, unsigned int > & commandSignal()
Returns a reference to a signal that is emit()ted when the remote user makes a request.
void report(const std::string &group={}) const
Generates helpful diagnostics.
AdminServer(GNet::EventState, GStore::MessageStore &store, FilterFactoryBase &, const GAuth::SaslClientSecrets &client_secrets, const G::StringArray &interfaces, const Config &config)
Constructor.
void emitCommand(Command, unsigned int)
Emits an asynchronous event on the commandSignal().
void notify(const std::string &s0, const std::string &s1, const std::string &s2, const std::string &s3)
Called when something happens which the admin users might be interested in.
GStore::MessageStore & store()
Returns a reference to the message store, as passed in to the constructor.
FilterFactoryBase & ff()
Returns a reference to the filter factory, as passed in to the constructor.
const GAuth::SaslClientSecrets & clientSecrets() const
Returns a reference to the client secrets object, as passed in to the constructor.
bool notifying() const
Returns true if the remote user has asked for notifications.
A factory interface for making GSmtp::Filter message processors.
A class which allows SMTP messages to be stored and retrieved.
std::vector< std::string > StringArray
A std::vector of std::strings.
constexpr const char * tx(const char *p) noexcept
A briefer alternative to G::gettext_noop().
std::map< std::string, std::string > StringMap
A std::map of std::strings.
A configuration structure for GNet::ServerPeer.
A configuration structure for GNet::Server.
A configuration structure for GSmtp::AdminServer.
A structure containing GSmtp::Client configuration parameters.
A slot holder, with connect() and emit() methods.