DEENESPTFRRUARHIKOZHNL

TCP/IP Stack (TcpIp)

ModulTcpIp (TCP/IP Stack)
BSW-Modul-ID170
Standard-Header#include "TcpIp.h"
SWS-SpezifikationAUTOSAR_SWS_TcpIp.pdf
ClusterEthernet Services

模块指南人工智能生成

在以太网栈中通过 TCP 和 UDP 为上一层提供 IP 通信以及地址管理。
AI 生成 未审核 模型: claude-opus-5-5 · 推理强度: high · 温度: 不可控 · 提示词: 0a4cda5ef1d2 来源 未决问题(3)
因果锚点:R20-11 自 R20-11 起有效 为此规范版本重新合成。
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

在以太网栈中通过 TCP 和 UDP 为上一层提供 IP 通信以及地址管理。

TcpIp 在 Classic 以太网栈中提供带有 ARP、NDP、ICMP 和 DHCP 的 IPv4 与 IPv6,以及 UDP 和 TCP,从而为 SoAd 等 Socket-Owner 提供服务 [SWS_TCPIP_00052]。EthSM 为每个 EthIf 控制器管理 ONLINE、ONHOLD 和 OFFLINE 状态。仅当为控制器分配了本地地址时,它才会变为 ONLINE [SWS_TCPIP_00085]。Socket 被请求、绑定,并在 TCP 情况下进行主动或被动连接,数据通过发送服务和回调运行。最重要的边界条件:TcpIp 仅在 ONLINE 状态下接受新的 TCP 连接,并且在 ONHOLD 下拒绝新的发送请求。

在 Classic 以太网栈中,TcpIp 负责 IP 通信。它由针对 IPv4(带有 ARP、ICMP、DHCP 和 Auto-IP)、IPv6(带有 NDP、ICMPv6 和 DHCPv6)以及 UDP、TCP 和 TLS 的子模块构成([SWS_TCPIP_00052],[SWS_TCPIP_00150])。向上,它通过专属的 TcpIp_<Up>GetSocket 函数和回调为 Socket-Owner(即 SoAd 或 CDD)提供服务([SWS_TCPIP_00220],[SWS_TCPIP_00222])。向下,它与 EthIf 交换帧 [SWS_TCPIP_00029]。

kontext EthSM EthSM TcpIp TcpIp IPv4 / ARP / ICMP / DHCP / Auto-IP IPv6 / NDP / ICMPv6 / DHCPv6 UDP / TCP / TLS / IPsec EthSM->TcpIp TcpIp_RequestComMode SoAd SoAd (Socket-Owner SOAD) SoAd->TcpIp TcpIp_SoAdGetSocket, TcpIp_Bind, TcpIp_TcpTransmit, TcpIp_UdpTransmit CDD CDD (Socket-Owner CDD) CDD->TcpIp TcpIp_<Up>GetSocket, Transmit-Dienste TcpIp->SoAd SoAd_RxIndication, SoAd_TxConfirmation, SoAd_TcpAccepted, SoAd_LocalIpAddrAssignmentChg TcpIp->CDD konfigurierte Callback-Namen EthIf EthIf TcpIp->EthIf EthIf_ProvideTxBuffer, EthIf_Transmit Det Det TcpIp->Det 开发与运行时错误 Csm Csm (optional) TcpIp->Csm Krypto-Dienste (TLS) IdsM IdsM (optional) TcpIp->IdsM Sicherheitsereignisse NvM NvM-Block (TCPIP_STORE) TcpIp->NvM gespeicherte IP-Adressen EthIf->TcpIp TcpIp_RxIndication

上下文图:TcpIp 位于 Socket-Owner 与 EthIf 之间,由 EthSM 控制,并向 DET 和 IdsM 报告。来源:[SWS_TCPIP_00220],[SWS_TCPIP_00070],[SWS_TCPIP_00361],SWS TcpIp 第17页

TcpIp 为每个 EthIf 控制器单独维护通信状态 [SWS_TCPIP_00083]。EthSM 通过 TcpIp_RequestComMode 请求 ONLINE、ONHOLD 或 OFFLINE 状态之一 [SWS_TCPIP_00070]。STARTUP 和 SHUTDOWN 为过渡状态,无法被请求 [SWS_TCPIP_00089]。ONLINE 启动地址分配。ONHOLD 保留 Socket 和地址,但不接受发送请求。OFFLINE 关闭 Socket([SWS_TCPIP_00075],[SWS_TCPIP_00074],[SWS_TCPIP_00072])。

zustand Start 开始 OFFLINE TCPIP_STATE_OFFLINE Start->OFFLINE TcpIp_Init() STARTUP TCPIP_STATE_STARTUP OFFLINE->STARTUP RequestComMode(ONLINE) / Adresszuweisungen aktivieren STARTUP->OFFLINE RequestComMode(OFFLINE) / Zuweisungen abbrechen ONLINE TCPIP_STATE_ONLINE STARTUP->ONLINE erste Adresse zugewiesen / <Up>_LocalIpAddrAssignmentChg(ASSIGNED) ONHOLD TCPIP_STATE_ONHOLD ONLINE->ONHOLD RequestComMode(ONHOLD) / ...(ONHOLD), Kommunikation deaktivieren SHUTDOWN TCPIP_STATE_SHUTDOWN ONLINE->SHUTDOWN RequestComMode(OFFLINE) 或 所有地址均已释放 / ...(UNASSIGNED),关闭套接字 ONHOLD->ONLINE RequestComMode(ONLINE) / reaktivieren, ...(ASSIGNED) ONHOLD->SHUTDOWN RequestComMode(OFFLINE) / ...(UNASSIGNED) SHUTDOWN->OFFLINE Ressourcen freigegeben

状态图:只有在为控制器分配了地址后,它才会变为 ONLINE。它通过释放资源的 SHUTDOWN 走向 OFFLINE。来源:[SWS_TCPIP_00085],[SWS_TCPIP_00077],[SWS_TCPIP_00087],SWS TcpIp 第60页

地址源自一个已配置的本地地址表。它们以静态方式、通过 DHCP 或作为链路本地地址进行分配,按优先级选择,并可根据需要保存在 NvM 中([SWS_TCPIP_00099],[SWS_TCPIP_00065],[SWS_TCPIP_00127],[SWS_TCPIP_00219])。<Up_LocalIpAddrAssignmentChg> 向上一层通知变更 [SWS_TCPIP_00229]。Socket 被请求并使用 TcpIp_Bind 绑定。TCP 连接通过 TcpIp_TcpConnect 或 TcpIp_TcpListen 建立([SWS_TCPIP_00111],[SWS_TCPIP_00112],[SWS_TCPIP_00113])。

发送通过 TcpIp_TcpTransmit 异步进行,或通过 TcpIp_UdpTransmit 同步进行。对于 TCP,上一层直接传递数据或通过 <Up_CopyTxData> 提供数据([SWS_TCPIP_00124],[SWS_TCPIP_00120])。TcpIp 根据本地地址和端口将接收到的数据报分配给某个 Socket [SWS_TCPIP_00170]。若缺少目标的 MAC 地址,则 TcpIpArpPacketQueueEnabled 决定是将报文排队还是丢弃 [SWS_TCPIP_00192]。超时、无法访问的主机或地址冲突等运行时错误由 TcpIp 报告给 DET。在 R20-11 中为此定义了代码 0x01 至 0x05 [SWS_TCPIP_00255]。为了实现安全防护,还加入了 TLS 1.2 及以上版本以及带有 IKEv2 的 IPsec([SWS_TCPIP_00302],[SWS_TCPIP_00353])。

在以太网栈中的角色:Socket-Owner 与 EthIf 之间的中介

TcpIp 在各子模块中汇集了 Classic ECU 的基于 IP 的通信 [SWS_TCPIP_00052]。对于 IPv4,要求支持 IP、ARP、ICMP、DHCPv4(客户端和服务器)、Auto-IP、UDP 和 TCP([SWS_TCPIP_00053],[SWS_TCPIP_00056],[SWS_TCPIP_00058],[SWS_TCPIP_00057],[SWS_TCPIP_00061])。对于 IPv6,还增加了 IPv6、NDP、ICMPv6 和一个 DHCPv6 客户端([SWS_TCPIP_00160],[SWS_TCPIP_00164],[SWS_TCPIP_00166])。三个扩展类别对支持范围进行了划分:IPv4 栈、IPv6 栈和双栈 SWS TcpIp 第18页。对于类别 3,全部范围均为强制性要求 [SWS_TCPIP_00150]。

向上,TcpIp 为 Socket-Owner 提供服务。若 TcpIpSocketOwnerUpperLayerType 设为 SOAD,回调名称为 SoAd_…。对于 CDD,适用的则是配置的函数名称([SWS_TCPIP_00220],[SWS_TCPIP_00221])。每个 Owner 获得一个专属的 TcpIp_<Up>GetSocket 函数,由此请求的 Socket 归其独占 [SWS_TCPIP_00222]。

向下,TcpIp 通过 TcpIp_RxIndication 接收帧 [SWS_TCPIP_00029]。它通过 EthIf_Transmit 发送,并且始终伴随 TxConfirmation = FALSE [SWS_TCPIP_00131]。EthSM 通过 TcpIp_RequestComMode 控制其状态 SWS EthSM 第27页。TcpIp 可选使用 CSM 服务 [SWS_TCPIP_00028],并向 IdsM 报告安全事件 [SWS_TCPIP_00361]。SWS TcpIp 第17页 给出了嵌入架构的概览。

kontext EthSM EthSM TcpIp TcpIp IPv4 / ARP / ICMP / DHCP / Auto-IP IPv6 / NDP / ICMPv6 / DHCPv6 UDP / TCP / TLS / IPsec EthSM->TcpIp TcpIp_RequestComMode SoAd SoAd (Socket-Owner SOAD) SoAd->TcpIp TcpIp_SoAdGetSocket, TcpIp_Bind, TcpIp_TcpTransmit, TcpIp_UdpTransmit CDD CDD (Socket-Owner CDD) CDD->TcpIp TcpIp_<Up>GetSocket, Transmit-Dienste TcpIp->SoAd SoAd_RxIndication, SoAd_TxConfirmation, SoAd_TcpAccepted, SoAd_LocalIpAddrAssignmentChg TcpIp->CDD konfigurierte Callback-Namen EthIf EthIf TcpIp->EthIf EthIf_ProvideTxBuffer, EthIf_Transmit Det Det TcpIp->Det 开发与运行时错误 Csm Csm (optional) TcpIp->Csm Krypto-Dienste (TLS) IdsM IdsM (optional) TcpIp->IdsM Sicherheitsereignisse NvM NvM-Block (TCPIP_STORE) TcpIp->NvM gespeicherte IP-Adressen EthIf->TcpIp TcpIp_RxIndication

上下文图:TcpIp 位于 Socket-Owner(SoAd 或 CDD)与 EthIf 之间。它由 EthSM 控制,向 DET 报告错误并向 IdsM 报告事件,且可选使用 CSM。来源:[SWS_TCPIP_00220],[SWS_TCPIP_00222],[SWS_TCPIP_00029],[SWS_TCPIP_00070],[SWS_TCPIP_00028],[SWS_TCPIP_00361],[SWS_TCPIP_00255],[SWS_TCPIP_00219],SWS TcpIp 第17页

控制器状态:从 TCPIP_STATE_OFFLINE 到 TCPIP_STATE_ONLINE

该模块使用 TcpIp_Init 和与具体实现相关的 TcpIp_ConfigType 进行初始化([SWS_TCPIP_00002],[SWS_TCPIP_00067])。TcpIp_MainFunction 是 Scheduler 的入口点 [SWS_TCPIP_00026]。解释:诸如超时等时间控制的过程很可能在此执行。 问题 Q-77b083e447651768 (未决)规范对此仅称“Schedules the TCP/IP stack”。

TcpIp 为每个 EthIf 控制器维护独立的状态:OFFLINE、STARTUP、ONLINE、ONHOLD 或 SHUTDOWN [SWS_TCPIP_00083]。若保存的请求与活动状态不同,TcpIp 会启动必要步骤 [SWS_TCPIP_00136]。

zustand Start 开始 OFFLINE TCPIP_STATE_OFFLINE Start->OFFLINE TcpIp_Init() STARTUP TCPIP_STATE_STARTUP OFFLINE->STARTUP RequestComMode(ONLINE) / Adresszuweisungen aktivieren STARTUP->OFFLINE RequestComMode(OFFLINE) / Zuweisungen abbrechen ONLINE TCPIP_STATE_ONLINE STARTUP->ONLINE erste Adresse zugewiesen / <Up>_LocalIpAddrAssignmentChg(ASSIGNED) ONHOLD TCPIP_STATE_ONHOLD ONLINE->ONHOLD RequestComMode(ONHOLD) / ...(ONHOLD), Kommunikation deaktivieren SHUTDOWN TCPIP_STATE_SHUTDOWN ONLINE->SHUTDOWN RequestComMode(OFFLINE) 或 所有地址均已释放 / ...(UNASSIGNED),关闭套接字 ONHOLD->ONLINE RequestComMode(ONLINE) / reaktivieren, ...(ASSIGNED) ONHOLD->SHUTDOWN RequestComMode(OFFLINE) / ...(UNASSIGNED) SHUTDOWN->OFFLINE Ressourcen freigegeben

状态图:每个 EthIf 控制器拥有独立的状态机。仅可请求 ONLINE、ONHOLD 和 OFFLINE,STARTUP 和 SHUTDOWN 为过渡状态。来源:[SWS_TCPIP_00075],[SWS_TCPIP_00085],[SWS_TCPIP_00076],[SWS_TCPIP_00086],[SWS_TCPIP_00077],[SWS_TCPIP_00087],[SWS_TCPIP_00088],SWS TcpIp 第60页(图表来自 R25-11,状态转换由 R20-11 Requirements 涵盖)

在 STARTUP 中,OFFLINE 请求会中止正在进行的分配 [SWS_TCPIP_00088]。若有人请求 STARTUP 或 SHUTDOWN,将以 E_NOT_OK 予以拒绝 [SWS_TCPIP_00089]。

典型的启动流程如下:EthSM 应 ComM 的请求发起 ONLINE SWS EthSM 第42页。随后 TcpIp 报告已分配的地址。之后 SoAd 请求 Socket 并进行绑定([SWS_TCPIP_00229],SWS SoAd 第20页)。来自 R25-11 的图表还展示了通过 EthSM_TcpIpModeIndication 得到的反馈 SWS TcpIp 第60页。对于 R20-11,该情况大概率同样适用。 问题 Q-a5e26ad792c23d58 (未决)

控制器启动直至绑定套接字ComMEthSMTcpIpSoAdEthSM_RequestComMode(network,COMM_FULL_COMMUNICATION)TcpIp_RequestComMode(CtrlIdx,TCPIP_STATE_ONLINE)E_OK (Auftrag angenommen)TCPIP_STATE_STARTUP:Adresszuweisungen aktivieren异步,例如 DHCP 或链路本地地址(Link-Local)erste Adresse zugewiesen:TCPIP_STATE_ONLINESoAd_LocalIpAddrAssignmentChg(IpAddrId,TCPIP_IPADDR_STATE_ASSIGNED)EthSM_TcpIpModeIndication(CtrlIdx,TCPIP_STATE_ONLINE) (vermutlich)Use Case: SoAd 打开套接字连接TcpIp_SoAdGetSocket(Domain, Protocol,SocketIdPtr)E_OK, SocketIdTcpIp_Bind(SocketId, LocalAddrId, PortPtr)E_OK

时序图:只有异步地址分配才会使控制器进入 ONLINE。之后 SoAd 才能请求并绑定 Socket。来源:[SWS_TCPIP_00070],[SWS_TCPIP_00075],[SWS_TCPIP_00085],[SWS_TCPIP_00229],[SWS_TCPIP_00018],[SWS_TCPIP_00015],SWS EthSM 第42页。向 EthSM 的反馈推测在 R20-11 中同样存在。

本地地址及其分配

其基础是一个来自 TcpIpLocalAddr 的本地地址表,这些地址在运行时分配给 EthIf 控制器([SWS_TCPIP_00099],SWS TcpIp 第220页)。条目通过 TcpIp_LocalAddrIdType 访问 [SWS_TCPIP_00030]。每个条目均可采用多种方式,例如静态、DHCP 或链路本地([SWS_TCPIP_00065],SWS TcpIp 第224页)。若具有更高优先级的地址变得可用,它将替换原有地址 [SWS_TCPIP_00127]。

分配与释放如何触发,取决于所配置的触发方式:

每次分配变更均由 <Up_LocalIpAddrAssignmentChg> 报告,附带一个类型为 TcpIp_IpAddrStateType 的值([SWS_TCPIP_00229],[SWS_TCPIP_00082])。TcpIp 通过免费 ARP 宣告新的 IPv4 地址 [SWS_TCPIP_00093]。它通过重复地址检测检查 IPv6 地址 [SWS_TCPIP_00159]。TcpIp_GetIpAddr、TcpIp_GetPhysAddr 和 TcpIp_GetCtrlIdx 用于查询([SWS_TCPIP_00032],[SWS_TCPIP_00033],[SWS_TCPIP_00141])。若查询未设置的 DHCP 选项,读取服务将返回长度 0 [SWS_TCPIP_00237]。

Socket:请求、绑定、连接、关闭

通过地址族和协议请求套接字([SWS_TCPIP_00018]、[SWS_TCPIP_00009]、[SWS_TCPIP_00010])。TcpIp_Bind 将其绑定到本地地址和端口 [SWS_TCPIP_00111]。如果端口、协议和地址已被占用,或者地址未分配,则此操作失败([SWS_TCPIP_00146]、[SWS_TCPIP_00254])。使用 TCPIP_PORT_ANY 时,协议栈会自行在 49152 到 65535 之间选择一个端口 SWS TcpIp 第85页。

对于 TCP,有两种建立连接的途径:

  • 作为客户端,TcpIp_TcpConnect 异步建立连接。连接建立后,TcpIp 调用 <Up_TcpConnected>([SWS_TCPIP_00112]、[SWS_TCPIP_00227])。
  • 作为服务器,TcpIp_TcpListen 将套接字置于 Listen 状态 [SWS_TCPIP_00113]。对于每个入站连接,TcpIp 都会派生出一个专有套接字,并通过 <Up_TcpAccepted> 进行通报 [SWS_TCPIP_00226]。若上限层返回 E_NOT_OK,TcpIp 将关闭连接 SWS SoAd 第81页。

TcpIp 仅在 ONLINE 状态下接受新的 TCP 连接 [SWS_TCPIP_00094]。

作为客户端与服务器的 TCP 连接建立SoAdTcpIpEthIfalt客户端(主动打开)TcpIp_TcpConnect(SocketId, RemoteAddrPtr)E_OK (asynchron)EthIf_ProvideTxBuffer / EthIf_Transmit(SYN)TcpIp_RxIndication(...)(对端响应)SoAd_TcpConnected(SocketId)服务器(被动打开)TcpIp_TcpListen(SocketId, MaxChannels)E_OKTcpIp_RxIndication(...)(Verbindungsanfrage)Socket SocketIdConnected ableiten(最多 MaxChannels 个并行)SoAd_TcpAccepted(SocketId,SocketIdConnected, RemoteAddrPtr)E_OK / E_NOT_OK(关闭连接)

时序图:客户端通过 <Up_TcpConnected> 接收确认。服务器为每个连接获取一个派生套接字,上限层可以接受或拒绝该套接字。来源:[SWS_TCPIP_00022]、[SWS_TCPIP_00023]、[SWS_TCPIP_00226]、[SWS_TCPIP_00227]、SWS TcpIp 第129页(后面的示意图还包含 LSduR,在此处省略)、SWS TcpIp 第107页

TcpIp_Close 正常终止 TCP 连接。若 Abort = TRUE,则通过 RST 立即中止连接。对于 UDP,资源会立即释放([SWS_TCPIP_00109]、[SWS_TCPIP_00110])。重置、FIN 或关闭等事件由 <Up_TcpIpEvent> 通报 [SWS_TCPIP_00144]。通过 TcpIp_ChangeParameter 可以修改套接字参数,例如接收窗口、帧优先级、Nagle 算法、TCP 选项过滤器或 UDP 校验和([SWS_TCPIP_00126]、[SWS_TCPIP_00266]、[SWS_TCPIP_00279])。

数据路径:发送、接收、地址解析

TcpIp_TcpTransmit 异步工作。若设置了 DataPtr,它将从该线性缓冲区中接收数据。若 DataPtr 为 NULL_PTR,则通过 <Up_CopyTxData> 获取数据。若 ForceRetrieve = TRUE,则恰好为 AvailableLength 字节;若为 FALSE,则可能更少([SWS_TCPIP_00124]、[SWS_TCPIP_00125]、[SWS_TCPIP_00228])。对于 TCP,TcpIp 仅在对端确认后才会调用 <Up_TxConfirmation>([SWS_TCPIP_00225]、SWS SoAd 第86页)。相比之下,TcpIp_UdpTransmit 则同步且立即发送([SWS_TCPIP_00025]、[SWS_TCPIP_00120])。

采用直接或间接数据提供的 TCP 发送SoAdTcpIpEthIfTcpIp_TcpTransmit(SocketId, DataPtr,AvailableLength, ForceRetrieve)altDataPtr != NULL_PTR从线性缓冲区获取数据DataPtr == NULL_PTRloop直至 AvailableLength(ForceRetrieve = TRUE)或更少(FALSE)SoAd_CopyTxData(SocketId, BufPtr, BufLength)BUFREQ_OKE_OKTcpIp_MainFunction()EthIf_ProvideTxBuffer(...)EthIf_Transmit(..., TxConfirmation = FALSE)TcpIp_RxIndication(...)(对端 ACK)SoAd_TxConfirmation(SocketId, Length)

时序图:数据直接传递或通过复制回调获取。向 EthIf 的发送在 MainFunction 上下文中运行,确认仅在对端返回 ACK 后到来。来源:[SWS_TCPIP_00050]、[SWS_TCPIP_00123]、[SWS_TCPIP_00124]、[SWS_TCPIP_00131]、SWS TcpIp 第109页

接收时,IP 层将每个数据报分配给本地地址表中的一个条目 [SWS_TCPIP_00169]。UDP 和 TCP 随后通过目标端口和本地地址选择套接字([SWS_TCPIP_00170]、[SWS_TCPIP_00172])。对于现有的 TCP 连接,源地址和源端口还必须匹配 [SWS_TCPIP_00173]。UDP 广播发送到所有匹配的套接字,发往广播地址的 TCP 段将被丢弃([SWS_TCPIP_00171]、[SWS_TCPIP_00174])。TcpIp 会重新组装分片的数据报,并允许为此对接收进行解耦([SWS_TCPIP_00054]、SWS TcpIp 第131页)。数据通过 <Up_RxIndication> 到达上限层。上限层处理完 TCP 数据后,TcpIp_TcpReceived 会重新打开接收窗口([SWS_TCPIP_00223]、[SWS_TCPIP_00115])。

数据报接收至上层EthIfTcpIpSoAdEthIf_MainFunctionRx()TcpIp_RxIndication(CtrlIdx, FrameType,IsBroadcast, PhysAddrPtr, DataPtr, LenByte)IP:将数据报分配给 TcpIpAddrIdUDP/TCP:通过目标端口和本地地址选择套接字Fragmente: Reassemblierung,Empfang ggf. entkoppeltSoAd_RxIndication(SocketId, RemoteAddrPtr,BufPtr, Length)optTCP-SocketTcpIp_TcpReceived(SocketId, Length)增大接收窗口

时序图:接收到的帧通过本地地址和端口分配给套接字。对于 TCP,上限层的确认会释放接收窗口。来源:[SWS_TCPIP_00029]、[SWS_TCPIP_00169]、[SWS_TCPIP_00170]、[SWS_TCPIP_00223]、[SWS_TCPIP_00115]、SWS TcpIp 第108页

为了发送,TcpIp 需要目标的 MAC 地址,并将其保存在 ARP 表中:

ARP 表的每次更改,TcpIp 都会通过 <Up_PhysAddrTableChg> 通报 [SWS_TCPIP_00142]。若 Neighbor Cache 已满,则会逐出最旧的条目 [SWS_TCPIP_00264]。TcpIp_GetRemotePhysAddr 和缓存读取服务允许进行查询([SWS_TCPIP_00138]、[SWS_TCPIP_91002]、[SWS_TCPIP_91001])。

adressaufloesung A IPv4-Paket an entfernten Host senden B Link-Layer-Adresse in ARP-Tabelle? A->B C Paket senden B->C 是 D 启动地址解析 (每个目标在 TcpIpArpRequestTimeout 内 最多发送一次 ARP 请求) B->D 不 E TcpIpArpPacketQueueEnabled? D->E F Paket einreihen, E_OK E->F TRUE G Sendeauftrag abweisen, E_NOT_OK E->G FALSE H ARP-Antwort empfangen: Tabelle aktualisieren, <Up>_PhysAddrTableChg(valid = TRUE) F->H H->C eingereihtes Paket (Interpretation)

活动图:若发送时缺少 ARP 条目,则根据配置对数据包进行排队或拒绝。针对同一目标的新请求将受到限制。来源:[SWS_TCPIP_00191]、[SWS_TCPIP_00192]、[SWS_TCPIP_00350]、[SWS_TCPIP_00142]、SWS TcpIp 第176页。Interpretation:排队的数据包在解析成功后发送。

安全防护与过滤:TLS、IPsec、IdsM

对于 TCP 连接,TcpIp 支持符合 IETF RFC 5246 的 TLS。低于 1.2 的版本将被拒绝([SWS_TCPIP_00300]、[SWS_TCPIP_00302])。PSK 身份和当前时间由可配置的 Callout 提供([SWS_TCPIP_91014]、[SWS_TCPIP_91012])。加密通过 CSM 进行([SWS_TCPIP_00028]、SWS TcpIp 第251页)。

IPsec 支持 IKEv2,不支持 IKEv1([SWS_TCPIP_00352]、[SWS_TCPIP_00353])。每个数据报都被分配一个策略,并根据该策略进行保护、放行或丢弃([SWS_TCPIP_00359]、[SWS_TCPIP_00360])。不允许的 IPv6 扩展头会导致静默丢弃 [SWS_TCPIP_00260]。若设置了 TcpIpEnableSecurityEventReporting,TcpIp 会向 IdsM 报告安全事件 [SWS_TCPIP_00361]。

发生错误时的行为

开发错误(包括 TCPIP_E_UNINIT、TCPIP_E_PARAM_POINTER、TCPIP_E_INV_ARG 和 TCPIP_E_ADDRINUSE)在 [SWS_TCPIP_00042] 中定义。检查内容包括:

独立于错误检测,TcpIp 会将某些拒绝作为 E_NOT_OK 返回,例如已被占用的端口或不匹配的地址族([SWS_TCPIP_00146]、[SWS_TCPIP_00205])。

运行时错误由 TcpIp 通过 Det_ReportRuntimeError 报告:

R20-11 仅定义了代码 0x01 至 0x05 [SWS_TCPIP_00255]。后续版本中新增的代码 TCPIP_E_TX_QUEUE_OVERRUN 和 TCPIP_E_TX_INTERNAL_PROCESSING_FAILED 在此处不适用 SWS TcpIp 第65页。

许多错误情况保持静默,因为不合规的数据包会被直接丢弃。TcpIp_GetAndResetMeasurementData 统计此类丢弃的数据包并重置计数器([SWS_TCPIP_91006]、[SWS_TCPIP_00296])。若无法解析 MAC 地址,TcpIp 会通报 TCPIP_E_PHYS_ADDR_MISS [SWS_TCPIP_00066]。对于自身子网之外的目标,TcpIp_GetRemotePhysAddr 立即返回 TCPIP_E_NOT_OK [SWS_TCPIP_00139]。

进一步详细证据

基于规范摘录由 AI 生成的指南。针对 R20-11,仅所链接的需求具有规范性,其他版本的偏差已作说明。

TCP/IP Stack (TcpIp)

Provides IPv4/IPv6 networking, TCP/UDP sockets, ARP, ICMP, and DHCP services.

Funktionen — Übersicht

Typen — Übersicht

Funktionen & Typen — Detailansicht

函数 TcpIp_Init [SWS_TCPIP_00002] 📄 PDF

void TcpIp_Init (const TcpIp_ConfigType* ConfigPtr);

This service initializes the TCP/ IP Stack. Tcp Ip_ Init may not block the start - up process for an indefinite amount of time. Caveats: The call of this service is mandatory before using the Tcp Ip instance for further processing.

函数 TcpIp_TcpConnect [SWS_TCPIP_00022] 📄 PDF

Std_ReturnType TcpIp_TcpConnect (TcpIp_SocketIdType SocketId, const TcpIp_SockAddrType* RemoteAddrPtr);

B y this API service the TCP/ IP stack is requested to establish a TCP connection to the configured peer.

函数 TcpIp_TcpListen [SWS_TCPIP_00023] 📄 PDF

Std_ReturnType TcpIp_TcpListen (TcpIp_SocketIdType SocketId, uint16 MaxChannels);

By this API service the TCP/ IP stack is requested to listen on the TCP socket specified by the socket identifier. Available v ia Tcp Ip.h

函数 TcpIp_RequestComMode [SWS_TCPIP_00070] 📄 PDF

Std_ReturnType TcpIp_RequestComMode (uint8 CtrlIdx, TcpIp_StateType State);

By this API service the TCP/ IP stack is requested to change the Tcp Ip state of the communication network identified by Eth If controller index.

函数 TcpIp_RequestIpAddrAssignment [SWS_TCPIP_00037] 📄 PDF

Std_ReturnType TcpIp_RequestIpAddrAssignment (TcpIp_LocalAddrIdType LocalAddrId, TcpIp_IpAddrAssignmentTypeType, const TcpIp_SockAddrType* LocalIpAddrPtr, uint8 Netmask, const TcpIp_SockAddrType* DefaultRouterPtr);

Service TcpIp_RequestIpAddrAssignment.

函数 TcpIp_ReleaseIpAddrAssignment [SWS_TCPIP_00078] 📄 PDF

Std_ReturnType TcpIp_ReleaseIpAddrAssignment (TcpIp_LocalAddrIdType LocalAddrId);

By this API service the local IP address assignment for the IP address specified by Local Addr Id shall be released.

函数 TcpIp_IcmpV6Transmit [SWS_TCPIP_00187] 📄 PDF

Std_ReturnType TcpIp_IcmpV6Transmit (TcpIp_LocalAddrIdType LocalIpAddrId, const TcpIp_SockAddrType* RemoteAddrPtr, uint8 HopLimit, uint8Type, uint8 Code, uint16 DataLength, const uint8* DataPtr); ⚠️

By this API service the TCP/ IP stack sends an ICMPv6 message according to the specified parameters.

函数 TcpIp_DhcpReadOption [SWS_TCPIP_00040] 📄 PDF

Std_ReturnType TcpIp_DhcpReadOption (TcpIp_LocalAddrIdType LocalIpAddrId, uint8 Option, uint8* DataLength, uint8* DataPtr);

By this API service the TCP/ IP stack retrieves DHCP option data identified by parameter option for already received DHCP options.

函数 TcpIp_DhcpV6ReadOption [SWS_TCPIP_00189] 📄 PDF

Std_ReturnType TcpIp_DhcpV6ReadOption (TcpIp_LocalAddrIdType LocalIpAddrId, uint16 Option, uint16* DataLength, uint8* DataPtr);

By this API service the TCP/ IP stack retrieve s DHCPv6 option data identified by parameter option for already received DHCPv6 options.

函数 TcpIp_DhcpWriteOption [SWS_TCPIP_00020] 📄 PDF

Std_ReturnType TcpIp_DhcpWriteOption (TcpIp_LocalAddrIdType LocalIpAddrId, uint8 Option, uint8 DataLength, const uint8* DataPtr);

By this API service the TCP/ IP stack writes the DHCP option data identified by parameter option.

函数 TcpIp_DhcpV6WriteOption [SWS_TCPIP_00190] 📄 PDF

Std_ReturnType TcpIp_DhcpV6WriteOption (TcpIp_LocalAddrIdType LocalIpAddrId, uint16 Option, uint16 DataLength, const uint8* DataPtr);

By this API service the TCP/ IP stack writes the DHCPv6 option data identified by parameter option.

函数 TcpIp_ChangeParameter [SWS_TCPIP_00016] 📄 PDF

Std_ReturnType TcpIp_ChangeParameter (TcpIp_SocketIdType SocketId, TcpIp_ParamIdType ParameterId, const uint8* ParameterValue);

By this API service the TCP/ IP stack is requested to change a parameter of a socket. E.g. the Nagle algorithm may be controlled by this API.

函数 TcpIp_GetIpAddr [SWS_TCPIP_00032] 📄 PDF

Std_ReturnType TcpIp_GetIpAddr (TcpIp_LocalAddrIdType LocalAddrId, TcpIp_SockAddrType* IpAddrPtr, uint8* NetmaskPtr, TcpIp_SockAddrType* DefaultRouterPtr);

Service TcpIp_GetIpAddr.

函数 TcpIp_GetPhysAddr [SWS_TCPIP_00033] 📄 PDF

Std_ReturnType TcpIp_GetPhysAddr (TcpIp_LocalAddrIdType LocalAddrId, uint8* PhysAddrPtr);

Obtains the physical source address used by the Eth If controller implicitly specif ied via Local Addr Id.

函数 TcpIp_GetRemotePhysAddr [SWS_TCPIP_00137] 📄 PDF

TcpIp_ReturnType TcpIp_GetRemotePhysAddr (uint8 CtrlIdx, const TcpIp_SockAddrType* IpAddrPtr, uint8* PhysAddrPtr, boolean InitRes);

Tcp Ip_ Get Remote Phys Addr queries the IP/ physical address translation table specified by Ctrl Idx and returns the physical address related to the IP addres s specified by Ip Addr Ptr. In case no physical address can be retrieved and parameter init Res is TRUE, address resolution for the specified IP address is initiated on the local network.

函数 TcpIp_GetCtrlIdx [SWS_TCPIP_00140] 📄 PDF

Std_ReturnType TcpIp_GetCtrlIdx (TcpIp_LocalAddrIdType LocalAddrId, uint8* CtrlIdxPtr);

Tcp Ip_ Get Ctrl Idx returns the index of the controller related to Local Addr Id.

函数 TcpIp_GetArpCacheEntries [SWS_TCPIP_91002] 📄 PDF

Std_ReturnType TcpIp_GetArpCacheEntries (AUTO SAR CP R20 - of uint8 ctrlIdx, uint32* numberOfElements, TcpIp_ArpCacheEntryType* entryListPtr); ⚠️

Copies entries from the physic al address cache of the IPv4 instance that is active on the Eth If controller specified by ctrl Idx into a user provided buffer. The function will copy all or number Of

函数 TcpIp_GetNdpCacheEntries [SWS_TCPIP_91001] 📄 PDF

Std_ReturnType TcpIp_GetNdpCacheEntries (uint8 ctrlIdx, uint32* numberOfElements, TcpIp_NdpCacheEntryType* entryListPtr);

Copies entries from the physic al address cache of the IPv6 instance that is active on the Eth If controller specified by ctrl Idx into a user provided buffer. The function will copy all or number Of

函数 TcpIp_GetAndResetMeasurementData [SWS_TCPIP_91006] 📄 PDF

Std_ReturnType TcpIp_GetAndResetMeasurementData (TcpIp_MeasurementIdxType MeasurementIdx, boolean MeasurementResetNeeded, uint32* MeasurementDataPtr);

Allows to read and reset detailed measurement data for diagnostic purposes. Get all Measurement Idx's at once is not supported. TCPIP_ MEAS_ ALL shall only be used to reset all Measurement Idx's at once. A NULL_ PTR shall be provided for Measurement Data Ptr in this case.

函数 TcpIp_UdpTransmit [SWS_TCPIP_00025] 📄 PDF

Std_ReturnType TcpIp_UdpTransmit (TcpIp_SocketIdType SocketId, const uint8* DataPtr, const TcpIp_SockAddrType* RemoteAddrPtr, uint16 TotalLength);

This service transmits data via UDP to a remote node. The transmission of the data is immediately performed with this function call by forwarding it to Eth If.

函数 TcpIp_MainFunction [SWS_TCPIP_00026] 📄 PDF

void TcpIp_MainFunction (void);

Schedules the TCP/ IP stack. (Entry point for scheduling) AUTO SAR CP R20 - of Document ID : AUTOSAR_SWS_TcpIp

函数 <Up_PhysAddrTableChg> [SWS_TCPIP_00143] 📄 PDF

void <Up_PhysAddrTableChg> (uint8 CtrlIdx, const TcpIp_SockAddrType* IpAddrPtr, const uint8* PhysAddrPtr, boolean valid);

This API is called by Tcp Ip in case of a change in the ARP/ NDP table related to the controller specified by Ctrl Idx.

函数 <Up_RxIndication> [SWS_TCPIP_00223] 📄 PDF

void <Up_RxIndication> (TcpIp_SocketIdType SocketId, const TcpIp_SockAddrType* RemoteAddrPtr, const uint8* BufPtr, uint16 Length);

The TCP/ IP stack calls this primitive after the reception of data on a socket. The socket identifier along with configuration information determines which module is to be called.

函数 <Up_TxConfirmation> [SWS_TCPIP_00225] 📄 PDF

void <Up_TxConfirmation> (TcpIp_SocketIdType SocketId, uint16 Length);

The TCP/ IP stack calls this function after the data has been acknowledged by the peer for TCP. Caveats: The upper layer might not be able to determine exactly which data bytes have been confirmed.

函数 <Up_TcpAccepted> [SWS_TCPIP_00226] 📄 PDF

Std_ReturnType <Up_TcpAccepted> (TcpIp_SocketIdType SocketId, TcpIp_SocketIdType SocketIdConnected, const TcpIp_SockAddrType* RemoteAddrPtr);

This service gets called if the stack put a socket into the listen mode before (as server) and a peer connected to it (as client). In detail: T he TCP/ IP stack calls this function after a socket was set into the listen state with Tcp Ip_ Tcp Listen() and a TCP connection is requested by the peer.

函数 <Up_TcpConnected> [SWS_TCPIP_00227] 📄 PDF

void <Up_TcpConnected> (TcpIp_SocketIdType SocketId);

This service gets called if the stack initiated a TCP connection before (as client) and the peer (the server) acknowledged the connection set up. In detail: The TCP/ IP stack calls this function after a socket was requested to connect with Tcp Ip_ Tcp Conn ect() and a TCP connection is confirmed by the peer. The parameter value of Socket Id equals the Socket Id value of the preceeding Tcp Ip_ Tcp Connect() call.

函数 <Up_CopyTxData> [SWS_TCPIP_00228] 📄 PDF

BufReq_ReturnType <Up_CopyTxData> (TcpIp_SocketIdType SocketId, uint8* BufPtr, uint16 BufLength);

This service requests to copy data for transmission to the buffer indicated. This call is triggered by Tcp Ip_ Transmit(). Note: The call to _ Copy Tx Data() may happen in the context of Tcp Ip_ Transmit().

函数 <Up_LocalIpAddrAssignmentChg> [SWS_TCPIP_00229] 📄 PDF

void <Up_LocalIpAddrAssignmentChg> (TcpIp_LocalAddrIdType IpAddrId, TcpIp_IpAddrStateType State);

This service gets called by the TCP/ IP stack if an IP address assignment changes (i.e. new address assigned or assigned address becomes invalid).

函数 <Up_IcmpMsgHandler> [SWS_TCPIP_00270] 📄 PDF

void <Up_IcmpMsgHandler> (TcpIp_LocalAddrIdType LocalAddrId, const TcpIp_SockAddrType* RemoteAddrPtr, uint8 Ttl, uint8Type, uint8 Code, uint16 DataLength, uint8* DataPtr); ⚠️

By this API service the configured ICMP message handler function is called by the TCP/ IP stack on reception of a ICMP message which is not handled by the TCP/ IP stack.

函数 <Up_DADAddressConflict> [SWS_TCPIP_91005] 📄 PDF

void <Up_DADAddressConflict> (TcpIp_LocalAddrIdType IpAddrId, const TcpIp_SockAddrType* IpAddrPtr, const uint8* LocalPhysAddrPtr, const uint8* RemotePhysAddrPtr);

This API is called by Tcp Ip in case the Duplicate Address Detection (DAD) is enabled and detecting a duplicate IP Address.

函数 <Up_TlsGetCurrentTime> [SWS_TCPIP_91012] 📄 PDF

Std_ReturnType <Up_TlsGetCurrentTime> (uint32* CurrentTimeUtc);

This function queries the current time. This information will be requested when assembling the client hello message.

函数 <Up_TlsServerGetPskIdentityHint> [SWS_TCPIP_91013] 📄 PDF

Std_ReturnType <Up_TlsServerGetPskIdentityHint> (TcpIp_SocketIdType SocketId, TcpIp_TlsConnectionIdType TlsConnectionId, uint16* IdentityHintLengthPtr, uint8* IdentityHintPtr);

Queries the Identity hint for a pr e - shared key ciphersuite. This information is transmitted by the TLS Server to provide its identification to the TLS client.

函数 <Up_TlsServerGetPskIdentity> [SWS_TCPIP_91015] 📄 PDF

Std_ReturnType <Up_TlsServerGetPskIdentity> (TcpIp_SocketIdType SocketId, TcpIp_TlsConnectionIdType TlsConnectionId, uint16 PskKeyIdentityLength, const uint8* PskKeyIdentityPtr, uint32* CsmKeyId);

This callback is used for the TLS server to provide the CSM key name according to the key identification that was selected by the TLS client. The TLS server must provide a Csm Key reference to a key that matches this key identification name.

类型 TcpIp_SockAddrType [SWS_TCPIP_00012] 📄 PDF

Generic structure used by APIs to specify an IP address. (A specific address type can be derived from this structure via a cast to the specific struct type.)

类型 TcpIp_SockAddrInetType [SWS_TCPIP_00013] 📄 PDF

This structure defines an IPv4 address type which can be derived from the generic address structure via cast.

类型 TcpIp_SockAddrInet6Type [SWS_TCPIP_00014] 📄 PDF

This structure defines a IPv6 address type which can be derived from the generic address structure via cast. AUTO SAR CP R20 - of Document ID : AUTOSAR_SWS_TcpIp

类型 TcpIp_LocalAddrIdType [SWS_TCPIP_00030] 📄 PDF

Address identification type for unique identification of a local IP address and Eth If Controller configured in the Tcp Ip module.

类型 TcpIp_SocketIdType [SWS_TCPIP_00038] 📄 PDF

Socket identifier type for unique identification of a Tcp Ip stack socket. TCPIP_ SOCKETID_ INVALID shall specify an invalid socket handle.

类型 TcpIp_TlsConnectionIdType [SWS_TCPIP_91011] 📄 PDF

TLS connection identifier type for unique identification of a TLS connection. TCPIP_ TLSCONNECTIONID_ INVALID shall specify an invalid TLS connection handle.

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/CP_MOD_TcpIp
Status
unspecified
Version
AUTOSAR/AP/record/CP_MOD_TcpIp@rel:R20-11#77583d27
Content hash
77583d27
Source
https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_TcpIp.pdf#nameddest=SWS_TCPIP_00002

主题图

详细视图

请在大纲中选择一个条目。

初始化与状态

Returns the version information.

void TcpIp_GetVersionInfo (Std_VersionInfoType* versioninfo);
TcpIp_Init 函数

This service initializes the TCP/ IP Stack. Tcp Ip_ Init may not block the start - up process for an indefinite amount of time. Caveats: The call of this service is mandatory before using the Tcp Ip instance for further processing.

void TcpIp_Init (const TcpIp_ConfigType* ConfigPtr);

服务 · Get…

Allows to read and reset detailed measurement data for diagnostic purposes. Get all Measurement Idx's at once is not supported. TCPIP_ MEAS_ ALL shall only be used to reset all Measurement Idx's at once. A NULL_ PTR shall be provided for Measurement Data Ptr in this case.

Std_ReturnType TcpIp_GetAndResetMeasurementData (TcpIp_MeasurementIdxType MeasurementIdx, boolean MeasurementResetNeeded, uint32* MeasurementDataPtr);

Copies entries from the physic al address cache of the IPv4 instance that is active on the Eth If controller specified by ctrl Idx into a user provided buffer. The function will copy all or number Of

Std_ReturnType TcpIp_GetArpCacheEntries (AUTO SAR CP R20 - of uint8 ctrlIdx, uint32* numberOfElements, TcpIp_ArpCacheEntryType* entryListPtr); ⚠️

Tcp Ip_ Get Ctrl Idx returns the index of the controller related to Local Addr Id.

Std_ReturnType TcpIp_GetCtrlIdx (TcpIp_LocalAddrIdType LocalAddrId, uint8* CtrlIdxPtr);

Service TcpIp_GetIpAddr.

Std_ReturnType TcpIp_GetIpAddr (TcpIp_LocalAddrIdType LocalAddrId, TcpIp_SockAddrType* IpAddrPtr, uint8* NetmaskPtr, TcpIp_SockAddrType* DefaultRouterPtr);

Copies entries from the physic al address cache of the IPv6 instance that is active on the Eth If controller specified by ctrl Idx into a user provided buffer. The function will copy all or number Of

Std_ReturnType TcpIp_GetNdpCacheEntries (uint8 ctrlIdx, uint32* numberOfElements, TcpIp_NdpCacheEntryType* entryListPtr);

Obtains the physical source address used by the Eth If controller implicitly specif ied via Local Addr Id.

Std_ReturnType TcpIp_GetPhysAddr (TcpIp_LocalAddrIdType LocalAddrId, uint8* PhysAddrPtr);

Tcp Ip_ Get Remote Phys Addr queries the IP/ physical address translation table specified by Ctrl Idx and returns the physical address related to the IP addres s specified by Ip Addr Ptr. In case no physical address can be retrieved and parameter init Res is TRUE, address resolution for the specified IP address is initiated on the local network.

TcpIp_ReturnType TcpIp_GetRemotePhysAddr (uint8 CtrlIdx, const TcpIp_SockAddrType* IpAddrPtr, uint8* PhysAddrPtr, boolean InitRes);

服务 · Dhcp…

By this API service the TCP/ IP stack retrieves DHCP option data identified by parameter option for already received DHCP options.

Std_ReturnType TcpIp_DhcpReadOption (TcpIp_LocalAddrIdType LocalIpAddrId, uint8 Option, uint8* DataLength, uint8* DataPtr);

By this API service the TCP/ IP stack retrieve s DHCPv6 option data identified by parameter option for already received DHCPv6 options.

Std_ReturnType TcpIp_DhcpV6ReadOption (TcpIp_LocalAddrIdType LocalIpAddrId, uint16 Option, uint16* DataLength, uint8* DataPtr);

By this API service the TCP/ IP stack writes the DHCPv6 option data identified by parameter option.

Std_ReturnType TcpIp_DhcpV6WriteOption (TcpIp_LocalAddrIdType LocalIpAddrId, uint16 Option, uint16 DataLength, const uint8* DataPtr);

By this API service the TCP/ IP stack writes the DHCP option data identified by parameter option.

Std_ReturnType TcpIp_DhcpWriteOption (TcpIp_LocalAddrIdType LocalIpAddrId, uint8 Option, uint8 DataLength, const uint8* DataPtr);

服务 · Tcp…

B y this API service the TCP/ IP stack is requested to establish a TCP connection to the configured peer.

Std_ReturnType TcpIp_TcpConnect (TcpIp_SocketIdType SocketId, const TcpIp_SockAddrType* RemoteAddrPtr);

By this API service the TCP/ IP stack is requested to listen on the TCP socket specified by the socket identifier. Available v ia Tcp Ip.h

Std_ReturnType TcpIp_TcpListen (TcpIp_SocketIdType SocketId, uint16 MaxChannels);

By this API service the reception of socket data is confirmed to the TCP/ IP stack.

Std_ReturnType TcpIp_TcpReceived (TcpIp_SocketIdType SocketId, uint32 Length);

Service TcpIp_TcpTransmit.

Std_ReturnType TcpIp_TcpTransmit (TcpIp_SocketIdType SocketId, const uint8* DataPtr, uint32 AvailableLength, boolean ForceRetrieve);

服务 · 其他

TcpIp_Bind 函数

Service TcpIp_Bind.

Std_ReturnType TcpIp_Bind (TcpIp_SocketIdType SocketId, TcpIp_LocalAddrIdType LocalAddrId, uint16* PortPtr);

By this API service the TCP/ IP stack is requested to change a parameter of a socket. E.g. the Nagle algorithm may be controlled by this API.

Std_ReturnType TcpIp_ChangeParameter (TcpIp_SocketIdType SocketId, TcpIp_ParamIdType ParameterId, const uint8* ParameterValue);

By this API service the TCP/ IP stack is requested to close the socket and release all related resources.

Std_ReturnType TcpIp_Close (TcpIp_SocketIdType SocketId, boolean Abort);

Service TcpIp_IcmpTransmit.

Std_ReturnType TcpIp_IcmpTransmit (TcpIp_LocalAddrIdType LocalIpAddrId, AUTO SAR CP R20 - of const TcpIp_SockAddrType* RemoteAddrPtr, uint8 Ttl, uint8Type, uint8 Code, uint16 DataLength, const uint8* DataPtr); ⚠️

By this API service the TCP/ IP stack sends an ICMPv6 message according to the specified parameters.

Std_ReturnType TcpIp_IcmpV6Transmit (TcpIp_LocalAddrIdType LocalIpAddrId, const TcpIp_SockAddrType* RemoteAddrPtr, uint8 HopLimit, uint8Type, uint8 Code, uint16 DataLength, const uint8* DataPtr); ⚠️

By this API service the local IP address assignment for the IP address specified by Local Addr Id shall be released.

Std_ReturnType TcpIp_ReleaseIpAddrAssignment (TcpIp_LocalAddrIdType LocalAddrId);

By this API service the TCP/ IP stack is requested to change the Tcp Ip state of the communication network identified by Eth If controller index.

Std_ReturnType TcpIp_RequestComMode (uint8 CtrlIdx, TcpIp_StateType State);

Service TcpIp_RequestIpAddrAssignment.

Std_ReturnType TcpIp_RequestIpAddrAssignment (TcpIp_LocalAddrIdType LocalAddrId, TcpIp_IpAddrAssignmentTypeType, const TcpIp_SockAddrType* LocalIpAddrPtr, uint8 Netmask, const TcpIp_SockAddrType* DefaultRouterPtr);

Resets all learned IP - addresses to invalid values.

Std_ReturnType TcpIp_ResetIpAssignment (void);

This service transmits data via UDP to a remote node. The transmission of the data is immediately performed with this function call by forwarding it to Eth If.

Std_ReturnType TcpIp_UdpTransmit (TcpIp_SocketIdType SocketId, const uint8* DataPtr, const TcpIp_SockAddrType* RemoteAddrPtr, uint16 TotalLength);

回调

By this API service the TCP/ IP stack gets an indication and the data of a received frame.

void TcpIp_RxIndication (uint8 CtrlIdx, Eth_FrameType FrameType, boolean IsBroadcast, const uint8* PhysAddrPtr, const uint8* DataPtr, uint16 LenByte);

Callout 与预期接口

This service requests to copy data for transmission to the buffer indicated. This call is triggered by Tcp Ip_ Transmit(). Note: The call to _ Copy Tx Data() may happen in the context of Tcp Ip_ Transmit().

BufReq_ReturnType <Up_CopyTxData> (TcpIp_SocketIdType SocketId, uint8* BufPtr, uint16 BufLength);

This API is called by Tcp Ip in case the Duplicate Address Detection (DAD) is enabled and detecting a duplicate IP Address.

void <Up_DADAddressConflict> (TcpIp_LocalAddrIdType IpAddrId, const TcpIp_SockAddrType* IpAddrPtr, const uint8* LocalPhysAddrPtr, const uint8* RemotePhysAddrPtr);

By this API service the configured ICMP message handler function is called by the TCP/ IP stack on reception of a ICMP message which is not handled by the TCP/ IP stack.

void <Up_IcmpMsgHandler> (TcpIp_LocalAddrIdType LocalAddrId, const TcpIp_SockAddrType* RemoteAddrPtr, uint8 Ttl, uint8Type, uint8 Code, uint16 DataLength, uint8* DataPtr); ⚠️

This service gets called by the TCP/ IP stack if an IP address assignment changes (i.e. new address assigned or assigned address becomes invalid).

void <Up_LocalIpAddrAssignmentChg> (TcpIp_LocalAddrIdType IpAddrId, TcpIp_IpAddrStateType State);

This API is called by Tcp Ip in case of a change in the ARP/ NDP table related to the controller specified by Ctrl Idx.

void <Up_PhysAddrTableChg> (uint8 CtrlIdx, const TcpIp_SockAddrType* IpAddrPtr, const uint8* PhysAddrPtr, boolean valid);

The TCP/ IP stack calls this primitive after the reception of data on a socket. The socket identifier along with configuration information determines which module is to be called.

void <Up_RxIndication> (TcpIp_SocketIdType SocketId, const TcpIp_SockAddrType* RemoteAddrPtr, const uint8* BufPtr, uint16 Length);

This service gets called if the stack put a socket into the listen mode before (as server) and a peer connected to it (as client). In detail: T he TCP/ IP stack calls this function after a socket was set into the listen state with Tcp Ip_ Tcp Listen() and a TCP connection is requested by the peer.

Std_ReturnType <Up_TcpAccepted> (TcpIp_SocketIdType SocketId, TcpIp_SocketIdType SocketIdConnected, const TcpIp_SockAddrType* RemoteAddrPtr);

This service gets called if the stack initiated a TCP connection before (as client) and the peer (the server) acknowledged the connection set up. In detail: The TCP/ IP stack calls this function after a socket was requested to connect with Tcp Ip_ Tcp Conn ect() and a TCP connection is confirmed by the peer. The parameter value of Socket Id equals the Socket Id value of the preceeding Tcp Ip_ Tcp Connect() call.

void <Up_TcpConnected> (TcpIp_SocketIdType SocketId);

Service .

Std_ReturnType <Up_TlsClientGetPskIdentity> (TcpIp_SocketIdType SocketId, TcpIp_TlsConnectionIdType TlsConnectionId, uint16 PskIdentityHintLength, const uint8* PskIdentityHintPtr, uint16* PskKeyIdentityLengthPtr, uint8* PskKeyIdentityPtr, uint32* CsmKeyId);

This function queries the current time. This information will be requested when assembling the client hello message.

Std_ReturnType <Up_TlsGetCurrentTime> (uint32* CurrentTimeUtc);

This callback is used for the TLS server to provide the CSM key name according to the key identification that was selected by the TLS client. The TLS server must provide a Csm Key reference to a key that matches this key identification name.

Std_ReturnType <Up_TlsServerGetPskIdentity> (TcpIp_SocketIdType SocketId, TcpIp_TlsConnectionIdType TlsConnectionId, uint16 PskKeyIdentityLength, const uint8* PskKeyIdentityPtr, uint32* CsmKeyId);

Queries the Identity hint for a pr e - shared key ciphersuite. This information is transmitted by the TLS Server to provide its identification to the TLS client.

Std_ReturnType <Up_TlsServerGetPskIdentityHint> (TcpIp_SocketIdType SocketId, TcpIp_TlsConnectionIdType TlsConnectionId, uint16* IdentityHintLengthPtr, uint8* IdentityHintPtr);

The TCP/ IP stack calls this function after the data has been acknowledged by the peer for TCP. Caveats: The upper layer might not be able to determine exactly which data bytes have been confirmed.

void <Up_TxConfirmation> (TcpIp_SocketIdType SocketId, uint16 Length);

周期性

Schedules the TCP/ IP stack. (Entry point for scheduling) AUTO SAR CP R20 - of Document ID : AUTOSAR_SWS_TcpIp

void TcpIp_MainFunction (void);

类型

Tcp Ip_ Arp Cache Entries elements type

Configuration data structure of the Tcp Ip module.

Tcp Ip address families.

Events reported by Tcp Ip.

IPv6 address assignment policy.

Specifies the state of local IP a ddress assignment

Address identification type for unique identification of a local IP address and Eth If Controller configured in the Tcp Ip module.

Index to select specific measurement data

Tcp Ip_ Ndp Cache Entries elements type

Type TcpIp_ParamIdType.

Protocol type used by a socket.

Tcp Ip specific return type.

This structure defines a IPv6 address type which can be derived from the generic address structure via cast. AUTO SAR CP R20 - of Document ID : AUTOSAR_SWS_TcpIp

This structure defines an IPv4 address type which can be derived from the generic address structure via cast.

Generic structure used by APIs to specify an IP address. (A specific address type can be derived from this structure via a cast to the specific struct type.)

Socket identifier type for unique identification of a Tcp Ip stack socket. TCPIP_ SOCKETID_ INVALID shall specify an invalid socket handle.

Specifies the Tcp Ip state for a specific Eth If controller.

TLS connection identifier type for unique identification of a TLS connection. TCPIP_ TLSCONNECTIONID_ INVALID shall specify an invalid TLS connection handle.

IP6 address wildcard.

IP address wildcard.

Local Addr Id wildcard.

Port wildcard.