PcapPlusPlus  21.11
pcpp::SSHLayer Class Reference

#include <SSHLayer.h>

Inheritance diagram for pcpp::SSHLayer:
pcpp::Layer pcpp::IDataContainer pcpp::SSHEncryptedMessage pcpp::SSHHandshakeMessage pcpp::SSHIdentificationMessage pcpp::SSHKeyExchangeInitMessage

Public Member Functions

void parseNextLayer ()
 
void computeCalculateFields ()
 
OsiModelLayer getOsiModelLayer () const
 
- Public Member Functions inherited from pcpp::Layer
virtual ~Layer ()
 
LayergetNextLayer () const
 
LayergetPrevLayer () const
 
ProtocolType getProtocol () 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
 
virtual size_t getHeaderLen () const =0
 
virtual std::string toString () const =0
 

Static Public Member Functions

static SSHLayercreateSSHMessage (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
static bool isSSHPort (uint16_t portSrc, uint16_t portDst)
 

Detailed Description

This is the base class for the SSH layer. It is an abstract class that cannot be instanciated. It holds some common functionality, but its most important method is createSSHMessage() which takes raw data and creates an SSH message according to the heuristics described in the SSHLayer.h file description

Member Function Documentation

◆ computeCalculateFields()

void pcpp::SSHLayer::computeCalculateFields ( )
inlinevirtual

Does nothing for this layer

Implements pcpp::Layer.

◆ createSSHMessage()

static SSHLayer* pcpp::SSHLayer::createSSHMessage ( uint8_t *  data,
size_t  dataLen,
Layer prevLayer,
Packet packet 
)
static

A static method that takes raw packet data and uses the heuristics described in the SSHLayer.h file description to create an SSH layer instance. This method assumes the data is indeed SSH data and not some other arbitrary data

Parameters
[in]dataA pointer to the raw data
[in]dataLenSize of the data in bytes
[in]prevLayerA pointer to the previous layer
[in]packetA pointer to the Packet instance where layer will be stored in
Returns
An instance of one of the classes that inherit SSHLayer as described in the SSHLayer.h file description

◆ getOsiModelLayer()

OsiModelLayer pcpp::SSHLayer::getOsiModelLayer ( ) const
inlinevirtual
Returns
The OSI Model layer this protocol belongs to

Implements pcpp::Layer.

◆ isSSHPort()

static bool pcpp::SSHLayer::isSSHPort ( uint16_t  portSrc,
uint16_t  portDst 
)
inlinestatic

A static method that takes src and dst ports and determines whether it's SSH traffic or not.

Parameters
[in]portSrcThe source TCP port to examine
[in]portDstThe dest TCP port to examine
Returns
Currently the implementation is very simple and returns "true" if either src or dst ports are equal to 22, "false" otherwise

◆ parseNextLayer()

void pcpp::SSHLayer::parseNextLayer ( )
virtual

Several SSH records can reside in a single packets. This method examins the remaining data and creates additional SSH records if applicable

Implements pcpp::Layer.