PcapPlusPlus
24.09
|
#include <SomeIpLayer.h>
Classes | |
struct | someiphdr |
Public Types | |
enum class | MsgType : uint8_t { REQUEST = 0x00 , REQUEST_ACK = 0x40 , REQUEST_NO_RETURN = 0x01 , REQUEST_NO_RETURN_ACK = 0x41 , NOTIFICATION = 0x02 , NOTIFICATION_ACK = 0x42 , RESPONSE = 0x80 , RESPONSE_ACK = 0xC0 , ERRORS = 0x81 , ERROR_ACK = 0xC1 , TP_REQUEST = 0x20 , TP_REQUEST_NO_RETURN = 0x21 , TP_NOTIFICATION = 0x22 , TP_RESPONSE = 0xa0 , TP_ERROR = 0xa1 } |
Public Member Functions | |
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 () | |
someiphdr * | getSomeIpHeader () 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 |
virtual void | computeCalculateFields () |
void | parseNextLayer () |
virtual std::string | toString () const |
OsiModelLayer | getOsiModelLayer () const |
Public Member Functions inherited from pcpp::Layer | |
virtual | ~Layer () |
Layer * | getNextLayer () const |
Layer * | getPrevLayer () const |
ProtocolType | getProtocol () const |
bool | isMemberOfProtocolFamily (ProtocolTypeFamily protocolTypeFamily) 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 Layer * | parseSomeIpLayer (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 () |
Represents a SOME/IP protocol layer
|
strong |
SOME/IP message types
|
inline |
A constructor that creates the layer from an existing packet raw data
[in] | data | A pointer to the raw data (will be casted to someiphdr) |
[in] | dataLen | Size of the data in bytes |
[in] | prevLayer | A pointer to the previous layer |
[in] | packet | A pointer to the Packet instance where layer will be stored in |
pcpp::SomeIpLayer::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 |
||
) |
Construct a new layer object
[in] | serviceID | Service ID |
[in] | methodID | Method ID |
[in] | clientID | Client ID |
[in] | sessionID | Session ID |
[in] | interfaceVersion | Interface Version |
[in] | type | Type of the message |
[in] | returnCode | Return Code |
[in] | data | A pointer to the raw data |
[in] | dataLen | Size of the data in bytes holds the reference to a data buffer. This option can be used to reduce the number of copies to generate packets. |
|
inline |
Destroy the layer object
|
static |
Adds port to a list of ports where pcap checks for SOME/IP communication. Each port must be removed at the end in order to have no memory leak.
[in] | port | Port to add |
|
inlinevirtual |
Does nothing for this layer
Implements pcpp::Layer.
Reimplemented in pcpp::SomeIpSdLayer, and pcpp::SomeIpTpLayer.
uint16_t pcpp::SomeIpLayer::getClientID | ( | ) | const |
Get the clientID
|
inlinevirtual |
uint8_t pcpp::SomeIpLayer::getInterfaceVersion | ( | ) | const |
Get the interfaceVersion
uint32_t pcpp::SomeIpLayer::getLengthField | ( | ) | const |
Get the Length Field of the SOME/IP header
uint32_t pcpp::SomeIpLayer::getMessageID | ( | ) | const |
Get the messageID
SomeIpLayer::MsgType pcpp::SomeIpLayer::getMessageType | ( | ) | const |
Get the message type
uint8_t pcpp::SomeIpLayer::getMessageTypeAsInt | ( | ) | const |
Get the message type
uint16_t pcpp::SomeIpLayer::getMethodID | ( | ) | const |
Get the methodID
|
inlinevirtual |
Implements pcpp::Layer.
|
inline |
|
inline |
uint8_t pcpp::SomeIpLayer::getProtocolVersion | ( | ) | const |
Get the protocolVersion
uint32_t pcpp::SomeIpLayer::getRequestID | ( | ) | const |
Get the requestID
uint8_t pcpp::SomeIpLayer::getReturnCode | ( | ) | const |
Get the returnCode
uint16_t pcpp::SomeIpLayer::getServiceID | ( | ) | const |
Get the serviceID
uint16_t pcpp::SomeIpLayer::getSessionID | ( | ) | const |
Get the sessionID
|
inline |
Get a pointer to the basic SOME/IP header. Notice this points directly to the data, so every change will change the actual packet data
|
static |
Checks if given port is a SOME/IP protocol port (only Service Discovery ports are checked for now)
[in] | port | Port to check |
|
virtual |
Identifies the following next layers: SomeIpLayer, SomeIpTpLayer, SomeIpSdLayer. Otherwise sets PayloadLayer
Implements pcpp::Layer.
|
static |
A static method that creates a SOME/IP or SOME/IP-TP layer from packet raw data. Returns PayloadLayer if data is not valid.
[in] | data | A pointer to the raw data |
[in] | dataLen | Size of the data in bytes |
[in] | prevLayer | A pointer to the previous layer |
[in] | packet | A pointer to the Packet instance where layer will be stored |
|
static |
Removes all ports from a list of ports where pcap checks for SOME/IP communication.
|
static |
Removes port from a list of ports where pcap checks for SOME/IP communication.
[in] | port | Port to remove |
void pcpp::SomeIpLayer::setClientID | ( | uint16_t | clientID | ) |
Set the Client ID
[in] | clientID | clientID to set |
void pcpp::SomeIpLayer::setInterfaceVersion | ( | uint8_t | version | ) |
Set the Interface Version
[in] | version | version to set |
void pcpp::SomeIpLayer::setMessageID | ( | uint32_t | messageID | ) |
Set the Message ID
[in] | messageID | messageID to set |
void pcpp::SomeIpLayer::setMessageType | ( | MsgType | type | ) |
Set the Message Type
[in] | type | Type to set |
void pcpp::SomeIpLayer::setMessageType | ( | uint8_t | type | ) |
Set the Message Type
[in] | type | Type to set |
void pcpp::SomeIpLayer::setMethodID | ( | uint16_t | methodID | ) |
Set the Method ID
[in] | methodID | methodID to set |
void pcpp::SomeIpLayer::setPayloadLength | ( | uint32_t | payloadLength | ) |
Set the length field of the SOME/IP header
[in] | payloadLength | Length of the payload |
void pcpp::SomeIpLayer::setProtocolVersion | ( | uint8_t | version | ) |
Set the Protocol Version
[in] | version | version to set |
void pcpp::SomeIpLayer::setRequestID | ( | uint32_t | requestID | ) |
Set the Request ID
[in] | requestID | requestID to set |
void pcpp::SomeIpLayer::setReturnCode | ( | uint8_t | returnCode | ) |
Set the returnCode
[in] | returnCode | ReturnCode to set |
void pcpp::SomeIpLayer::setServiceID | ( | uint16_t | serviceID | ) |
Set the Service ID
[in] | serviceID | serviceID to set |
void pcpp::SomeIpLayer::setSessionID | ( | uint16_t | sessionID | ) |
Set the Session ID
[in] | sessionID | sessionID to set |
|
virtual |
Implements pcpp::Layer.
Reimplemented in pcpp::SomeIpSdLayer, and pcpp::SomeIpTpLayer.