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

news2025/2/22 13:12:31

前言
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.coloradmin.cn/o/2301278.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

用PyInstaller构建动态脚本执行器:嵌入式Python解释器与模块打包 - 简明教程

技术场景&#xff1a; 需分发的Python工具要求终端用户可动态修改执行逻辑将Python环境与指定库&#xff08;如NumPy/Pandas&#xff09;嵌入可执行文件实现"一次打包&#xff0c;动态扩展"的轻量化解决方案。 ▌ 架构设计原理 1. 双模运行时识别 # 核心判断逻辑…

在做题中学习(89):螺旋矩阵

解法&#xff1a;模拟 思路&#xff1a;创建ret数组&#xff0c;用变量标记原矩阵的行数和列数&#xff0c;遍历一个元素就push_back进ret数组&#xff0c;每次遍历完一行或一列&#xff0c;相应行/列数--&#xff0c;进行顺时针螺旋遍历到为0即可。 细节&#xff1a;要有边界…

从零搭建微服务项目Base(第5章——SpringBoot项目LogBack日志配置+Feign使用)

前言&#xff1a; 本章主要在原有项目上添加了日志配置&#xff0c;对SpringBoot默认的logback的配置进行了自定义修改&#xff0c;并详细阐述了xml文件配置要点&#xff08;只对日志配置感兴趣的小伙伴可选择直接跳到第三节&#xff09;&#xff0c;并使用Feign代替原有RestT…

【数据分析】通过个体和遗址层面的遗传相关性网络分析

禁止商业或二改转载,仅供自学使用,侵权必究,如需截取部分内容请后台联系作者! 文章目录 介绍原理应用场景加载R包数据下载函数个体层面的遗传相关性网络分析导入数据数据预处理构建遗传相关性的个体网络对个体网络Nij进行可视化评估和选择最佳模型评估和选择最佳模型最佳模型…

在 macOS 的 ARM 架构上按住 Command (⌘) + Shift + .(点)。这将暂时显示隐藏文件和文件夹。

在 macOS 的 ARM 架构&#xff08;如 M1/M2 系列的 Mac&#xff09;上&#xff0c;设置 Finder&#xff08;访达&#xff09;来显示隐藏文件夹的步骤如下&#xff1a; 使用快捷键临时显示隐藏文件&#xff1a; 在Finder中按住 Command (⌘) Shift .&#xff08;点&#xff…

【产品经理】需求分析方法论+实践

阐述了需求分析的基本认知&#xff0c;包括需求分析的定义、原则和内容。接着&#xff0c;文章详细介绍了需求分析的十个步骤&#xff0c;从收集需求到结果评审&#xff0c;为产品经理提供了清晰的操作指南。 作为产品经理&#xff0c;需求分析是一个最基本的工作&#xff0c;但…

Windows平台的小工具,功能实用!

今天给大家分享一款超实用的Windows平台监控工具&#xff0c;堪称“桌面小管家”&#xff0c;能帮你轻松掌握电脑的各种运行状态&#xff0c;比如网速、下载速度、内存和CPU占用率等常用参数&#xff0c;让你的电脑运行情况一目了然。 TrafficMonitor 网速监控悬浮窗软件 这款…

SAP-工单技术性关闭操作手册

文章目录 单个工单批量处理TECO和CLSD标识的区别 单个工单 事务代码CO02&#xff0c;输入工单号后回车 功能-》限制处理-》技术性完成 工单状态更改 撤销TECO操作 CO02输入工单号&#xff0c;功能-》限制处理-》撤销技术性完成 批量处理 事务代码COHV&#xff0c;点击生…

Aseprite绘画流程案例(1)——画相机图标

原图&#xff1a; 步骤一&#xff1a;打开需要参照的图标 步骤二&#xff1a;将参照的图片拖放到右边&#xff0c;作为参考 步骤三&#xff1a;新建24x24的画布&#xff0c;背景为白色的画布 步骤四&#xff1a;点击菜单栏——视图——显示——像素网格&#xff08;如果画布已经…

安装海康威视相机SDK后,catkin_make其他项目时,出现“libusb_set_option”错误的解决方法

硬件&#xff1a;雷神MIX G139H047LD 工控机 系统&#xff1a;ubuntu20.04 之前运行某项目时&#xff0c;处于正常状态。后来由于要使用海康威视工业相机&#xff08;型号&#xff1a;MV-CA013-21UC&#xff09;&#xff0c;便下载了并安装了该相机的SDK&#xff0c;之后运行…

云计算架构学习之Ansible-playbook实战、Ansible-流程控制、Ansible-字典循环-roles角色

一、Ansible-playbook实战 1.Ansible-playbook安装软件 bash #编写yml [rootansible ansible]# cat wget.yml - hosts: backup tasks: - name: Install wget yum: name: wget state: present #检查playbook的语法 [rootansible ansible]…

网络工程师 (47)QOS

一、概念与原理 QOS即服务质量&#xff08;Quality of Service&#xff09;是一种网络技术&#xff0c;用于管理和保证网络中不同类型的质量和性能。它通过设置优先级和带宽限制等策略&#xff0c;确保关键应用&#xff08;如视频会议、语音通信&#xff09;的数据包能够在网络…

风铃摇晃的弧度与不安等长

晴&#xff0c;2025年2月19日 的确是&#xff0c;有依靠又有谁会去自己打伞。是啊&#xff0c;有时候生活推着我们走的样子确实挺无力的。不过谁都愿意携手走的&#xff0c;希望有一天再也不用“抛头露面”了吧。 又下载回了 X &#xff0c;马上 Gork 3 可以使用&#xff0c…

Linux部署DeepSeek r1 模型训练

之前写过一篇windows下部署deepseekR1的文章&#xff0c;有小伙伴反馈提供一篇linux下部署DeepSeek r1 模型训练教程&#xff0c;在 Linux 环境下&#xff0c;我找了足够的相关资料&#xff0c;花费了一些时间&#xff0c;我成功部署了 DeepSeek R1 模型训练任务&#xff0c;结…

JetBrains 2024开发者生态报告 -你尝试过用VR头戴设备编程吗

JetBrains 2024开发者生态报告&#xff1a;核心洞察 方法论 覆盖 171 个国家/地区 的 23,262 名开发者 。数据按区域开发者数量和就业状态加权。 主要趋势 AI 整合 80% 的公司允许使用第三方 AI 工具&#xff08;如 ChatGPT、Copilot&#xff09;。18% 的开发者将 AI 集成到产…

汇能感知的光谱相机/模块产品有哪些?

CM020A 分辨率&#xff1a;1600H1200V 光谱范围&#xff1a;350~950nm 光谱分辨率&#xff1a;1nm 接口&#xff1a;USB2.0 帧率&#xff1a;16001200 (6帧) 输出格式&#xff1a;Raw 8bit FOV&#xff1a;D73.5H58.8V44.1 相机尺寸&#xff1a;505055mm VM02S10 分辨率…

Spring中Bean的四种实例化方法

Bean的四种实例化方法 Bean是Spring核心的概念&#xff0c;另外一个核心的概念是AOP。官网上&#xff0c;Bean的解释是&#xff1a; In Spring, the objects that form the backbone of your application and that are managed by the Spring IoC container are called beans…

Office word打开加载比较慢处理方法

1.添加safe参数 ,找到word启动项,右击word,选择属性 , 添加/safe , 应用并确定 2.取消加载项,点击文件,点击选项 ,点击加载项,点击转到,取消所有勾选,确定。

一台服务器将docker image打包去另一天服务器安装这个镜像

一台服务器将docker image打到去另一天服务器安装这个镜像 1. 打包2.另一台服务器执行 1. 打包 docker save -o nebula-graph-studio.tar harbor1.vm.example.lan/dockerio/vesoft/nebula-graph-studioxxx.tar 是打包好的文件 后面的是 docker image 2.另一台服务器执行 docke…

在局域网中连接Grafana数据源

目录 登录Grafana 添加数据源 配置数据源 保存并测试 使用数据源 注意事项 登录Grafana 打开浏览器&#xff0c;访问Grafana的地址&#xff0c;默认是http://localhost:3000。 使用默认用户名和密码登录&#xff08;通常是admin/admin&#xff09;&#xff0c;登录后建议…