Skip to content

Commit e2d10e9

Browse files
authored
Add discrete FTPControl and FTPData protocol types. (#1916)
* Split FTP protocol type into FTPControl and FTPData to differentiate between channels. * Docs update. * Lint * Fixed FTP capitalization. * Fix FTPData usage.
1 parent 31f6a05 commit e2d10e9

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

Packet++/header/FtpLayer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ namespace pcpp
1414
{
1515
protected:
1616
FtpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet)
17-
: SingleCommandTextProtocol(data, dataLen, prevLayer, packet, FTP) {};
17+
: SingleCommandTextProtocol(data, dataLen, prevLayer, packet, FTPControl) {};
1818
FtpLayer(const std::string& command, const std::string& option)
19-
: SingleCommandTextProtocol(command, option, FTP) {};
19+
: SingleCommandTextProtocol(command, option, FTPControl) {};
2020

2121
public:
2222
/// A static method that checks whether the port is considered as FTP control
@@ -447,7 +447,7 @@ namespace pcpp
447447
FtpDataLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet)
448448
: PayloadLayer(data, dataLen, prevLayer, packet)
449449
{
450-
m_Protocol = FTP;
450+
m_Protocol = FTPData;
451451
};
452452

453453
/// @return Returns the protocol info as readable string

Packet++/header/ProtocolType.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ namespace pcpp
163163
/// Telnet Protocol
164164
const ProtocolType Telnet = 40;
165165

166-
/// File Transfer (FTP) Protocol
167-
const ProtocolType FTP = 41;
166+
/// File Transfer (FTP) Protocol - Control channel
167+
const ProtocolType FTPControl = 41;
168168

169169
/// ICMPv6 protocol
170170
const ProtocolType ICMPv6 = 42;
@@ -223,6 +223,12 @@ namespace pcpp
223223
/// Diagnostic over IP protocol (DOIP)
224224
const ProtocolType DOIP = 59;
225225

226+
/// File Transfer Protocol (FTP) Data channel
227+
const ProtocolType FTPData = 60;
228+
229+
/// FTP protocol family (FTPControl and FtpData protocols)
230+
const ProtocolTypeFamily FTP = 0x3c29;
231+
226232
/// An enum representing OSI model layers
227233
enum OsiModelLayer
228234
{

0 commit comments

Comments
 (0)