MessageSomeIP

Summary

Represents a SOME/IP (Scalable service-Oriented MiddlewarE over IP) message.

See also

Message

Methods
Properties
Events

Structure

class MessageSomeIP
append_message(message: IMessageInternetApplication)

Lets the user packs several messages into one packet, each appended message will have its own header.

Parameters

message (IMessageInternetApplication) – The message to append

capture(filter: Filter = None) MessageSomeIP

Matches any message with the same protocol.

Parameters

filter (Filter) – Filter to use to narrow down packets to capture

Returns

Listens to the bus until a message is received and returns this first message

Return type

MessageSomeIP

capture(timeout: int32, filter: Filter = None) MessageSomeIP

Waits for the first message having the same protocol that the sent message without verify the IP address and the port between send and respond message and return it. A timeout is specified to guarantee that the script can continue if no message is captured in a certain time interval.

Parameters
  • timeout (int32) – Max time in milliseconds to wait for the response.

  • filter (Filter) – Filter to use to narrow down packets to capture

Returns

First message captured from the bus or None in case no message is received.

Return type

MessageSomeIP

capture_list(timeout: int32, filter: Filter = None) IReadOnlyList[MessageSomeIP]

Waits for any response having the same protocol that the sent message without verify the IP address and the port between send and respond message and return them all as a list. A timeout is specified to guarantee that the script can continue if no message is received in a certain time interval.

Parameters
  • timeout (int32) – Max time in milliseconds to wait for the response.

  • filter (Filter) – Filter to use to narrow down packets to capture

Returns

List of messages captured from the bus during a given period of time.

Return type

IReadOnlyList[MessageSomeIP]

close_writer()

Closes the file previously created with open_writer(file).

connect(timeout: float = 1) bool

Opens a TCP connection.

Parameters

timeout (float) – Number of seconds to wait for connection to establish before aborting.

Returns

for connect() returns True if there’s a connection.

Return type

bool

disconnect(timeout: float = 0)

Closes the TCP connection opened with connect.

Parameters

timeout (float) – Number of seconds to wait for connection to close before aborting. If timeout is 0 (default) the connection would be closed with a TCP RST instead of normal TCP FIN, this prevents the connection from remaining stuck in the TIME_WAIT state for two minutes.

get_all_bytes() Array[uint8]

Gets the content of the whole message from Ethernet layer.

Returns

Array of bytes representing the message from Ethernet layer.

Return type

Array[uint8]

get_all_input_params() IDictionary

Retrieves all the encoded or decoded input parameters. Where, parameters and complex members are following the information from the database attached to the SOME/IP message (if the database is not set, an exception will be | | invoked) . If the deserialization is not possible (message ID does not exist in the database), an empty dictionary will be returned. When the parameters’ specification does not match the payload of the SOME/IP message (wrong | SOME/IP message following a database), an exception will be invoked: in this case the dictionary will be filled with deserialized valid parameters and completed with default value of no valid one.

Returns

Dictionary: “key” short name of the param. “value” DecodedParameter type.

Return type

IDictionary

get_all_output_params() IDictionary

Gets all the encoded or decoded output parameters.

Returns

Array of bytes representing the payload of the message

Return type

IDictionary

get_bytes() Array[uint8]

Gets the content of the payload.

Returns

Array of bytes representing the payload of the message.

Return type

Array[uint8]

get_field_param(value: str) object

Gets the value of the field parameter.

Parameters

value (str) – The name of the parameter.

Returns

Field parameter.

Return type

object

get_hex_bytes() str

Converts the payload of the message from decimal to hex and outputs it to a string of bytes.

Returns

Payload of message in hex bytes.

Return type

str

get_input_param(value: str) object

Gets the input parameter of the message.

Parameters

value (str) – The value of the parameter.

Returns

Parameter of field.

Return type

object

get_input_parameters() Array[Parameter]

Returns a list of input parameter object.

Returns

List of input parameters of the method/event.

Return type

Array[Parameter]

get_input_parameters(service_id: uint16, method_id: uint16) Array[Parameter]

Returns a list of input parameter object.

Parameters
  • service_id (uint16) – (optional) Service identifier.

  • method_id (uint16) – (optional) Method/Event identifier.

Returns

List of input parameters of the method/event.

Return type

Array[Parameter]

get_output_param(value: str) object

Gets the output parameter of the message.

Parameters

value (str) – The value of the parameter.

Returns

The message's output parameter

Return type

object

get_output_parameters() Array[Parameter]

Gets a list of the output parameters object

Returns

List of input parameters of the method/event.

Return type

Array[Parameter]

get_output_parameters(service_id: uint16, method_id: uint16) Array[Parameter]

Gets a list of the output parameters object

Parameters
  • service_id (uint16) – (optional) Service identifier.

  • method_id (uint16) – (optional) Method/Event identifier.

Returns

List of input parameters of the method/event.

Return type

Array[Parameter]

get_service_version() uint32

Gets the service version of the message.

Returns

Service version of the message.

Return type

uint32

has_dynamic_parameters() bool

Checks if the message has dynamic parameters.

Returns

True if the message has dynamic parameters. Otherwise, False.

Return type

bool

hex_view() str

Allows to visualize messages in hexadecimal format.

Returns

Hexadecimal representation of the whole message.

Return type

str

hex_view(nb_bytes_per_line: int32) str

Allows to visualize messages in hexadecimal format.

Parameters

nb_bytes_per_line (int32) – (optional) number of bytes per line.

Returns

Hexadecimal representation of the whole message.

Return type

str

is_segmented() bool

Checks if the message is segmented.

Returns

True if the message is segmented. False if not

Return type

bool

open_writer(file: str, fileFormat: FILEFORMAT or None = None)

Creates a PCAP or PCAPNG file for writing the received messages. If the file already exists, it will be overwritten (old file data will be lost). Use the store() method to record received messages into the file.

Parameters
  • file (str) – Absolute path of the file where the messages will be stored

  • fileFormat (FILEFORMAT or None) – Obsolete, you don't need to specify this argument anymore

receive() MessageSomeIP

Matches a response for the used message.

Returns

Listens to the bus until a message is received and returns this first message

Return type

MessageSomeIP

receive(timeout: int32) MessageSomeIP

Waits for the first response having the IP address destination equals to the IP address source of the sent message and return it. A timeout is specified to guarantee that the script can continue if no message is received in a certain time interval.

Parameters

timeout (int32) – Max time in milliseconds to wait for the response.

Returns

First message received from the bus or None in case no message is received.

Return type

MessageSomeIP

receive_list(timeout: int32) IReadOnlyList[MessageSomeIP]

Waits for any response having the IP address destination equals to the IP address source of sent message and return them all as a list. A timeout is specified to guarantee that the script can continue if no message is received in a certain time interval.

Parameters

timeout (int32) – Max time in milliseconds to wait for the response.

Returns

List of messages received from the bus during a given period of time.

Return type

IReadOnlyList[MessageSomeIP]

send() bool

Sends the message (the one used to call the method) through the Ethernet bus.

Returns

Returns True if the message is sent successfully. Otherwise, an exception will be thrown.

Return type

bool

send_receive(timeout: int32 = 1000) MessageSomeIP

Sends the message (the one used to call the method) through the Ethernet bus and waits for a possible response, i.e. a message from the target address to our own address. It is possible to specify a timeout to guarantee that the script can continue if no response is detected in a certain time interval.

Parameters

timeout (int32) – (optional) Max time in milliseconds to wait for the response. Default 1 second

Returns

First message detected from the destination address to our address. This can be the response to the message sent but it is not 100% guaranteed; additional traffic can be captured before this expected response and thus returned.

Return type

MessageSomeIP

send_receive_list(timeout: int32) IReadOnlyList[MessageSomeIP]

Sends the message through the Ethernet bus, listens for a while and returns a list with all the messages captured in that period. It is possible to specify a timeout to guarantee that the script can continue if no response is detected in a certain time interval.

Parameters

timeout (int32) – Max time in milliseconds to wait for the response.

Returns

List of messages detected from the destination address to our address. This can be the response to the message sent but it is not 100% guaranteed; additional traffic can be captured before this expected response and thus returned.

Return type

IReadOnlyList[MessageSomeIP]

set_all_bytes(all_packet: Array[uint8]) bool

Sets the content of the whole message from Ethernet layer, byte per byte.

Parameters

all_packet (Array[uint8]) – All packet to set.

Returns

True if the operation was successful, False otherwise.

Return type

bool

set_bytes(payload: Array[uint8])

Sets the content of the payload, byte per byte.

Parameters

payload (Array[uint8]) – Array of bytes to set.

set_crc_value() uint32

Calculates and retrieves the CRC identifier of SOME/IP message.

Returns

Returns the CRC identifier of the SOME/IP message. Otherwise, it returns to 0.

Return type

uint32

set_field_param(param: str, value: object)

Sets the field or members of it (if it is complex) with values specified by the user.

Parameters
  • param (str) – Name of the parameter to set.

  • value (object) – New value for the parameter.

set_input_param(param: str, value: object)

Sets the parameter and members of it (if it is complex) with values specified by user.

Parameters
  • param (str) – Name of the parameter to set.

  • value (object) – New value for the parameter.

set_output_param(param: str, value: object)

Sets the parameter and members of it (if it is complex) with values specified by user.

Parameters
  • param (str) – Name of the parameter to set.

  • value (object) – New value for the parameter.

start_capture(filter: Filter = None)

Used for online capture(capturing network traffic from an adapter). Used with callback function(on_message_received()) and stop_capture() method.

Parameters

filter (Filter) – Filter to use to narrow down packets to capture

start_capture(file: str, wait_eof: bool, filter: Filter = None)

Used for offline capture(reading packets from pcap or asc file). Used with callback function(on_message_received()) and stop_capture() method.

Parameters
  • file (str) – The trace file from where the messages will be read.

  • wait_eof (bool) – If True the function would block until all frames in the file are read. If False the function would read the frames in the background.

  • filter (Filter) – Filter to use to narrow down packets to capture

start_listener()

Starts listening for TCP clients through the receiver network adapter.

start_responding_machine()

With this function, it is possible to simulate an ECU. It captures packets and, for every received message, it calls is_request callback. If it returns True, then it calls the make_reply callback

stop_capture()

Stops capturing Ethernet messages, either directly from the bus or from a trace file (depending on the version used to start the capture).

stop_listener(timeout: float = 0)

Stops listening for TCP clients through the receiver network adapter.

Parameters

timeout (float) – Number of seconds to wait for connection to close before aborting. If timeout is 0 (default) the connection would be closed with a TCP RST instead of normal TCP FIN, this prevents the connection from remaining stuck in the TIME_WAIT state for two minutes.

stop_responding_machine()

Stops the responding machine activated with start_responding_machine.

store(file: str)

Writes the message into the trace file.

Parameters

file (str) – Path of the file where the messages will be stored.

store()

Writes the message into the trace file opened with open_writer(file).

tree_view() str

Gives the tree view of the message.

Returns

Tree view representation of the message.

Return type

str

@on_capture_start

The event is triggered when the capture of Ethernet messages is started. See start_capture .

@on_capture_stop

The event is triggered when the capture of Ethernet messages is stopped. See stop_capture .

@on_message_received(message: MessageSomeIP)

Event is triggered every time a message is read from the Ethernet bus or a trace file. See start_capture.

Parameters

message (MessageSomeIP) – The message object being handled.

auto_calculate

Determines which parameters are auto calculated.

Type

AutoCalculate

capture_info

General information about the context in which the message was captured from. None if the message was not captured

Type

CaptureInfo

connected

True if the message is connected, False otherwise.

Type

bool

data_base

Takes the database object.

Type

Database

ethernet_header

Object containing all the information from the Ethernet header like the source and destination MAC addresses of the message.

Type

HeaderEthernet

frame_number

Number of the frame received, in the context of all the ethernet traffic captured.

Type

int64

ip_header

Object containing all the information from the IP header like the source and destination IP addresses of the message.

Type

HeaderIP

ipv4_header

Object containing all the information from the IPV4 header.

Type

HeaderIPv4

ipv6_header

Object containing all the information from the IPV6 header.

Type

HeaderIPv6

messages

Messages list.

Type

List[IMessageInternetApplication]

network_protocol

Network Protocol of the message.

Type

NetworkProtocols

payload

Content, in bytes, of the payload of the message.

Type

Array[uint8]

payload_size

The size of the payload.

Type

uint32

protocol

This field defines the protocol bytes used.

Type

Protocols

someip_header

Object containing all the information from the SOME/IP header.

Type

ISomeIPHeader

tcp_header

Object containing all the information from the TCP header.

Type

HeaderTCP

timestamp

Timestamp of the message.

Type

decimal

tp_header

Object containing all the information from the SOME/IP-TP header.

Type

ISomeIpTpHeader

transport_header

Object containing all the information from the transport header (usually TCP or UDP) like the source and destination ports.

Type

HeaderTransport

transport_protocol

Object containing all the information from the transport protocol (usually TCP or UDP) like the source and destination ports.

Type

Protocols

udp_header

Object containing all the information from the UDP header.

Type

HeaderUDP

vlan_tag

Object containing all VLAN info.

Type

HeaderVlan