21#ifndef G_SMTP_SERVER_PARSER_H
22#define G_SMTP_SERVER_PARSER_H
45 bool allow_spaces {
false} ;
46 bool allow_nobrackets {
false} ;
47 bool alabels {
false} ;
48 std::string allow_spaces_help ;
49 std::string allow_nobrackets_help ;
50 Config & set_allow_spaces(
bool b =
true ) noexcept ;
51 Config & set_allow_nobrackets(
bool b =
true ) noexcept ;
52 Config & set_alabels(
bool b =
true ) noexcept ;
53 Config & set_allow_spaces_help(
const std::string & ) ;
54 Config & set_allow_nobrackets_help(
const std::string & ) ;
56 using AddressStyle = GStore::MessageStore::AddressStyle ;
62 std::string raw_address ;
64 AddressStyle address_style {AddressStyle::Ascii} ;
65 bool utf8_mailbox_part {
false} ;
66 bool utf8_domain_part {
false} ;
67 std::size_t tailpos {std::string::npos} ;
68 std::size_t size {0U} ;
71 bool smtputf8 {
false} ;
72 bool invalid_spaces {
false} ;
73 bool invalid_nobrackets {
false} ;
82 static std::pair<std::size_t,bool>
parseBdatSize( std::string_view ) ;
85 static std::pair<bool,bool>
parseBdatLast( std::string_view ) ;
91 static std::string
parseVrfy(
const std::string & ) ;
101 static AddressCommand parseAddressPart( std::string_view ,
const Config & ) ;
102 static std::size_t parseMailNumericValue( std::string_view , std::string_view , AddressCommand & ) ;
103 static std::string parseMailStringValue( std::string_view , std::string_view , AddressCommand & , Conversion = Conversion::None ) ;
104 static bool parseMailBoolean( std::string_view , std::string_view , AddressCommand & ) ;
105 static std::string encodeDomain( std::string_view ) ;
108inline GSmtp::ServerParser::Config & GSmtp::ServerParser::Config::set_allow_spaces(
bool b )
noexcept { allow_spaces = b ;
return *this ; }
109inline GSmtp::ServerParser::Config & GSmtp::ServerParser::Config::set_allow_nobrackets(
bool b )
noexcept { allow_nobrackets = b ;
return *this ; }
111inline GSmtp::ServerParser::Config & GSmtp::ServerParser::Config::set_allow_spaces_help(
const std::string & s ) { allow_spaces_help = s ;
return *this ; }
112inline GSmtp::ServerParser::Config & GSmtp::ServerParser::Config::set_allow_nobrackets_help(
const std::string & s ) { allow_nobrackets_help = s ;
return *this ; }
A static class for SMTP command parsing, used by GSmtp::ServerProtocol as a mix-in base.
static AddressCommand parseRcptTo(std::string_view, const Config &)
Parses a RCPT-TO command.
static std::string parseVrfy(const std::string &)
Parses a VRFY command.
static AddressCommand parseMailFrom(std::string_view, const Config &)
Parses a MAIL-FROM command.
static std::pair< bool, bool > parseBdatLast(std::string_view)
Parses a BDAT LAST command.
static std::pair< std::size_t, bool > parseBdatSize(std::string_view)
Parses a BDAT command.
static std::string parseHeloPeerName(const std::string &)
Parses the peer name from an HELO/EHLO command.
A configuration structure for GSmtp::ServerParser.