Internet Engineering Task Force (IETF)                           M. Komu
Request for Comments: 6316                              Aalto University
Category: Informational                                       M. Bagnulo
ISSN: 2070-1721                                                     UC3M
                                                               K. Slavov
                                                        S. Sugimoto, Ed.
                                                                Ericsson
                                                               July 2011
        
Internet Engineering Task Force (IETF)                           M. Komu
Request for Comments: 6316                              Aalto University
Category: Informational                                       M. Bagnulo
ISSN: 2070-1721                                                     UC3M
                                                               K. Slavov
                                                        S. Sugimoto, Ed.
                                                                Ericsson
                                                               July 2011
        

Sockets Application Program Interface (API) for Multihoming Shim

多归宿垫片的套接字应用程序接口(API)

Abstract

摘要

This document specifies sockets API extensions for the multihoming shim layer. The API aims to enable interactions between applications and the multihoming shim layer for advanced locator management, and access to information about failure detection and path exploration.

本文档指定了多归宿垫片层的套接字API扩展。该API旨在实现应用程序和多归宿垫片层之间的交互,以实现高级定位器管理,并访问有关故障检测和路径探索的信息。

This document is based on an assumption that a multihomed host is equipped with a conceptual sub-layer (hereafter called "shim sub-layer") inside the IP layer that maintains mappings between identifiers and locators. Examples of the shim are Shim6 and the Host Identity Protocol (HIP).

本文档基于这样一种假设,即多宿主机在IP层内配备了一个概念子层(以下称为“垫片子层”),用于维护标识符和定位器之间的映射。shim的示例包括Shim6和主机标识协议(HIP)。

Status of This Memo

关于下段备忘

This document is not an Internet Standards Track specification; it is published for informational purposes.

本文件不是互联网标准跟踪规范;它是为了提供信息而发布的。

This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Not all documents approved by the IESG are a candidate for any level of Internet Standard; see Section 2 of RFC 5741.

本文件是互联网工程任务组(IETF)的产品。它代表了IETF社区的共识。它已经接受了公众审查,并已被互联网工程指导小组(IESG)批准出版。并非IESG批准的所有文件都适用于任何级别的互联网标准;见RFC 5741第2节。

Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc6316.

有关本文件当前状态、任何勘误表以及如何提供反馈的信息,请访问http://www.rfc-editor.org/info/rfc6316.

Copyright Notice

版权公告

Copyright (c) 2011 IETF Trust and the persons identified as the document authors. All rights reserved.

版权所有(c)2011 IETF信托基金和确定为文件作者的人员。版权所有。

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.

本文件受BCP 78和IETF信托有关IETF文件的法律规定的约束(http://trustee.ietf.org/license-info)自本文件出版之日起生效。请仔细阅读这些文件,因为它们描述了您对本文件的权利和限制。从本文件中提取的代码组件必须包括信托法律条款第4.e节中所述的简化BSD许可证文本,并提供简化BSD许可证中所述的无担保。

This document may contain material from IETF Documents or IETF Contributions published or made publicly available before November 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) controlling the copyright in such materials, this document may not be modified outside the IETF Standards Process, and derivative works of it may not be created outside the IETF Standards Process, except to format it for publication as an RFC or to translate it into languages other than English.

本文件可能包含2008年11月10日之前发布或公开的IETF文件或IETF贡献中的材料。控制某些材料版权的人员可能未授予IETF信托允许在IETF标准流程之外修改此类材料的权利。在未从控制此类材料版权的人员处获得充分许可的情况下,不得在IETF标准流程之外修改本文件,也不得在IETF标准流程之外创建其衍生作品,除了将其格式化以RFC形式发布或将其翻译成英语以外的其他语言。

Table of Contents

目录

   1. Introduction ....................................................3
   2. Requirements Language ...........................................4
   3. Terminology and Background ......................................4
   4. System Overview .................................................7
   5. Requirements ....................................................8
   6. Socket Options for Multihoming Shim Sub-Layer ..................10
      6.1. SHIM_ASSOCIATED ...........................................14
      6.2. SHIM_DONTSHIM .............................................15
      6.3. SHIM_HOT_STANDBY ..........................................16
      6.4. SHIM_LOC_LOCAL_PREF .......................................17
      6.5. SHIM_LOC_PEER_PREF ........................................18
      6.6. SHIM_LOC_LOCAL_RECV .......................................19
      6.7. SHIM_LOC_PEER_RECV ........................................20
      6.8. SHIM_LOC_LOCAL_SEND .......................................20
      6.9. SHIM_LOC_PEER_SEND ........................................22
      6.10. SHIM_LOCLIST_LOCAL .......................................23
      6.11. SHIM_LOCLIST_PEER ........................................25
      6.12. SHIM_APP_TIMEOUT .........................................26
      6.13. SHIM_PATHEXPLORE .........................................27
        
   1. Introduction ....................................................3
   2. Requirements Language ...........................................4
   3. Terminology and Background ......................................4
   4. System Overview .................................................7
   5. Requirements ....................................................8
   6. Socket Options for Multihoming Shim Sub-Layer ..................10
      6.1. SHIM_ASSOCIATED ...........................................14
      6.2. SHIM_DONTSHIM .............................................15
      6.3. SHIM_HOT_STANDBY ..........................................16
      6.4. SHIM_LOC_LOCAL_PREF .......................................17
      6.5. SHIM_LOC_PEER_PREF ........................................18
      6.6. SHIM_LOC_LOCAL_RECV .......................................19
      6.7. SHIM_LOC_PEER_RECV ........................................20
      6.8. SHIM_LOC_LOCAL_SEND .......................................20
      6.9. SHIM_LOC_PEER_SEND ........................................22
      6.10. SHIM_LOCLIST_LOCAL .......................................23
      6.11. SHIM_LOCLIST_PEER ........................................25
      6.12. SHIM_APP_TIMEOUT .........................................26
      6.13. SHIM_PATHEXPLORE .........................................27
        
      6.14. SHIM_DEFERRED_CONTEXT_SETUP ..............................28
      6.15. Applicability ............................................28
      6.16. Error Handling ...........................................29
   7. Ancillary Data for Multihoming Shim Sub-Layer ..................29
      7.1. Get Locator from Incoming Packet ..........................30
      7.2. Set Locator for Outgoing Packet ...........................30
      7.3. Notification from Application to Multihoming Shim
           Sub-Layer .................................................31
      7.4. Applicability .............................................31
   8. Data Structures ................................................32
      8.1. Data Structure for Locator Information ....................32
           8.1.1. Handling Locator behind NAT ........................33
      8.2. Path Exploration Parameter ................................34
      8.3. Feedback Information ......................................35
   9. System Requirements ............................................36
   10. Relation to Existing Sockets API Extensions ...................36
   11. Operational Considerations ....................................37
      11.1. Conflict Resolution ......................................37
      11.2. Incompatibility between IPv4 and IPv6 ....................38
   12. IANA Considerations ...........................................38
   13. Protocol Constant .............................................38
   14. Security Considerations .......................................38
      14.1. Treatment of Unknown Locator .............................39
           14.1.1. Treatment of Unknown Source Locator ...............39
           14.1.2. Treatment of Unknown Destination Locator ..........39
   15. Acknowledgments ...............................................40
   16. References ....................................................40
      16.1. Normative References .....................................40
      16.2. Informative References ...................................41
   Appendix A. Context Forking .......................................42
        
      6.14. SHIM_DEFERRED_CONTEXT_SETUP ..............................28
      6.15. Applicability ............................................28
      6.16. Error Handling ...........................................29
   7. Ancillary Data for Multihoming Shim Sub-Layer ..................29
      7.1. Get Locator from Incoming Packet ..........................30
      7.2. Set Locator for Outgoing Packet ...........................30
      7.3. Notification from Application to Multihoming Shim
           Sub-Layer .................................................31
      7.4. Applicability .............................................31
   8. Data Structures ................................................32
      8.1. Data Structure for Locator Information ....................32
           8.1.1. Handling Locator behind NAT ........................33
      8.2. Path Exploration Parameter ................................34
      8.3. Feedback Information ......................................35
   9. System Requirements ............................................36
   10. Relation to Existing Sockets API Extensions ...................36
   11. Operational Considerations ....................................37
      11.1. Conflict Resolution ......................................37
      11.2. Incompatibility between IPv4 and IPv6 ....................38
   12. IANA Considerations ...........................................38
   13. Protocol Constant .............................................38
   14. Security Considerations .......................................38
      14.1. Treatment of Unknown Locator .............................39
           14.1.1. Treatment of Unknown Source Locator ...............39
           14.1.2. Treatment of Unknown Destination Locator ..........39
   15. Acknowledgments ...............................................40
   16. References ....................................................40
      16.1. Normative References .....................................40
      16.2. Informative References ...................................41
   Appendix A. Context Forking .......................................42
        
1. Introduction
1. 介绍

This document defines sockets API extensions by which upper-layer protocols may be informed about and control the way in which a multihoming shim sub-layer in the IP layer manages the dynamic choice of locators. Initially, the multihoming shim sub-layer refers to Shim6 and/or HIP, but it is defined generically.

本文档定义了套接字API扩展,通过这些扩展,上层协议可以了解并控制IP层中的多主垫片子层管理定位器动态选择的方式。最初,多归宿垫片子层指的是Shim6和/或HIP,但其定义一般。

The role of the multihoming shim sub-layer (hereafter called "shim sub-layer" in this document) is to avoid impacts to upper-layer protocols that may be caused when the endhost changes its attachment point to the Internet -- for instance, in the case of a rehoming event under the multihomed environment. There is, however, a need for an API in the cases where 1) the upper-layer protocol is particularly sensitive to impacts, or 2) the upper-layer protocol wants to benefit from better knowledge of what is going on underneath.

多宿主垫片子层(在本文档中称为“垫片子层”)的作用是避免当终端主机更改其到Internet的连接点时可能对上层协议造成的影响,例如,在多宿主环境下发生重传事件的情况下。然而,如果1)上层协议对影响特别敏感,或2)上层协议希望从对底层情况的更好了解中获益,则需要API。

There are various kinds of technologies that aim to solve the same issue (the multihoming issue). Note that there will be conflict when more than one shim sub-layer is active at the same time. The assumption made in this document is that there is only a single shim sub-layer (HIP or Shim6) activated on the system.

有各种各样的技术旨在解决同一问题(多宿问题)。请注意,当多个垫片子层同时处于活动状态时,会出现冲突。本文件中的假设是系统上仅激活了一个垫片子层(HIP或Shim6)。

The target readers of this document are application programmers who develop application software that may benefit greatly from multihomed environments. In addition, this document aims to provide necessary information for developers of shim protocols to implement APIs for enabling advanced locator management.

本文档的目标读者是应用程序程序员,他们开发的应用程序软件可能会从多宿主环境中获得巨大的好处。此外,本文档旨在为shim协议的开发人员提供必要的信息,以实现实现高级定位器管理的API。

2. Requirements Language
2. 需求语言

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].

本文件中的关键词“必须”、“不得”、“必需”、“应”、“不应”、“应”、“不应”、“建议”、“可”和“可选”应按照[RFC2119]中所述进行解释。

3. Terminology and Background
3. 术语和背景

This section provides terminology used in this document. Basically, most of the terms used in this document are taken from the following documents:

本节提供了本文件中使用的术语。本文件中使用的大多数术语基本上取自以下文件:

o Shim6 Protocol Specification [RFC5533]

o Shim6协议规范[RFC5533]

o HIP Architecture [RFC4423]

o HIP体系结构[RFC4423]

o Reachability Protocol (REAP) [RFC5534]

o 可达性协议(REAP)[RFC5534]

In this document, the term "IP" refers to both IPv4 and IPv6, unless the protocol version is specifically mentioned. The following are definitions of terms frequently used in this document:

在本文档中,术语“IP”指IPv4和IPv6,除非特别提及协议版本。以下是本文件中常用术语的定义:

o Endpoint Identifier (EID) -- The identifier used by the application to specify the endpoint of a given communication. Applications may handle EIDs in various ways, such as long-lived connections, callbacks, and referrals [SHIM6-APP-REFER].

o 端点标识符(EID)——应用程序用于指定给定通信的端点的标识符。应用程序可能以各种方式处理EID,例如长时间连接、回调和引用[SHIM6-APP-Reference]。

* In the case of Shim6, an identifier called a ULID (Upper-Layer Identifier) serves as an EID. A ULID is chosen from locators available on the host.

* 在Shim6的情况下,称为ULID(上层标识符)的标识符用作EID。从主机上可用的定位器中选择ULID。

* In the case of HIP, an identifier called a Host Identifier serves as an EID. A Host Identifier is derived from the public key of a given host. For the sake of backward compatibility with the sockets API, the Host Identifier is represented in the form of a hash of a public key.

* 对于HIP,称为主机标识符的标识符用作EID。主机标识符是从给定主机的公钥派生的。为了与套接字API向后兼容,主机标识符以公钥散列的形式表示。

* Note that the EID appears in the standard sockets API as an address, and does not appear in the extensions defined in this document, which only concern locators.

* 请注意,EID作为地址出现在标准套接字API中,而不出现在本文档中定义的扩展中,这些扩展只涉及定位器。

o Locator - The IP address actually used to deliver IP packets. Locators are present in the source and destination fields of the IP header of a packet on the wire. A locator as discussed in this document could be either an IPv4 address or an IPv6 address. Note that HIP can handle both IPv4 and IPv6 locators, whereas Shim6 can handle only IPv6 locators. For the HIP case, a locator can be a private IPv4 address when the host is behind a NAT. Section 8.1.1 gives a detailed description about the handling of a locator behind a NAT.

o 定位器-实际用于传送IP数据包的IP地址。定位器存在于有线数据包的IP报头的源和目标字段中。本文档中讨论的定位器可以是IPv4地址或IPv6地址。请注意,HIP可以处理IPv4和IPv6定位器,而Shim6只能处理IPv6定位器。对于HIP情况,当主机位于NAT之后时,定位器可以是专用IPv4地址。第8.1.1节详细描述了NAT后面定位器的处理。

* List of locators - A list of locators associated with an EID. There are two lists of locators stored in a given context. One is associated with the local EID, and the other is associated with the remote EID. As defined in [RFC5533], the list of locators associated with an EID 'A' is denoted as Ls(A).

* 定位器列表-与EID关联的定位器列表。有两个定位器列表存储在给定的上下文中。一个与本地EID关联,另一个与远程EID关联。如[RFC5533]中所定义,与EID“A”相关联的定位器列表表示为Ls(A)。

* Preferred locator - The (source/destination) locator currently used to send packets within a given context.

* 首选定位器-当前用于在给定上下文中发送数据包的(源/目标)定位器。

* Unknown locator - Any locator that does not appear in the locator list of the shim context associated with the socket. When there is no shim context associated with the socket, any source and/or destination locator requested by the application is considered to be an unknown locator.

* 未知定位器-未出现在与插槽关联的垫片上下文的定位器列表中的任何定位器。当没有与套接字关联的垫片上下文时,应用程序请求的任何源和/或目标定位器都被视为未知定位器。

* Valid locator - A valid locator means that the locator is considered to be valid in the security sense. More specifically, the validity indicates whether the locator is part of a Hash-Based Address (HBA) set [RFC5535].

* 有效定位器-有效定位器意味着定位器在安全意义上是有效的。更具体地说,有效性指示定位器是否是基于哈希的地址(HBA)集[RFC5535]的一部分。

* Verified locator - A verified locator means that the locator is considered to be reachable according to the result of a REAP return routability check. Note that the verification applies only to the peer's locator.

* 验证定位器-验证定位器意味着根据收货返回可路由性检查的结果,定位器被认为是可到达的。请注意,验证仅适用于对等方的定位器。

o Shim - The conceptual sub-layer inside the IP layer. This sub-layer maintains mappings between EIDs and locators. An EID can be associated with more than one locator at a time when the host is multihomed. The term "shim" does not refer to a specific protocol but refers to the conceptual sub-layer inside the IP layer.

o 垫片-IP层内的概念子层。此子层维护EID和定位器之间的映射。当主机是多主机时,EID可以同时与多个定位器关联。术语“垫片”不是指特定的协议,而是指IP层内的概念子层。

o Identifier/locator adaptation - The adaptation performed at the shim sub-layer. This adaptation may end up re-writing the source and/or destination addresses of an IP packet. In the outbound packet processing, the EID pair is converted to the associated locator pair. In the inbound packet processing, the locator pair is converted to the EID pair.

o 标识符/定位器自适应-在垫片子层执行的自适应。这种自适应可能最终会重新写入IP分组的源地址和/或目的地址。在出站分组处理中,EID对被转换为相关联的定位器对。在入站数据包处理中,定位器对转换为EID对。

o Context - The state information shared by a given pair of peers. Context stores a binding between the EID and associated locators. Contexts are maintained by the shim sub-layer. Deferred context setup is a scenario where a context is established after the communication starts. Deferred context setup is possible if the ULID is routable, such as in the case of Shim6.

o 上下文-由给定对等方对共享的状态信息。上下文存储EID和关联定位器之间的绑定。上下文由垫片子层维护。延迟上下文设置是在通信开始后建立上下文的场景。如果ULID是可路由的,那么延迟上下文设置是可能的,例如在Shim6的情况下。

o Reachability detection - The procedure to check reachability between a given locator pair.

o 可达性检测-检查给定定位器对之间可达性的过程。

o Path - The sequence of routers that an IP packet goes through to reach the destination.

o 路径-IP数据包到达目的地所经过的路由器序列。

o Path exploration - The procedure to explore available paths for a given set of locator pairs.

o 路径探索-探索给定定位器对集的可用路径的过程。

o Outage - The incident that prevents IP packets flowing from the source locator to the destination locator. When there is an outage, it means that there is no reachability between a given locator pair. The outage may be caused by various reasons, such as a shortage of network resources, congestion, and human error (faulty operation).

o 中断-阻止IP数据包从源定位器流向目标定位器的事件。当出现中断时,这意味着给定定位器对之间不存在可达性。中断可能由各种原因引起,如网络资源短缺、拥塞和人为错误(错误操作)。

o Working address pair - Considered to be "working" if the packet can safely travel from the source to the destination, where the packet contains the first address from the pair as the source address and the second address from the pair as the destination address. If reachability is confirmed in both directions, the address pair is considered to be working bi-directionally.

o 工作地址对-如果数据包可以安全地从源传输到目的地,则视为“工作”,其中数据包包含该对中的第一个地址作为源地址,第二个地址作为目的地地址。如果在两个方向上都确认了可达性,则认为地址对是双向工作的。

o Reachability Protocol (REAP) - The protocol for detecting failure and exploring reachability in a multihomed environment. REAP is defined in [RFC5534].

o 可达性协议(REAP)-在多宿环境中检测故障和探索可达性的协议。REAP在[RFC5534]中定义。

In this document, syntax and semantics of the API are given in the same way as in the Portable Operating System Interface (POSIX) standard [POSIX]. The API specifies how to use ancillary data (aka cmsg) to access the locator information with recvmsg() and/or sendmsg() I/O calls. The API is described in C language, and data types are defined in the POSIX format; intN_t means a signed integer of exactly N bits (e.g., int16_t), and uintN_t means an unsigned integer of exactly N bits (e.g., uint32_t).

在本文档中,API的语法和语义以与可移植操作系统接口(POSIX)标准[POSIX]相同的方式给出。API指定如何使用辅助数据(也称为cmsg)通过recvmsg()和/或sendmsg()I/O调用访问定位器信息。API采用C语言描述,数据类型采用POSIX格式定义;intN_t表示正好N位的有符号整数(例如,int16_t),而uintN_t表示正好N位的无符号整数(例如,uint32_t)。

The distinction between "connected" sockets and "unconnected" sockets is important when discussing the applicability of the sockets API defined in this document. A connected socket is bound to a given peer, whereas an unconnected socket is not bound to any specific peers. A TCP socket becomes a connected socket when the TCP connection establishment is completed. UDP sockets are unconnected, unless the application uses the connect() system call.

在讨论本文档中定义的套接字API的适用性时,“已连接”套接字和“未连接”套接字之间的区别非常重要。连接的套接字绑定到给定的对等方,而未连接的套接字不绑定到任何特定的对等方。TCP连接建立完成后,TCP套接字将成为已连接的套接字。UDP套接字是未连接的,除非应用程序使用connect()系统调用。

4. System Overview
4. 系统概述

Figure 1 illustrates the system overview. The shim sub-layer and REAP component exist inside the IP layer. Applications use the sockets API defined in this document to interface with the shim sub-layer and the transport layer for locator management, failure detection, and path exploration.

图1说明了系统概述。垫片子层和收割组件存在于IP层内部。应用程序使用本文档中定义的套接字API与垫片子层和传输层进行接口,以进行定位器管理、故障检测和路径探索。

It is also possible that the shim sub-layer interacts with the transport layer; however, such an interaction is outside the scope of this document.

垫片子层也可能与传输层相互作用;但是,这种交互不在本文档的范围内。

                        +------------------------+
                        |       Application      |
                        +------------------------+
                           ^                 ^
              ~~~~~~~~~~~~~|~Socket Interface|~~~~~~~~~~~~~~
                           |                 v
               +-----------|------------------------------+
               |           |  Transport Layer             |
               +-----------|------------------------------+
                     ^     |
       +-------------|-----|-------------------------------------+
       |             v     v                                     |
       |   +-----------------------------+       +----------+    |  IP
       |   |            Shim             |<----->|   REAP   |    | Layer
       |   +-----------------------------+       +----------+    |
       |                       ^                      ^          |
       +-----------------------|----------------------|----------+
                               v                      v
               +------------------------------------------+
               |                Link Layer                |
               +------------------------------------------+
        
                        +------------------------+
                        |       Application      |
                        +------------------------+
                           ^                 ^
              ~~~~~~~~~~~~~|~Socket Interface|~~~~~~~~~~~~~~
                           |                 v
               +-----------|------------------------------+
               |           |  Transport Layer             |
               +-----------|------------------------------+
                     ^     |
       +-------------|-----|-------------------------------------+
       |             v     v                                     |
       |   +-----------------------------+       +----------+    |  IP
       |   |            Shim             |<----->|   REAP   |    | Layer
       |   +-----------------------------+       +----------+    |
       |                       ^                      ^          |
       +-----------------------|----------------------|----------+
                               v                      v
               +------------------------------------------+
               |                Link Layer                |
               +------------------------------------------+
        

Figure 1: System Overview

图1:系统概述

5. Requirements
5. 要求

The following is a list of requirements from applications:

以下是应用程序的要求列表:

o Turn on/off shim. An application should be able to request to turn on or turn off the multihoming support by the shim layer:

o 打开/关闭垫片。应用程序应能够通过垫片层请求打开或关闭多归宿支持:

* Apply shim. The application should be able to explicitly request that the shim sub-layer apply multihoming support.

* 使用垫片。应用程序应该能够明确请求垫片子层应用多归宿支持。

* Don't apply shim. The application should be able to request that the shim sub-layer not apply the multihoming support but apply normal IP processing at the IP layer.

* 不要使用垫片。应用程序应该能够请求垫片子层不应用多主支持,而是在IP层应用正常IP处理。

* Note that this function is also required by other types of multihoming mechanisms, such as the Stream Control Transmission Protocol (SCTP) and multipath TCP, to avoid potential conflict with the shim sub-layer.

* 请注意,其他类型的多宿主机制(如流控制传输协议(SCTP)和多路径TCP)也需要此功能,以避免与垫片子层的潜在冲突。

o Locator management.

o 定位器管理。

* It should be possible to set a preferred source and/or destination locator within a given context.

* 应该可以在给定上下文中设置首选源和/或目标定位器。

* It should be possible to get a preferred source and/or destination locator within a given context.

* 应该可以在给定的上下文中获得首选的源和/或目标定位器。

* It should be possible to set a list of source and/or destination locators within a given context: Ls(local) and Ls(remote).

* 应该可以在给定上下文中设置源和/或目标定位器的列表:Ls(本地)和Ls(远程)。

* It should be possible to get a list of source and/or destination locators within a given context: Ls(local) and Ls(remote).

* 应该可以在给定上下文中获取源和/或目标定位器的列表:Ls(本地)和Ls(远程)。

o Notification from applications and upper-layer protocols to the shim sub-layer about the status of the communication. The notification occurs in an event-based manner. Applications and/or upper-layer protocols may provide positive feedback or negative feedback to the shim sub-layer. Note that these types of feedback are mentioned in [RFC5534]:

o 应用程序和上层协议向垫片子层发出有关通信状态的通知。通知以基于事件的方式发生。应用程序和/或上层协议可向垫片子层提供正反馈或负反馈。请注意,[RFC5534]中提到了这些类型的反馈:

* Applications and/or upper-layer protocols (e.g., TCP) may provide positive feedback to the shim sub-layer informing that the communication is going well.

* 应用程序和/或上层协议(例如,TCP)可向垫片子层提供正反馈,告知通信进展顺利。

* Applications and/or upper-layer protocols (e.g., TCP) may provide negative feedback to the shim sub-layer informing that the communication status is not satisfactory. TCP may detect a problem when it does not receive any expected ACK message from the peer. The REAP module may be triggered by the negative feedback and invoke the path exploration procedure.

* 应用程序和/或上层协议(例如,TCP)可向垫片子层提供负反馈,告知通信状态不令人满意。当TCP没有从对等方接收到任何预期的ACK消息时,它可能会检测到问题。REAP模块可能由负反馈触发,并调用路径探索过程。

o Feedback from applications to the shim sub-layer. Applications should be able to inform the shim sub-layer of the timeout values for detecting failures, sending keepalives, and starting the exploration procedure. In particular, applications should be able to suppress keepalives.

o 应用程序对垫片子层的反馈。应用程序应该能够通知垫片子层检测故障、发送keepalives和启动探索过程的超时值。特别是,应用程序应该能够抑制keepalive。

o Hot-standby. Applications may request the shim sub-layer for a hot-standby capability. This means that alternative paths are known to be working in advance of a failure detection. In such a case, it is possible for the shim sub-layer to immediately replace the current locator pair with an alternative locator pair.

o 热备用。应用程序可能会请求垫片子层提供热备用功能。这意味着在故障检测之前,已知备选路径正在工作。在这种情况下,垫片子层可以立即用替代定位器对替换当前定位器对。

o Eagerness for locator exploration. An application should be able to inform the shim sub-layer of how aggressively it wants the REAP mechanism to perform a path exploration (e.g., by specifying the number of concurrent attempts of discovery of working locator pairs) when an outage occurs on the path between the locator pair in use.

o 对定位器探索的渴望。当正在使用的定位器对之间的路径发生中断时,应用程序应能够通知垫片子层它希望收割机制执行路径探索的积极程度(例如,通过指定发现工作定位器对的并发尝试次数)。

o Providing locator information to applications. An application should be able to obtain information about the locator pair that was actually used to send or receive packets.

o 向应用程序提供定位器信息。应用程序应该能够获得关于实际用于发送或接收数据包的定位器对的信息。

* For inbound traffic, the application may be interested in the locator pair that was actually used to receive the packet.

* 对于入站流量,应用程序可能对实际用于接收数据包的定位器对感兴趣。

* For outbound traffic, the application may be interested in the locator pair that was actually used to transmit the packet.

* 对于出站流量,应用程序可能对实际用于传输分组的定位器对感兴趣。

In this way, applications may have additional control of the locator management. For example, an application becomes capable of verifying if its preference for a locator is actually applied to the flow or not.

这样,应用程序可以具有定位器管理的附加控制。例如,应用程序能够验证其对定位器的偏好是否实际应用于流。

o Applications should be able to know if the shim sub-layer supports deferred context setup or not.

o 应用程序应该能够知道垫片子层是否支持延迟上下文设置。

o An application should be able to know if the communication is now being served by the shim sub-layer or not.

o 应用程序应该能够知道现在是否由垫片子层提供通信服务。

o An application should be able to use a common interface to access an IPv4 locator and an IPv6 locator.

o 应用程序应该能够使用公共接口访问IPv4定位器和IPv6定位器。

6. Socket Options for Multihoming Shim Sub-Layer
6. 多重归宿垫片子层的插座选项

In this section, socket options that are specific to the shim sub-layer are defined.

在本节中,将定义特定于垫片子层的插座选项。

Table 1 shows a list of the socket options that are specific to the shim sub-layer. All of these socket options are defined at the level SOL_SHIM. When an application uses one of the socket options by getsockopt() or setsockopt(), the second argument MUST be set to SOL_SHIM.

表1显示了特定于垫片子层的插座选项列表。所有这些插座选项都是在SOL_SHIM级别定义的。当应用程序通过getsockopt()或setsockopt()使用其中一个套接字选项时,第二个参数必须设置为SOL_SHIM。

The first column of Table 1 gives the name of the option. The second column indicates whether the value for the socket option can be read by getsockopt(), and the third column indicates whether the value for the socket option can be written by setsockopt(). The fourth column provides a brief description of the socket option. The fifth column shows the type of data structure specified along with the socket option. By default, the data structure type is an integer.

表1的第一列给出了选项的名称。第二列指示getsockopt()是否可以读取套接字选项的值,第三列指示setsockopt()是否可以写入套接字选项的值。第四列提供了套接字选项的简要说明。第五列显示与套接字选项一起指定的数据结构类型。默认情况下,数据结构类型为整数。

   +-----------------------------+-----+-----+-----------------+-------+
   | optname                     | get | set | description     | dtype |
   +-----------------------------+-----+-----+-----------------+-------+
   | SHIM_ASSOCIATED             | o   |     | Get the         | int   |
   |                             |     |     | parameter that  |       |
   |                             |     |     | indicates       |       |
   |                             |     |     | whether the     |       |
   |                             |     |     | socket is       |       |
   |                             |     |     | associated (1)  |       |
   |                             |     |     | with any shim   |       |
   |                             |     |     | context or not  |       |
   |                             |     |     | (0).            |       |
   | SHIM_DONTSHIM               | o   | o   | Get or set the  | int   |
   |                             |     |     | parameter that  |       |
   |                             |     |     | indicates       |       |
   |                             |     |     | whether or not  |       |
   |                             |     |     | to employ       |       |
   |                             |     |     | multihoming     |       |
   |                             |     |     | support by the  |       |
   |                             |     |     | shim sub-layer. |       |
   | SHIM_HOT_STANDBY            | o   | o   | Get or set the  | int   |
   |                             |     |     | parameter to    |       |
   |                             |     |     | request the     |       |
   |                             |     |     | shim sub-layer  |       |
   |                             |     |     | to prepare a    |       |
   |                             |     |     | hot-standby     |       |
   |                             |     |     | connection.     |       |
   | SHIM_LOC_LOCAL_PREF         | o   | o   | Set the         | Note  |
   |                             |     |     | preference      | 1     |
   |                             |     |     | value for a     |       |
   |                             |     |     | source locator  |       |
   |                             |     |     | for outbound    |       |
   |                             |     |     | traffic.  Get   |       |
   |                             |     |     | the preferred   |       |
   |                             |     |     | locator for the |       |
   |                             |     |     | source locator  |       |
   |                             |     |     | for outbound    |       |
   |                             |     |     | traffic.        |       |
        
   +-----------------------------+-----+-----+-----------------+-------+
   | optname                     | get | set | description     | dtype |
   +-----------------------------+-----+-----+-----------------+-------+
   | SHIM_ASSOCIATED             | o   |     | Get the         | int   |
   |                             |     |     | parameter that  |       |
   |                             |     |     | indicates       |       |
   |                             |     |     | whether the     |       |
   |                             |     |     | socket is       |       |
   |                             |     |     | associated (1)  |       |
   |                             |     |     | with any shim   |       |
   |                             |     |     | context or not  |       |
   |                             |     |     | (0).            |       |
   | SHIM_DONTSHIM               | o   | o   | Get or set the  | int   |
   |                             |     |     | parameter that  |       |
   |                             |     |     | indicates       |       |
   |                             |     |     | whether or not  |       |
   |                             |     |     | to employ       |       |
   |                             |     |     | multihoming     |       |
   |                             |     |     | support by the  |       |
   |                             |     |     | shim sub-layer. |       |
   | SHIM_HOT_STANDBY            | o   | o   | Get or set the  | int   |
   |                             |     |     | parameter to    |       |
   |                             |     |     | request the     |       |
   |                             |     |     | shim sub-layer  |       |
   |                             |     |     | to prepare a    |       |
   |                             |     |     | hot-standby     |       |
   |                             |     |     | connection.     |       |
   | SHIM_LOC_LOCAL_PREF         | o   | o   | Set the         | Note  |
   |                             |     |     | preference      | 1     |
   |                             |     |     | value for a     |       |
   |                             |     |     | source locator  |       |
   |                             |     |     | for outbound    |       |
   |                             |     |     | traffic.  Get   |       |
   |                             |     |     | the preferred   |       |
   |                             |     |     | locator for the |       |
   |                             |     |     | source locator  |       |
   |                             |     |     | for outbound    |       |
   |                             |     |     | traffic.        |       |
        
   | SHIM_LOC_PEER_PREF          | o   | o   | Set the         | Note  |
   |                             |     |     | preference      | 1     |
   |                             |     |     | value for a     |       |
   |                             |     |     | destination     |       |
   |                             |     |     | locator for     |       |
   |                             |     |     | outbound        |       |
   |                             |     |     | traffic.  Get   |       |
   |                             |     |     | the preferred   |       |
   |                             |     |     | locator for the |       |
   |                             |     |     | destination     |       |
   |                             |     |     | locator for     |       |
   |                             |     |     | outbound        |       |
   |                             |     |     | traffic.        |       |
   | SHIM_LOC_LOCAL_RECV         | o   | o   | Request the     | int   |
   |                             |     |     | shim sub-layer  |       |
   |                             |     |     | to store the    |       |
   |                             |     |     | destination     |       |
   |                             |     |     | locator of the  |       |
   |                             |     |     | received IP     |       |
   |                             |     |     | packet in an    |       |
   |                             |     |     | ancillary data  |       |
   |                             |     |     | object.         |       |
   | SHIM_LOC_PEER_RECV          | o   | o   | Request the     | int   |
   |                             |     |     | shim sub-layer  |       |
   |                             |     |     | to store the    |       |
   |                             |     |     | source locator  |       |
   |                             |     |     | of the received |       |
   |                             |     |     | IP packet in an |       |
   |                             |     |     | ancillary data  |       |
   |                             |     |     | object.         |       |
   | SHIM_LOC_LOCAL_SEND         | o   | o   | Get or set the  | Note  |
   |                             |     |     | source locator  | 1     |
   |                             |     |     | of outgoing IP  |       |
   |                             |     |     | packets.        |       |
   | SHIM_LOC_PEER_SEND          | o   | o   | Get or set the  | Note  |
   |                             |     |     | destination     | 1     |
   |                             |     |     | locator of      |       |
   |                             |     |     | outgoing IP     |       |
   |                             |     |     | packets.        |       |
   | SHIM_LOCLIST_LOCAL          | o   | o   | Get or set the  | Note  |
   |                             |     |     | list of         | 2     |
   |                             |     |     | locators        |       |
   |                             |     |     | associated with |       |
   |                             |     |     | the local EID.  |       |
        
   | SHIM_LOC_PEER_PREF          | o   | o   | Set the         | Note  |
   |                             |     |     | preference      | 1     |
   |                             |     |     | value for a     |       |
   |                             |     |     | destination     |       |
   |                             |     |     | locator for     |       |
   |                             |     |     | outbound        |       |
   |                             |     |     | traffic.  Get   |       |
   |                             |     |     | the preferred   |       |
   |                             |     |     | locator for the |       |
   |                             |     |     | destination     |       |
   |                             |     |     | locator for     |       |
   |                             |     |     | outbound        |       |
   |                             |     |     | traffic.        |       |
   | SHIM_LOC_LOCAL_RECV         | o   | o   | Request the     | int   |
   |                             |     |     | shim sub-layer  |       |
   |                             |     |     | to store the    |       |
   |                             |     |     | destination     |       |
   |                             |     |     | locator of the  |       |
   |                             |     |     | received IP     |       |
   |                             |     |     | packet in an    |       |
   |                             |     |     | ancillary data  |       |
   |                             |     |     | object.         |       |
   | SHIM_LOC_PEER_RECV          | o   | o   | Request the     | int   |
   |                             |     |     | shim sub-layer  |       |
   |                             |     |     | to store the    |       |
   |                             |     |     | source locator  |       |
   |                             |     |     | of the received |       |
   |                             |     |     | IP packet in an |       |
   |                             |     |     | ancillary data  |       |
   |                             |     |     | object.         |       |
   | SHIM_LOC_LOCAL_SEND         | o   | o   | Get or set the  | Note  |
   |                             |     |     | source locator  | 1     |
   |                             |     |     | of outgoing IP  |       |
   |                             |     |     | packets.        |       |
   | SHIM_LOC_PEER_SEND          | o   | o   | Get or set the  | Note  |
   |                             |     |     | destination     | 1     |
   |                             |     |     | locator of      |       |
   |                             |     |     | outgoing IP     |       |
   |                             |     |     | packets.        |       |
   | SHIM_LOCLIST_LOCAL          | o   | o   | Get or set the  | Note  |
   |                             |     |     | list of         | 2     |
   |                             |     |     | locators        |       |
   |                             |     |     | associated with |       |
   |                             |     |     | the local EID.  |       |
        
   | SHIM_LOCLIST_PEER           | o   | o   | Get or set the  | Note  |
   |                             |     |     | list of         | 2     |
   |                             |     |     | locators        |       |
   |                             |     |     | associated with |       |
   |                             |     |     | the peer's EID. |       |
   | SHIM_APP_TIMEOUT            | o   | o   | Get or set the  | int   |
   |                             |     |     | Send Timeout    |       |
   |                             |     |     | value of REAP.  |       |
   | SHIM_PATHEXPLORE            | o   | o   | Get or set      | Note  |
   |                             |     |     | parameters for  | 3     |
   |                             |     |     | path            |       |
   |                             |     |     | exploration and |       |
   |                             |     |     | failure         |       |
   |                             |     |     | detection.      |       |
   | SHIM_CONTEXT_DEFERRED_SETUP | o   |     | Get the         | int   |
   |                             |     |     | parameter that  |       |
   |                             |     |     | indicates       |       |
   |                             |     |     | whether         |       |
   |                             |     |     | deferred        |       |
   |                             |     |     | context setup   |       |
   |                             |     |     | is supported or |       |
   |                             |     |     | not.            |       |
   +-----------------------------+-----+-----+-----------------+-------+
        
   | SHIM_LOCLIST_PEER           | o   | o   | Get or set the  | Note  |
   |                             |     |     | list of         | 2     |
   |                             |     |     | locators        |       |
   |                             |     |     | associated with |       |
   |                             |     |     | the peer's EID. |       |
   | SHIM_APP_TIMEOUT            | o   | o   | Get or set the  | int   |
   |                             |     |     | Send Timeout    |       |
   |                             |     |     | value of REAP.  |       |
   | SHIM_PATHEXPLORE            | o   | o   | Get or set      | Note  |
   |                             |     |     | parameters for  | 3     |
   |                             |     |     | path            |       |
   |                             |     |     | exploration and |       |
   |                             |     |     | failure         |       |
   |                             |     |     | detection.      |       |
   | SHIM_CONTEXT_DEFERRED_SETUP | o   |     | Get the         | int   |
   |                             |     |     | parameter that  |       |
   |                             |     |     | indicates       |       |
   |                             |     |     | whether         |       |
   |                             |     |     | deferred        |       |
   |                             |     |     | context setup   |       |
   |                             |     |     | is supported or |       |
   |                             |     |     | not.            |       |
   +-----------------------------+-----+-----+-----------------+-------+
        

Table 1: Socket Options for Multihoming Shim Sub-Layer

表1:多归宿垫片子层的插座选项

Note 1: Pointer to a shim_locator as defined in Section 8.

注1:指向第8节中定义的垫片定位器的指针。

Note 2: Pointer to an array of shim_locator data.

注2:指向垫片定位器数据数组的指针。

Note 3: Pointer to a shim_pathexplore as defined in Section 8.

注3:指向第8节中定义的垫片的指针。

Figure 2 illustrates how the shim-specific socket options fit into the system model of sockets API. The figure shows that the shim sub-layer and the additional protocol components (IPv4 and IPv6) below the shim sub-layer are new to the system model. As previously mentioned, all the shim-specific socket options are defined at the SOL_SHIM level. This design choice brings the following advantages:

图2说明了特定于垫片的套接字选项如何适合socket API的系统模型。该图显示,shim子层和shim子层下面的附加协议组件(IPv4和IPv6)是系统模型的新组件。如前所述,所有特定于垫片的插座选项都是在SOL_垫片级别定义的。这种设计选择具有以下优点:

1. The existing sockets APIs continue to work at the layer above the shim sub-layer. That is, those legacy APIs handle IP addresses as identifiers.

1. 现有套接字API继续在垫片子层上方的层上工作。也就是说,这些遗留API将IP地址作为标识符处理。

2. With newly defined socket options for the shim sub-layer, the application obtains additional control of locator management.

2. 通过为垫片子层新定义的套接字选项,应用程序可以获得定位器管理的额外控制。

3. The shim-specific socket options can be kept independent from address family (IPPROTO_IP or IPPROTO_IPV6) and transport protocol (IPPROTO_TCP or IPPROTO_UDP) settings.

3. 特定于垫片的套接字选项可以独立于地址系列(IPPROTO_IP或IPPROTO_IPV6)和传输协议(IPPROTO_TCP或IPPROTO_UDP)设置。

                            s1 s2      s3 s4
                             |  |       |  |
            +----------------|--|-------|--|----------------+
            |             +-------+   +-------+             |
            | IPPROTO_TCP |  TCP  |   |  UDP  |             |
            |             +-------+   +-------+             |
            |                |   \     /   |                |
            |                |    -----    |                |
            |                |   /     \   |                |
            |              +------+   +------+              |
            |   IPPROTO_IP | IPv4 |   | IPv6 | IPPROTO_IPV6 |
            |              +------+   +------+              |
            |                  \         /             SOL_SOCKET
            |          +--------\-------/--------+          |
            | SOL_SHIM |          shim           |          |
            |          +--------/-------\--------+          |
            |                  /         \                  |
            |              +------+   +------+              |
            |              | IPv4 |   | IPv6 |              |
            |              +------+   +------+              |
            |                  |          |                 |
            +------------------|----------|-----------------+
                               |          |
                             IPv4       IPv6
                           Datagram   Datagram
        
                            s1 s2      s3 s4
                             |  |       |  |
            +----------------|--|-------|--|----------------+
            |             +-------+   +-------+             |
            | IPPROTO_TCP |  TCP  |   |  UDP  |             |
            |             +-------+   +-------+             |
            |                |   \     /   |                |
            |                |    -----    |                |
            |                |   /     \   |                |
            |              +------+   +------+              |
            |   IPPROTO_IP | IPv4 |   | IPv6 | IPPROTO_IPV6 |
            |              +------+   +------+              |
            |                  \         /             SOL_SOCKET
            |          +--------\-------/--------+          |
            | SOL_SHIM |          shim           |          |
            |          +--------/-------\--------+          |
            |                  /         \                  |
            |              +------+   +------+              |
            |              | IPv4 |   | IPv6 |              |
            |              +------+   +------+              |
            |                  |          |                 |
            +------------------|----------|-----------------+
                               |          |
                             IPv4       IPv6
                           Datagram   Datagram
        

Figure 2: System Model of Sockets API with Shim Sub-Layer

图2:带垫片子层的Sockets API系统模型

6.1. SHIM_ASSOCIATED
6.1. SHIM_关联

The SHIM_ASSOCIATED option is used to check whether or not the socket is associated with any shim context.

SHIM_ASSOCIATED选项用于检查套接字是否与任何垫片上下文关联。

This option is meaningful when the locator information of the received IP packet does not tell whether or not the identifier/ locator adaptation is performed. Note that the EID pair and the locator pair may be identical in some cases.

当接收到的IP分组的定位器信息不告诉是否执行了标识符/定位器适配时,该选项是有意义的。注意,EID对和定位器对在某些情况下可能相同。

Note that the socket option is read-only, and the option value can be read by getsockopt(). The result (0/1/2) is set in the option value (the fourth argument of getsockopt()).

请注意,套接字选项是只读的,选项值可以由getsockopt()读取。结果(0/1/2)在选项值(getsockopt()的第四个参数)中设置。

When the application specifies the socket option to an unconnected socket, error code EOPNOTSUPP is returned to the application.

当应用程序为未连接的套接字指定套接字选项时,将向应用程序返回错误代码EOPNOTSUPP。

The data type of the option value is an integer. The option value indicates the presence of shim context. A return value of 1 means that the socket is associated with a shim context at the shim sub-layer. A return value of 0 indicates that there is no shim context associated with the socket. A return value of 2 means that it is not known whether or not the socket is associated with a shim context, and this MUST be returned only when the socket is unconnected. In other words, the returned value MUST be 0 or 1 when the socket is connected.

选项值的数据类型为整数。选项值表示存在垫片上下文。返回值为1表示套接字与垫片子层上的垫片上下文关联。返回值0表示没有与套接字关联的垫片上下文。返回值2表示不知道套接字是否与垫片上下文关联,并且只有在套接字未连接时才必须返回该值。换句话说,连接套接字时,返回值必须为0或1。

For example, the option can be used by the application as follows:

例如,应用程序可以按如下方式使用该选项:

       int optval;
       int optlen = sizeof(optval);
        
       int optval;
       int optlen = sizeof(optval);
        

getsockopt(fd, SOL_SHIM, SHIM_ASSOCIATED, &optval, &optlen);

getsockopt(fd、SOL_垫片、垫片相关、optval和optlen);

6.2. SHIM_DONTSHIM
6.2. SHIM_DONTSHIM

The SHIM_DONTSHIM option is used to request that the shim layer not provide the multihoming support for the communication established over the socket.

SHIM_DONTSHIM选项用于请求垫片层不为通过套接字建立的通信提供多主支持。

The data type of the option value is an integer, and it takes 0 or 1. An option value of 0 means that the shim sub-layer is employed if available. An option value of 1 means that the application does not want the shim sub-layer to provide the multihoming support for the communication established over the socket.

选项值的数据类型为整数,取值为0或1。选项值为0表示使用垫片子层(如果可用)。选项值为1表示应用程序不希望垫片子层为通过套接字建立的通信提供多主支持。

The default value is set to 0, which means that the shim sub-layer performs identifier/locator adaptation if available.

默认值设置为0,这意味着垫片子层执行标识符/定位器自适应(如果可用)。

Any attempt to disable the multihoming shim support MUST be made by the application before the socket is connected. If an application makes such an attempt for a connected socket, error code EOPNOTSUPP MUST be returned.

在连接插座之前,应用程序必须尝试禁用多归位垫片支撑。如果应用程序尝试连接套接字,则必须返回错误代码EOPNOTSUPP。

For example, an application can request that the system not apply the multihoming support as follows:

例如,应用程序可以请求系统不应用多宿主支持,如下所示:

int optval;

int optval;

optval = 1;

optval=1;

       setsockopt(fd, SOL_SHIM, SHIM_DONTSHIM, &optval, sizeof(optval));
        
       setsockopt(fd, SOL_SHIM, SHIM_DONTSHIM, &optval, sizeof(optval));
        

For example, the application can check the option value as follows:

例如,应用程序可以检查选项值,如下所示:

       int optval;
       int len;
        
       int optval;
       int len;
        
       len = sizeof(optval);
        
       len = sizeof(optval);
        

getsockopt(fd, SOL_SHIM, SHIM_DONTSHIM, &optval, &len);

getsockopt(fd、SOL_SHIM、SHIM_DONTSHIM、optval和len);

6.3. SHIM_HOT_STANDBY
6.3. 垫片\u热\u备用

The SHIM_HOT_STANDBY option is used to control whether or not the shim sub-layer employs a hot-standby connection for the socket. A hot-standby connection is an alternative working locator pair to the current locator pair. This option is effective only when there is a shim context associated with the socket.

SHIM_HOT_STANDBY选项用于控制垫片子层是否为套接字使用热备用连接。热备用连接是当前定位器对的替代工作定位器对。仅当存在与套接字关联的垫片上下文时,此选项才有效。

The data type of the option value is an integer.

选项值的数据类型为整数。

The option value can be set by setsockopt().

选项值可通过setsockopt()设置。

The option value can be read by getsockopt().

getsockopt()可以读取选项值。

By default, the value is set to 0, meaning that hot-standby connection is disabled.

默认情况下,该值设置为0,表示禁用了热备用连接。

When the application specifies the socket option to an unconnected socket, error code EOPNOTSUPP is returned to the application.

当应用程序为未连接的套接字指定套接字选项时,将向应用程序返回错误代码EOPNOTSUPP。

When there is no shim context associated with the socket, error code ENOENT is returned to the application.

当没有与套接字关联的垫片上下文时,将向应用程序返回错误代码enoint。

For example, an application can request establishment of a hot-standby connection by using the socket option as follows:

例如,应用程序可以使用套接字选项请求建立热备用连接,如下所示:

int optval;

int optval;

optval = 1;

optval=1;

setsockopt(fd, SOL_SHIM, SHIM_HOT_STANDBY, &optval, sizeof(optval));

设置锁定选项(fd、SOL_垫片、垫片热备和optval、尺寸(optval));

For example, an application can get the option value by using the socket option as follows:

例如,应用程序可以使用套接字选项获取选项值,如下所示:

       int optval;
       int len;
        
       int optval;
       int len;
        
       len = sizeof(optval);
        
       len = sizeof(optval);
        

getsockopt(fd, SOL_SHIM, SHIM_HOT_STANDBY, &optval, &len);

getsockopt(fd、SOL_垫片、垫片热备、optval和len);

6.4. SHIM_LOC_LOCAL_PREF
6.4. 垫片位置本地预

The SHIM_LOC_LOCAL_PREF option is used to set the preference value for a source locator for outbound traffic, or to get the preference value of the source locator for outbound traffic that has the highest preference value.

SHIM_LOC_LOCAL_PREF选项用于为出站流量的源定位器设置首选项值,或获取具有最高首选项值的出站流量的源定位器的首选项值。

This option is effective only when there is a shim context associated with the socket.

仅当存在与套接字关联的垫片上下文时,此选项才有效。

By default, the option value is set to NULL, meaning that the option is disabled.

默认情况下,选项值设置为NULL,表示该选项已禁用。

The preference of a locator is defined by a combination of priority and weight as per DNS SRV [RFC2782]. Note that the Shim6 base protocol defines the preference of a locator in the same way.

根据DNS SRV[RFC2782],定位器的首选项由优先级和权重的组合定义。注意,Shim6基本协议以相同的方式定义定位器的首选项。

The data type of the option value is a pointer to the shim_locator information data structure as defined in Section 8.1.

选项值的数据类型是指向第8.1节中定义的垫片定位器信息数据结构的指针。

When an application specifies the socket option to an unconnected socket, error code EOPNOTSUPP is returned to the application.

当应用程序为未连接的套接字指定套接字选项时,将向应用程序返回错误代码EOPNOTSUPP。

When there is no shim context associated with the socket, error code ENOENT is returned to the application.

当没有与套接字关联的垫片上下文时,将向应用程序返回错误代码enoint。

Error code EINVALIDLOCATOR is returned when the validation of the specified locator fails.

当指定定位器的验证失败时,返回错误代码EINVALIDLOCATOR。

An application can set the preference value for a source locator for outbound traffic by setsockopt() with the socket option. Note that lc_ifidx and lc_flags (as defined in Section 8.1) have no effect in a set operation. Below is an example of such a set operation.

应用程序可以通过使用套接字选项setsockopt()为出站流量设置源定位器的首选项值。请注意,lc_ifidx和lc_标志(定义见第8.1节)在set操作中不起作用。下面是此类集合操作的示例。

       struct shim_locator lc;
       struct in6_addr ip6;
        
       struct shim_locator lc;
       struct in6_addr ip6;
        
       /* ...set the locator (ip6)... */
        
       /* ...set the locator (ip6)... */
        
       memset(&lc, 0, sizeof(shim_locator));
       lc.lc_family = AF_INET6;  /* IPv6 */
       lc.lc_ifidx = 0;
       lc.lc_flags = 0;
       lc.lc_prio = 1;
       lc.lc_weight = 10;
       memcpy(&lc.lc_addr, &ip6, sizeof(in6_addr));
        
       memset(&lc, 0, sizeof(shim_locator));
       lc.lc_family = AF_INET6;  /* IPv6 */
       lc.lc_ifidx = 0;
       lc.lc_flags = 0;
       lc.lc_prio = 1;
       lc.lc_weight = 10;
       memcpy(&lc.lc_addr, &ip6, sizeof(in6_addr));
        

setsockopt(fd, SOL_SHIM, SHIM_LOC_LOCAL_PREF, &lc, sizeof(optval));

设置锁定选项(fd、SOL_垫片、垫片位置_本地_PREF和lc、尺寸(optval));

An application can get the source locator for outbound traffic that has the highest preference value by using the socket option. Below is an example of such a get operation.

应用程序可以通过使用套接字选项获取具有最高首选值的出站流量的源定位器。下面是此类get操作的示例。

       struct shim_locator lc;
       int len;
        
       struct shim_locator lc;
       int len;
        
       len = sizeof(lc);
        
       len = sizeof(lc);
        

getsockopt(fd, SOL_SHIM, SHIM_LOC_LOCAL_PREF, &lc, &len);

getsockopt(fd、SOL、垫片、垫片、位置、本地、预、lc和len);

6.5. SHIM_LOC_PEER_PREF
6.5. 垫片位置对等位置优先

The SHIM_LOC_PEER_PREF option is used to set the preference value for a destination locator for outbound traffic, or to get the preference value of the destination locator for outbound traffic that has the highest preference value.

SHIM_LOC_PEER_PREF选项用于设置出站流量的目标定位器的首选项值,或获取具有最高首选项值的出站流量的目标定位器的首选项值。

This option is effective only when there is a shim context associated with the socket.

仅当存在与套接字关联的垫片上下文时,此选项才有效。

By default, the option value is set to NULL, meaning that the option is disabled.

默认情况下,选项值设置为NULL,表示该选项已禁用。

As defined earlier, the preference of a locator is defined by a combination of priority and weight as per DNS SRV [RFC2782]. When there is more than one candidate destination locator, the shim sub-layer makes a selection based on the priority and weight specified for each locator.

如前所述,根据DNS SRV[RFC2782],定位器的首选项由优先级和权重的组合来定义。当存在多个候选目标定位器时,垫片子层根据为每个定位器指定的优先级和权重进行选择。

The data type of the option value is a pointer to the shim_locator information data structure as defined in Section 8.1.

选项值的数据类型是指向第8.1节中定义的垫片定位器信息数据结构的指针。

When the application specifies the socket option to an unconnected socket, error code EOPNOTSUPP is returned to the application.

当应用程序为未连接的套接字指定套接字选项时,将向应用程序返回错误代码EOPNOTSUPP。

When there is no shim context associated with the socket, error code ENOENT is returned to the application.

当没有与套接字关联的垫片上下文时,将向应用程序返回错误代码enoint。

Error code EINVALIDLOCATOR is returned when the validation of the requested locator fails.

当请求的定位器验证失败时,返回错误代码EINVALIDLOCATOR。

Error code EUNREACHABLELOCATOR is returned when the requested locator is determined to be unreachable according to a reachability check.

当根据可达性检查确定请求的定位器不可访问时,返回错误代码EUNREACHABLELOCATOR。

The usage of the option is the same as that of SHIM_LOC_LOCAL_PREF.

该选项的用法与SHIM_LOC_LOCAL_PREF相同。

6.6. SHIM_LOC_LOCAL_RECV
6.6. 垫片位置本地记录

The SHIM_LOC_LOCAL_RECV option can be used to request that the shim sub-layer store the destination locator of the received IP packet in an ancillary data object that can be accessed by recvmsg(). This option is effective only when there is a shim context associated with the socket.

SHIM_LOC_LOCAL_RECV选项可用于请求SHIM子层将接收到的IP数据包的目标定位器存储在可由recvmsg()访问的辅助数据对象中。仅当存在与套接字关联的垫片上下文时,此选项才有效。

The data type of the option value is an integer. The option value MUST be binary (0 or 1). By default, the option value is set to 0, meaning that the option is disabled.

选项值的数据类型为整数。选项值必须为二进制(0或1)。默认情况下,选项值设置为0,表示该选项已禁用。

An application can set the option value by setsockopt().

应用程序可以通过setsockopt()设置选项值。

An application can get the option value by getsockopt().

应用程序可以通过getsockopt()获取选项值。

See Section 7 for the procedure to access locator information stored in the ancillary data objects.

有关访问存储在辅助数据对象中的定位器信息的过程,请参见第7节。

When the application specifies the socket option to an unconnected socket, error code EOPNOTSUPP is returned to the application.

当应用程序为未连接的套接字指定套接字选项时,将向应用程序返回错误代码EOPNOTSUPP。

When there is no shim context associated with the socket, error code ENOENT is returned to the application.

当没有与套接字关联的垫片上下文时,将向应用程序返回错误代码enoint。

For example, an application can request the shim sub-layer to store a destination locator by using the socket option as follows:

例如,应用程序可以使用套接字选项请求垫片子层存储目标定位器,如下所示:

int optval;

int optval;

optval = 1;

optval=1;

setsockopt(fd, SOL_SHIM, SHIM_LOC_LOCAL_RECV, &optval, sizeof(optval));

设置锁定选项(fd、SOL_垫片、垫片位置、局部位置和optval、尺寸(optval));

For example, an application can get the option value as follows:

例如,应用程序可以按如下方式获取选项值:

       int optval;
       int len;
        
       int optval;
       int len;
        
       len = sizeof(optval);
        
       len = sizeof(optval);
        

getsockopt(fd, SOL_SHIM, SHIM_LOC_LOCAL_RECV, &optval, &len);

getsockopt(fd、SOL_SHIM、SHIM_LOC_LOCAL_RECV和optval及len);

6.7. SHIM_LOC_PEER_RECV
6.7. 垫片位置对等记录

The SHIM_LOC_PEER_RECV option is used to request that the shim sub-layer store the source locator of the received IP packet in an ancillary data object that can be accessed by recvmsg(). This option is effective only when there is a shim context associated with the socket.

SHIM_LOC_PEER_RECV选项用于请求SHIM子层将接收到的IP数据包的源定位器存储在可由recvmsg()访问的辅助数据对象中。仅当存在与套接字关联的垫片上下文时,此选项才有效。

The data type of the option value is an integer. The option value MUST be binary (0 or 1). By default, the option value is set to 0, meaning that the option is disabled.

选项值的数据类型为整数。选项值必须为二进制(0或1)。默认情况下,选项值设置为0,表示该选项已禁用。

The option value can be set by setsockopt().

选项值可通过setsockopt()设置。

The option value can be read by getsockopt().

getsockopt()可以读取选项值。

See Section 7 for the procedure to access locator information stored in the ancillary data objects.

有关访问存储在辅助数据对象中的定位器信息的过程,请参见第7节。

When the application specifies the socket option to an unconnected socket, error code EOPNOTSUPP is returned to the application.

当应用程序为未连接的套接字指定套接字选项时,将向应用程序返回错误代码EOPNOTSUPP。

When there is no shim context associated with the socket, error code ENOENT is returned to the application.

当没有与套接字关联的垫片上下文时,将向应用程序返回错误代码enoint。

The usage of the option is the same as that of the SHIM_LOC_LOCAL_RECV option.

该选项的用法与SHIM_LOC_LOCAL_RECV选项的用法相同。

6.8. SHIM_LOC_LOCAL_SEND
6.8. 垫片位置本地发送

The SHIM_LOC_LOCAL_SEND option is used to request that the shim sub-layer use a specific locator as the source locator for the IP packets to be sent from the socket. This option is effective only when there is a shim context associated with the socket.

SHIM_LOC_LOCAL_SEND选项用于请求垫片子层使用特定定位器作为要从套接字发送的IP数据包的源定位器。仅当存在与套接字关联的垫片上下文时,此选项才有效。

The data type of the option value is a pointer to the shim_locator data structure.

选项值的数据类型是指向垫片定位器数据结构的指针。

An application can set the local locator by setsockopt(), providing a locator that is stored in a shim_locator data structure. When a zero-filled locator is specified, the pre-existing setting of the local locator is inactivated.

应用程序可以通过setsockopt()设置本地定位器,提供存储在shim_locator数据结构中的定位器。当指定零填充定位器时,本地定位器的现有设置将被禁用。

An application can get the local locator by getsockopt().

应用程序可以通过getsockopt()获取本地定位器。

When the application specifies the socket option to an unconnected socket, error code EOPNOTSUPP is returned to the application.

当应用程序为未连接的套接字指定套接字选项时,将向应用程序返回错误代码EOPNOTSUPP。

When there is no shim context associated with the socket, error code ENOENT is returned to the application.

当没有与套接字关联的垫片上下文时,将向应用程序返回错误代码enoint。

Error code EINVALIDLOCATOR is returned when an invalid locator is specified.

指定无效定位器时返回错误代码EINVALIDLOCATOR。

For example, an application can request the shim sub-layer to use a specific local locator by using the socket option as follows:

例如,应用程序可以通过使用套接字选项请求垫片子层使用特定的本地定位器,如下所示:

       struct shim_locator locator;
       struct in6_addr ia6;
        
       struct shim_locator locator;
       struct in6_addr ia6;
        
       /* an IPv6 address preferred for the source locator is copied
          to the parameter ia6 */
        
       /* an IPv6 address preferred for the source locator is copied
          to the parameter ia6 */
        
       memset(&locator, 0, sizeof(locator));
        
       memset(&locator, 0, sizeof(locator));
        
       /* fill shim_locator data structure */
       locator.lc_family = AF_INET6;
       locator.lc_ifidx = 0;
       locator.lc_flags = 0;
       locator.lc_prio = 0;
       locator.lc_weight = 0;
       memcpy(&locator.lc_addr, &ia6, sizeof(ia6));
        
       /* fill shim_locator data structure */
       locator.lc_family = AF_INET6;
       locator.lc_ifidx = 0;
       locator.lc_flags = 0;
       locator.lc_prio = 0;
       locator.lc_weight = 0;
       memcpy(&locator.lc_addr, &ia6, sizeof(ia6));
        

setsockopt(fd, SOL_SHIM, SHIM_LOC_LOCAL_SEND, &locator, sizeof(locator));

设置锁定选项(fd、SOL_垫片、垫片_LOC_LOCAL_SEND和定位器、尺寸(定位器));

For example, an application can get the designated local locator by using the socket option as follows:

例如,应用程序可以使用套接字选项获取指定的本地定位器,如下所示:

struct shim_locator locator;

结构垫片定位器;

       memset(&locator, 0, sizeof(locator));
        
       memset(&locator, 0, sizeof(locator));
        

getsockopt(fd, SOL_SHIM, SHIM_LOC_LOCAL_SEND, &locator, sizeof(locator));

getsockopt(fd、SOL_SHIM、SHIM_LOC_LOCAL_SEND和定位器、sizeof(定位器));

       /* check locator */
        
       /* check locator */
        
6.9. SHIM_LOC_PEER_SEND
6.9. 垫片位置对等发送

The SHIM_LOC_PEER_SEND option is used to request that the shim sub-layer use a specific locator for the destination locator of IP packets to be sent from the socket. This option is effective only when there is a shim context associated with the socket.

SHIM_LOC_PEER_SEND选项用于请求垫片子层使用特定的定位器作为从套接字发送的IP数据包的目标定位器。仅当存在与套接字关联的垫片上下文时,此选项才有效。

The data type of the option value is a pointer to the shim_locator data structure.

选项值的数据类型是指向垫片定位器数据结构的指针。

An application can set the remote locator by setsockopt(), providing a locator that is stored in a shim_locator data structure. When a zero-filled locator is specified, the pre-existing setting of the remote locator is inactivated.

应用程序可以通过setsockopt()设置远程定位器,提供存储在shim_locator数据结构中的定位器。当指定零填充定位器时,远程定位器的现有设置将被禁用。

An application can get the specified remote locator by getsockopt().

应用程序可以通过getsockopt()获取指定的远程定位器。

The difference between the SHIM_LOC_PEER_SEND option and the SHIM_LOC_PEER_PREF option is that the former guarantees the use of a requested locator when applicable, whereas the latter does not.

SHIM_LOC_PEER_SEND选项和SHIM_LOC_PEER_PREF选项之间的区别在于前者保证在适用时使用请求的定位器,而后者则不保证。

When the application specifies the socket option to an unconnected socket, error code EOPNOTSUPP is returned to the application.

当应用程序为未连接的套接字指定套接字选项时,将向应用程序返回错误代码EOPNOTSUPP。

When there is no shim context associated with the socket, error code ENOENT is returned to the application.

当没有与套接字关联的垫片上下文时,将向应用程序返回错误代码enoint。

Error code EINVALIDLOCATOR is returned when the validation of the requested locator fails.

当请求的定位器验证失败时,返回错误代码EINVALIDLOCATOR。

Error code EUNVERIFIEDLOCATOR is returned when reachability for the requested locator has not been verified yet.

当请求的定位器的可达性尚未验证时,返回错误代码EUNVERIFIEDLOCATOR。

Error code EUNREACHABLELOCATOR is returned when the requested locator is determined to be unreachable according to a reachability check.

当根据可达性检查确定请求的定位器不可访问时,返回错误代码EUNREACHABLELOCATOR。

The usage of the option is the same as that of the SHIM_LOC_LOCAL_SEND option.

该选项的用法与SHIM_LOC_LOCAL_SEND选项的用法相同。

6.10. SHIM_LOCLIST_LOCAL
6.10. 垫片\u本地列表\u本地

The SHIM_LOCLIST_LOCAL option is used to get or set the locator list associated with the local EID of the shim context associated with the socket. This option is effective only when there is a shim context associated with the socket.

SHIM_LOCLIST_LOCAL选项用于获取或设置与套接字关联的垫片上下文的本地EID关联的定位器列表。仅当存在与套接字关联的垫片上下文时,此选项才有效。

The data type of the option value is a pointer to the buffer in which a locator list is stored. See Section 8 for the data structure for storing the locator information. By default, the option value is set to NULL, meaning that the option is disabled.

选项值的数据类型是指向存储定位器列表的缓冲区的指针。有关存储定位器信息的数据结构,请参见第8节。默认情况下,选项值设置为NULL,表示该选项已禁用。

An application can get the locator list by getsockopt(). Note that the size of the buffer pointed to by the optval argument SHOULD be large enough to store an array of locator information. The number of the locator information is not known beforehand.

应用程序可以通过getsockopt()获取定位器列表。请注意,optval参数指向的缓冲区的大小应该足够大,以存储定位器信息数组。定位器信息的编号事先未知。

The local locator list can be set by setsockopt(). The buffer pointed to by the optval argument MUST contain an array of locator structures.

本地定位器列表可以通过setsockopt()设置。optval参数指向的缓冲区必须包含定位器结构数组。

When the application specifies the socket option to an unconnected socket, error code EOPNOTSUPP is returned to the application.

当应用程序为未连接的套接字指定套接字选项时,将向应用程序返回错误代码EOPNOTSUPP。

When there is no shim context associated with the socket, error code ENOENT is returned to the application.

当没有与套接字关联的垫片上下文时,将向应用程序返回错误代码enoint。

Error code EINVALIDLOCATOR is returned when the validation of any of the specified locators failed.

当任何指定定位器的验证失败时,返回错误代码EINVALIDLOCATOR。

Error code ETOOMANYLOCATORS is returned when the number of locators specified exceeds the limit (SHIM_MAX_LOCATORS), or when the size of the buffer provided by the application is not large enough to store the locator list provided by the shim sub-layer.

当指定的定位器数量超过限制(SHIM_MAX_locators)或应用程序提供的缓冲区大小不足以存储SHIM子层提供的定位器列表时,返回错误代码ETOOMANYLOCATORS。

For example, an application can set a list of locators to be associated with the local EID by using the socket option as follows. Note that an IPv4 locator can be handled by HIP and not by Shim6.

例如,应用程序可以使用套接字选项设置要与本地EID关联的定位器列表,如下所示。请注意,IPv4定位器可以由HIP而不是Shim6处理。

       struct shim_locator locators[SHIM_MAX_LOCATORS];
       struct sockaddr_in *sin;
       struct sockaddr_in6 *sin6;
        
       struct shim_locator locators[SHIM_MAX_LOCATORS];
       struct sockaddr_in *sin;
       struct sockaddr_in6 *sin6;
        
       memset(locators, 0, sizeof(locators));
        
       memset(locators, 0, sizeof(locators));
        

...

...

       /* obtain local IP addresses from local interfaces */
        
       /* obtain local IP addresses from local interfaces */
        

...

...

       /* first locator (an IPv6 address) */
       locators[0].lc_family = AF_INET6;
       locators[0].lc_ifidx = 0;
       locators[0].lc_flags = 0;
       locators[0].lc_prio = 1;
       locators[0].lc_weight = 0;
       memcpy(&locators[0].lc_addr, &sa6->sin6_addr,
              sizeof(sa6->sin6_addr));
        
       /* first locator (an IPv6 address) */
       locators[0].lc_family = AF_INET6;
       locators[0].lc_ifidx = 0;
       locators[0].lc_flags = 0;
       locators[0].lc_prio = 1;
       locators[0].lc_weight = 0;
       memcpy(&locators[0].lc_addr, &sa6->sin6_addr,
              sizeof(sa6->sin6_addr));
        

...

...

       /* second locator (an IPv4 address) */
       locators[1].lc_family = AF_INET;
       locators[1].lc_ifidx = 0;
       locators[1].lc_flags = 0;
       locators[1].lc_prio = 0;
       locators[1].lc_weight = 0;
       memcpy(&locators[1].lc_addr, &sa->sin_addr,
              sizeof(sa->sin_addr));
        
       /* second locator (an IPv4 address) */
       locators[1].lc_family = AF_INET;
       locators[1].lc_ifidx = 0;
       locators[1].lc_flags = 0;
       locators[1].lc_prio = 0;
       locators[1].lc_weight = 0;
       memcpy(&locators[1].lc_addr, &sa->sin_addr,
              sizeof(sa->sin_addr));
        

setsockopt(fd, SOL_SHIM, SHIM_LOCLIST_LOCAL, locators, sizeof(locators));

setsockopt(fd、SOL_垫片、垫片_LOCLIST_LOCAL、定位器、尺寸(定位器));

For example, an application can get a list of locators that are associated with the local EID by using the socket option as follows:

例如,应用程序可以使用套接字选项获取与本地EID关联的定位器列表,如下所示:

struct shim_locator locators[SHIM_MAX_LOCATORS];

结构垫片定位器[垫片最大定位器];

       memset(locators, 0, sizeof(locators));
        
       memset(locators, 0, sizeof(locators));
        

getsockopt(fd, SOL_SHIM, SHIM_LOC_LOCAL_RECV, locators, sizeof(locators));

getsockopt(fd、SOL_SHIM、SHIM_LOC_LOCAL_RECV、定位器、定位器尺寸);

       /* parse locators */
       ...
        
       /* parse locators */
       ...
        
6.11. SHIM_LOCLIST_PEER
6.11. 垫片\u本地列表\u对等

The SHIM_LOCLIST_PEER option is used to get or set the locator list associated with the peer EID of the shim context associated with the socket. This option is effective only when there is a shim context associated with the socket.

SHIM_LOCLIST_PEER选项用于获取或设置与套接字关联的垫片上下文的对等EID关联的定位器列表。仅当存在与套接字关联的垫片上下文时,此选项才有效。

The data type of the option value is a pointer to the buffer where a locator list is stored. See Section 8 for the data structure for storing the locator information. By default, the option value is set to NULL, meaning that the option is disabled.

选项值的数据类型是指向存储定位器列表的缓冲区的指针。有关存储定位器信息的数据结构,请参见第8节。默认情况下,选项值设置为NULL,表示该选项已禁用。

An application can get the locator list by getsockopt(). Note that the size of the buffer pointed to by the optval argument SHOULD be large enough to store an array of locator information. The number of the locator information is not known beforehand.

应用程序可以通过getsockopt()获取定位器列表。请注意,optval参数指向的缓冲区的大小应该足够大,以存储定位器信息数组。定位器信息的编号事先未知。

An application can set the locator list by setsockopt(). The buffer pointed to by the optval argument MUST contain an array of locator list items.

应用程序可以通过setsockopt()设置定位器列表。optval参数指向的缓冲区必须包含定位器列表项数组。

When the application specifies the socket option to an unconnected socket, error code EOPNOTSUPP is returned to the application.

当应用程序为未连接的套接字指定套接字选项时,将向应用程序返回错误代码EOPNOTSUPP。

When there is no shim context associated with the socket, error code ENOENT is returned to the application.

当没有与套接字关联的垫片上下文时,将向应用程序返回错误代码enoint。

Error code EINVALIDLOCATOR is returned when the validation of any of the specified locators failed.

当任何指定定位器的验证失败时,返回错误代码EINVALIDLOCATOR。

Error code EUNVERIFIEDLOCATOR is returned when reachability for the requested locator has not been verified yet.

当请求的定位器的可达性尚未验证时,返回错误代码EUNVERIFIEDLOCATOR。

Error code EUNREACHABLELOCATOR is returned when the requested locator is determined to be unreachable according to a reachability check.

当根据可达性检查确定请求的定位器不可访问时,返回错误代码EUNREACHABLELOCATOR。

Error code ETOOMANYLOCATORS is returned when the number of locators specified exceeds the limit (SHIM_MAX_LOCATORS), or when the size of the buffer provided by the application is not large enough to store the locator list provided by the shim sub-layer.

当指定的定位器数量超过限制(SHIM_MAX_locators)或应用程序提供的缓冲区大小不足以存储SHIM子层提供的定位器列表时,返回错误代码ETOOMANYLOCATORS。

The usage of the option is the same as that of SHIM_LOCLIST_LOCAL.

该选项的用法与SHIM_LOCLIST_LOCAL相同。

6.12. SHIM_APP_TIMEOUT
6.12. 垫片应用超时

The SHIM_APP_TIMEOUT option is used to get or set the Send Timeout value of REAP [RFC5534]. This option is effective only when there is a shim context associated with the socket.

SHIM_APP_TIMEOUT选项用于获取或设置REAP[RFC5534]的发送超时值。仅当存在与套接字关联的垫片上下文时,此选项才有效。

The data type of the option value is an integer. The value indicates the period of timeout in seconds to send a REAP Keepalive message since the last outbound traffic. By default, the option value is set to 0, meaning that the option is disabled. When the option is disabled, the REAP mechanism follows its default Send Timeout value as specified in [RFC5534].

选项值的数据类型为整数。该值指示自上次出站通信以来发送保留消息的超时时间(秒)。默认情况下,选项值设置为0,表示该选项已禁用。禁用该选项时,收获机制将遵循[RFC5534]中指定的默认发送超时值。

When the application specifies the socket option to an unconnected socket, error code EOPNOTSUPP is returned to the application.

当应用程序为未连接的套接字指定套接字选项时,将向应用程序返回错误代码EOPNOTSUPP。

When there is no shim context associated with the socket, error code ENOENT is returned to the application.

当没有与套接字关联的垫片上下文时,将向应用程序返回错误代码enoint。

When there is no REAP instance on the system, error code EOPNOTSUPP is returned to the application.

当系统上没有REAP实例时,将向应用程序返回错误代码EOPNOTSUPP。

For example, an application can set the timeout value by using the socket option as follows:

例如,应用程序可以使用套接字选项设置超时值,如下所示:

int optval;

int optval;

       optval = 15; /* 15 seconds */
        
       optval = 15; /* 15 seconds */
        

setsockopt(fd, SOL_SHIM, SHIM_APP_TIMEOUT, &optval, sizeof(optval));

设置锁定选项(fd、SOL_垫片、垫片应用超时和optval、sizeof(optval));

For example, an application can get the timeout value by using the socket option as follows:

例如,应用程序可以使用套接字选项获取超时值,如下所示:

       int optval;
       int len;
        
       int optval;
       int len;
        
       len = sizeof(optval);
        
       len = sizeof(optval);
        

getsockopt(fd, SOL_SHIM, SHIM_APP_TIMEOUT, &optval, &len);

getsockopt(fd、SOL_SHIM、SHIM_APP_TIMEOUT和optval及len);

6.13. SHIM_PATHEXPLORE
6.13. SHIM_PATHEXPLORE

The application MAY use this socket option to get or set parameters concerning path exploration. Path exploration is a procedure to find an alternative locator pair to the current locator pair. As the REAP specification defines, a peer may send Probe messages to find an alternative locator pair.

应用程序可以使用此套接字选项获取或设置有关路径探索的参数。路径探索是找到当前定位器对的替代定位器对的过程。正如REAP规范所定义的,对等方可以发送探测消息以找到替代定位器对。

This option is effective only when there is a shim context associated with the socket.

仅当存在与套接字关联的垫片上下文时,此选项才有效。

The data type of the option value is a pointer to the buffer where a set of information for path exploration is stored. The data structure is defined in Section 8.

选项值的数据类型是指向缓冲区的指针,缓冲区中存储了一组用于路径探索的信息。第8节定义了数据结构。

By default, the option value is set to NULL, meaning that the option is disabled.

默认情况下,选项值设置为NULL,表示该选项已禁用。

When the application specifies the socket option to an unconnected socket, error code EOPNOTSUPP is returned to the application.

当应用程序为未连接的套接字指定套接字选项时,将向应用程序返回错误代码EOPNOTSUPP。

When there is no shim context associated with the socket, error code ENOENT is returned to the application.

当没有与套接字关联的垫片上下文时,将向应用程序返回错误代码enoint。

For example, an application can set parameters for path exploration by using the socket option as follows:

例如,应用程序可以使用套接字选项设置路径探索的参数,如下所示:

struct shim6_pathexplore pe;

结构shim6_;

       pe.pe_probenum = 4;        /* times */
       pe.pe_keepaliveto = 10;    /* seconds */
       pe.pe_initprobeto = 500;   /* milliseconds */
       pe.pe_reserved = 0;
        
       pe.pe_probenum = 4;        /* times */
       pe.pe_keepaliveto = 10;    /* seconds */
       pe.pe_initprobeto = 500;   /* milliseconds */
       pe.pe_reserved = 0;
        
       setsockopt(fd, SOL_SHIM, SHIM_PATHEXPLORE, &pe, sizeof(pe));
        
       setsockopt(fd, SOL_SHIM, SHIM_PATHEXPLORE, &pe, sizeof(pe));
        

For example, an application can get parameters for path exploration by using the socket option as follows:

例如,应用程序可以使用套接字选项获取路径探索的参数,如下所示:

       struct shim6_pathexplore pe;
       int len;
        
       struct shim6_pathexplore pe;
       int len;
        
       len = sizeof(pe);
        
       len = sizeof(pe);
        

getsockopt(fd, SOL_SHIM, SHIM_PATHEXPLORE, &pe, &len);

getsockopt(fd、SOL_SHIM、SHIM_PATHEXPLORE、pe和len);

6.14. SHIM_DEFERRED_CONTEXT_SETUP
6.14. 垫片\u延迟\u上下文\u设置

The SHIM_DEFERRED_CONTEXT_SETUP option is used to check whether or not deferred context setup is possible. Deferred context setup means that the context is established in parallel with the data communication. Note that Shim6 supports deferred context setup and HIP does not, because EIDs in HIP (i.e., Host Identifiers) are non-routable.

SHIM_DEFERRED_CONTEXT_SETUP选项用于检查是否可以进行延迟上下文设置。延迟上下文设置意味着上下文是与数据通信并行建立的。注意,Shim6支持延迟上下文设置,而HIP不支持,因为HIP中的EID(即主机标识符)是不可路由的。

Note that the socket option is read-only, and the option value can be read by getsockopt().

请注意,套接字选项是只读的,选项值可以由getsockopt()读取。

The data type for the option value is an integer. The option value MUST be binary (0 or 1). The option value of 1 means that the shim sub-layer supports deferred context setup.

选项值的数据类型为整数。选项值必须为二进制(0或1)。选项值1表示垫片子层支持延迟上下文设置。

When the application specifies the socket option to an unconnected socket, error code EOPNOTSUPP is returned to the application.

当应用程序为未连接的套接字指定套接字选项时,将向应用程序返回错误代码EOPNOTSUPP。

For example, an application can check whether deferred context setup is possible or not as follows:

例如,应用程序可以检查延迟上下文设置是否可行,如下所示:

       int optval;
       int len;
        
       int optval;
       int len;
        
       len = sizeof(optval);
        
       len = sizeof(optval);
        

getsockopt(fd, SOL_SHIM, SHIM_DEFERRED_CONTEXT_SETUP, &optval, &len);

getsockopt(fd、SOL\u SHIM、SHIM\u DEFERRED\u CONTEXT\u SETUP、&optval和len);

6.15. Applicability
6.15. 适用性

All the socket options defined in this section except for the SHIM_DONTSHIM option are applicable to applications that use connected sockets.

本节中定义的所有插座选项(SHIM_DONTSHIM选项除外)均适用于使用连接插座的应用程序。

All the socket options defined in this section except for the SHIM_ASSOCIATED, SHIM_DONTSHIM, and SHIM_CONTEXT_DEFERRED_SETUP options are effective only when there is a shim context associated with the socket.

本节中定义的所有套接字选项(关联的SHIM_、SHIM_DONTSHIM和SHIM_CONTEXT_DEFERRED_设置选项除外)仅在存在与套接字关联的SHIM_上下文时有效。

6.16. Error Handling
6.16. 错误处理

If successful, getsockopt() and setsockopt() return 0; otherwise, the functions return -1 and set errno to indicate an error.

如果成功,getsockopt()和setsockopt()返回0;否则,函数返回-1并设置errno以指示错误。

The following are new error values defined for some shim-specific socket options indicating that the getsockopt() or setsockopt() finished incompletely:

以下是为某些特定于垫片的套接字选项定义的新错误值,指示getsockopt()或setsockopt()未完成:

EINVALIDLOCATOR This indicates that the locator is not part of the HBA set [RFC5535] within the shim context associated with the socket.

EINVALIDLOCATOR这表示定位器不是与套接字关联的垫片上下文中HBA集[RFC5535]的一部分。

EUNVERIFIEDLOCATOR This indicates that the reachability of the locator has not been confirmed. This error is applicable to only the peer's locator.

EUNVERIFIEDLOCATOR这表示尚未确认定位器的可达性。此错误仅适用于对等方的定位器。

EUNREACHABLELOCATOR This indicates that the locator is not reachable according to the result of the reachability check. This error is applicable to only the peer's locator.

EUNREACHABLELOCATOR这表示根据可达性检查的结果无法访问定位器。此错误仅适用于对等方的定位器。

7. Ancillary Data for Multihoming Shim Sub-Layer
7. 多归宿垫片子层的辅助数据

This section provides definitions of ancillary data to be used for locator management and notification from/to the shim sub-layer to/ from the application.

本节提供了辅助数据的定义,这些辅助数据用于定位器管理和垫片子层与应用程序之间的通知。

When the application performs locator management by sendmsg() or recvmsg(), a member of the msghdr structure (given in Figure 3) called msg_control holds a pointer to the buffer in which one or more shim-specific ancillary data objects may be stored. An ancillary data object can store a single locator. It should be possible to process the shim-specific ancillary data object by the existing macros defined in the POSIX standard and [RFC3542].

当应用程序通过sendmsg()或recvmsg()执行定位器管理时,名为msg_control的msghdr结构(如图3所示)的一个成员持有一个指向缓冲区的指针,缓冲区中可能存储一个或多个特定于垫片的辅助数据对象。辅助数据对象可以存储单个定位器。应该可以通过POSIX标准和[RFC3542]中定义的现有宏来处理特定于垫片的辅助数据对象。

        struct msghdr {
                caddr_t msg_name;       /* optional address */
                u_int   msg_namelen;    /* size of address */
                struct  iovec *msg_iov; /* scatter/gather array */
                u_int   msg_iovlen;     /* # elements in msg_iov */
                caddr_t msg_control;    /* ancillary data, see below */
                u_int   msg_controllen; /* ancillary data buffer len */
                int     msg_flags;      /* flags on received message */
        };
        
        struct msghdr {
                caddr_t msg_name;       /* optional address */
                u_int   msg_namelen;    /* size of address */
                struct  iovec *msg_iov; /* scatter/gather array */
                u_int   msg_iovlen;     /* # elements in msg_iov */
                caddr_t msg_control;    /* ancillary data, see below */
                u_int   msg_controllen; /* ancillary data buffer len */
                int     msg_flags;      /* flags on received message */
        };
        

Figure 3: msghdr Structure

图3:msghdr结构

In the case of an unconnected socket, msg_name stores the socket address of the peer. Note that the address is not a locator of the peer but the identifier of the peer. SHIM_LOC_PEER_RECV can be used to get the locator of the peer node.

对于未连接的套接字,msg_name存储对等方的套接字地址。请注意,地址不是对等方的定位器,而是对等方的标识符。SHIM_LOC_PEER_RECV可用于获取对等节点的定位器。

Table 2 is a list of the shim-specific ancillary data that can be used for locator management by recvmsg() or sendmsg(). In any case, the value of cmsg_level MUST be set to SOL_SHIM.

表2列出了可由recvmsg()或sendmsg()用于定位器管理的特定于垫片的辅助数据。在任何情况下,cmsg_level的值必须设置为SOL_SHIM。

     +---------------------+-----------+-----------+-----------------+
     | cmsg_type           | sendmsg() | recvmsg() |   cmsg_data[]   |
     +---------------------+-----------+-----------+-----------------+
     | SHIM_LOC_LOCAL_RECV |           |     o     |      Note 1     |
     | SHIM_LOC_PEER_RECV  |           |     o     |      Note 1     |
     | SHIM_LOC_LOCAL_SEND |     o     |           |      Note 1     |
     | SHIM_LOC_PEER_SEND  |     o     |           |      Note 1     |
     | SHIM_FEEDBACK       |     o     |           | shim_feedback{} |
     +---------------------+-----------+-----------+-----------------+
        
     +---------------------+-----------+-----------+-----------------+
     | cmsg_type           | sendmsg() | recvmsg() |   cmsg_data[]   |
     +---------------------+-----------+-----------+-----------------+
     | SHIM_LOC_LOCAL_RECV |           |     o     |      Note 1     |
     | SHIM_LOC_PEER_RECV  |           |     o     |      Note 1     |
     | SHIM_LOC_LOCAL_SEND |     o     |           |      Note 1     |
     | SHIM_LOC_PEER_SEND  |     o     |           |      Note 1     |
     | SHIM_FEEDBACK       |     o     |           | shim_feedback{} |
     +---------------------+-----------+-----------+-----------------+
        

Table 2: Shim-Specific Ancillary Data

表2:垫片特定辅助数据

   Note 1: cmsg_data[] within msg_control includes a single
   sockaddr_in{} or sockaddr_in6{} and padding if necessary
        
   Note 1: cmsg_data[] within msg_control includes a single
   sockaddr_in{} or sockaddr_in6{} and padding if necessary
        
7.1. Get Locator from Incoming Packet
7.1. 从传入数据包获取定位器

An application can get locator information from the received IP packet by specifying the shim-specific socket options for the socket. When SHIM_LOC_LOCAL_RECV and/or SHIM_LOC_PEER_RECV socket options are set, the application can retrieve a local and/or remote locator from the ancillary data.

应用程序可以通过为套接字指定特定于垫片的套接字选项,从接收到的IP数据包中获取定位器信息。当设置了SHIM_LOC_LOCAL_RECV和/或SHIM_LOC_PEER_RECV套接字选项时,应用程序可以从辅助数据中检索本地和/或远程定位器。

When there is no shim context associated with the socket, the shim sub-layer MUST return zero-filled locator information to the application.

当没有与套接字关联的垫片上下文时,垫片子层必须向应用程序返回零填充定位器信息。

7.2. Set Locator for Outgoing Packet
7.2. 设置传出数据包的定位器

An application can specify the locators to be used for transmitting an IP packet by sendmsg(). When the ancillary data of cmsg_type SHIM_LOC_LOCAL_SEND and/or SHIM_LOC_PEER_SEND are specified, the application can explicitly specify the source and/or the destination locators to be used for the communication over the socket. If the specified locator pair is verified, the shim sub-layer overrides the locator(s) of the outgoing IP packet. Note that the effect is limited to the datagram transmitted by the sendmsg().

应用程序可以指定sendmsg()用于传输IP数据包的定位器。当指定cmsg_类型SHIM_LOC_LOCAL_SEND和/或SHIM_LOC_PEER_SEND的辅助数据时,应用程序可以明确指定用于套接字通信的源和/或目标定位器。如果验证了指定的定位器对,则垫片子层将覆盖传出IP数据包的定位器。请注意,该效果仅限于sendmsg()传输的数据报。

When there is no shim context associated with the socket, error code ENOENT is returned to the application.

当没有与套接字关联的垫片上下文时,将向应用程序返回错误代码enoint。

Error code EINVALIDLOCATOR is returned when validation of the specified locator fails.

当指定定位器的验证失败时,返回错误代码EINVALIDLOCATOR。

Error code EUNVERIFIEDLOCATOR is returned when reachability for the requested locator has not been verified yet. The application is recommended to use another destination locator until the reachability check for the requested locator is done.

当请求的定位器的可达性尚未验证时,返回错误代码EUNVERIFIEDLOCATOR。建议应用程序使用另一个目标定位器,直到完成所请求定位器的可达性检查。

Error code EUNREACHABLELOCATOR is returned when the requested locator is determined to be unreachable according to a reachability check. The application is recommended to use another destination locator when receiving the error.

当根据可达性检查确定请求的定位器不可访问时,返回错误代码EUNREACHABLELOCATOR。建议应用程序在收到错误时使用另一个目标定位器。

7.3. Notification from Application to Multihoming Shim Sub-Layer
7.3. 从应用程序到多主垫片子层的通知

An application MAY provide feedback to the shim sub-layer about the communication status. Such feedback is useful for the shim sub-layer to monitor the reachability status of the currently used locator pair in a given shim context.

应用可向垫片子层提供关于通信状态的反馈。这种反馈对于垫片子层在给定垫片上下文中监控当前使用的定位器对的可达性状态非常有用。

The notification can be made by sendmsg() specifying a new ancillary data called SHIM_FEEDBACK. The ancillary data can be handled by specifying the SHIM_FEEDBACK option in cmsg_type.

可以通过sendmsg()指定名为SHIM_FEEDBACK的新辅助数据来发出通知。可以通过在cmsg_类型中指定SHIM_反馈选项来处理辅助数据。

When there is no shim context associated with the socket, error code ENOENT is returned to the application.

当没有与套接字关联的垫片上下文时,将向应用程序返回错误代码enoint。

See Section 8.3 for details of the data structure to be used.

有关要使用的数据结构的详细信息,请参见第8.3节。

It is outside the scope of this document to describe how the shim sub-layer would react when feedback is provided by an application.

当应用程序提供反馈时,垫片子层将如何反应,这超出了本文档的范围。

7.4. Applicability
7.4. 适用性

All the ancillary data for the shim sub-layer is applicable to connected sockets.

垫片子层的所有辅助数据适用于连接的插座。

Care is needed when the SHIM_LOC_*_RECV socket option is used for stream-oriented sockets (e.g., TCP sockets) because there is no one-to-one mapping between a single send or receive operation and the data (e.g., a TCP segment) being received. In other words, there is

当SHIM_LOC_*_recvsocket选项用于面向流的套接字(例如TCP套接字)时,需要小心,因为在单个发送或接收操作和正在接收的数据(例如TCP段)之间没有一对一映射。换句话说,有

no guarantee that the locator(s) set in the SHIM_LOC_*_RECV ancillary data is identical to the locator(s) that appears in the IP packets received. The shim sub-layer SHOULD provide the latest locator information to the application in response to the SHIM_LOC_*_RECV socket option.

不保证垫片LOC RECV辅助数据中设置的定位器与接收的IP数据包中显示的定位器相同。垫片子层应向应用程序提供最新的定位器信息,以响应垫片LOC RECV插座选项。

8. Data Structures
8. 数据结构

This section gives data structures for the shim sub-layer. These data structures are either used as a parameter for setsockopt() or getsockopt() (as mentioned in Section 6), or as a parameter for ancillary data to be processed by sendmsg() or recvmsg() (as mentioned in Section 7).

本节给出了垫片子层的数据结构。这些数据结构要么用作setsockopt()或getsockopt()的参数(如第6节所述),要么用作sendmsg()或recvmsg()处理的辅助数据的参数(如第7节所述)。

8.1. Data Structure for Locator Information
8.1. 定位器信息的数据结构

As defined in Section 6, the SHIM_LOC_*_PREF, SHIM_LOC_*_SEND, and SHIM_LOCLIST_* socket options need to handle one or more locator information points. Locator information includes not only the locator itself but also additional information about the locator that is useful for locator management. A new data structure is defined to serve as a placeholder for the locator information.

如第6节所定义,SHIM_LOC_*_PREF、SHIM_LOC_*_SEND和SHIM_LOCLIST_*插槽选项需要处理一个或多个定位器信息点。定位器信息不仅包括定位器本身,还包括有关定位器的附加信息,这些信息对于定位器管理非常有用。定义了一个新的数据结构作为定位器信息的占位符。

Figure 4 illustrates the data structure called shim_locator, which stores locator information.

图4说明了名为shim_locator的数据结构,它存储定位器信息。

        struct shim_locator {
                uint8_t    lc_family;       /* address family */
                uint8_t    lc_proto;        /* protocol */
                uint16_t   lc_port;         /* port number */
                uint16_t   lc_prio;         /* preference value */
                uint16_t   lc_weight;       /* weight */
                uint32_t   lc_ifidx;        /* interface index */
                struct in6_addr lc_addr;    /* address */
                uint16_t   lc_flags;        /* flags */
        };
        
        struct shim_locator {
                uint8_t    lc_family;       /* address family */
                uint8_t    lc_proto;        /* protocol */
                uint16_t   lc_port;         /* port number */
                uint16_t   lc_prio;         /* preference value */
                uint16_t   lc_weight;       /* weight */
                uint32_t   lc_ifidx;        /* interface index */
                struct in6_addr lc_addr;    /* address */
                uint16_t   lc_flags;        /* flags */
        };
        

Figure 4: Shim Locator Structure

图4:垫片定位器结构

lc_family Address family of the locator (e.g., AF_INET, AF_INET6). It is required that the parameter contains a non-zero value indicating the exact address family of the locator.

定位器的lc_系列地址系列(例如,AF_INET、AF_INET6)。要求参数包含一个非零值,该值指示定位器的确切地址族。

lc_proto Internet Protocol number for the protocol that is used to handle a locator behind a NAT. The value MUST be set to zero when there is no NAT involved. When the locator is behind a NAT, the value MUST be set to IPPROTO_UDP.

用于处理NAT后面的定位器的协议的lc_proto Internet协议编号。当不涉及NAT时,该值必须设置为零。当定位器位于NAT后面时,该值必须设置为IPPROTO_UDP。

lc_port Port number that is used for handling a locator behind a NAT.

用于处理NAT后面的定位器的lc_端口号。

lc_prio Priority of the locator. The range is 0-65535. The lowest priority value means the highest priority.

定位器的lc_优先级。范围是0-65535。最低优先级值表示最高优先级。

lc_weight Weight value indicates a relative weight for locators with the same priority value. The range is 0-65535. A locator with higher weight value is prioritized over the other locators with lower weight values.

lc_权重值表示具有相同优先级值的定位器的相对权重。范围是0-65535。权重值较高的定位器优先于其他权重值较低的定位器。

lc_ifidx Interface index of the network interface to which the locator is assigned. This field is applicable only to local locators, and has no effect in set operations.

指定定位器的网络接口的lc_ifidx接口索引。此字段仅适用于本地定位器,在集合操作中无效。

lc_addr Contains the locator. In the case of IPv4, the locator MUST be formatted in the IPv4-mapped IPv6 address as defined in [RFC4291]. The locator MUST be stored in network byte order.

lc_addr包含定位器。对于IPv4,定位器必须按照[RFC4291]中定义的IPv4映射IPv6地址进行格式化。定位器必须以网络字节顺序存储。

lc_flags Each bit of the flags represents a specific characteristic of the locator. The Hash-Based Address (HBA) is defined as 0x01. The Cryptographically Generated Address (CGA) is defined as 0x02. This field has no effect in set operations.

lc_标志标志的每一位代表定位器的特定特征。基于哈希的地址(HBA)定义为0x01。加密生成的地址(CGA)定义为0x02。此字段在集合操作中无效。

8.1.1. Handling Locator behind NAT
8.1.1. NAT后面的处理定位器

Note that the locator information MAY contain a locator behind a Network Address Translator (NAT). Such a situation may arise when the host is behind the NAT and uses a local address as a source locator to communicate with the peer. Note that a NAT traversal mechanism for HIP is defined, which allows a HIP host to tunnel control and data traffic over UDP [RFC5770]. Note also that the locator behind a NAT is not necessarily an IPv4 address and can be an IPv6 address. Below is an example where the application sets a UDP encapsulation interface as a source locator when sending IP packets.

注意,定位器信息可以包含网络地址转换器(NAT)后面的定位器。当主机位于NAT后面并且使用本地地址作为源定位器与对等方通信时,可能出现这种情况。注意,定义了HIP的NAT遍历机制,允许HIP主机通过UDP[RFC5770]隧道控制和数据通信。还要注意,NAT后面的定位器不一定是IPv4地址,也可以是IPv6地址。下面是应用程序在发送IP数据包时将UDP封装接口设置为源定位器的示例。

          struct shim_locator locator;
          struct in6_addr ia6;
        
          struct shim_locator locator;
          struct in6_addr ia6;
        
          /* copy the private IPv4 address to the ia6 as an IPv4-mapped
             IPv6 address */
        
          /* copy the private IPv4 address to the ia6 as an IPv4-mapped
             IPv6 address */
        
          memset(&locator, 0, sizeof(locator));
        
          memset(&locator, 0, sizeof(locator));
        
          /* fill shim_locator data structure */
          locator.lc_family = AF_INET;
          locator.lc_proto = IPPROTO_UDP;
          locator.lc_port = 50500;
          locator.lc_ifidx = 0;
          locator.lc_flags = 0;
          locator.lc_prio = 0;
          locator.lc_weight = 0;
        
          /* fill shim_locator data structure */
          locator.lc_family = AF_INET;
          locator.lc_proto = IPPROTO_UDP;
          locator.lc_port = 50500;
          locator.lc_ifidx = 0;
          locator.lc_flags = 0;
          locator.lc_prio = 0;
          locator.lc_weight = 0;
        
          memcpy(&locator.lc_addr, &ia6, sizeof(ia6));
        
          memcpy(&locator.lc_addr, &ia6, sizeof(ia6));
        

setsockopt(fd, SOL_SHIM, SHIM_LOC_LOCAL_SEND, &locator, sizeof(locator));

设置锁定选项(fd、SOL_垫片、垫片_LOC_LOCAL_SEND和定位器、尺寸(定位器));

Figure 5: Handling Locator behind NAT

图5:NAT后面的处理定位器

8.2. Path Exploration Parameter
8.2. 路径探索参数

As defined in Section 6, SHIM_PATHEXPLORE allows an application to set or read the parameters for path exploration and failure detection. A new data structure called shim_pathexplore is defined to store the necessary parameters. Figure 6 illustrates the data structure. The data structure can be passed to getsockopt() or setsockopt() as an argument.

如第6节所定义,SHIM_PATHEXPLORE允许应用程序设置或读取用于路径探索和故障检测的参数。定义了一个名为shim_pathexplore的新数据结构来存储必要的参数。图6说明了数据结构。数据结构可以作为参数传递给getsockopt()或setsockopt()。

        struct shim_pathexplore {
                uint16_t  pe_probenum;      /* # of initial probes */
                uint16_t  pe_keepaliveto;   /* Keepalive Timeout */
                uint16_t  pe_keepaliveint;  /* Keepalive Interval */
                uint16_t  pe_initprobeto;   /* Initial Probe Timeout */
                uint32_t  pe_reserved;      /* reserved */
        };
        
        struct shim_pathexplore {
                uint16_t  pe_probenum;      /* # of initial probes */
                uint16_t  pe_keepaliveto;   /* Keepalive Timeout */
                uint16_t  pe_keepaliveint;  /* Keepalive Interval */
                uint16_t  pe_initprobeto;   /* Initial Probe Timeout */
                uint32_t  pe_reserved;      /* reserved */
        };
        

Figure 6: Path Explore Structure

图6:路径探索结构

pe_probenum Indicates the number of initial Probe messages to be sent. The value MUST be set as per [RFC5534].

pe_probenum表示要发送的初始探测消息数。该值必须按照[RFC5534]进行设置。

pe_keepaliveto Indicates the timeout value in seconds for detecting a failure when the host does not receive any packets for a certain period of time while there is outbound traffic. When the timer expires, the path exploration procedure will be carried out by sending a REAP Probe message. The value MUST be set as per [RFC5534].

pe_Keepalive表示当主机在某段时间内没有接收到任何数据包,同时存在出站流量时,检测故障的超时值(以秒为单位)。当计时器过期时,将通过发送REAP Probe消息来执行路径探索过程。该值必须按照[RFC5534]进行设置。

pe_keepaliveint Indicates the interval of REAP Keepalive messages in seconds to be sent by the host when there is no outbound traffic to the peer host. The value MUST be set as per [RFC5534].

pe_Keepalive表示当对等主机没有出站流量时,主机发送的保留消息的间隔(以秒为单位)。该值必须按照[RFC5534]进行设置。

pe_initprobeto Indicates the retransmission timer of the REAP Probe message in milliseconds. Note that this timer is applied before exponential back-off is started. A REAP Probe message for the same locator pair may be retransmitted. The value MUST be set as per [RFC5534].

pe_initprobeto以毫秒为单位指示获取探测消息的重传计时器。请注意,此计时器在指数后退开始之前应用。同一定位器对的收割探测消息可被重传。该值必须按照[RFC5534]进行设置。

pe_reserved A reserved field for future extension. By default, the field MUST be initialized to zero.

pe_为将来的扩展保留了一个保留字段。默认情况下,该字段必须初始化为零。

8.3. Feedback Information
8.3. 反馈信息

As mentioned in Section 7.3, applications can inform the shim sub-layer about the status of unicast reachability of the locator pair currently in use. The feedback information can be handled by using ancillary data called SHIM_FEEDBACK. A new data structure named shim_feedback is illustrated in Figure 7.

如第7.3节所述,应用程序可以通知垫片子层当前使用的定位器对的单播可达性状态。可以使用称为SHIM_反馈的辅助数据来处理反馈信息。图7显示了一个名为shim_feedback的新数据结构。

        struct shim_feedback {
                uint8_t   fb_direction;    /* direction of traffic */
                uint8_t   fb_indicator;    /* indicator (1-3) */
                uint16_t  fb_reserved;     /* reserved */
        };
        
        struct shim_feedback {
                uint8_t   fb_direction;    /* direction of traffic */
                uint8_t   fb_indicator;    /* indicator (1-3) */
                uint16_t  fb_reserved;     /* reserved */
        };
        

Figure 7: Feedback Information Structure

图7:反馈信息结构

fb_direction Indicates the direction of reachability between the locator pair in question. A value of 0 indicates outbound direction, and a value of 1 indicates inbound direction.

fb_方向表示所讨论的定位器对之间的可达性方向。值0表示出站方向,值1表示入站方向。

fb_indicator A value indicating the degree of satisfaction of a unidirectional reachability for a given locator pair.

fb_指示符一个值,指示给定定位器对单向可达性的满意度。

* 0: Default value. Whenever this value is specified, the feedback information MUST NOT be processed by the shim sub-layer.

* 0:默认值。每当指定此值时,垫片子层不得处理反馈信息。

* 1: Unable to connect. There is no unidirectional reachability between the locator pair in question.

* 1:无法连接。有问题的定位器对之间没有单向可达性。

* 2: Unsatisfactory. The application is not satisfied with the unidirectional reachability between the locator pair in question.

* 2:不满意。应用程序对所讨论的定位器对之间的单向可达性不满意。

* 3: Satisfactory. There is satisfactory unidirectional reachability between the locator pair in question.

* 3:满意。在所讨论的定位器对之间存在令人满意的单向可达性。

fb_reserved Reserved field. MUST be ignored by the receiver.

fb_保留字段。必须被接收者忽略。

9. System Requirements
9. 系统要求

As addressed in Section 6, most of the socket options and ancillary data defined in this document are applicable to connected sockets. It is assumed that the kernel is capable of maintaining the association between a connected socket and a shim context. This requirement is considered to be reasonable because a pair of source and destination IP addresses is bound to a connected socket.

如第6节所述,本文件中定义的大多数插座选项和辅助数据适用于连接的插座。假设内核能够维护连接的套接字和垫片上下文之间的关联。这一要求被认为是合理的,因为一对源和目标IP地址绑定到一个连接的套接字。

10. Relation to Existing Sockets API Extensions
10. 与现有套接字API扩展的关系

This section explains the relation between the sockets API defined in this document and the existing sockets API extensions.

本节解释本文档中定义的套接字API与现有套接字API扩展之间的关系。

As mentioned in Section 6, the basic assumption is that the existing sockets API continues to work above the shim sub-layer. This means that the existing sockets API deals with identifiers, and the sockets API defined in this document deals with locators.

如第6节所述,基本假设是现有套接字API继续在垫片子层上方工作。这意味着现有的套接字API处理标识符,而本文中定义的套接字API处理定位器。

SHIM_LOC_LOCAL_SEND and SHIM_LOC_PEER_SEND socket options are semantically similar to the IPV6_PKTINFO sockets API in the sense that both provide a means for an application to set the source IP address of outbound IP packets.

SHIM_LOC_LOCAL_SEND和SHIM_LOC_PEER_SEND套接字选项在语义上类似于IPV6_PKTINFO套接字API,因为两者都为应用程序提供了设置出站IP数据包的源IP地址的方法。

SHIM_LOC_LOCAL_RECV and SHIM_LOC_PEER_RECV socket options are semantically similar to the IP_RECVDSTADDR and IPV6_PKTINFO sockets APIs in the sense that both provide a means for an application to get the source and/or destination IP address of inbound IP packets.

SHIM_LOC_LOCAL_RECV和SHIM_LOC_PEER_RECV套接字选项在语义上类似于IP_RECVDSTADDR和IPV6_PKTINFO套接字API,两者都为应用程序提供了获取入站IP数据包的源和/或目标IP地址的方法。

getsockname() and getpeername() enable an application to get the "name" of the communication endpoints, which is represented by a pair of IP addresses and port numbers assigned to the socket. getsockname() gives the IP address and port number assigned to the socket on the local side, and getpeername() gives the IP address and port number of the peer side.

getsockname()和getpeername()使应用程序能够获取通信端点的“名称”,该名称由分配给套接字的一对IP地址和端口号表示。getsockname()提供分配给本地端套接字的IP地址和端口号,getpeername()提供对等端的IP地址和端口号。

11. Operational Considerations
11. 业务考虑

This section gives operational considerations of the sockets API defined in this document.

本节给出了本文档中定义的套接字API的操作注意事项。

11.1. Conflict Resolution
11.1. 冲突解决

There can be a conflicting situation when different applications specify different preferences for the same shim context. For instance, suppose that applications A and B establish communication with the same EID pair while both applications have different preferences in their choice of local locator. The notion of context forking in Shim6 can resolve the conflicting situation.

当不同的应用程序为同一垫片上下文指定不同的首选项时,可能会出现冲突情况。例如,假设应用程序A和B使用相同的EID对建立通信,而这两个应用程序在选择本地定位器时具有不同的首选项。Shim6中的上下文分叉概念可以解决冲突情况。

It is possible that socket options defined in Section 6 cause a conflicting situation when the target context is shared by multiple applications. In such a case, the socket handler should inform the shim sub-layer that context forking is required. In Shim6, when a context is forked, a unique identifier called the Forked Instance Identifier (FII) is assigned to the newly forked context. The forked context is then exclusively associated with the socket through which a non-default preference value was specified. The forked context is maintained by the shim sub-layer during the lifetime of the associated socket instance. When the socket is closed, the shim sub-layer SHOULD delete the associated context.

当多个应用程序共享目标上下文时,第6节中定义的套接字选项可能会导致冲突情况。在这种情况下,套接字处理程序应该通知垫片子层需要上下文分叉。在Shim6中,当上下文被分叉时,一个称为分叉实例标识符(FII)的唯一标识符被分配给新分叉的上下文。然后,分叉上下文专门与套接字关联,通过该套接字指定了非默认首选项值。分叉上下文由垫片子层在关联套接字实例的生存期内维护。当套接字关闭时,垫片子层应删除关联的上下文。

When the application specifies SHIM_LOC_*_SEND specifying a different source or destination locator that does not have the highest priority and weight specified by the SHIM_LOC_*_PREF, the shim sub-layer SHOULD supersede the request made by SHIM_LOC_*_SEND over the preference specified by SHIM_LOC_*_PREF.

当应用程序指定SHIM_LOC_*\u SEND指定一个不同的源或目标定位器,该定位器不具有SHIM_LOC_*\u PREF指定的最高优先级和权重时,SHIM子层应取代SHIM_LOC_*\u SEND根据SHIM_LOC_*\u PREF指定的首选项发出的请求。

When the peer provides preferences of the locators (e.g., a Shim6 peer sends a locator with a Locator Preferences Option) that conflict with preferences specified by the applications either by SHIM_LOC_PEER_SEND or SHIM_LOC_PEER_PREF, the shim sub-layer SHOULD supersede the preferences made by the applications over the preferences specified by the peer.

当对等方提供与应用程序通过SHIM_LOC_peer_SEND或SHIM_LOC_peer_PREF指定的首选项冲突的定位器首选项(例如,Shim6对等方发送带有定位器首选项的定位器)时,垫片子层应取代应用程序的首选项,而不是对等方指定的首选项。

11.2. Incompatibility between IPv4 and IPv6
11.2. IPv4和IPv6之间的不兼容

The shim sub-layer performs identifier/locator adaptation. Therefore, in some cases, the whole IP header can be replaced with a new IP header of a different address family (e.g., conversion from IPv4 to IPv6 or vice versa). Hence, there is an issue regarding how to make the conversion with minimum impact. Note that this issue is common in other protocol conversion techniques [RFC2765] [RFC6145].

垫片子层执行标识符/定位器自适应。因此,在某些情况下,整个IP报头可以替换为不同地址系列的新IP报头(例如,从IPv4转换为IPv6或反之亦然)。因此,存在一个关于如何在影响最小的情况下进行转换的问题。请注意,此问题在其他协议转换技术[RFC2765][RFC6145]中很常见。

As studied in the previous works on protocol conversion [RFC2765], [RFC6145] some of the features (IPv6 routing headers, hop-by-hop extension headers, and destination headers) from IPv6 are not convertible to IPv4. In addition, the notion of source routing is not exactly the same in IPv4 and IPv6. This means that an error may occur during the conversion of the identifier and locator. It is outside the scope of this document to describe how the shim sub-layer should behave in such erroneous cases.

正如之前关于协议转换的工作[RFC2765],[RFC6145]中所研究的,IPv6的某些功能(IPv6路由头、逐跳扩展头和目标头)无法转换为IPv4。此外,源路由的概念在IPv4和IPv6中并不完全相同。这意味着在标识符和定位器的转换过程中可能会发生错误。描述垫片子层在此类错误情况下的行为超出了本文件的范围。

12. IANA Considerations
12. IANA考虑

There are no IANA considerations for the socket options (SHIM_*), the ancillary data, and the socket level (SOL_SHIM) that are defined in this document. All the numbers concerned are not under the control of the IETF or IANA, but they are platform-specific.

本文档中定义的插座选项(垫片)、辅助数据和插座级别(SOL垫片)没有IANA注意事项。所有相关数字不在IETF或IANA的控制之下,但它们是特定于平台的。

13. Protocol Constant
13. 协议常数

This section defines a protocol constant.

本节定义协议常量。

SHIM_MAX_LOCATORS The maximum number of locators to be included in a locator list. The value is set to 32.

SHIM_MAX_LOCATORS定位器定位器列表中要包含的最大定位器数量。该值设置为32。

14. Security Considerations
14. 安全考虑

This section gives security considerations of the API defined in this document.

本节给出了本文档中定义的API的安全注意事项。

14.1. Treatment of Unknown Locator
14.1. 未知定位器的处理

When sending IP packets, there is a possibility that an application will request the use of an unknown locator for the source and/or destination locators. Note that the treatment of an unknown locator can be a subject of security considerations, because the use of an invalid source and/or destination locator may cause a redirection attack.

发送IP数据包时,应用程序可能会请求对源和/或目标定位器使用未知定位器。请注意,对未知定位器的处理可能是安全考虑的主题,因为使用无效的源和/或目标定位器可能会导致重定向攻击。

14.1.1. Treatment of Unknown Source Locator
14.1.1. 未知源定位器的处理

The shim sub-layer checks to determine if the requested locator is available on any local interface. If not, the shim sub-layer MUST reject the request and return an error message with the EINVALIDLOCATOR code to the application. If the locator is confirmed to be available, the shim sub-layer SHOULD initiate the procedure to update the locator list.

垫片子层检查以确定请求的定位器是否在任何本地接口上可用。否则,垫片子层必须拒绝请求,并向应用程序返回带有EINVALIDLOCATOR代码的错误消息。如果确认定位器可用,垫片子层应启动更新定位器列表的程序。

Use of the following socket options and ancillary data requires treatment of an unknown source locator:

使用以下插座选项和辅助数据需要处理未知源定位器:

o SHIM_LOC_LOCAL_SEND

o 垫片位置本地发送

o SHIM_LOC_LOCAL_PREF

o 垫片位置本地预

o SHIM_LOCLIST_LOCAL

o 垫片\u本地列表\u本地

14.1.2. Treatment of Unknown Destination Locator
14.1.2. 未知目的地定位器的处理

If the shim sub-layer turns out to be Shim6, the Shim6 layer MUST reject the request for using an unknown destination locator.

如果垫片子层被证明是Shim6,则Shim6层必须拒绝使用未知目标定位器的请求。

If the shim sub-layer turns out to be HIP, the HIP layer MUST reject the request for using an unknown destination locator. There is, however, an exceptional case where the HIP layer SHOULD accept the request, provided that the HIP association is in the UNASSOCIATED state. Details of locator handling in HIP are described in Section 4.6 of [RFC6317].

如果垫片子层被证明是HIP,HIP层必须拒绝使用未知目标定位器的请求。但是,如果髋部关联处于非关联状态,则髋部层应接受请求的例外情况。[RFC6317]第4.6节描述了HIP中定位器操作的详细信息。

Use of the following socket options and ancillary data requires treatment of an unknown destination locator:

使用以下插座选项和辅助数据需要处理未知目标定位器:

o SHIM_LOC_PEER_SEND

o 垫片位置对等发送

o SHIM_LOC_PEER_PREF

o 垫片位置对等位置优先

o SHIM_LOCLIST_PEER

o 垫片\u本地列表\u对等

15. Acknowledgments
15. 致谢

The authors would like to thank Jari Arkko, who participated in the discussion that led to the first version of this document, and Tatuya Jinmei, who thoroughly reviewed the early draft version of this document and provided detailed comments on sockets API-related issues. Thomas Henderson provided valuable comments, especially from the HIP perspective.

作者要感谢Jari Arkko和Tatuya Jinmei,Jari Arkko参与了导致本文件第一版的讨论,Tatuya Jinmei彻底审查了本文件的早期草案,并就与API相关的问题提供了详细的意见。托马斯·亨德森(Thomas Henderson)提供了宝贵的意见,特别是从嘻哈的角度。

The authors sincerely thank the following people for their helpful comments regarding the document: Samu Varjonen, Dmitriy Kuptsov, Brian Carpenter, Michael Scharf, Sebastien Barre, and Roni Even.

作者真诚地感谢以下人士对该文件的有益评论:萨缪·瓦尔乔宁、德米特里·库普佐夫、布赖恩·卡彭特、迈克尔·沙尔夫、塞巴斯蒂安·巴尔和罗尼·伊恩。

16. References
16. 工具书类
16.1. Normative References
16.1. 规范性引用文件

[POSIX] "IEEE Std. 1003.1-2008 Standard for Information Technology -- Portable Operating System Interface (POSIX). Open group Technical Standard: Base Specifications, Issue 7", September 2008, <http://www.opengroup.org/austin>.

[POSIX]“IEEE标准1003.1-2008信息技术标准——便携式操作系统接口(POSIX).开放组技术标准:基本规范,第7期”,2008年9月<http://www.opengroup.org/austin>.

[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.

[RFC2119]Bradner,S.,“RFC中用于表示需求水平的关键词”,BCP 14,RFC 2119,1997年3月。

[RFC3542] Stevens, W., Thomas, M., Nordmark, E., and T. Jinmei, "Advanced Sockets Application Program Interface (API) for IPv6", RFC 3542, May 2003.

[RFC3542]Stevens,W.,Thomas,M.,Nordmark,E.,和T.Jinmei,“IPv6的高级套接字应用程序接口(API)”,RFC 3542,2003年5月。

[RFC4423] Moskowitz, R. and P. Nikander, "Host Identity Protocol (HIP) Architecture", RFC 4423, May 2006.

[RFC4423]Moskowitz,R.和P.Nikander,“主机身份协议(HIP)体系结构”,RFC 4423,2006年5月。

[RFC5533] Nordmark, E. and M. Bagnulo, "Shim6: Level 3 Multihoming Shim Protocol for IPv6", RFC 5533, June 2009.

[RFC5533]Nordmark,E.和M.Bagnulo,“Shim6:IPv6的3级多主垫片协议”,RFC 55332009年6月。

[RFC5534] Arkko, J. and I. van Beijnum, "Failure Detection and Locator Pair Exploration Protocol for IPv6 Multihoming", RFC 5534, June 2009.

[RFC5534]Arkko,J.和I.van Beijnum,“IPv6多宿的故障检测和定位器对探测协议”,RFC 55342009年6月。

16.2. Informative References
16.2. 资料性引用

[RFC2765] Nordmark, E., "Stateless IP/ICMP Translation Algorithm (SIIT)", RFC 2765, February 2000.

[RFC2765]Nordmark,E.“无状态IP/ICMP转换算法(SIIT)”,RFC2765,2000年2月。

[RFC2782] Gulbrandsen, A., Vixie, P., and L. Esibov, "A DNS RR for specifying the location of services (DNS SRV)", RFC 2782, February 2000.

[RFC2782]Gulbrandsen,A.,Vixie,P.和L.Esibov,“用于指定服务位置(DNS SRV)的DNS RR”,RFC 2782,2000年2月。

[RFC4291] Hinden, R. and S. Deering, "IP Version 6 Addressing Architecture", RFC 4291, February 2006.

[RFC4291]Hinden,R.和S.Deering,“IP版本6寻址体系结构”,RFC 42912006年2月。

[RFC5535] Bagnulo, M., "Hash-Based Addresses (HBA)", RFC 5535, June 2009.

[RFC5535]Bagnulo,M.,“基于哈希的地址(HBA)”,RFC5352009年6月。

[RFC5770] Komu, M., Henderson, T., Tschofenig, H., Melen, J., and A. Keranen, Ed., "Basic Host Identity Protocol (HIP) Extensions for Traversal of Network Address Translators", RFC 5770, April 2010.

[RFC5770]Komu,M.,Henderson,T.,Tschofenig,H.,Melen,J.,和A.Keranen,Ed.,“用于遍历网络地址转换器的基本主机身份协议(HIP)扩展”,RFC 57702010年4月。

[RFC6145] Li, X., Bao, C., and F. Baker, "IP/ICMP Translation Algorithm", RFC 6145, April 2011.

[RFC6145]Li,X.,Bao,C.,和F.Baker,“IP/ICMP翻译算法”,RFC 61452011年4月。

[RFC6317] Komu, M. and T. Henderson, "Basic Socket Interface Extensions for the Host Identity Protocol (HIP)", RFC 6317, July 2011.

[RFC6317]Komu,M.和T.Henderson,“主机标识协议(HIP)的基本套接字接口扩展”,RFC 63172011年7月。

[SHIM6-APP-REFER] Nordmark, E., "Shim6 Application Referral Issues", Work in Progress, July 2005.

[SHIM6-APP-REFER]Nordmark,E.,“SHIM6应用程序转介问题”,正在进行的工作,2005年7月。

Appendix A. Context Forking
附录A.上下文分叉

In this section, an issue concerning context forking and its relation to the multihoming shim API are discussed.

在本节中,将讨论有关上下文分叉及其与多宿主垫片API的关系的问题。

Shim6 supports the notion of context forking. A peer may decide to fork a context for a certain reason (e.g., an upper-layer protocol prefers to use a different locator pair than the one defined in an available context). The procedure of context forking is done similarly to the normal context establishment, performing the 4-way message exchange. A peer who has decided to fork a context initiates the context establishment. Hereafter, we call this peer the "initiator". The peer of the initiator is called the "responder".

Shim6支持上下文分叉的概念。对等方可能出于某种原因决定分叉上下文(例如,上层协议倾向于使用不同于在可用上下文中定义的定位器对)。上下文分叉的过程类似于正常的上下文建立,执行4路消息交换。决定分叉上下文的对等方启动上下文建立。此后,我们称该对等方为“发起方”。发起方的对等方称为“响应方”。

Once the forked context is established between the peers, on the initiator side, it is possible to apply forked context to the packet flow, since the system maintains an association between the forked context and the socket owned by the application that has requested the context forking. How this association is maintained is an implementation-specific issue. However, on the responder side, there is a question of how the outbound packet can be multiplexed by the shim sub-layer, because there is more than one Shim6 context that matches with the ULID pair of the packet flow. There is a need to differentiate packet flows not only by the ULID pairs but by some other information and associate a given packet flow with a specific context.

一旦对等方之间建立了分叉上下文,在发起方一侧,就可以将分叉上下文应用于数据包流,因为系统在分叉上下文和请求上下文分叉的应用程序所拥有的套接字之间保持关联。如何维护这种关联是一个特定于实现的问题。然而,在响应器侧,存在出站分组如何被垫片子层复用的问题,因为存在多个与分组流的ULID对匹配的Shim6上下文。不仅需要通过ULID对来区分分组流,还需要通过一些其他信息来区分分组流,并将给定分组流与特定上下文相关联。

Figure 8 gives an example of a scenario where two communicating peers fork a context. Initially, there has been a single transaction between the peers, by the application 1 (App1). Accordingly, another transaction is started, by application 2 (App2). Both of the transactions are made based on the same ULID pair. The first context pair (Ctx1) is established for the transaction of App1. Given the requests from App2, the shim sub-layer on Peer 1 decides to fork a context. Accordingly, a forked context (Ctx2) is established between the peers, which should be exclusively applied to the transaction of App2. Ideally, multiplexing and demultiplexing of packet flows that relate to App1 and App2 should be done as illustrated in Figure 8. However, as mentioned earlier, the responder needs to multiplex outbound flows of App1 and App2 somehow. Note that if a context forking occurs on the initiator side, a context forking needs to also occur on the responder side.

图8给出了一个场景示例,其中两个通信对等方分叉一个上下文。最初,应用程序1(App1)在对等方之间存在一个事务。因此,应用程序2(App2)启动另一个事务。这两个事务都基于相同的ULID对进行。为App1的事务建立第一个上下文对(Ctx1)。给定来自App2的请求,对等1上的垫片子层决定分叉一个上下文。因此,在对等方之间建立分叉上下文(Ctx2),该上下文应专门应用于App2的事务。理想情况下,与App1和App2相关的数据包流的多路复用和解多路复用应该如图8所示完成。然而,如前所述,响应者需要以某种方式多路复用App1和App2的出站流。注意,如果上下文分叉发生在启动器端,那么上下文分叉也需要发生在响应端。

Peer 1 Peer 2 (initiator) (responder)

对等方1对等方2(发起方)(响应方)

       +----+         +----+                  +----+         +----+
       |App1|         |App2|                  |App1|         |App2|
       +----+         +----+                  +----+         +----+
         |^             |^                      ^|             ^|
         v|             v|                      |v             |v
    -----S1-------------S2-----            -----S1-------------S2-----
         ||             ||                      ||             ||
         ||             ||                      ||             ||
        
       +----+         +----+                  +----+         +----+
       |App1|         |App2|                  |App1|         |App2|
       +----+         +----+                  +----+         +----+
         |^             |^                      ^|             ^|
         v|             v|                      |v             |v
    -----S1-------------S2-----            -----S1-------------S2-----
         ||             ||                      ||             ||
         ||             ||                      ||             ||
        
        Ctx1           Ctx2                    Ctx1           Ctx2
    ULID:<A1,B1>   ULID:<A1,B1>            ULID:<B1,A1>    ULID:<B1,A1>
    Loc: <A1,B2>   Loc: <A1,B3>            Loc: <B2,A1>    Loc: <B3,A1>
    FII: 0         FII: 100                FII: 0          FII: 100
        
        Ctx1           Ctx2                    Ctx1           Ctx2
    ULID:<A1,B1>   ULID:<A1,B1>            ULID:<B1,A1>    ULID:<B1,A1>
    Loc: <A1,B2>   Loc: <A1,B3>            Loc: <B2,A1>    Loc: <B3,A1>
    FII: 0         FII: 100                FII: 0          FII: 100
        
         |^             |^                      ^|             ^|
         ||             ||                      ||             ||
         ||             ||                      ||             ||
         \..............||....................../|             ||
          \.............||......................./             ||
                        ||                                     ||
                        \|...................................../|
                         \....................................../
        
         |^             |^                      ^|             ^|
         ||             ||                      ||             ||
         ||             ||                      ||             ||
         \..............||....................../|             ||
          \.............||......................./             ||
                        ||                                     ||
                        \|...................................../|
                         \....................................../
        

Figure 8: Context Forking

图8:上下文分叉

How to solve the issue described above is a topic for further study.

如何解决上述问题是一个有待进一步研究的课题。

Authors' Addresses

作者地址

Miika Komu Aalto University Espoo Finland

芬兰埃斯波大学

   Phone: +358505734395
   Fax:   +358947025014
   EMail: miika@iki.fi
   URI:   http://cse.aalto.fi/research/groups/datacommunications/people/
        
   Phone: +358505734395
   Fax:   +358947025014
   EMail: miika@iki.fi
   URI:   http://cse.aalto.fi/research/groups/datacommunications/people/
        

Marcelo Bagnulo Universidad Carlos III de Madrid Av. Universidad 30 Leganes 28911 SPAIN

马德里卡洛斯三世大学。西班牙勒冈30大学28911

   Phone: +34 91 6248837
   EMail: marcelo@it.uc3m.es
   URI:   http://it.uc3m.es/marcelo
        
   Phone: +34 91 6248837
   EMail: marcelo@it.uc3m.es
   URI:   http://it.uc3m.es/marcelo
        

Kristian Slavov Ericsson Research Nomadiclab Hirsalantie 11 Jorvas FI-02420 Finland

克里斯蒂安·斯拉沃夫·爱立信游牧研究实验室Hirsalantie 11 Jorvas FI-02420芬兰

   Phone: +358 9 299 3286
   EMail: kristian.slavov@ericsson.com
        
   Phone: +358 9 299 3286
   EMail: kristian.slavov@ericsson.com
        

Shinta Sugimoto (editor) Nippon Ericsson K.K. Koraku Mori Building 1-4-14, Koraku, Bunkyo-ku Tokyo 112-0004 Japan

杉本新田(编辑)日本爱立信K.K.Koraku Mori大厦1-4-14,日本东京本岛Koraku 112-0004

   Phone: +81 3 3830 2241
   EMail: shinta.sugimoto@ericsson.com
        
   Phone: +81 3 3830 2241
   EMail: shinta.sugimoto@ericsson.com