Skip to content

Commit

Permalink
structure test file
Browse files Browse the repository at this point in the history
  • Loading branch information
egecetin committed Sep 18, 2023
1 parent 1dcb111 commit 4145366
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 56 deletions.
109 changes: 54 additions & 55 deletions Packet++/header/SmtpLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/
namespace pcpp
{

/**
* Class for general SMTP message
*/
Expand Down Expand Up @@ -182,60 +181,60 @@ namespace pcpp
*/
enum class SmtpStatusCode : int
{
/// System status, or system help reply
SYSTEM_STATUS = 211,
/// Help message
HELP_MESSAGE = 214,
/// Server ready
SERVER_READY = 220,
/// Server closing transmission channel
SERVER_CLOSE = 221,
/// Requested mail action okay, completed
COMMAND_COMPLETE = 250,
/// User not local; will forward
FORWARD_PATH = 251,
/// Cannot VRFY user, but will accept message and attempt delivery
CANNOT_VERIFY = 252,
/// Server challenge
SERVER_CHALLENGE = 334,
/// Start mail input
START_MAIL = 354,
/// Service not available, closing transmission channel
SERVER_UNAVAILABLE = 421,
/// Requested mail action not taken: mailbox unavailable (mailbox busy or temporarily blocked)
MAILBOX_UNAVAILABLE_TEMP = 450,
/// Requested action aborted: local error in processing
SERVER_ABORT_LOCAL = 451,
/// Requested action not taken: insufficient system storage
SERVER_ABORT_STORAGE = 452,
/// Server unable to accommodate parameters
PARAM_NOT_ACCOMMODATED = 455,
/// Syntax error, command unrecognized
SYNTAXX_ERROR_CMD = 500,
/// Syntax error in parameters or arguments
SYNTAX_ERROR_PARAM = 501,
/// Command not implemented
CMD_NOT_IMPLEMENTED = 502,
/// Bad sequence of commands
BAD_CMD_SEQUENCE = 503,
/// Command parameter not implemented
PARAM_NOT_IMPLEMENTED = 504,
/// Server does not accept mail
NOT_ACCEPT = 521,
/// Encryption needed
ENCRYPT_NEED = 523,
/// Requested action not taken: mailbox unavailable (mailbox not found)
MAILBOX_UNAVAILABLE = 550,
/// User not local
USER_NOT_LOCAL = 551,
/// Requested mail action aborted: exceeded storage allocation
EXCEED_STORAGE = 552,
/// Requested action not taken: mailbox name not allowed
NAME_NOT_ALLOWED = 553,
/// Transaction failed
TRANSACTION_FAIL = 554,
/// Domain does not accept mail
DOMAIN_NOT_ACCEPT = 556
/// System status, or system help reply
SYSTEM_STATUS = 211,
/// Help message
HELP_MESSAGE = 214,
/// Server ready
SERVER_READY = 220,
/// Server closing transmission channel
SERVER_CLOSE = 221,
/// Requested mail action okay, completed
COMMAND_COMPLETE = 250,
/// User not local; will forward
FORWARD_PATH = 251,
/// Cannot VRFY user, but will accept message and attempt delivery
CANNOT_VERIFY = 252,
/// Server challenge
SERVER_CHALLENGE = 334,
/// Start mail input
START_MAIL = 354,
/// Service not available, closing transmission channel
SERVER_UNAVAILABLE = 421,
/// Requested mail action not taken: mailbox unavailable (mailbox busy or temporarily blocked)
MAILBOX_UNAVAILABLE_TEMP = 450,
/// Requested action aborted: local error in processing
SERVER_ABORT_LOCAL = 451,
/// Requested action not taken: insufficient system storage
SERVER_ABORT_STORAGE = 452,
/// Server unable to accommodate parameters
PARAM_NOT_ACCOMMODATED = 455,
/// Syntax error, command unrecognized
SYNTAXX_ERROR_CMD = 500,
/// Syntax error in parameters or arguments
SYNTAX_ERROR_PARAM = 501,
/// Command not implemented
CMD_NOT_IMPLEMENTED = 502,
/// Bad sequence of commands
BAD_CMD_SEQUENCE = 503,
/// Command parameter not implemented
PARAM_NOT_IMPLEMENTED = 504,
/// Server does not accept mail
NOT_ACCEPT = 521,
/// Encryption needed
ENCRYPT_NEED = 523,
/// Requested action not taken: mailbox unavailable (mailbox not found)
MAILBOX_UNAVAILABLE = 550,
/// User not local
USER_NOT_LOCAL = 551,
/// Requested mail action aborted: exceeded storage allocation
EXCEED_STORAGE = 552,
/// Requested action not taken: mailbox name not allowed
NAME_NOT_ALLOWED = 553,
/// Transaction failed
TRANSACTION_FAIL = 554,
/// Domain does not accept mail
DOMAIN_NOT_ACCEPT = 556
};

/** A constructor that creates the layer from an existing packet raw data
Expand Down
1 change: 0 additions & 1 deletion Packet++/src/SmtpLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace pcpp
{

// ----------------- Class SmtpRequestLayer -----------------
bool SmtpRequestLayer::setCommand(SmtpCommand code) { return setCommandInternal(getCommandAsString(code)); }

Expand Down
1 change: 1 addition & 0 deletions Tests/Packet++Test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ add_executable(
Tests/SipSdpTests.cpp
Tests/Sll2Tests.cpp
Tests/SllNullLoopbackTests.cpp
Tests/SmtpTests.cpp
Tests/SomeIpSdTests.cpp
Tests/SomeIpTests.cpp
Tests/SSHTests.cpp
Expand Down
28 changes: 28 additions & 0 deletions Tests/Packet++Test/Tests/SmtpTests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "../TestDefinition.h"
#include "../Utils/TestUtils.h"
#include "EndianPortable.h"
#include "EthLayer.h"
#include "IPv4Layer.h"
#include "IPv6Layer.h"
#include "Packet.h"
#include "SmtpLayer.h"
#include "SystemUtils.h"
#include "TcpLayer.h"

PTF_TEST_CASE(SmtpParsingTests)
{
timeval time;
gettimeofday(&time, nullptr);
}

PTF_TEST_CASE(SmtpCreationTests)
{
timeval time;
gettimeofday(&time, nullptr);
}

PTF_TEST_CASE(SmtpEditTests)
{
timeval time;
gettimeofday(&time, nullptr);
}

0 comments on commit 4145366

Please sign in to comment.