SOME/IP--协议英文原文讲解8

前言
SOME/IP协议越来越多的用于汽车电子行业中,关于协议详细完全的中文资料却没有,所以我将结合工作经验并对照英文原版协议做一系列的文章。基本分三大块:

1. SOME/IP协议讲解

2. SOME/IP-SD协议讲解

3. python/C++举例调试讲解


4.2 Specification of SOME/IP Protocol
This chapter describes the Remote Procedure Call(RPC), Event Notifications and Error
Handling of SOME/IP.

4.2.1 Transport Protocol Bindings
In order to transport SOME/IP messages different transport protocols may be used.
SOME/IP currently supports UDP and TCP. Their bindings are explained in the following sections,
while Chapter 6 discusses which transport protocol to choose.

SOME/IP支持TCP/UDP传输 第6章讲怎么选择

[PRS_SOMEIP_00138]
Upstream requirements: RS_SOMEIP_00015
If a server runs different instances of the same service, messages belonging to different
service instances shall be mapped to the service instance by the transport protocol
port on the server side.
For details of see Chapter 4.2.1.3

不同的服务实例在不同的server上要用port区分


什么是 服务实例?

 服务 是给一组或一种功能 编的号码。如果多个设备同时都提供这个服务,那怎么区分呢?
就在服务ID的基础上 再进一步区分实例ID,实例就是实现这个服务的不同设备。给这些设备编上不同ID,这个ID就是实例ID。


[PRS_SOMEIP_00535]
Upstream requirements: RS_SOMEIP_00010
All Transport Protocol Bindings shall support transporting more than one SOME/IP
message in a Transport Layer PDU (i.e. UDP packet or TCP segment).
TCP UDP 都应支持SOME/IP的聚包发送 -- 单条UDP/TCP消息中有多条SOME/IP消息组合在一起
[PRS_SOMEIP_00142]
Upstream requirements: RS_SOMEIP_00010
The receiving SOME/IP implementation shall be capable of receiving unaligned
SOME/IP messages transported by UDP or TCP.
传输层过来的多条消息长度不同的SOMEIP消息 要能够拆分解析
Rationale:
When transporting multiple SOME/IP payloads in UDP or TCP the alignment of the
payloads can be only guaranteed, if the length of every payloads is a multiple of the
alignment size (e.g. 32 bits).

[PRS_SOMEIP_00140]
Upstream requirements: RS_SOMEIP_00010
The header format allows transporting more than one SOME/IP message in a single
packet. The SOME/IP implementation shall identify the end of a SOME/IP message by
means of the SOME/IP length field. Based on the packet length field, SOME/IP shall
determine if there are additional SOME/IP messages in the packet. This shall apply for
UDP and TCP transport.
SOMEIP header的长度字段 就能解析和拆分多条消息。

[PRS_SOMEIP_00141]
Upstream requirements: RS_SOMEIP_00010, RS_SOMEIP_00027
Each SOME/IP payload shall have its own SOME/IP header.
每个payload都对应 自己的 header

[PRS_SOMEIP_00940]
Upstream requirements: RS_SOMEIP_00010, RS_SOMEIP_00027
One Service-Instance can use the following setup for its communication of all the
methods, events, and notifications:
• up to one TCP connection
• up to one UDP unicast connection
• up to one UDP multicast connection -- 只能用于events/notify
服务的方法、事件、通知功能 可以通过TCP UDP单播/多播 通信。不包含UDP广播
具体下面有讲,不能一概而论

4.2.1.1 UDP Binding
[PRS_SOMEIP_00139]
Upstream requirements: RS_SOMEIP_00010
The UDP binding of SOME/IP shall be achieved by transporting SOME/IP messages
in UDP packets.
[PRS_SOMEIP_00137]
Upstream requirements: RS_SOMEIP_00010
SOME/IP protocol shall not restrict the usage of UDP fragmentation.
不能限制 UDP协议在IP层默认的分包功能

[PRS_SOMEIP_00943]
Upstream requirements: RS_SOMEIP_00010
The client and server shall use a single UDP unicast connection for all methods,
events, and notifications of a Service-Instance which are configured to be communicated using UDP unicast.
方法 事件 和 通知 都可以用单播
[PRS_SOMEIP_00942]
Upstream requirements: RS_SOMEIP_00010
The client and server shall use a single UDP multicast address combination ("connection") per eventgroup,
which is configured to be communicated using UDP multicast.
这个意思是每个事件组 只能绑定在一个组播地址上 ,但是多个事件组可以绑定在一个组播地址上

If the same multicast address is shared between different service instances of the same
service, then the port number of the UDP multicast address combination used for each
of these service instances shall be different, at least on server side.
同一个服务的不同实例对象共享同一个组播地址则需要用端口号做区分

4.2.1.2 TCP Binding
The TCP binding of SOME/IP is heavily based on the UDP binding. In contrast to the
UDP binding, the TCP binding allows much bigger SOME/IP messages and uses the
robustness features of TCP (coping with loss, reorder, duplication, etc.).
In order to lower latency and reaction time, Nagle’s algorithm should be turned off
(TCP_NODELAY).
通过 setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int)) 关闭了 Nagle's Algorithm,参数 flag 设置为 1 以启用 TCP_NODELAY。防止TCP组包延迟
[PRS_SOMEIP_00706]
Upstream requirements: RS_SOMEIP_00010
When the TCP connection is lost, pending requests shall be handled if a timeout
occurred.
编程指导:当TCP连接断开时 则需要处理挤压的待发送的请求或回复
Since TCP handles reliability, additional means of reliability are not needed.
TCP处理 不要SOMEIP层做额外的可靠性传输动作
[PRS_SOMEIP_00707]
Upstream requirements: RS_SOMEIP_00010
The client and server shall use a single TCP connection for all methods, events, and
notifications of a Service-Instance which are configured to be communicated using
TCP.
一个server 一个client 之间的所有服务相关的方法事件通知 可以用一个tcp连接进行通信。

[PRS_SOMEIP_00708]
Upstream requirements: RS_SOMEIP_00010
The TCP connection shall be opened by the client, when the first method call shall be
transported or the client tries to receive the first notifications.
tcp的连接 应该由 client端发起,
当client 第一次发起method获取 准备接收nofiy时
The client is responsible for re-establishing the TCP connection whenever it fails.
当TCP 连接断开时,client有义务重新发起连接
[PRS_SOMEIP_00709]
Upstream requirements: RS_SOMEIP_00010
The TCP connection shall be closed by the client, when the TCP connection is not
required anymore.
TCP的断开 应该由client发起,当client不在需要时 或不能拥有时。
[PRS_SOMEIP_00710]
Upstream requirements: RS_SOMEIP_00010
The TCP connection shall be closed by the client, when all Services using the TCP
connections are not available anymore (stopped or timed out).
server端发起stop offer 或 offer的TTL超时 ,应该由client发起断链

[PRS_SOMEIP_00711]
Upstream requirements: RS_SOMEIP_00010
The server shall not stop the TCP connection when stopping all services. Give the
client enough time to process the control data to shutdown the TCP connection itself.
server发送stop offer后 应该留时间等待client断链
Rational:
When the server closes the TCP connection before the client recognized that the TCP
is not needed anymore, the client will try to reestablish the TCP connection.
就算server发起了断链,当client发现server服务继续有效时 应该继续发起连接

Allowing resync to TCP stream using Magic Cookies
下面 展示了server和client 发送Magic Cookies消息的固定格式和内容。
对方收到这个报文后不需要回复 这是一个边界消息。
比如TP消息(后面讲:UDP的SOME/IP分片功能) 发送最后一包后 这个可以用作进一步确认是最后一包。

[PRS_SOMEIP_00154]
Upstream requirements: RS_SOMEIP_00010
In order to allow testing tools to identify the boundaries of SOME/IP Message
transported via TCP, the SOME/IP Magic Cookie Message may be inserted into the
SOME/IP messages over TCP message stream at regular distances.
[PRS_SOMEIP_00160]
Upstream requirements: RS_SOMEIP_00010
The layout of the Magic Cookie Messages shall consist of the followign fields:
• for communincation from Client to Server:
– Message ID (Service ID/Method ID): 0xFFFF 0000
– Length: 0x0000 0008
– Request ID (Client ID/Session ID): 0xDEAD BEEF
– Protocol Version: 0x01
– Interface Version: 0x01
– Message Type: 0x01
– Return Code: 0x00

• for communincation from Server to Client:
– Message ID (Service ID/Method ID): 0xFFFF 8000
– Length: 0x0000 0008
– Request ID (Client ID/Session ID): 0xDEAD BEEF
– Protocol Version: 0x01
– Interface Version: 0x01
– Message Type: 0x02
– Return Code: 0x00

4.2.1.3 Multiple Service-Instances
[PRS_SOMEIP_00162]
Upstream requirements: RS_SOMEIP_00015
Service-Instances of the same Service are identified through different Instance IDs. It
shall be supported that multiple Service-Instances reside on different ECUs as well as
multiple Service-Instances of one or more Services reside on one single ECU.
不同的实例 应该有不同的实例ID。
多个实例 可以部署在不同的ECU 或 单个ECU上
[PRS_SOMEIP_00163]
Upstream requirements: RS_SOMEIP_00015
While several Service-Instances of different Services shall be able to share the same
port number of the transport layer protocol used on both the provided/server and the
consumed/client side, multiple Service-Instances of the same Service on the provided/server
side on one single ECU shall use different port numbers per ServiceInstance. Multiple
Service-Instances of the same Service on the required/client side
on one single ECU may use the same port number per Service-Instance.
1. 不同服务的多个实例 可以使用同一个port(不管是client还是server)
2. server端 单个服务的多个实例 要用不同的Port区分
3. client端 单个服务的多个实例可以使用一个port

Rationale: Normal SOME/IP (not SOME/IP-SD) messages do not carry the ServiceInstance
ID as a dedicated field in the SOME/IP header. - Thus port numbers (and perhaps
the transport protocol) need to be used to distinguish different Service-Instance
of the same Service of a single ECU. This way a Service-Instance can be identified
through the combination of the Service ID combined with the endpoint information (i.e.,
IP-address, transport protocol (UDP/TCP), and port number). It is sufficient to use
different port numbers for the different Service-Instances of the same Service on either
the server or the client side, since only a single difference in the 4-tuple <src IP, src
port, dst IP, dst port > is sufficient as a distinguishing criterion. As the server is the
one actually providing the different Service-Instances, the server is also the natural
place to handle the distinction. = > The server shall use different port numbers for
providing different Service-Instances of the same Service.
不同的实例 肯定处于不同的TCP/UDP连接中,否则区分实例就没意义了。

不同的连接 就要依赖四元组来区分。
由于 client端 IP+prot 同一组可以接收不同实例的数据,就不能用client的IP和port来区分实例连接。
另外同一个ECU(IP)也可以有不同的实例,那就只能通过server的prt来区分不同的实例了。

Recommendation: It is recommended that instances use the same port number for
UDP and TCP. If a Service-Instance uses UDP port x, only this Service-Instance of the
Service and not another Service-Instance of the same Service should use exactly TCP
port x for its Service provision.
建议:对于同一个服务的同一个实例 server端或client端的UDP和TCP协议可以用同一个端口号。(同一个服务 不同event/method可以使用不同的协议)
 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/21014.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

禁止WPS强制打开PDF文件

原文网址&#xff1a;禁止WPS强制打开PDF文件_IT利刃出鞘的博客-CSDN博客 简介 本文介绍如何避免WPS强制打开PDF文件。 方法 1.删除注册表里.pdf的WPS绑定 WinR&#xff0c;输入&#xff1a;regedit&#xff0c;回车。找到&#xff1a;HKEY_CLASSES_ROOT\.pdf删除KWPS.PDF…

Pytorch深度学习教程_3_初识pytorch

欢迎来到《PyTorch深度学习教程》系列的第三篇&#xff01;在前面的两篇中&#xff0c;我们已经介绍了Python及numpy的基本使用。今天&#xff0c;我们将深入探索PyTorch的核心功能&#xff0c;帮助你更好地理解和使用这个强大的深度学习框架。 欢迎订阅专栏&#xff1a; 深度…

Windows桌面系统管理5:Windows 10操作系统注册表

Windows桌面系统管理0&#xff1a;总目录-CSDN博客 Windows桌面系统管理1&#xff1a;计算机硬件组成及组装-CSDN博客 Windows桌面系统管理2&#xff1a;VMware Workstation使用和管理-CSDN博客 Windows桌面系统管理3&#xff1a;Windows 10操作系统部署与使用-CSDN博客 Wi…

web入侵实战分析-常见web攻击类应急处置实验1

场景说明&#xff1a; 某天运维人员发现在/opt/tomcat8/webapps/test/目录下&#xff0c;多出了一个index_bak.jsp这个文件&#xff0c; 并告诉你如下信息 操作系统&#xff1a;ubuntu-16.04业务&#xff1a;测试站点中间件&#xff1a;tomcat开放端口&#xff1a;22&#x…

Bio-ORACLE数据分享[decade 2010-2020] [Surface layers]

Bio-ORACLE数据分享[decade 2010-2020] [Surface layers] 文章目录 Bio-ORACLE数据分享[decade 2010-2020] [Surface layers]前言一、文件分享&#xff08;主要&#xff09;二、相关代码&#xff08;选看&#xff09;总结 Bio-ORACLE数据分享[decade 2010-2020] [Surface layer…

换服务器需要做的工作(记录一下)

1.Nginx开启OCSP 加快Let’s Encrypt免费证书 HTTPS网站访问速度 https://blog.csdn.net/wx23986/article/details/141722669 2.添加伪静态规则 location / {rewrite ^([^\.]*)/topic-(.)\.html$ $1/portal.php?modtopic&topic$2 last;rewrite ^([^\.]*)/article-([0-9…

c++作业

练习题&#xff1a; #include <iostream> #include <cstring> using namespace std;class mystring {char* p;int len; public:mystring();mystring(const char* p);~mystring();void copy(const mystring& str);void append(const mystring& str);void sh…

网络爬虫学习:借助DeepSeek完善爬虫软件,实现模拟鼠标右键点击,将链接另存为本地文件

一、前言 最近几个月里&#xff0c;我一直在学习网络爬虫方面的知识&#xff0c;每有收获都会将所得整理成文发布&#xff0c;不知不觉已经发了7篇日志了&#xff1a; 网络爬虫学习&#xff1a;从百度搜索结果抓取标题、链接、内容&#xff0c;并保存到xlsx文件中 网络爬虫学…

leetcode203.移除链表元素

目录 问题描述示例提示 具体思路思路一思路二 代码实现 问题描述 给你一个链表的头节点 head 和一个整数 val &#xff0c;请你删除链表中所有满足 Node.val val 的节点&#xff0c;并返回 新的头节点 。 题目链接&#xff1a;移除链表元素 示例 提示 列表中的节点数目在范围…

全球直播新标杆:DeepSeek融合全平台AI无人直播,构建直播流量永动机!

全球直播新标杆&#xff1a;DeepSeek融合全平台AI无人直播&#xff0c;构建直播流量永动机&#xff01; 在科技日新月异的今天&#xff0c;直播行业正经历一场前所未有的变革。在这场变革中&#xff0c;DeepSeek凭借其创新的AI无人直播系统&#xff0c;正逐步树立起全球直播的新…

postgres源码学习之简单sql查询

postgres源码学习之sql查询 sql查询的主流程读取sql解析sql重写sql获得执行计划执行查询操作结果返回 sql查询的主流程 参考postgres的处理流程 由上一节&#xff0c;我们可以看到&#xff0c;当有新的连接通过权限认证之后&#xff0c;将进入等待接收sql语句&#xff0c;并执…

【AI实践】阿里百炼文本对话Agent安卓版搭建

环境&#xff1a;安卓手机运行环境&#xff1b;WinsurfAI编程工具&#xff1b;阿里百炼提前创建Agent应用&#xff1b; 耗时&#xff1a;2小时&#xff1b; 1&#xff0c;新建安卓项目 完成文本输入&#xff0c;并将输入的文字显示出来。 2&#xff0c;安装SDK 参考文档 安…

[论文阅读] SeeSR: Towards Semantics-Aware Real-World Image Super-Resolution

文章目录 一、前言二、主要贡献三、Introduction四、Methodology4.1 Motivation &#xff1a;4.2Framework Overview.** 一、前言 通信作者是香港理工大学 & OPPO研究所的张磊教授&#xff0c;也是图像超分ISR的一个大牛了。 论文如下 SeeSR: Towards Semantics-Aware Rea…

探秘 DeepSeek R1 模型:跨越多领域的科技奇迹,引领智能应用新浪潮

DeepSeek R1 模型功能强大&#xff0c;应用广泛。在自然语言处理、计算机视觉、推荐系统和医疗等领域都能发挥作用。本文介绍了其在各领域的应用场景和代码示例&#xff0c;助你深入了解它。 目录 ​编辑 一、本篇背景&#xff1a; 二、DeepSeek R1 模型概述&#xff1a; …

常用网络工具分析(ping,tcpdump等)

写在前面 本文看下常用网络工具。 1&#xff1a;ping 1.1&#xff1a;用途 用于检验网络的连通性。 1.2&#xff1a;实战 在Linux环境中执行&#xff1a;ping www.sina.com.cn&#xff1a; [rootlocalhost ~]# ping www.sina.com.cn PING spool.grid.sinaedge.com (111.…

【MySQL】表操作

表操作 一、创建表 1、语句2、语句介绍3、注意事项4、介绍5、示例 二、查看表结构 1、语句2、介绍3、返回的信息4、示例 三、添加字段 1、语句2、语句介绍3、示例 四、修改 1、语句2、语句介绍3、示例 五、删除 1、语句2、示例 六、修改表名 1、语句2、语句介绍3、示例 七、删…

【UCB CS 61B SP24】Lecture 3 - Lists 1: References, Recursion, and Lists学习笔记

本文开坑伯克利 CS 61B&#xff08;算法与数据结构&#xff09;2024年春季课程学习笔记&#xff0c;Lecture 1 & Lecture 2 的内容为课程介绍与 Java 基础&#xff0c;因此直接跳过。本文内容为介绍基本数据类型与引用数据类型的区别&#xff0c;以及手动实现整数列表。 1…

【C语言】fwrite函数用法介绍

目录 一、函数原型 二、参数解析 三、返回值 四、核心特性 五、案例代码 案例1&#xff1a;写入字符串到文件 案例2&#xff1a;写入整型数组到二进制文件 案例3&#xff1a;写入结构体数据 六、注意事项 一、函数原型 作用&#xff1a;将内存中的数据块以二进制形式…

WIN系统服务器如何修改远程端口?

在Windows服务器上修改远程桌面协议&#xff08;RDP&#xff09;的默认端口&#xff08;3389&#xff09;可以增强服务器的安全性&#xff0c;减少被恶意扫描和攻击的风险。以下是修改远程端口的详细步骤&#xff1a; --- ### **步骤 1&#xff1a;通过注册表修改远程端口** …

使用Termux将安卓手机变成随身AI服务器(page assist连接)

通过以下方法在安卓手机上运行 Ollama 及大模型&#xff0c;无需 Root 权限&#xff0c;具体方案如下&#xff1a; 通过 Termux 模拟 Linux 环境运行 核心工具&#xff1a; 安装 &#xff08;安卓终端模拟器&#xff09;()]。借助 proot-distro 工具安装 Linux 发行版&#xf…