SOME/IP in AUTOSAR Classic

SOME/IP

Socket connections and routing groups

Inside SoAd every network partner gets a socket connection, and every route through it can be switched on and off by a routing group. Sd fills in the partners' addresses and switches the routing groups; that is how a SubscribeEventgroup turns into actual event flow.

Socket connections

A socket connection connects one local port of the ECU with one partner: its IP address and port, over UDP or TCP. Socket connections with the same local port and settings form a socket connection group (socket connections that share one local port and protocol), one socket connection per partner. A socket connection can start with a wildcard remote address (any address: the partner is not known yet) and get the real address later.

filled by Sd

From Endpoint options

When an OfferService or a SubscribeEventgroup brings an Endpoint option, Sd writes that address into a free socket connection of the right group that still has the wildcard remote address, or finds the socket connection that already has it.

filled on arrival

From the first message

A UDP socket connection with the wildcard remote address can also take the address of the first accepted message that arrives through it. This is how a server's socket connection learns which client is calling.

opened by Sd

Open and close

Sd asks SoAd to open the socket connections of a service instance when it starts using it, and to close them when it stops. A TCP socket connection on the client side opens the TCP connection.

Routing groups

A routing group works like a named switch attached to routes: a PDU route (the way of a PDU from PduR out to its socket connections) or a socket route, which takes a received message from a socket connection up to a module by its header ID. When all routing groups of a route are off, nothing flows on it. A routing group attached to a socket connection group has a separate on/off for each socket connection, so it can be on for one partner and off for another.

Inside SoAd on the radar: the BrakeEvent PDU from PduR fans out to three socket connections of one socket connection group. Routing group Eventgroup 1 has its own state per socket connection: on for the brake ECU and the display ECU, which subscribed, off for a socket connection with the wildcard remote address. Sd switches the routing group; the socket connections lead to TcpIp sockets. inside SoAd (radar ECU) BrakeEvent PDUfrom PduR socket connection 1brake ECU · 192.168.0.20 : 40001 socket connection 2display ECU · 192.168.0.30 : 40001 socket connection 3wildcard remote address · unused on on off Sd on per socket connection withSubscribeEventgroup; off withStopSubscribeEventgroupor when the TTL runs out routing group "Eventgroup 1"
Figure 1. One PDU in, two PDUs out: routing group "Eventgroup 1" is on for socket connections 1 and 2 only. Sd turned it on when each client subscribed; it turns it off for a socket connection when that client sends a StopSubscribeEventgroup or its TTL runs out.

Which routing groups Sd uses

A triggering routing group (a routing group that makes SoAd send at once, fetching the data from the module above) is how a new subscriber gets its initial event without the server SWC writing the value again. The table lists all of them.

SideRouting group forTurned on
Serverthe methods of a service instancewhen the instance starts its phases, so REQUESTs can arrive
Serverthe events of an eventgroup, per socket connectionfor each client that subscribes, by UDP or TCP
Serverthe events of an eventgroup, by multicastwhen the number of subscribers reaches the multicast threshold
Servertriggering routing group for initial events, per socket connectionused once per new subscriber: SoAd fetches the current value from the module above and sends it to that socket connection only
Clientthe methods of a service instancewhen the instance is AVAILABLE
Clientthe events of an eventgroup (UDP, TCP)when it subscribes
Clientthe events of an eventgroup (multicast)when the SubscribeEventgroupAck brings a Multicast option

Responses find their way back

On the server, REQUESTs from several clients arrive through different socket connections of one socket connection group. The RTE keeps the PDU meta data of each REQUEST (extra data that travels with a PDU; here the socket connection ID) and hands it back with the RESPONSE, so SoAd sends the RESPONSE through that same socket connection to the right client.

Try it

You are inside the radar's SoAd. Let clients subscribe and stop, send BrakeEvent, and receive a REQUEST.

Socket connectionRemote addressRouting group "Eventgroup 1"Routing group "methods"

Things to notice. Sending BrakeEvent before any SubscribeEventgroup produces no PDU at all: the routing group is off for every socket connection. The initial event goes out through the triggering routing group to the new subscriber's socket connection only. The REQUEST from the display ECU is answered through the socket connection it came in by.

Check yourself optional

New terms in this lesson

TermMeaning
socket connection groupSocket connections that share one local port and protocol (UDP or TCP), one per partner
wildcard remote addressA remote address of "any": the partner is not known yet; Sd or the first message fills it in
PDU routeThe way of a PDU from PduR out to one or more socket connections
triggering routing groupA routing group that makes SoAd send at once, fetching the data from the module above; used for initial events
PDU meta dataExtra data that travels with a PDU, here the socket connection ID, so a RESPONSE goes back to the right client

Source: Socket Adaptor, R20-11, sections 7.1, 7.2.1, 7.2.3, 7.6, 7.9 and 7.10; Service Discovery, R20-11, sections 7.2.4, 7.6.4 (fan out) and 7.7.5 (fan in); RTE, R20-11, section 4.3.2.6; System Template, R20-11, section 10.2.