1 #ifndef PACKETPP_SMTP_LAYER
2 #define PACKETPP_SMTP_LAYER
24 SmtpLayer(
const std::string& command,
const std::string& option)
35 return port == 25 || port == 587;
79 DATA = (
'D') | (
'A' << 8) | (
'T' << 16) | (
'A' << 24),
81 EHLO = (
'E') | (
'H' << 8) | (
'L' << 16) | (
'O' << 24),
83 EXPN = (
'E') | (
'X' << 8) | (
'P' << 16) | (
'N' << 24),
85 HELO = (
'H') | (
'E' << 8) | (
'L' << 16) | (
'O' << 24),
87 HELP = (
'H') | (
'E' << 8) | (
'L' << 16) | (
'P' << 24),
89 MAIL = (
'M') | (
'A' << 8) | (
'I' << 16) | (
'L' << 24),
91 NOOP = (
'N') | (
'O' << 8) | (
'O' << 16) | (
'P' << 24),
93 QUIT = (
'Q') | (
'U' << 8) | (
'I' << 16) | (
'T' << 24),
95 RCPT = (
'R') | (
'C' << 8) | (
'P' << 16) | (
'T' << 24),
97 RSET = (
'R') | (
'S' << 8) | (
'E' << 16) | (
'T' << 24),
99 VRFY = (
'V') | (
'R' << 8) | (
'F' << 16) | (
'Y' << 24),
101 STARTTLS = ((
'S') | (
'T' << 8) | (
'A' << 16) | (
'R' << 24) |
102 static_cast<uint64_t
>((
'T') | (
'T' << 8) | (
'L' << 16) | (
'S' << 24)) << 32),
104 TURN = (
'T') | (
'U' << 8) | (
'R' << 16) | (
'N' << 24),
106 SEND = (
'S') | (
'E' << 8) | (
'N' << 16) | (
'D' << 24),
108 SOML = (
'S') | (
'O' << 8) | (
'M' << 16) | (
'L' << 24),
110 SAML = (
'S') | (
'A' << 8) | (
'M' << 16) | (
'L' << 24),
112 AUTH = (
'A') | (
'U' << 8) | (
'T' << 16) | (
'H' << 24),
114 ATRN = (
'A') | (
'T' << 8) | (
'R' << 16) | (
'N' << 24),
116 BDAT = (
'B') | (
'D' << 8) | (
'A' << 16) | (
'T' << 24),
118 ETRN = (
'E') | (
'T' << 8) | (
'R' << 16) | (
'N' << 24),
120 XADR = (
'X') | (
'A' << 8) | (
'D' << 16) | (
'R' << 24),
122 XCIR = (
'X') | (
'C' << 8) | (
'I' << 16) | (
'R' << 24),
124 XSTA = (
'X') | (
'S' << 8) | (
'T' << 16) | (
'A' << 24),
126 XGEN = (
'X') | (
'G' << 8) | (
'E' << 16) | (
'N' << 24)
136 :
SmtpLayer(data, dataLen, prevLayer, packet) {};
289 :
SmtpLayer(data, dataLen, prevLayer, packet) {};
297 :
SmtpLayer(std::to_string(int(code)), option) {};
Definition: SingleCommandTextProtocol.h:19
Definition: SmtpLayer.h:19
void computeCalculateFields()
Does nothing for this layer.
Definition: SmtpLayer.h:53
size_t getHeaderLen() const
Definition: SmtpLayer.h:47
OsiModelLayer getOsiModelLayer() const
Definition: SmtpLayer.h:59
static bool isSmtpPort(uint16_t port)
Definition: SmtpLayer.h:33
void parseNextLayer()
SMTP is the always last so does nothing for this layer.
Definition: SmtpLayer.h:41
Definition: SmtpLayer.h:69
std::string toString() const
std::string getCommandString() const
SmtpCommand
Definition: SmtpLayer.h:75
@ STARTTLS
Start TLS handshake.
@ SAML
Send mail to terminal and mailbox.
@ TURN
Reverse the role of sender and receiver.
@ BDAT
Submit mail contents.
@ ETRN
Request to start SMTP queue processing.
@ ATRN
Reverse the role of sender and receiver.
@ SEND
Send mail to terminal.
@ QUIT
Close conversation.
@ EXPN
Expand the mailing list.
@ EHLO
Initiate conversation.
@ XGEN
Release status of whether a compiled configuration and character set are in use.
@ SOML
Send mail to terminal or to mailbox.
@ RCPT
Receiver indication.
@ XADR
Release status of the channel.
@ XSTA
Release status of the number of messages in channel queues.
@ XCIR
Release status of the circuit checking facility.
@ DATA
Starting mail body.
@ AUTH
Authenticate client and server.
@ HELO
Initiate conversation.
static std::string getCommandAsString(SmtpCommand code)
bool setCommand(SmtpCommand code)
SmtpRequestLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: SmtpLayer.h:135
SmtpCommand getCommand() const
static std::string getCommandInfo(SmtpCommand code)
std::string getCommandOption(bool removeEscapeCharacters=true) const
SmtpRequestLayer(const SmtpCommand &command, const std::string &option="")
Definition: SmtpLayer.h:143
bool setCommandOption(const std::string &value)
Definition: SmtpLayer.h:205
SmtpResponseLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: SmtpLayer.h:288
static std::string getStatusCodeAsString(SmtpStatusCode code)
bool setStatusOption(const std::string &value)
SmtpStatusCode
Definition: SmtpLayer.h:211
@ NAME_NOT_ALLOWED
Requested action not taken: mailbox name not allowed.
@ PARAM_NOT_ACCOMMODATED
Server unable to accommodate parameters.
@ INSUFFICIENT_STORAGE
Requested action not taken: insufficient system storage.
@ SERVICE_READY
<domain> Service ready
@ HELP_MESSAGE
Help message.
@ ENCRYPT_NEED
Encryption needed.
@ EXCEED_STORAGE
Requested mail action aborted: exceeded storage allocation.
@ SERVICE_UNAVAILABLE
<domain> Service not available, closing transmission channel
@ MAILBOX_UNAVAILABLE_TEMP
Requested mail action not taken: mailbox unavailable (mail busy or temporarily blocked)
@ SERVICE_CLOSE
<domain> Service closing transmission channel
@ ENCRYPT_REQUIRED
Encryption required for requested authentication mechanism.
@ AUTH_CRED_INVALID
Authentication credentials invalid.
@ SYSTEM_STATUS
System status, or system help reply.
@ ABORT_LOCAL_ERROR
Requested action aborted: local error in processing.
@ CMD_BAD_SEQUENCE
Bad sequence of commands.
@ CMD_NOT_IMPLEMENTED
Command not implemented.
@ AUTH_REQUIRED
Authentication required.
@ CMD_NOT_RECOGNIZED
Syntax error, command unrecognized.
@ USER_NOT_LOCAL
User not local; please try <forward-path>
@ COMPLETED
Requested mail action okay, completed.
@ SYNTAX_ERROR_PARAM
Syntax error in parameters or arguments.
@ PASS_NEEDED
A password transition is needed.
@ TRANSACTION_FAIL
Transaction failed.
@ DOMAIN_NOT_ACCEPT
Domain does not accept mail.
@ MAIL_NOT_ACCEPTED
Server does not accept mail.
@ MAILBOX_UNAVAILABLE
Requested action not taken: mailbox unavailable.
@ PARAM_NOT_IMPLEMENTED
Command parameter not implemented.
@ TEMP_AUTH_FAILED
Temporary authentication failed.
@ AUTH_SUCCESS
Authentication successful.
@ MAIL_INPUT
Start mail input; end with <CRLF>.<CRLF>
@ WILL_FORWARD
User not local; will forward to <forward-path>
@ AUTH_TOO_WEAK
Authentication mechanism is too weak.
@ CANNOT_VERIFY
Cannot VRFY user, but will accept message and attempt delivery.
bool setStatusCode(SmtpStatusCode code)
std::string getStatusCodeString() const
std::string toString() const
std::string getStatusOption(bool removeEscapeCharacters=true) const
SmtpResponseLayer(const SmtpStatusCode &code, const std::string &option="")
Definition: SmtpLayer.h:296
SmtpStatusCode getStatusCode() const
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:354
@ OsiModelApplicationLayer
Definition: ProtocolType.h:368