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可以使用不同的协议)
 

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

基于YOLO11深度学习的果园苹果检测与计数系统设计与实现【python源码+Pyqt5界面+数据集+训练代码】

《------往期经典推荐------》 一、AI应用软件开发实战专栏【链接】 项目名称项目名称1.【人脸识别与管理系统开发】2.【车牌识别与自动收费管理系统开发】3.【手势识别系统开发】4.【人脸面部活体检测系统开发】5.【图片风格快速迁移软件开发】6.【人脸表表情识别系统】7.【…

【C++】 Flow of Control

《C程序设计基础教程》——刘厚泉&#xff0c;李政伟&#xff0c;二零一三年九月版&#xff0c;学习笔记 文章目录 1、选择结构1.1、if 语句1.2、嵌套的 if 语句1.3、条件运算符 ?:1.4、switch 语句 2、循环结构2.1、while 语句2.2、do-while 语句2.3、 for 循环2.4、循环嵌套…

mysql 学习15 SQL优化,插入数据优化,主键优化,order by优化,group by 优化,limit 优化,count 优化,update 优化

插入数据优化&#xff0c; insert 优化&#xff0c; 批量插入&#xff08;一次不超过1000条&#xff09; 手动提交事务 主键顺序插入 load 从本地一次插入大批量数据&#xff0c; 登陆时 mysql --local-infile -u root -p load data local infile /root/sql1.log into table tb…

玩转大语言模型——使用LM Studio在本地部署deepseek R1的零基础)教程

系列文章目录 玩转大语言模型——使用langchain和Ollama本地部署大语言模型 玩转大语言模型——三分钟教你用langchain提示词工程获得猫娘女友 玩转大语言模型——ollama导入huggingface下载的模型 玩转大语言模型——langchain调用ollama视觉多模态语言模型 玩转大语言模型—…

【复现DeepSeek-R1之Open R1实战】系列7:GRPO原理介绍、训练流程和源码深度解析

目录 4.6 GRPO训练过程4.6.1 GRPO原理4.6.2 设置参考模型4.6.3 从训练集中抽取问题4.6.4 旧策略模型生成G个输出4.6.5 对每个输出用奖励模型 RM 打分4.6.6 根据目标函数做梯度更新 【复现DeepSeek-R1之Open R1实战】系列博文链接&#xff1a; 【复现DeepSeek-R1之Open R1实战】…

STM32物联网终端实战:从传感器到云端的低功耗设计

STM32物联网终端实战&#xff1a;从传感器到云端的低功耗设计 一、项目背景与挑战分析 1.1 物联网终端典型需求 &#xff08;示意图说明&#xff1a;传感器数据采集 → 本地处理 → 无线传输 → 云端存储&#xff09; 在工业物联网场景中&#xff0c;终端设备需满足以下核心需…

R 语言科研绘图第 26 期 --- 密度图-基础

在发表科研论文的过程中&#xff0c;科研绘图是必不可少的&#xff0c;一张好看的图形会是文章很大的加分项。 为了便于使用&#xff0c;本系列文章介绍的所有绘图都已收录到了 sciRplot 项目中&#xff0c;获取方式&#xff1a; R 语言科研绘图模板 --- sciRplothttps://mp.…

Starlink卫星动力学系统仿真建模番外篇6-地球敏感器

地球敏感器&#xff1a;介绍、使用方法及相关算法 地球敏感器是航天器姿态控制系统中的重要传感器&#xff0c;用于确定地球相对于航天器的位置和方向。它在卫星、空间站和深空探测器等任务中广泛应用&#xff0c;主要用于姿态控制、轨道调整和导航。本文将介绍地球敏感器的基…

【含文档+PPT+源码】基于微信小程序的猎兔汽车保养维修美容服务平台的设计与实现

项目介绍 本课程演示的是一款基于微信小程序的猎兔汽车保养维修美容服务平台的设计与实现&#xff0c;主要针对计算机相关专业的正在做毕设的学生与需要项目实战练习的 Java 学习者。 1.包含&#xff1a;项目源码、项目文档、数据库脚本、软件工具等所有资料 2.带你从零开始部…

斐波那契数列模型:在动态规划的丝绸之路上追寻斐波那契的足迹(上)

文章目录 引言递归与动态规划的对比递归解法的初探动态规划的优雅与高效自顶向下的记忆化搜索自底向上的迭代法 性能分析与比较小结 引言 斐波那契数列&#xff0c;这一数列如同一条无形的丝线&#xff0c;穿越千年时光&#xff0c;悄然延续其魅力。其定义简单而优美&#xff…

基于微信小程序的宿舍报修管理系统设计与实现,SpringBoot(15500字)+Vue+毕业论文+指导搭建视频

运行环境 jdkmysqlIntelliJ IDEAmaven3微信开发者工具 项目技术SpringBoothtmlcssjsjqueryvue2uni-app 宿舍报修小程序是一个集中管理宿舍维修请求的在线平台&#xff0c;为学生、维修人员和管理员提供了一个便捷、高效的交互界面。以下是关于这些功能的简单介绍&#xff1a; …

Linux环境开发工具

Linux软件包管理器yum Linux下安装软件方式&#xff1a; 源代码安装rpm安装——Linux安装包yum安装——解决安装源、安装版本、安装依赖的问题 yum对应于Windows系统下的应用商店 使用Linux系统的人&#xff1a;大部分是职业程序员 客户端怎么知道去哪里下载软件&#xff1…

遥感影像目标检测:从CNN(Faster-RCNN)到Transformer(DETR)

我国高分辨率对地观测系统重大专项已全面启动&#xff0c;高空间、高光谱、高时间分辨率和宽地面覆盖于一体的全球天空地一体化立体对地观测网逐步形成&#xff0c;将成为保障国家安全的基础性和战略性资源。未来10年全球每天获取的观测数据将超过10PB&#xff0c;遥感大数据时…

大数据开发治理平台~DataWorks(核心功能汇总)

目录 数据集成 功能概述 使用限制 功能相关补充说明 数据开发 功能概述 数据建模 功能概述 核心技术与架构 数据分析 功能概述 数据治理 数据地图 功能概述 数据质量 功能概述 数据治理资产 功能概述 使用限制 数据服务 功能概述 数据集成 DataWorks的数据…

Mongodb数据管理

Mongodb数据管理 1.登录数据库&#xff0c;查看默认的库 [rootdb51~]# mongo> show databases; admin 0.000GB config 0.000GB local 0.000GB> use admin switched to db admin > show tables system.version > admin库&#xff1a;admin 是 MongoDB 的管理…

洛谷P8707 [蓝桥杯 2020 省 AB1] 走方格

#include <iostream> using namespace std; int f[31][31]; int main(){int n,m;scanf("%d%d",&n,&m);f[1][1]1;//边界&#xff1a;f(1,1)1for(int i1;i<n;i)for(int j1;j<m;j)if((i&1||j&1)&&(i!1||j!1))//i,j不均为偶数&#…

腿足机器人之七- 逆运动学

腿足机器人之七- 逆运动学 基本概念腿部运动的数学表示坐标系定义以及自由度说明正运动学模型 逆运动学求解几何解法数值迭代法雅可比矩阵法基础双足机器人步态规划中的雅可比法应用 工程挑战与解决方案实际应用中的工具和算法多解问题高自由度机器人&#xff08;如Atlas的28自…

【强化学习的数学原理】第10课-Actor-Critic方法-笔记

学习资料&#xff1a;bilibili 西湖大学赵世钰老师的【强化学习的数学原理】课程。链接&#xff1a;强化学习的数学原理 西湖大学 赵世钰 文章目录 一、最简单的Actor-Critic&#xff08;QAC&#xff09;二、Advantage Actor-Critic&#xff08;A2C&#xff09;三、重要性采样和…

vtkCamera类的Dolly函数作用及相机拉近拉远

录 1. 预备知识 1.1.相机焦点 2. vtkCamera类的Dolly函数作用 3. 附加说明 1. 预备知识 要理解vtkCamera类的Dolly函数作用,就必须先了解vtkCamera类表示的相机的各种属性。  VTK是用vtkCamera类来表示三维渲染场景中的相机。vtkCamera负责把三维场景投影到二维平面,如…

JavaScript中的函数基础知识

JavaScript中的函数基础知识 1.函数声明的三种方式1.1 函数声明语句1.2 函数表达式1.3 new Function 2.函数的返回值3.函数调用的几种方法4.函数参数4.1 函数内部的arguments对象&#xff08;是个伪数组&#xff09;4.2 获取形参的个数4.3 函数不存在重载4.4 参数传递(1) 基本数…