PcapPlusPlus  23.09
pcpp::SomeIpSdLayer Class Reference

#include <SomeIpSdLayer.h>

Inheritance diagram for pcpp::SomeIpSdLayer:
pcpp::SomeIpLayer pcpp::Layer pcpp::IDataContainer

Public Member Functions

 SomeIpSdLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
 SomeIpSdLayer (uint16_t serviceID, uint16_t methodID, uint16_t clientID, uint16_t sessionID, uint8_t interfaceVersion, MsgType type, uint8_t returnCode, uint8_t flags)
 
 ~SomeIpSdLayer ()
 
uint8_t getFlags () const
 
void setFlags (uint8_t flags)
 
uint32_t getNumEntries () const
 
uint32_t getNumOptions () const
 
const EntriesVec getEntries () const
 
const OptionsVec getOptions () const
 
const OptionsVec getOptionsFromEntry (uint32_t index) const
 
uint32_t addEntry (const SomeIpSdEntry &entry)
 
bool addOptionTo (uint32_t indexEntry, const SomeIpSdOption &option)
 
void computeCalculateFields ()
 
std::string toString () const
 
- Public Member Functions inherited from pcpp::SomeIpLayer
 SomeIpLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
 SomeIpLayer (uint16_t serviceID, uint16_t methodID, uint16_t clientID, uint16_t sessionID, uint8_t interfaceVersion, MsgType type, uint8_t returnCode, const uint8_t *const data=nullptr, size_t dataLen=0)
 
 ~SomeIpLayer ()
 
someiphdrgetSomeIpHeader () const
 
uint32_t getMessageID () const
 
void setMessageID (uint32_t messageID)
 
uint16_t getServiceID () const
 
void setServiceID (uint16_t serviceID)
 
uint16_t getMethodID () const
 
void setMethodID (uint16_t methodID)
 
uint32_t getLengthField () const
 
uint32_t getRequestID () const
 
void setRequestID (uint32_t requestID)
 
uint16_t getSessionID () const
 
void setSessionID (uint16_t sessionID)
 
uint16_t getClientID () const
 
void setClientID (uint16_t clientID)
 
uint8_t getProtocolVersion () const
 
void setProtocolVersion (uint8_t version)
 
uint8_t getInterfaceVersion () const
 
void setInterfaceVersion (uint8_t version)
 
uint8_t getMessageTypeAsInt () const
 
SomeIpLayer::MsgType getMessageType () const
 
void setMessageType (MsgType type)
 
void setMessageType (uint8_t type)
 
uint8_t getReturnCode () const
 
void setReturnCode (uint8_t returnCode)
 
void setPayloadLength (uint32_t payloadLength)
 
uint8_t * getPduPayload () const
 
size_t getPduPayloadSize () const
 
size_t getHeaderLen () const
 
void parseNextLayer ()
 
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
 

Static Public Member Functions

static bool isSomeIpSdPort (uint16_t port)
 
static bool isDataValid (const uint8_t *data, size_t dataLen)
 
- Static Public Member Functions inherited from pcpp::SomeIpLayer
static LayerparseSomeIpLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
static bool isSomeIpPort (uint16_t port)
 
static void addSomeIpPort (uint16_t port)
 
static void removeSomeIpPort (uint16_t port)
 
static void removeAllSomeIpPorts ()
 

Additional Inherited Members

- Public Types inherited from pcpp::SomeIpLayer
enum  MsgType : uint8_t {
  MsgType::REQUEST = 0x00, MsgType::REQUEST_ACK = 0x40, MsgType::REQUEST_NO_RETURN = 0x01, MsgType::REQUEST_NO_RETURN_ACK = 0x41,
  MsgType::NOTIFICATION = 0x02, MsgType::NOTIFICATION_ACK = 0x42, MsgType::RESPONSE = 0x80, MsgType::RESPONSE_ACK = 0xC0,
  MsgType::ERRORS = 0x81, MsgType::ERROR_ACK = 0xC1, MsgType::TP_REQUEST = 0x20, MsgType::TP_REQUEST_NO_RETURN = 0x21,
  MsgType::TP_NOTIFICATION = 0x22, MsgType::TP_RESPONSE = 0xa0, MsgType::TP_ERROR = 0xa1
}
 

Detailed Description

Implementation of the SOME/IP-SD protocol

Constructor & Destructor Documentation

◆ SomeIpSdLayer() [1/2]

pcpp::SomeIpSdLayer::SomeIpSdLayer ( uint8_t *  data,
size_t  dataLen,
Layer prevLayer,
Packet packet 
)

A constructor that creates the layer from an existing packet raw 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

◆ SomeIpSdLayer() [2/2]

pcpp::SomeIpSdLayer::SomeIpSdLayer ( uint16_t  serviceID,
uint16_t  methodID,
uint16_t  clientID,
uint16_t  sessionID,
uint8_t  interfaceVersion,
MsgType  type,
uint8_t  returnCode,
uint8_t  flags 
)

Construct a new SomeIpSdLayer object

Parameters
[in]serviceIDService ID
[in]methodIDMethod ID
[in]clientIDClient ID
[in]sessionIDSession ID
[in]interfaceVersionInterface Version
[in]typeType of the message
[in]returnCodeReturn Code
[in]flagsFlags that shall be used in the header

◆ ~SomeIpSdLayer()

pcpp::SomeIpSdLayer::~SomeIpSdLayer ( )
inline

Destroy the layer object

Member Function Documentation

◆ addEntry()

uint32_t pcpp::SomeIpSdLayer::addEntry ( const SomeIpSdEntry entry)

Adds a given entry to the layer and returns the index of the entry

Parameters
[in]entryPointer to the entry that shall be added to the layer
Returns
uint32_t Returns the index of the entry starting with 0

◆ addOptionTo()

bool pcpp::SomeIpSdLayer::addOptionTo ( uint32_t  indexEntry,
const SomeIpSdOption option 
)

Adds an option to an entry that has already been added to the layer by using addEntry(). The option is also added to the layer itself. If the option cannot by assigned to the entry, the option is not copied into the layer.

Parameters
[in]indexEntryIndex of the entry where the option shall be added. First Entry has index 0
[in]optionPointer to the option that shall be added
Returns
True if the option could be assigned to the entry and was copied into the layer, false otherwise

◆ computeCalculateFields()

void pcpp::SomeIpSdLayer::computeCalculateFields ( )
inlinevirtual

Does nothing for this layer

Reimplemented from pcpp::SomeIpLayer.

◆ getEntries()

const EntriesVec pcpp::SomeIpSdLayer::getEntries ( ) const

Get the Entries from this layer

Returns
EntriesVec Vector holding pointers to the options

◆ getFlags()

uint8_t pcpp::SomeIpSdLayer::getFlags ( ) const

Get the Flags of the layer

Returns
uint8_t Flags

◆ getNumEntries()

uint32_t pcpp::SomeIpSdLayer::getNumEntries ( ) const

Get the number of entries in this layer

Returns
uint32_t

◆ getNumOptions()

uint32_t pcpp::SomeIpSdLayer::getNumOptions ( ) const

Get the number of options in this layer

Returns
uint32_t

◆ getOptions()

const OptionsVec pcpp::SomeIpSdLayer::getOptions ( ) const

Get the Options from this layer

Returns
OptionsVec Vector holding pointers to the options

◆ getOptionsFromEntry()

const OptionsVec pcpp::SomeIpSdLayer::getOptionsFromEntry ( uint32_t  index) const

Get the Options from a specific Entry

Parameters
[in]indexIndex of the Entry, starting with 0.
Returns
OptionsVec Vector holding pointers to the options

◆ isDataValid()

static bool pcpp::SomeIpSdLayer::isDataValid ( const uint8_t *  data,
size_t  dataLen 
)
static

The static method makes validation of input data

Parameters
[in]dataThe pointer to the beginning of byte stream of IP packet
[in]dataLenThe length of byte stream
Returns
True if the data is valid and can represent the packet

◆ isSomeIpSdPort()

static bool pcpp::SomeIpSdLayer::isSomeIpSdPort ( uint16_t  port)
inlinestatic

Checks if given port is a SOME/IP-SD protocol port

Parameters
[in]portPort to check
Returns
true if SOME/IP-SD protocol port, false if not

◆ setFlags()

void pcpp::SomeIpSdLayer::setFlags ( uint8_t  flags)

Set the Flags of the layer

Parameters
[in]flagsFlags to set

◆ toString()

std::string pcpp::SomeIpSdLayer::toString ( ) const
virtual
Returns
The string representation of the SOME/IP-SD layer

Reimplemented from pcpp::SomeIpLayer.