From c85a1af372075e0add5f6dc039ddecbd8183613a Mon Sep 17 00:00:00 2001 From: Dimitar Krastev Date: Sun, 10 Aug 2025 09:02:14 +0300 Subject: [PATCH 1/5] Split FTP protocol type into FTPControl and FTPData to differentiate between channels. --- Packet++/header/FtpLayer.h | 6 +++--- Packet++/header/ProtocolType.h | 9 +++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Packet++/header/FtpLayer.h b/Packet++/header/FtpLayer.h index 63cd6565b4..05792eff09 100644 --- a/Packet++/header/FtpLayer.h +++ b/Packet++/header/FtpLayer.h @@ -14,9 +14,9 @@ namespace pcpp { protected: FtpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : SingleCommandTextProtocol(data, dataLen, prevLayer, packet, FTP) {}; + : SingleCommandTextProtocol(data, dataLen, prevLayer, packet, FTPControl) {}; FtpLayer(const std::string& command, const std::string& option) - : SingleCommandTextProtocol(command, option, FTP) {}; + : SingleCommandTextProtocol(command, option, FTPControl) {}; public: /// A static method that checks whether the port is considered as FTP control @@ -447,7 +447,7 @@ namespace pcpp FtpDataLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) : PayloadLayer(data, dataLen, prevLayer, packet) { - m_Protocol = FTP; + m_Protocol = FtpData; }; /// @return Returns the protocol info as readable string diff --git a/Packet++/header/ProtocolType.h b/Packet++/header/ProtocolType.h index 2e6d00044b..9c850126e7 100644 --- a/Packet++/header/ProtocolType.h +++ b/Packet++/header/ProtocolType.h @@ -163,8 +163,8 @@ namespace pcpp /// Telnet Protocol const ProtocolType Telnet = 40; - /// File Transfer (FTP) Protocol - const ProtocolType FTP = 41; + /// File Transfer (FTP) Protocol - Control channel + const ProtocolType FTPControl = 41; /// ICMPv6 protocol const ProtocolType ICMPv6 = 42; @@ -223,6 +223,11 @@ namespace pcpp /// Diagnostic over IP protocol (DOIP) const ProtocolType DOIP = 59; + /// File Transfer Protocol (FTP) Data channel + const ProtocolType FtpData = 60; + + const ProtocolTypeFamily Ftp = 0x3c29; // FTPControl and FtpData protocols + /// An enum representing OSI model layers enum OsiModelLayer { From c7310c30c77a8c035f57be48e2c2689a80ec0625 Mon Sep 17 00:00:00 2001 From: Dimitar Krastev Date: Sun, 10 Aug 2025 09:12:27 +0300 Subject: [PATCH 2/5] Docs update. --- Packet++/header/ProtocolType.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Packet++/header/ProtocolType.h b/Packet++/header/ProtocolType.h index 9c850126e7..1d76bce067 100644 --- a/Packet++/header/ProtocolType.h +++ b/Packet++/header/ProtocolType.h @@ -226,7 +226,8 @@ namespace pcpp /// File Transfer Protocol (FTP) Data channel const ProtocolType FtpData = 60; - const ProtocolTypeFamily Ftp = 0x3c29; // FTPControl and FtpData protocols + /// FTP protocol family (FTPControl and FtpData protocols) + const ProtocolTypeFamily Ftp = 0x3c29; /// An enum representing OSI model layers enum OsiModelLayer From edba03a128842c2e0e35c85ab6cb328ee5852b02 Mon Sep 17 00:00:00 2001 From: Dimitar Krastev Date: Sun, 10 Aug 2025 09:12:59 +0300 Subject: [PATCH 3/5] Lint --- Packet++/header/ProtocolType.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packet++/header/ProtocolType.h b/Packet++/header/ProtocolType.h index 1d76bce067..6f9c4d0402 100644 --- a/Packet++/header/ProtocolType.h +++ b/Packet++/header/ProtocolType.h @@ -227,7 +227,7 @@ namespace pcpp const ProtocolType FtpData = 60; /// FTP protocol family (FTPControl and FtpData protocols) - const ProtocolTypeFamily Ftp = 0x3c29; + const ProtocolTypeFamily Ftp = 0x3c29; /// An enum representing OSI model layers enum OsiModelLayer From 08cdd2ad0d1f36fde234245f76ba6a895ed07a36 Mon Sep 17 00:00:00 2001 From: Dimitar Krastev Date: Sun, 10 Aug 2025 10:42:16 +0300 Subject: [PATCH 4/5] Fixed FTP capitalization. --- Packet++/header/ProtocolType.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Packet++/header/ProtocolType.h b/Packet++/header/ProtocolType.h index 6f9c4d0402..e025123bd2 100644 --- a/Packet++/header/ProtocolType.h +++ b/Packet++/header/ProtocolType.h @@ -224,10 +224,10 @@ namespace pcpp const ProtocolType DOIP = 59; /// File Transfer Protocol (FTP) Data channel - const ProtocolType FtpData = 60; + const ProtocolType FTPData = 60; /// FTP protocol family (FTPControl and FtpData protocols) - const ProtocolTypeFamily Ftp = 0x3c29; + const ProtocolTypeFamily FTP = 0x3c29; /// An enum representing OSI model layers enum OsiModelLayer From 8046b2a8e53d89e2cd67f057ccfa2374023182f1 Mon Sep 17 00:00:00 2001 From: Dimitar Krastev Date: Sun, 10 Aug 2025 10:47:00 +0300 Subject: [PATCH 5/5] Fix FTPData usage. --- Packet++/header/FtpLayer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packet++/header/FtpLayer.h b/Packet++/header/FtpLayer.h index 05792eff09..c0be452282 100644 --- a/Packet++/header/FtpLayer.h +++ b/Packet++/header/FtpLayer.h @@ -447,7 +447,7 @@ namespace pcpp FtpDataLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) : PayloadLayer(data, dataLen, prevLayer, packet) { - m_Protocol = FtpData; + m_Protocol = FTPData; }; /// @return Returns the protocol info as readable string