PcapPlusPlus
24.09
|
#include <SmtpLayer.h>
Public Types | |
enum class | SmtpCommand : uint64_t { UNK , DATA = ('D') | ('A' << 8) | ('T' << 16) | ('A' << 24) , EHLO = ('E') | ('H' << 8) | ('L' << 16) | ('O' << 24) , EXPN = ('E') | ('X' << 8) | ('P' << 16) | ('N' << 24) , HELO = ('H') | ('E' << 8) | ('L' << 16) | ('O' << 24) , HELP = ('H') | ('E' << 8) | ('L' << 16) | ('P' << 24) , MAIL = ('M') | ('A' << 8) | ('I' << 16) | ('L' << 24) , NOOP = ('N') | ('O' << 8) | ('O' << 16) | ('P' << 24) , QUIT = ('Q') | ('U' << 8) | ('I' << 16) | ('T' << 24) , RCPT = ('R') | ('C' << 8) | ('P' << 16) | ('T' << 24) , RSET = ('R') | ('S' << 8) | ('E' << 16) | ('T' << 24) , VRFY = ('V') | ('R' << 8) | ('F' << 16) | ('Y' << 24) , STARTTLS , TURN = ('T') | ('U' << 8) | ('R' << 16) | ('N' << 24) , SEND = ('S') | ('E' << 8) | ('N' << 16) | ('D' << 24) , SOML = ('S') | ('O' << 8) | ('M' << 16) | ('L' << 24) , SAML = ('S') | ('A' << 8) | ('M' << 16) | ('L' << 24) , AUTH = ('A') | ('U' << 8) | ('T' << 16) | ('H' << 24) , ATRN = ('A') | ('T' << 8) | ('R' << 16) | ('N' << 24) , BDAT = ('B') | ('D' << 8) | ('A' << 16) | ('T' << 24) , ETRN = ('E') | ('T' << 8) | ('R' << 16) | ('N' << 24) , XADR = ('X') | ('A' << 8) | ('D' << 16) | ('R' << 24) , XCIR = ('X') | ('C' << 8) | ('I' << 16) | ('R' << 24) , XSTA = ('X') | ('S' << 8) | ('T' << 16) | ('A' << 24) , XGEN = ('X') | ('G' << 8) | ('E' << 16) | ('N' << 24) } |
Public Member Functions | |
SmtpRequestLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet) | |
SmtpRequestLayer (const SmtpCommand &command, const std::string &option="") | |
bool | setCommand (SmtpCommand code) |
SmtpCommand | getCommand () const |
std::string | getCommandString () const |
bool | setCommandOption (const std::string &value) |
std::string | getCommandOption (bool removeEscapeCharacters=true) const |
std::string | toString () const |
Public Member Functions inherited from pcpp::SmtpLayer | |
void | parseNextLayer () |
SMTP is the always last so does nothing for this layer. | |
size_t | getHeaderLen () const |
void | computeCalculateFields () |
Does nothing for this layer. | |
OsiModelLayer | getOsiModelLayer () const |
Public Member Functions inherited from pcpp::SingleCommandTextProtocol | |
bool | isMultiLine () const |
Public Member Functions inherited from pcpp::Layer | |
virtual | ~Layer () |
Layer * | getNextLayer () const |
Layer * | getPrevLayer () const |
ProtocolType | getProtocol () const |
bool | isMemberOfProtocolFamily (ProtocolTypeFamily protocolTypeFamily) const |
uint8_t * | getData () const |
size_t | getDataLen () const |
uint8_t * | getLayerPayload () const |
size_t | getLayerPayloadSize () const |
bool | isAllocatedToPacket () const |
void | copyData (uint8_t *toArr) const |
uint8_t * | getDataPtr (size_t offset=0) const |
Static Public Member Functions | |
static std::string | getCommandInfo (SmtpCommand code) |
static std::string | getCommandAsString (SmtpCommand code) |
Static Public Member Functions inherited from pcpp::SmtpLayer | |
static bool | isSmtpPort (uint16_t port) |
Static Public Member Functions inherited from pcpp::SingleCommandTextProtocol | |
static bool | isDataValid (const uint8_t *data, size_t dataSize) |
Class for representing the request messages of SMTP Layer
|
strong |
Enum for SMTP command codes
|
inline |
A constructor that creates the layer from an existing packet raw data
[in] | data | A pointer to the raw data |
[in] | dataLen | Size of the data in bytes |
[in] | prevLayer | A pointer to the previous layer |
[in] | packet | A pointer to the Packet instance where layer will be stored in |
|
inlineexplicit |
A constructor that creates layer with provided input values
[in] | command | SMTP command |
[in] | option | Argument of the command |
SmtpCommand pcpp::SmtpRequestLayer::getCommand | ( | ) | const |
Get the command of request message
|
static |
Convert the command to readable string
[in] | code | Command code to convert |
|
static |
Convert the command info to readable string
[in] | code | Command code to convert |
std::string pcpp::SmtpRequestLayer::getCommandOption | ( | bool | removeEscapeCharacters = true | ) | const |
Get the command argument of request message
[in] | removeEscapeCharacters | Whether non-alphanumerical characters should be removed or not |
std::string pcpp::SmtpRequestLayer::getCommandString | ( | ) | const |
Get the command of request message as string
bool pcpp::SmtpRequestLayer::setCommand | ( | SmtpCommand | code | ) |
Set the command of request message
[in] | code | Value to set command |
bool pcpp::SmtpRequestLayer::setCommandOption | ( | const std::string & | value | ) |
Set the command argument of request message
[in] | value | Value to set command argument |
|
virtual |
Implements pcpp::Layer.