idnits 2.17.1 draft-ietf-dtn-tcpclv4-11.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- -- The draft header indicates that this document obsoletes RFC7242, but the abstract doesn't seem to directly say this. It does mention RFC7242 though, so this could be OK. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (February 28, 2019) is 1882 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'TCPTERM' is mentioned on line 585, but not defined == Missing Reference: 'SESSTERM' is mentioned on line 638, but not defined == Missing Reference: 'I1' is mentioned on line 781, but not defined == Missing Reference: 'L1' is mentioned on line 769, but not defined == Missing Reference: 'L2' is mentioned on line 769, but not defined == Missing Reference: 'L3' is mentioned on line 775, but not defined ** Obsolete normative reference: RFC 7525 (ref. 'BCP195') (Obsoleted by RFC 9325) == Outdated reference: A later version (-31) exists of draft-ietf-dtn-bpbis-12 ** Obsolete normative reference: RFC 793 (Obsoleted by RFC 9293) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) == Outdated reference: A later version (-27) exists of draft-ietf-dtn-bpsec-09 Summary: 3 errors (**), 0 flaws (~~), 9 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Delay Tolerant Networking B. Sipos 3 Internet-Draft RKF Engineering 4 Obsoletes: 7242 (if approved) M. Demmer 5 Intended status: Standards Track UC Berkeley 6 Expires: September 1, 2019 J. Ott 7 Aalto University 8 S. Perreault 9 February 28, 2019 11 Delay-Tolerant Networking TCP Convergence Layer Protocol Version 4 12 draft-ietf-dtn-tcpclv4-11 14 Abstract 16 This document describes a revised protocol for the TCP-based 17 convergence layer (TCPCL) for Delay-Tolerant Networking (DTN). The 18 protocol revision is based on implementation issues in the original 19 TCPCL Version 3 of RFC7242 and updates to the Bundle Protocol 20 contents, encodings, and convergence layer requirements in Bundle 21 Protocol Version 7. Specifically, the TCPCLv4 uses CBOR-encoded BPv7 22 bundles as its service data unit being transported and provides a 23 reliable transport of such bundles. Several new IANA registries are 24 defined for TCPCLv4 which define some behaviors inherited from 25 TCPCLv3 but with updated encodings and/or semantics. 27 Status of This Memo 29 This Internet-Draft is submitted in full conformance with the 30 provisions of BCP 78 and BCP 79. 32 Internet-Drafts are working documents of the Internet Engineering 33 Task Force (IETF). Note that other groups may also distribute 34 working documents as Internet-Drafts. The list of current Internet- 35 Drafts is at https://datatracker.ietf.org/drafts/current/. 37 Internet-Drafts are draft documents valid for a maximum of six months 38 and may be updated, replaced, or obsoleted by other documents at any 39 time. It is inappropriate to use Internet-Drafts as reference 40 material or to cite them other than as "work in progress." 42 This Internet-Draft will expire on September 1, 2019. 44 Copyright Notice 46 Copyright (c) 2019 IETF Trust and the persons identified as the 47 document authors. All rights reserved. 49 This document is subject to BCP 78 and the IETF Trust's Legal 50 Provisions Relating to IETF Documents 51 (https://trustee.ietf.org/license-info) in effect on the date of 52 publication of this document. Please review these documents 53 carefully, as they describe your rights and restrictions with respect 54 to this document. Code Components extracted from this document must 55 include Simplified BSD License text as described in Section 4.e of 56 the Trust Legal Provisions and are provided without warranty as 57 described in the Simplified BSD License. 59 Table of Contents 61 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 62 1.1. Convergence Layer Services . . . . . . . . . . . . . . . 4 63 2. Requirements Language . . . . . . . . . . . . . . . . . . . . 6 64 2.1. Definitions Specific to the TCPCL Protocol . . . . . . . 6 65 3. General Protocol Description . . . . . . . . . . . . . . . . 9 66 3.1. TCPCL Session Overview . . . . . . . . . . . . . . . . . 9 67 3.2. TCPCL States and Transitions . . . . . . . . . . . . . . 11 68 3.3. Transfer Segmentation Policies . . . . . . . . . . . . . 16 69 3.4. Example Message Exchange . . . . . . . . . . . . . . . . 17 70 4. Session Establishment . . . . . . . . . . . . . . . . . . . . 19 71 4.1. TCP Connection . . . . . . . . . . . . . . . . . . . . . 19 72 4.2. Contact Header . . . . . . . . . . . . . . . . . . . . . 19 73 4.3. Contact Validation and Negotiation . . . . . . . . . . . 20 74 4.4. Session Security . . . . . . . . . . . . . . . . . . . . 21 75 4.4.1. TLS Handshake Result . . . . . . . . . . . . . . . . 22 76 4.4.2. Example TLS Initiation . . . . . . . . . . . . . . . 22 77 4.5. Message Type Codes . . . . . . . . . . . . . . . . . . . 23 78 4.6. Session Initialization Message (SESS_INIT) . . . . . . . 24 79 4.7. Session Parameter Negotiation . . . . . . . . . . . . . . 26 80 4.8. Session Extension Items . . . . . . . . . . . . . . . . . 27 81 5. Established Session Operation . . . . . . . . . . . . . . . . 28 82 5.1. Upkeep and Status Messages . . . . . . . . . . . . . . . 28 83 5.1.1. Session Upkeep (KEEPALIVE) . . . . . . . . . . . . . 28 84 5.1.2. Message Rejection (MSG_REJECT) . . . . . . . . . . . 29 85 5.2. Bundle Transfer . . . . . . . . . . . . . . . . . . . . . 30 86 5.2.1. Bundle Transfer ID . . . . . . . . . . . . . . . . . 31 87 5.2.2. Data Transmission (XFER_SEGMENT) . . . . . . . . . . 31 88 5.2.3. Data Acknowledgments (XFER_ACK) . . . . . . . . . . . 33 89 5.2.4. Transfer Refusal (XFER_REFUSE) . . . . . . . . . . . 34 90 5.2.5. Transfer Extension Items . . . . . . . . . . . . . . 37 91 6. Session Termination . . . . . . . . . . . . . . . . . . . . . 38 92 6.1. Session Termination Message (SESS_TERM) . . . . . . . . . 39 93 6.2. Idle Session Shutdown . . . . . . . . . . . . . . . . . . 41 94 7. Implementation Status . . . . . . . . . . . . . . . . . . . . 41 95 8. Security Considerations . . . . . . . . . . . . . . . . . . . 42 96 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 43 97 9.1. Port Number . . . . . . . . . . . . . . . . . . . . . . . 43 98 9.2. Protocol Versions . . . . . . . . . . . . . . . . . . . . 44 99 9.3. Session Extension Types . . . . . . . . . . . . . . . . . 44 100 9.4. Transfer Extension Types . . . . . . . . . . . . . . . . 45 101 9.5. Message Types . . . . . . . . . . . . . . . . . . . . . . 46 102 9.6. XFER_REFUSE Reason Codes . . . . . . . . . . . . . . . . 46 103 9.7. SESS_TERM Reason Codes . . . . . . . . . . . . . . . . . 47 104 9.8. MSG_REJECT Reason Codes . . . . . . . . . . . . . . . . . 48 105 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 49 106 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 49 107 11.1. Normative References . . . . . . . . . . . . . . . . . . 49 108 11.2. Informative References . . . . . . . . . . . . . . . . . 50 109 Appendix A. Significant changes from RFC7242 . . . . . . . . . . 50 110 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 51 112 1. Introduction 114 This document describes the TCP-based convergence-layer protocol for 115 Delay-Tolerant Networking. Delay-Tolerant Networking is an end-to- 116 end architecture providing communications in and/or through highly 117 stressed environments, including those with intermittent 118 connectivity, long and/or variable delays, and high bit error rates. 119 More detailed descriptions of the rationale and capabilities of these 120 networks can be found in "Delay-Tolerant Network Architecture" 121 [RFC4838]. 123 An important goal of the DTN architecture is to accommodate a wide 124 range of networking technologies and environments. The protocol used 125 for DTN communications is the Bundle Protocol Version 7 (BPv7) 126 [I-D.ietf-dtn-bpbis], an application-layer protocol that is used to 127 construct a store-and-forward overlay network. BPv7 requires the 128 services of a "convergence-layer adapter" (CLA) to send and receive 129 bundles using the service of some "native" link, network, or Internet 130 protocol. This document describes one such convergence-layer adapter 131 that uses the well-known Transmission Control Protocol (TCP). This 132 convergence layer is referred to as TCP Convergence Layer Version 4 133 (TCPCLv4). For the remainder of this document, the abbreviation "BP" 134 without the version suffix refers to BPv7. For the remainder of this 135 document, the abbreviation "TCPCL" without the version suffix refers 136 to TCPCLv4. 138 The locations of the TCPCL and the BP in the Internet model protocol 139 stack (described in [RFC1122]) are shown in Figure 1. In particular, 140 when BP is using TCP as its bearer with TCPCL as its convergence 141 layer, both BP and TCPCL reside at the application layer of the 142 Internet model. 144 +-------------------------+ 145 | DTN Application | -\ 146 +-------------------------| | 147 | Bundle Protocol (BP) | -> Application Layer 148 +-------------------------+ | 149 | TCP Conv. Layer (TCPCL) | | 150 +-------------------------+ | 151 | TLS (optional) | -/ 152 +-------------------------+ 153 | TCP | ---> Transport Layer 154 +-------------------------+ 155 | IPv4/IPv6 | ---> Network Layer 156 +-------------------------+ 157 | Link-Layer Protocol | ---> Link Layer 158 +-------------------------+ 160 Figure 1: The Locations of the Bundle Protocol and the TCP 161 Convergence-Layer Protocol above the Internet Protocol Stack 163 This document describes the format of the protocol data units passed 164 between entities participating in TCPCL communications. This 165 document does not address: 167 o The format of protocol data units of the Bundle Protocol, as those 168 are defined elsewhere in [RFC5050] and [I-D.ietf-dtn-bpbis]. This 169 includes the concept of bundle fragmentation or bundle 170 encapsulation. The TCPCL transfers bundles as opaque data blocks. 172 o Mechanisms for locating or identifying other bundle entities 173 within an internet. 175 1.1. Convergence Layer Services 177 This version of the TCPCL provides the following services to support 178 the overlaying Bundle Protocol agent. In all cases, this is not an 179 API defintion but a logical description of how the CL may interact 180 with the BP agent. Each of these interactions may be associated with 181 any number of additional metadata items as necessary to support the 182 operation of the CL or BP agent. 184 Attempt Session The TCPCL allows a BP agent to pre-emptively attempt 185 to establish a TCPCL session with a peer entity. Each session 186 attempt can send a different set of session negotiation parameters 187 as directed by the BP agent. 189 Terminate Session The TCPCL allows a BP agent to pre-emptively 190 terminate an established TCPCL session with a peer entity. The 191 terminate request is on a per-session basis. 193 Session State Changed The TCPCL supports indication when the session 194 state changes. The top-level session states indicated are: 196 Contact Negotating: A TCP connection has been made (as either 197 active or passive entity) and contact negotiation has begun. 199 Session Negotiating: Contact negotation has been completed 200 (including possible TLS use) and session negotiation has begun. 202 Established: The session has been fully established and is ready 203 for its first transfer. 205 Closing: The entity received a SESS_TERM message and is in the 206 closing state. 208 Terminated: The session has finished normal termination 209 sequencing.. 211 Failed: The session ended without normal termination sequencing. 213 Session Idle Changed The TCPCL supports indication when the live/ 214 idle sub-state changes. This occurs only when the top-level 215 session state is Established. Because TCPCL transmits serially 216 over a TCP connection, it suffers from "head of queue blocking" 217 this indication provides information about when a session is 218 available for immediate transfer start. 220 Begin Transmission The principal purpose of the TCPCL is to allow a 221 BP agent to transmit bundle data over an established TCPCL 222 session. Transmission request is on a per-session basis, the CL 223 does not necessarily perform any per-session or inter-session 224 queueing. Any queueing of transmissions is the obligation of the 225 BP agent. 227 Transmission Success The TCPCL supports positive indication when a 228 bundle has been fully transferred to a peer entity. 230 Transmission Intermediate Progress The TCPCL supports positive 231 indication of intermediate progress of transferr to a peer entity. 232 This intermediate progress is at the granularity of each 233 transferred segment. 235 Transmission Failure The TCPCL supports positive indication of 236 certain reasons for bundle transmission failure, notably when the 237 peer entity rejects the bundle or when a TCPCL session ends before 238 transferr success. The TCPCL itself does not have a notion of 239 transfer timeout. 241 Reception Initialized The TCPCL supports indication to the reciver 242 just before any transmssion data is sent. This corresponds to 243 reception of the XFER_SEGMENT message with the START flag set. 245 Interrupt Reception The TCPCL allows a BP agent to interrupt an 246 individual transfer before it has fully completed (successfully or 247 not). Interruption can occur any time after the reception is 248 initialized. 250 Reception Success The TCPCL supports positive indication when a 251 bundle has been fully transferred from a peer entity. 253 Reception Intermediate Progress The TCPCL supports positive 254 indication of intermediate progress of transfer from the peer 255 entity. This intermediate progress is at the granularity of each 256 transferred segment. Intermediate reception indication allows a 257 BP agent the chance to inspect bundle header contents before the 258 entire bundle is available, and thus supports the "Reception 259 Interruption" capability. 261 Reception Failure The TCPCL supports positive indication of certain 262 reasons for reception failure, notably when the local entity 263 rejects an attempted transfer for some local policy reason or when 264 a TCPCL session ends before transfer success. The TCPCL itself 265 does not have a notion of transfer timeout. 267 2. Requirements Language 269 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 270 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 271 document are to be interpreted as described in [RFC2119]. 273 2.1. Definitions Specific to the TCPCL Protocol 275 This section contains definitions specific to the TCPCL protocol. 277 TCPCL Entity: This is the notional TCPCL application that initiates 278 TCPCL sessions. This design, implementation, configuration, and 279 specific behavior of such an entity is outside of the scope of 280 this document. However, the concept of an entity has utility 281 within the scope of this document as the container and initiator 282 of TCPCL sessions. The relationship between a TCPCL entity and 283 TCPCL sessions is defined as follows: 285 A TCPCL Entity MAY actively initiate any number of TCPCL 286 Sessions and should do so whenever the entity is the initial 287 transmitter of information to another entity in the network. 289 A TCPCL Entity MAY support zero or more passive listening 290 elements that listen for connection requests from other TCPCL 291 Entities operating on other entitys in the network. 293 A TCPCL Entity MAY passivley initiate any number of TCPCL 294 Sessions from requests received by its passive listening 295 element(s) if the entity uses such elements. 297 These relationships are illustrated in Figure 2. For most TCPCL 298 behavior within a session, the two entities are symmetric and 299 there is no protocol distinction between them. Some specific 300 behavior, particularly during session establishment, distinguishes 301 between the active entity and the passive entity. For the 302 remainder of this document, the term "entity" without the prefix 303 "TCPCL" refers to a TCPCL entity. 305 TCP Connection: The term Connection in this specification 306 exclusively refers to a TCP connection and any and all behaviors, 307 sessions, and other states association with that TCP connection. 309 TCPCL Session: A TCPCL session (as opposed to a TCP connection) is a 310 TCPCL communication relationship between two TCPCL entities. 311 Within a single TCPCL session there are two possible transfer 312 streams; one in each direction, with one stream from each entity 313 being the outbound stream and the other being the inbound stream. 314 The lifetime of a TCPCL session is bound to the lifetime of an 315 underlying TCP connection. A TCPCL session is terminated when the 316 TCP connection ends, due either to one or both entities actively 317 terminating the TCP connection or due to network errors causing a 318 failure of the TCP connection. For the remainder of this 319 document, the term "session" without the prefix "TCPCL" refers to 320 a TCPCL session. 322 Session parameters: These are a set of values used to affect the 323 operation of the TCPCL for a given session. The manner in which 324 these parameters are conveyed to the bundle entity and thereby to 325 the TCPCL is implementation dependent. However, the mechanism by 326 which two entities exchange and negotiate the values to be used 327 for a given session is described in Section 4.3. 329 Transfer Stream: A Transfer stream is a uni-directional user-data 330 path within a TCPCL Session. Messages sent over a transfer stream 331 are serialized, meaning that one set of user data must complete 332 its transmission prior to another set of user data being 333 transmitted over the same transfer stream. Each uni-directional 334 stream has a single sender entity and a single receiver entity. 336 Transfer: This refers to the procedures and mechanisms for 337 conveyance of an individual bundle from one node to another. Each 338 transfer within TCPCL is identified by a Transfer ID number which 339 is unique only to a single direction within a single Session. 341 Transfer Segment: A subset of a transfer of user data being 342 communicated over a trasnfer stream. 344 Idle Session: A TCPCL session is idle while the only messages being 345 transmitted or received are KEEPALIVE messages. 347 Live Session: A TCPCL session is live while any messages are being 348 transmitted or received. 350 Reason Codes: The TCPCL uses numeric codes to encode specific 351 reasons for individual failure/error message types. 353 The relationship between connections, sessions, and streams is shown 354 in Figure 3. 356 +--------------------------------------------+ 357 | TCPCL Entity | 358 | | +----------------+ 359 | +--------------------------------+ | | |-+ 360 | | Actively Inititated Session #1 +------------->| Other | | 361 | +--------------------------------+ | | TCPCL Entity's | | 362 | ... | | Passive | | 363 | +--------------------------------+ | | Listener | | 364 | | Actively Inititated Session #n +------------->| | | 365 | +--------------------------------+ | +----------------+ | 366 | | +-----------------+ 367 | +---------------------------+ | 368 | +---| +---------------------------+ | +----------------+ 369 | | | | Optional Passive | | | |-+ 370 | | +-| Listener(s) +<-------------+ | | 371 | | +---------------------------+ | | | | 372 | | | | Other | | 373 | | +---------------------------------+ | | TCPCL Entity's | | 374 | +--->| Passively Inititated Session #1 +-------->| Active | | 375 | | +---------------------------------+ | | Initiator(s) | | 376 | | | | | | 377 | | +---------------------------------+ | | | | 378 | +--->| Passively Inititated Session #n +-------->| | | 379 | +---------------------------------+ | +----------------+ | 380 | | +-----------------+ 381 +--------------------------------------------+ 383 Figure 2: The relationships between TCPCL entities 385 +----------------------------+ +--------------------------+ 386 | TCPCL Session | | TCPCL "Other" Session | 387 | | | | 388 | +-----------------------+ | | +---------------------+ | 389 | | TCP Connection | | | | TCP Connection | | 390 | | | | | | | | 391 | | +-------------------+ | | | | +-----------------+ | | 392 | | | Optional Inbound | | | | | | Peer Outbound | | | 393 | | | Transfer Stream |<-[Seg]--[Seg]--[Seg]-| | Transfer Stream | | | 394 | | | ----- | | | | | | ----- | | | 395 | | | RECEIVER | | | | | | SENDER | | | 396 | | +-------------------+ | | | | +-----------------+ | | 397 | | | | | | | | 398 | | +-------------------+ | | | | +-----------------+ | | 399 | | | Optional Outbound | | | | | | Peer Inbound | | | 400 | | | Transfer Stream |------[Seg]---[Seg]---->| Transfer Stream | | | 401 | | | ----- | | | | | | ----- | | | 402 | | | SENDER | | | | | | RECEIVER | | | 403 | | +-------------------+ | | | | +-----------------+ | | 404 | +-----------------------+ | | +---------------------+ | 405 +----------------------------+ +--------------------------+ 407 Figure 3: The relationship within a TCPCL Session of its two streams 409 3. General Protocol Description 411 The service of this protocol is the transmission of DTN bundles via 412 the Transmission Control Protocol (TCP). This document specifies the 413 encapsulation of bundles, procedures for TCP setup and teardown, and 414 a set of messages and node requirements. The general operation of 415 the protocol is as follows. 417 3.1. TCPCL Session Overview 419 First, one node establishes a TCPCL session to the other by 420 initiating a TCP connection in accordance with [RFC0793]. After 421 setup of the TCP connection is complete, an initial contact header is 422 exchanged in both directions to establish a shared TCPCL version and 423 possibly initiate TLS security. Once contact negotiation is 424 complete, TCPCL messaging is available and the session negotiation is 425 used to set parameters of the TCPCL session. One of these parameters 426 is a singleton endpoint identifier for each node (not the singleton 427 Endpoint Identifier (EID) of any application running on the node) to 428 denote the bundle-layer identity of each DTN node. This is used to 429 assist in routing and forwarding messages (e.g. to prevent loops). 431 Once negotiated, the parameters of a TCPCL session cannot change and 432 if there is a desire by either peer to transfer data under different 433 parameters then a new session must be established. This makes CL 434 logic simpler but relies on the assumption that establishing a TCP 435 connection is lightweight enough that TCP connection overhead is 436 negligable compared to TCPCL data sizes. 438 Once the TCPCL session is established and configured in this way, 439 bundles can be transferred in either direction. Each transfer is 440 performed by an sequence of logical segments of data within 441 XFER_SEGMENT messages. Multiple bundles can be transmitted 442 consecutively in a single direction on a single TCPCL connection. 443 Segments from different bundles are never interleaved. Bundle 444 interleaving can be accomplished by fragmentation at the BP layer or 445 by establishing multiple TCPCL sessions between the same peers. 447 A feature of this protocol is for the receiving node to send 448 acknowledgment (XFER_ACK) messages as bundle data segments arrive. 449 The rationale behind these acknowledgments is to enable the sender 450 node to determine how much of the bundle has been received, so that 451 in case the session is interrupted, it can perform reactive 452 fragmentation to avoid re-sending the already transmitted part of the 453 bundle. In addition, there is no explicit flow control on the TCPCL 454 layer. 456 A TCPCL receiver can interrupt the transmission of a bundle at any 457 point in time by replying with a XFER_REFUSE message, which causes 458 the sender to stop transmission of the associated bundle (if it 459 hasn't already finished transmission) Note: This enables a cross- 460 layer optimization in that it allows a receiver that detects that it 461 already has received a certain bundle to interrupt transmission as 462 early as possible and thus save transmission capacity for other 463 bundles. 465 For sessions that are idle, a KEEPALIVE message is sent at a 466 negotiated interval. This is used to convey node live-ness 467 information during otherwise message-less time intervals. 469 A SESS_TERM message is used to start the closing of a TCPCL session 470 (see Section 6.1). During shutdown sequencing, in-progress transfers 471 can be completed but no new transfers can be initiated. A SESS_TERM 472 message can also be used to refuse a session setup by a peer (see 473 Section 4.3). It is an implementation matter to determine whether or 474 not to close a TCPCL session while there are no transfers queued or 475 in-progress. 477 Once a session is established established, TCPCL is a symmetric 478 protocol between the peers. Both sides can start sending data 479 segments in a session, and one side's bundle transfer does not have 480 to complete before the other side can start sending data segments on 481 its own. Hence, the protocol allows for a bi-directional mode of 482 communication. Note that in the case of concurrent bidirectional 483 transmission, acknowledgment segments MAY be interleaved with data 484 segments. 486 3.2. TCPCL States and Transitions 488 The states of a nominal TCPCL session (i.e. without session failures) 489 are indicated in Figure 4. 491 +-------+ 492 | START | 493 +-------+ 494 | 495 TCP Establishment 496 | 497 V 498 +-----------+ +---------------------+ 499 | TCP |----------->| Contact / Session | 500 | Connected | | Negotiation | 501 +-----------+ +---------------------+ 502 | 503 +-----Session Parameters-----+ 504 | Negotiated 505 V 506 +-------------+ +-------------+ 507 | Established |----New Transfer---->| Established | 508 | Session | | Session | 509 | Idle |<---Transfers Done---| Live | 510 +-------------+ +-------------+ 511 | | 512 +------------------------------------+ 513 | 514 SESS_TERM Exchange 515 | 516 V 517 +-------------+ 518 | Established | +-------------+ 519 | Session |----Transfers------>| TCP | 520 | Ending | Done | Terminating | 521 +-------------+ +-------------+ 522 | 523 +------------Close Message------------+ 524 | 525 V 526 +-------+ 527 | END | 528 +-------+ 530 Figure 4: Top-level states of a TCPCL session 532 Notes on Established Session states: 534 Session "Live" means transmitting or reeiving over a transfer 535 stream. 537 Session "Idle" means no transmission/reception over a transfer 538 stream. 540 Session "Closing" means no new transfers will be allowed. 542 The contact negotiation sequencing is performed either as the active 543 or passive peer, and is illustrated in Figure 5 and Figure 6 544 respectively which both share the data validation and analyze final 545 states of Figure 7. 547 +-------+ 548 | START |-----TCP-----+ 549 +-------+ Connecting | 550 V 551 +-----------+ +---------+ 552 | Connected |--OK-->| Send CH |--OK-->[PCH] 553 +-----------+ +---------+ 554 | | 555 Error Error 556 | | 557 V | 558 [TCPTERM]<-------------+ 560 Figure 5: Contact Initiation as Active peer 562 +-------+ 563 | START |-----TCP----->[PCH] 564 +-------+ Connected 566 Figure 6: Contact Initiation as Passive peer 567 +-------->[TCPTERM]<----------+ 568 | | 569 Timeout Error 570 or Error | 571 | | 572 +-------+ +---------+ Contact +----------+ 573 | START |---->| Waiting |---- Header --->| Validate | 574 +-------+ +---------+ Received +----------+ 575 | 576 +---------------------------+ 577 | 578 V 579 +---------+ 580 +--Error--| Analyze |---No TLS---->[SI] 581 | | | ^ 582 | +---------+ | 583 | | | 584 V TLS | 585 [TCPTERM] Negotiated | 586 ^ | | 587 | V | 588 | +-----------+ | 589 | | Establish |---Success---+ 590 +--Error--| TLS | 591 +-----------+ 593 Figure 7: Processing of Contact Header (PCH) 595 The session negotiation sequencing is performed either as the active 596 or passive peer, and is illustrated in Figure 8 and Figure 9 597 respectively which both share the data validation and analyze final 598 states of Figure 10. 600 +-------+ TCPCL 601 | START |--Messaging--+ 602 +-------+ Available | 603 V 604 +----------------+ 605 | Send SESS_INIT |--OK-->[PSI] 606 +----------------+ 607 | 608 Error 609 | 610 V 611 [SESSTERM] 613 Figure 8: Session Initiation as Active peer 615 +-------+ TCPCL 616 | START |---Messaging-->[PSI] 617 +-------+ Available 619 Figure 9: Session Initiation as Passive peer 621 +------->[SESSTERM]<--------+ 622 | | 623 Timeout Error 624 or Error | 625 | | 626 +-------+ +---------+ +----------+ 627 | START |---->| Waiting |---SESS_INIT--->| Validate | 628 +-------+ +---------+ Received +----------+ 629 | 630 +---------------------------+ 631 | 632 V 633 +---------+ +--------------+ 634 +--Error--| Analyze |---->| Established | 635 | | | | Session Idle | 636 | +---------+ +--------------+ 637 V 638 [SESSTERM] 640 Figure 10: Processing of Session Initiation (PSI) 642 Transfers can occur after a session is established and it's not in 643 the ending state. Each transfer occurs within a single logical 644 transfer stream between a sender and a receiver, as illustrated in 645 Figure 11 and Figure 12 respectively. 647 +--Send XFER_SEGMENT--+ 648 +--------+ | | 649 | Stream | +-------------+ | 650 | Idle |---Send XFER_SEGMENT-->| In Progress |<------------+ 651 +--------+ +-------------+ 652 | 653 +---------All segments sent-------+ 654 | 655 V 656 +---------+ +--------+ 657 | Waiting |---- Receive Final---->| Stream | 658 | for Ack | XFER_ACK | IDLE | 659 +---------+ +--------+ 661 Figure 11: Transfer sender states 663 Notes on transfer sending: 665 Pipelining of transfers can occur when the sending entity begins a 666 new transfer while in the "Waiting for Ack" state. 668 +-Receive XFER_SEGMENT-+ 669 +--------+ | Send XFER_ACK | 670 | Stream | +-------------+ | 671 | IDLE |--Receive XFER_SEGMENT-->| In Progress |<-------------+ 672 +--------+ +-------------+ 673 | 674 +--------Sent Final XFER_ACK--------+ 675 | 676 V 677 +--------+ 678 | Stream | 679 | IDLE | 680 +--------+ 682 Figure 12: Transfer receiver states 684 3.3. Transfer Segmentation Policies 686 Each TCPCL session allows a negotiated transfer segmentation polcy to 687 be applied in each transfer direction. A receiving node can set the 688 Segment MRU in its contact header to determine the largest acceptable 689 segment size, and a transmitting node can segment a transfer into any 690 sizes smaller than the receiver's Segment MRU. It is a network 691 administration matter to determine an appropriate segmentation policy 692 for entities operating TCPCL, but guidance given here can be used to 693 steer policy toward performance goals. It is also advised to 694 consider the Segment MRU in relation to chunking/packetization 695 performed by TLS, TCP, and any intermediate network-layer nodes. 697 Minimum Overhead For a simple network expected to exchange 698 relatively small bundles, the Segment MRU can be set to be 699 identical to the Transfer MRU which indicates that all transfers 700 can be sent with a single data segment (i.e. no actual 701 segmentation). If the network is closed and all transmitters are 702 known to follow a single-segment transfer policy, then receivers 703 can avoid the necessity of segment reassembly. Because this CL 704 operates over a TCP stream, which suffers from a form of head-of- 705 queue blocking between messages, while one node is transmitting a 706 single XFER_SEGMENT message it is not able to transmit any 707 XFER_ACK or XFER_REFUSE for any associated received transfers. 709 Predictable Message Sizing In situations where the maximum message 710 size is desired to be well-controlled, the Segment MRU can be set 711 to the largest acceptable size (the message size less XFER_SEGMENT 712 header size) and transmitters can always segment a transfer into 713 maximum-size chunks no larger than the Segment MRU. This 714 guarantees that any single XFER_SEGMENT will not monopolize the 715 TCP stream for too long, which would prevent outgoing XFER_ACK and 716 XFER_REFUSE associated with received transfers. 718 Dynamic Segmentation Even after negotiation of a Segment MRU for 719 each receiving node, the actual transfer segmentation only needs 720 to guarantee than any individual segment is no larger than that 721 MRU. In a situation where network "goodput" is dynamic, the 722 transfer segmentation size can also be dynamic in order to control 723 message transmission duration. 725 Many other policies can be established in a TCPCL network between 726 these two extremes. Different policies can be applied to each 727 direction to/from any particular node. Additionally, future header 728 and transfer extension types can apply further nuance to transfer 729 policies and policy negotiation. 731 3.4. Example Message Exchange 733 The following figure depicts the protocol exchange for a simple 734 session, showing the session establishment and the transmission of a 735 single bundle split into three data segments (of lengths "L1", "L2", 736 and "L3") from Entity A to Entity B. 738 Note that the sending node can transmit multiple XFER_SEGMENT 739 messages without waiting for the corresponding XFER_ACK responses. 740 This enables pipelining of messages on a transfer stream. Although 741 this example only demonstrates a single bundle transmission, it is 742 also possible to pipeline multiple XFER_SEGMENT messages for 743 different bundles without necessarily waiting for XFER_ACK messages 744 to be returned for each one. However, interleaving data segments 745 from different bundles is not allowed. 747 No errors or rejections are shown in this example. 749 Entity A Entity B 750 ======== ======== 751 +-------------------------+ 752 | Contact Header | -> +-------------------------+ 753 +-------------------------+ <- | Contact Header | 754 +-------------------------+ 755 +-------------------------+ 756 | SESS_INIT | -> +-------------------------+ 757 +-------------------------+ <- | SESS_INIT | 758 +-------------------------+ 760 +-------------------------+ 761 | XFER_SEGMENT (start) | -> 762 | Transfer ID [I1] | 763 | Length [L1] | 764 | Bundle Data 0..(L1-1) | 765 +-------------------------+ 766 +-------------------------+ +-------------------------+ 767 | XFER_SEGMENT | -> <- | XFER_ACK (start) | 768 | Transfer ID [I1] | | Transfer ID [I1] | 769 | Length [L2] | | Length [L1] | 770 |Bundle Data L1..(L1+L2-1)| +-------------------------+ 771 +-------------------------+ 772 +-------------------------+ +-------------------------+ 773 | XFER_SEGMENT (end) | -> <- | XFER_ACK | 774 | Transfer ID [I1] | | Transfer ID [I1] | 775 | Length [L3] | | Length [L1+L2] | 776 |Bundle Data | +-------------------------+ 777 | (L1+L2)..(L1+L2+L3-1)| 778 +-------------------------+ 779 +-------------------------+ 780 <- | XFER_ACK (end) | 781 | Transfer ID [I1] | 782 | Length [L1+L2+L3] | 783 +-------------------------+ 785 +-------------------------+ 786 | SESS_TERM | -> +-------------------------+ 787 +-------------------------+ <- | SESS_TERM | 788 +-------------------------+ 790 Figure 13: An example of the flow of protocol messages on a single 791 TCP Session between two entities 793 4. Session Establishment 795 For bundle transmissions to occur using the TCPCL, a TCPCL session 796 MUST first be established between communicating entities. It is up 797 to the implementation to decide how and when session setup is 798 triggered. For example, some sessions MAY be opened proactively and 799 maintained for as long as is possible given the network conditions, 800 while other sessions MAY be opened only when there is a bundle that 801 is queued for transmission and the routing algorithm selects a 802 certain next-hop node. 804 4.1. TCP Connection 806 To establish a TCPCL session, an entity MUST first establish a TCP 807 connection with the intended peer entity, typically by using the 808 services provided by the operating system. Destination port number 809 4556 has been assigned by IANA as the Registered Port number for the 810 TCP convergence layer. Other destination port numbers MAY be used 811 per local configuration. Determining a peer's destination port 812 number (if different from the registered TCPCL port number) is up to 813 the implementation. Any source port number MAY be used for TCPCL 814 sessions. Typically an operating system assigned number in the TCP 815 Ephemeral range (49152-65535) is used. 817 If the entity is unable to establish a TCP connection for any reason, 818 then it is an implementation matter to determine how to handle the 819 connection failure. An entity MAY decide to re-attempt to establish 820 the connection. If it does so, it MUST NOT overwhelm its target with 821 repeated connection attempts. Therefore, the entity MUST retry the 822 connection setup no earlier than some delay time from the last 823 attempt, and it SHOULD use a (binary) exponential backoff mechanism 824 to increase this delay in case of repeated failures. 826 Once a TCP connection is established, each entity MUST immediately 827 transmit a contact header over the TCP connection. The format of the 828 contact header is described in Section 4.2. 830 4.2. Contact Header 832 Once a TCP connection is established, both parties exchange a contact 833 header. This section describes the format of the contact header and 834 the meaning of its fields. 836 Upon receipt of the contact header, both entities perform the 837 validation and negotiation procedures defined in Section 4.3. After 838 receiving the contact header from the other entity, either entity MAY 839 refuse the session by sending a SESS_TERM message with an appropriate 840 reason code. 842 The format for the Contact Header is as follows: 844 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 845 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 846 +---------------+---------------+---------------+---------------+ 847 | magic='dtn!' | 848 +---------------+---------------+---------------+---------------+ 849 | Version | Flags | 850 +---------------+---------------+ 852 Figure 14: Contact Header Format 854 See Section 4.3 for details on the use of each of these contact 855 header fields. 857 The fields of the contact header are: 859 magic: A four-octet field that always contains the octet sequence 860 0x64 0x74 0x6e 0x21, i.e., the text string "dtn!" in US-ASCII (and 861 UTF-8). 863 Version: A one-octet field value containing the value 4 (current 864 version of the protocol). 866 Flags: A one-octet field of single-bit flags, interpreted according 867 to the descriptions in Table 1. 869 +----------+--------+-----------------------------------------------+ 870 | Name | Code | Description | 871 +----------+--------+-----------------------------------------------+ 872 | CAN_TLS | 0x01 | If bit is set, indicates that the sending | 873 | | | peer is capable of TLS security. | 874 | | | | 875 | Reserved | others | 876 +----------+--------+-----------------------------------------------+ 878 Table 1: Contact Header Flags 880 4.3. Contact Validation and Negotiation 882 Upon reception of the contact header, each node follows the following 883 procedures to ensure the validity of the TCPCL session and to 884 negotiate values for the session parameters. 886 If the magic string is not present or is not valid, the connection 887 MUST be terminated. The intent of the magic string is to provide 888 some protection against an inadvertent TCP connection by a different 889 protocol than the one described in this document. To prevent a flood 890 of repeated connections from a misconfigured application, an entity 891 MAY elect to hold an invalid connection open and idle for some time 892 before closing it. 894 The first negotiation is on the TCPCL protocol version to use. The 895 active node always sends its Contact Header first and waits for a 896 response from the passive node. The active node can repeatedly 897 attempt different protocol versions in descending order until the 898 passive node accepts one with a corresponding Contact Header reply. 899 Only upon response of a Contact Header from the passive node is the 900 TCPCL protocol version established and parameter negotiation begun. 902 During contact initiation, the active TCPCL node SHALL send the 903 highest TCPCL protocol version on a first session attempt for a TCPCL 904 peer. If the active node receives a Contact Header with a different 905 protocol version than the one sent earlier on the TCP connection, the 906 TCP connection SHALL be terminated. If the active node receives a 907 SESS_TERM message with reason of "Version Mismatch", that node MAY 908 attempt further TCPCL sessions with the peer using earlier protocol 909 version numbers in decreasing order. Managing multi-TCPCL-session 910 state such as this is an implementation matter. 912 If the passive node receives a contact header containing a version 913 that is greater than the current version of the protocol that the 914 node implements, then the node SHALL shutdown the session with a 915 reason code of "Version mismatch". If the passive node receives a 916 contact header with a version that is lower than the version of the 917 protocol that the node implements, the node MAY either terminate the 918 session (with a reason code of "Version mismatch") or the node MAY 919 adapt its operation to conform to the older version of the protocol. 920 The decision of version fall-back is an implementation matter. 922 4.4. Session Security 924 This version of the TCPCL supports establishing a Transport Layer 925 Security (TLS) session within an existing TCP connection. When TLS 926 is used within the TCPCL it affects the entire session. Once 927 established, there is no mechanism available to downgrade a TCPCL 928 session to non-TLS operation. If this is desired, the entire TCPCL 929 session MUST be terminated and a new non-TLS-negotiated session 930 established. 932 The use of TLS is negotated using the Contact Header as described in 933 Section 4.3. After negotiating an Enable TLS parameter of true, and 934 before any other TCPCL messages are sent within the session, the 935 session entities SHALL begin a TLS handshake in accordance with 936 [RFC5246]. The parameters within each TLS negotiation are 937 implementation dependent but any TCPCL node SHALL follow all 938 recommended practices of [BCP195], or any updates or successors that 939 become part of [BCP195]. By convention, this protocol uses the node 940 which initiated the underlying TCP connection as the "client" role of 941 the TLS handshake request. 943 The TLS handshake, if it occurs, is considered to be part of the 944 contact negotiation before the TCPCL session itself is established. 945 Specifics about sensitive data exposure are discussed in Section 8. 947 4.4.1. TLS Handshake Result 949 If a TLS handshake cannot negotiate a TLS session, both entities of 950 the TCPCL session SHALL terminate the TCP connection. At this point 951 the TCPCL session has not yet been established so there is no TCPCL 952 session to terminate. This also avoids any potential security issues 953 assoicated with further TCP communication with an untrusted peer. 955 After a TLS session is successfully established, the active peer 956 SHALL send a SESS_INIT message to begin session negotiation. This 957 session negotation and all subsequent messaging are secured. 959 4.4.2. Example TLS Initiation 961 A summary of a typical CAN_TLS usage is shown in the sequence in 962 Figure 15 below. 964 Entity A Entity B 965 ======== ======== 967 +-------------------------+ 968 | Open TCP Connnection | -> 969 +-------------------------+ +-------------------------+ 970 <- | Accept Connection | 971 +-------------------------+ 973 +-------------------------+ 974 | Contact Header | -> 975 +-------------------------+ +-------------------------+ 976 <- | Contact Header | 977 +-------------------------+ 979 +-------------------------+ +-------------------------+ 980 | TLS Negotiation | -> <- | TLS Negotiation | 981 | (as client) | | (as server) | 982 +-------------------------+ +-------------------------+ 984 ... secured TCPCL messaging, starting with SESS_INIT ... 986 +-------------------------+ +-------------------------+ 987 | SESS_TERM | -> <- | SESS_TERM | 988 +-------------------------+ +-------------------------+ 990 Figure 15: A simple visual example of TCPCL TLS Establishment between 991 two entities 993 4.5. Message Type Codes 995 After the initial exchange of a contact header, all messages 996 transmitted over the session are identified by a one-octet header 997 with the following structure: 999 0 1 2 3 4 5 6 7 1000 +---------------+ 1001 | Message Type | 1002 +---------------+ 1004 Figure 16: Format of the Message Header 1006 The message header fields are as follows: 1008 Message Type: Indicates the type of the message as per Table 2 1009 below. Encoded values are listed in Section 9.5. 1011 +--------------+----------------------------------------------------+ 1012 | Type | Description | 1013 +--------------+----------------------------------------------------+ 1014 | SESS_INIT | Contains the session parameter inputs from one of | 1015 | | the entities, as described in Section 4.6. | 1016 | | | 1017 | XFER_SEGMENT | Indicates the transmission of a segment of bundle | 1018 | | data, as described in Section 5.2.2. | 1019 | | | 1020 | XFER_ACK | Acknowledges reception of a data segment, as | 1021 | | described in Section 5.2.3. | 1022 | | | 1023 | XFER_REFUSE | Indicates that the transmission of the current | 1024 | | bundle SHALL be stopped, as described in Section | 1025 | | 5.2.4. | 1026 | | | 1027 | KEEPALIVE | Used to keep TCPCL session active, as described in | 1028 | | Section 5.1.1. | 1029 | | | 1030 | SESS_TERM | Indicates that one of the entities participating | 1031 | | in the session wishes to cleanly terminate the | 1032 | | session, as described in Section 6. | 1033 | | | 1034 | MSG_REJECT | Contains a TCPCL message rejection, as described | 1035 | | in Section 5.1.2. | 1036 +--------------+----------------------------------------------------+ 1038 Table 2: TCPCL Message Types 1040 4.6. Session Initialization Message (SESS_INIT) 1042 Before a session is established and ready to transfer bundles, the 1043 session parameters are negotiated between the connected entities. 1044 The SESS_INIT message is used to convey the per-entity parameters 1045 which are used together to negotiate the per-session parameters as 1046 described in Section 4.7. 1048 The format of a SESS_INIT message is as follows in Figure 17. 1050 +-------------------------------+ 1051 | Message Header | 1052 +-------------------------------+ 1053 | Keepalive Interval (U16) | 1054 +-------------------------------+ 1055 | Segment MRU (U64) | 1056 +-------------------------------+ 1057 | Transfer MRU (U64) | 1058 +-------------------------------+ 1059 | EID Length (U16) | 1060 +-------------------------------+ 1061 | EID Data (variable) | 1062 +-------------------------------+ 1063 | Session Extension Length (U32)| 1064 +-------------------------------+ 1065 | Session Extension Items (var.)| 1066 +-------------------------------+ 1068 Figure 17: SESS_INIT Format 1070 The fields of the SESS_INIT message are: 1072 Keepalive Interval: A 16-bit unsigned integer indicating the 1073 interval, in seconds, between any subsequent messages being 1074 transmitted by the peer. The peer receiving this contact header 1075 uses this interval to determine how long to wait after any last- 1076 message transmission and a necessary subsequent KEEPALIVE message 1077 transmission. 1079 Segment MRU: A 64-bit unsigned integer indicating the largest 1080 allowable single-segment data payload size to be received in this 1081 session. Any XFER_SEGMENT sent to this peer SHALL have a data 1082 payload no longer than the peer's Segment MRU. The two entities 1083 of a single session MAY have different Segment MRUs, and no 1084 relation between the two is required. 1086 Transfer MRU: A 64-bit unsigned integer indicating the largest 1087 allowable total-bundle data size to be received in this session. 1088 Any bundle transfer sent to this peer SHALL have a Total Bundle 1089 Length payload no longer than the peer's Transfer MRU. This value 1090 can be used to perform proactive bundle fragmentation. The two 1091 entities of a single session MAY have different Transfer MRUs, and 1092 no relation between the two is required. 1094 EID Length and EID Data: Together these fields represent a variable- 1095 length text string. The EID Length is a 16-bit unsigned integer 1096 indicating the number of octets of EID Data to follow. A zero EID 1097 Length SHALL be used to indicate the lack of EID rather than a 1098 truly empty EID. This case allows an entity to avoid exposing EID 1099 information on an untrusted network. A non-zero-length EID Data 1100 SHALL contain the UTF-8 encoded EID of some singleton endpoint in 1101 which the sending entity is a member, in the canonical format of 1102 :. This EID encoding is 1103 consistent with [I-D.ietf-dtn-bpbis]. 1105 Session Extension Length and Session Extension Items: Together these 1106 fields represent protocol extension data not defined by this 1107 specification. The Session Extension Length is the total number 1108 of octets to follow which are used to encode the Session Extension 1109 Item list. The encoding of each Session Extension Item is within 1110 a consistent data container as described in Section 4.8. The full 1111 set of Session Extension Items apply for the duration of the TCPCL 1112 session to follow. The order and mulitplicity of these Session 1113 Extension Items MAY be significant, as defined in the associated 1114 type specification(s). 1116 4.7. Session Parameter Negotiation 1118 An entity calculates the parameters for a TCPCL session by 1119 negotiating the values from its own preferences (conveyed by the 1120 contact header it sent to the peer) with the preferences of the peer 1121 node (expressed in the contact header that it received from the 1122 peer). The negotiated parameters defined by this specification are 1123 described in the following paragraphs. 1125 Transfer MTU and Segment MTU: The maximum transmit unit (MTU) for 1126 whole transfers and individual segments are idententical to the 1127 Transfer MRU and Segment MRU, respectively, of the recevied 1128 contact header. A transmitting peer can send individual segments 1129 with any size smaller than the Segment MTU, depending on local 1130 policy, dynamic network conditions, etc. Determining the size of 1131 each transmitted segment is an implementation matter. 1133 Session Keepalive: Negotiation of the Session Keepalive parameter is 1134 performed by taking the minimum of this two contact headers' 1135 Keepalive Interval. The Session Keepalive interval is a parameter 1136 for the behavior described in Section 5.1.1. 1138 Enable TLS: Negotiation of the Enable TLS parameter is performed by 1139 taking the logical AND of the two contact headers' CAN_TLS flags. 1140 A local security policy is then applied to determine of the 1141 negotated value of Enable TLS is acceptable. It can be a 1142 reasonable security policy to both require or disallow the use of 1143 TLS depending upon the desired network flows. If the Enable TLS 1144 state is unacceptable, the node SHALL terminate the session with a 1145 reason code of "Contact Failure". Note that this contact failure 1146 is different than a failure of TLS handshake after an agreed-upon 1147 and acceptable Enable TLS state. If the negotiated Enable TLS 1148 value is true and acceptable then TLS negotiation feature 1149 (described in Section 4.4) begins immediately following the 1150 contact header exchange. 1152 Once this process of parameter negotiation is completed (which 1153 includes a possible completed TLS handshake of the connection to use 1154 TLS), this protocol defines no additional mechanism to change the 1155 parameters of an established session; to effect such a change, the 1156 TCPCL session MUST be terminated and a new session established. 1158 4.8. Session Extension Items 1160 Each of the Session Extension Items SHALL be encoded in an identical 1161 Type-Length-Value (TLV) container form as indicated in Figure 18. 1163 The fields of the Session Extension Item are: 1165 Flags: A one-octet field containing generic bit flags about the 1166 Item, which are listed in Table 3. If a TCPCL entity receives a 1167 Session Extension Item with an unknown Item Type and the CRITICAL 1168 flag set, the entity SHALL close the TCPCL session with SESS_TERM 1169 reason code of "Contact Failure". If the CRITICAL flag is not 1170 set, an entity SHALL skip over and ignore any item with an unknown 1171 Item Type. 1173 Item Type: A 16-bit unsigned integer field containing the type of 1174 the extension item. This specification does not define any 1175 extension types directly, but does allocate an IANA registry for 1176 such codes (see Section 9.3). 1178 Item Length: A 32-bit unsigned integer field containing the number 1179 of Item Value octets to follow. 1181 Item Value: A variable-length data field which is interpreted 1182 according to the associated Item Type. This specification places 1183 no restrictions on an extension's use of available Item Value 1184 data. Extension specifications SHOULD avoid the use of large data 1185 lengths, as no bundle transfers can begin until the full extension 1186 data is sent. 1188 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 1189 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1190 +---------------+---------------+---------------+---------------+ 1191 | Item Flags | Item Type | Item Length...| 1192 +---------------+---------------+---------------+---------------+ 1193 | length contd. | Item Value... | 1194 +---------------+---------------+---------------+---------------+ 1195 | value contd. | 1196 +---------------+---------------+---------------+---------------+ 1198 Figure 18: Session Extension Item Format 1200 +----------+--------+-----------------------------------------------+ 1201 | Name | Code | Description | 1202 +----------+--------+-----------------------------------------------+ 1203 | CRITICAL | 0x01 | If bit is set, indicates that the receiving | 1204 | | | peer must handle the extension item. | 1205 | | | | 1206 | Reserved | others | 1207 +----------+--------+-----------------------------------------------+ 1209 Table 3: Session Extension Item Flags 1211 5. Established Session Operation 1213 This section describes the protocol operation for the duration of an 1214 established session, including the mechanism for transmitting bundles 1215 over the session. 1217 5.1. Upkeep and Status Messages 1219 5.1.1. Session Upkeep (KEEPALIVE) 1221 The protocol includes a provision for transmission of KEEPALIVE 1222 messages over the TCPCL session to help determine if the underlying 1223 TCP connection has been disrupted. 1225 As described in Section 4.3, a negotiated parameter of each session 1226 is the Session Keepalive interval. If the negotiated Session 1227 Keepalive is zero (i.e. one or both contact headers contains a zero 1228 Keepalive Interval), then the keepalive feature is disabled. There 1229 is no logical minimum value for the keepalive interval, but when used 1230 for many sessions on an open, shared network a short interval could 1231 lead to excessive traffic. For shared network use, entities SHOULD 1232 choose a keepalive interval no shorter than 30 seconds. There is no 1233 logical maximum value for the keepalive interval, but an idle TCP 1234 connection is liable for closure by the host operating system if the 1235 keepalive time is longer than tens-of-minutes. Entities SHOULD 1236 choose a keepalive interval no longer than 10 minutes (600 seconds). 1238 Note: The Keepalive Interval SHOULD NOT be chosen too short as TCP 1239 retransmissions MAY occur in case of packet loss. Those will have to 1240 be triggered by a timeout (TCP retransmission timeout (RTO)), which 1241 is dependent on the measured RTT for the TCP connection so that 1242 KEEPALIVE messages MAY experience noticeable latency. 1244 The format of a KEEPALIVE message is a one-octet message type code of 1245 KEEPALIVE (as described in Table 2) with no additional data. Both 1246 sides SHALL send a KEEPALIVE message whenever the negotiated interval 1247 has elapsed with no transmission of any message (KEEPALIVE or other). 1249 If no message (KEEPALIVE or other) has been received in a session 1250 after some implementation-defined time duration, then the node SHALL 1251 terminate the session by transmitting a SESS_TERM message (as 1252 described in Section 6.1) with reason code "Idle Timeout". If 1253 configurable, the idle timeout duration SHOULD be no shorter than 1254 twice the keepalive interval. If not configurable, the idle timeout 1255 duration SHOULD be exactly twice the keepout interval. 1257 5.1.2. Message Rejection (MSG_REJECT) 1259 If a TCPCL node receives a message which is unknown to it (possibly 1260 due to an unhandled protocol mismatch) or is inappropriate for the 1261 current session state (e.g. a KEEPALIVE message received after 1262 contact header negotiation has disabled that feature), there is a 1263 protocol-level message to signal this condition in the form of a 1264 MSG_REJECT reply. 1266 The format of a MSG_REJECT message is as follows in Figure 19. 1268 +-----------------------------+ 1269 | Message Header | 1270 +-----------------------------+ 1271 | Reason Code (U8) | 1272 +-----------------------------+ 1273 | Rejected Message Header | 1274 +-----------------------------+ 1276 Figure 19: Format of MSG_REJECT Messages 1278 The fields of the MSG_REJECT message are: 1280 Reason Code: A one-octet refusal reason code interpreted according 1281 to the descriptions in Table 4. 1283 Rejected Message Header: The Rejected Message Header is a copy of 1284 the Message Header to which the MSG_REJECT message is sent as a 1285 response. 1287 +-------------+------+----------------------------------------------+ 1288 | Name | Code | Description | 1289 +-------------+------+----------------------------------------------+ 1290 | Message | 0x01 | A message was received with a Message Type | 1291 | Type | | code unknown to the TCPCL node. | 1292 | Unknown | | | 1293 | | | | 1294 | Message | 0x02 | A message was received but the TCPCL node | 1295 | Unsupported | | cannot comply with the message contents. | 1296 | | | | 1297 | Message | 0x03 | A message was received while the session is | 1298 | Unexpected | | in a state in which the message is not | 1299 | | | expected. | 1300 +-------------+------+----------------------------------------------+ 1302 Table 4: MSG_REJECT Reason Codes 1304 5.2. Bundle Transfer 1306 All of the messages in this section are directly associated with 1307 transferring a bundle between TCPCL entities. 1309 A single TCPCL transfer results in a bundle (handled by the 1310 convergence layer as opaque data) being exchanged from one node to 1311 the other. In TCPCL a transfer is accomplished by dividing a single 1312 bundle up into "segments" based on the receiving-side Segment MRU 1313 (see Section 4.2). The choice of the length to use for segments is 1314 an implementation matter, but each segment MUST be no larger than the 1315 receiving node's maximum receive unit (MRU) (see the field "Segment 1316 MRU" of Section 4.2). The first segment for a bundle MUST set the 1317 'START' flag, and the last one MUST set the 'end' flag in the 1318 XFER_SEGMENT message flags. 1320 A single transfer (and by extension a single segment) SHALL NOT 1321 contain data of more than a single bundle. This requirement is 1322 imposed on the agent using the TCPCL rather than TCPCL itself. 1324 If multiple bundles are transmitted on a single TCPCL connection, 1325 they MUST be transmitted consecutively without interleaving of 1326 segments from multiple bundles. 1328 5.2.1. Bundle Transfer ID 1330 Each of the bundle transfer messages contains a Transfer ID which is 1331 used to correlate messages (from both sides of a transfer) for each 1332 bundle. A Transfer ID does not attempt to address uniqueness of the 1333 bundle data itself and has no relation to concepts such as bundle 1334 fragmentation. Each invocation of TCPCL by the bundle protocol 1335 agent, requesting transmission of a bundle (fragmentary or 1336 otherwise), results in the initiation of a single TCPCL transfer. 1337 Each transfer entails the sending of a sequence of some number of 1338 XFER_SEGMENT and XFER_ACK messages; all are correlated by the same 1339 Transfer ID. 1341 Transfer IDs from each node SHALL be unique within a single TCPCL 1342 session. The initial Transfer ID from each node SHALL have value 1343 zero. Subsequent Transfer ID values SHALL be incremented from the 1344 prior Transfer ID value by one. Upon exhaustion of the entire 64-bit 1345 Transfer ID space, the sending node SHALL terminate the session with 1346 SESS_TERM reason code "Resource Exhaustion". 1348 For bidirectional bundle transfers, a TCPCL node SHOULD NOT rely on 1349 any relation between Transfer IDs originating from each side of the 1350 TCPCL session. 1352 5.2.2. Data Transmission (XFER_SEGMENT) 1354 Each bundle is transmitted in one or more data segments. The format 1355 of a XFER_SEGMENT message follows in Figure 20. 1357 +------------------------------+ 1358 | Message Header | 1359 +------------------------------+ 1360 | Message Flags (U8) | 1361 +------------------------------+ 1362 | Transfer ID (U64) | 1363 +------------------------------+ 1364 | Transfer Extension | 1365 | Length (U32) | 1366 | (only for START segment) | 1367 +------------------------------+ 1368 | Transfer Extension | 1369 | Items (var.) | 1370 | (only for START segment) | 1371 +------------------------------+ 1372 | Data length (U64) | 1373 +------------------------------+ 1374 | Data contents (octet string) | 1375 +------------------------------+ 1377 Figure 20: Format of XFER_SEGMENT Messages 1379 The fields of the XFER_SEGMENT message are: 1381 Message Flags: A one-octet field of single-bit flags, interpreted 1382 according to the descriptions in Table 5. 1384 Transfer ID: A 64-bit unsigned integer identifying the transfer 1385 being made. 1387 Transfer Extension Length and Transfer Extension Items: Together 1388 these fields represent protocol extension data for this 1389 specification. The Transfer Extension Length and Transfer 1390 Extension Item fields SHALL only be present when the 'START' flag 1391 is set on the message. The Transfer Extension Length is the total 1392 number of octets to follow which are used to encode the Transfer 1393 Extension Item list. The encoding of each Transfer Extension Item 1394 is within a consistent data container as described in 1395 Section 5.2.5. The full set of transfer extension items apply 1396 only to the assoicated single transfer. The order and 1397 mulitplicity of these transfer extension items MAY be significant, 1398 as defined in the associated type specification(s). 1400 Data length: A 64-bit unsigned integer indicating the number of 1401 octets in the Data contents to follow. 1403 Data contents: The variable-length data payload of the message. 1405 +----------+--------+-----------------------------------------------+ 1406 | Name | Code | Description | 1407 +----------+--------+-----------------------------------------------+ 1408 | END | 0x01 | If bit is set, indicates that this is the | 1409 | | | last segment of the transfer. | 1410 | | | | 1411 | START | 0x02 | If bit is set, indicates that this is the | 1412 | | | first segment of the transfer. | 1413 | | | | 1414 | Reserved | others | 1415 +----------+--------+-----------------------------------------------+ 1417 Table 5: XFER_SEGMENT Flags 1419 The flags portion of the message contains two optional values in the 1420 two low-order bits, denoted 'START' and 'END' in Table 5. The 1421 'START' bit MUST be set to one if it precedes the transmission of the 1422 first segment of a transfer. The 'END' bit MUST be set to one when 1423 transmitting the last segment of a transfer. In the case where an 1424 entire transfer is accomplished in a single segment, both the 'START' 1425 and 'END' bits MUST be set to one. 1427 Once a transfer of a bundle has commenced, the node MUST only send 1428 segments containing sequential portions of that bundle until it sends 1429 a segment with the 'END' bit set. No interleaving of multiple 1430 transfers from the same node is possible within a single TCPCL 1431 session. Simultaneous transfers between two entities MAY be achieved 1432 using multiple TCPCL sessions. 1434 5.2.3. Data Acknowledgments (XFER_ACK) 1436 Although the TCP transport provides reliable transfer of data between 1437 transport peers, the typical BSD sockets interface provides no means 1438 to inform a sending application of when the receiving application has 1439 processed some amount of transmitted data. Thus, after transmitting 1440 some data, the TCPCL needs an additional mechanism to determine 1441 whether the receiving agent has successfully received the segment. 1442 To this end, the TCPCL protocol provides feedback messaging whereby a 1443 receiving node transmits acknowledgments of reception of data 1444 segments. 1446 The format of an XFER_ACK message follows in Figure 21. 1448 +-----------------------------+ 1449 | Message Header | 1450 +-----------------------------+ 1451 | Message Flags (U8) | 1452 +-----------------------------+ 1453 | Transfer ID (U64) | 1454 +-----------------------------+ 1455 | Acknowledged length (U64) | 1456 +-----------------------------+ 1458 Figure 21: Format of XFER_ACK Messages 1460 The fields of the XFER_ACK message are: 1462 Message Flags: A one-octet field of single-bit flags, interpreted 1463 according to the descriptions in Table 5. 1465 Transfer ID: A 64-bit unsigned integer identifying the transfer 1466 being acknowledged. 1468 Acknowledged length: A 64-bit unsigned integer indicating the total 1469 number of octets in the transfer which are being acknowledged. 1471 A receiving TCPCL node SHALL send an XFER_ACK message in response to 1472 each received XFER_SEGMENT message. The flags portion of the 1473 XFER_ACK header SHALL be set to match the corresponding DATA_SEGMENT 1474 message being acknowledged. The acknowledged length of each XFER_ACK 1475 contains the sum of the data length fields of all XFER_SEGMENT 1476 messages received so far in the course of the indicated transfer. 1477 The sending node SHOULD transmit multiple XFER_SEGMENT messages 1478 without waiting for the corresponding XFER_ACK responses. This 1479 enables pipelining of messages on a transfer stream. 1481 For example, suppose the sending node transmits four segments of 1482 bundle data with lengths 100, 200, 500, and 1000, respectively. 1483 After receiving the first segment, the node sends an acknowledgment 1484 of length 100. After the second segment is received, the node sends 1485 an acknowledgment of length 300. The third and fourth 1486 acknowledgments are of length 800 and 1800, respectively. 1488 5.2.4. Transfer Refusal (XFER_REFUSE) 1490 The TCPCL supports a mechanism by which a receiving node can indicate 1491 to the sender that it does not want to receive the corresponding 1492 bundle. To do so, upon receiving an XFER_SEGMENT message, the node 1493 MAY transmit a XFER_REFUSE message. As data segments and 1494 acknowledgments MAY cross on the wire, the bundle that is being 1495 refused SHALL be identified by the Transfer ID of the refusal. 1497 There is no required relation between the Transfer MRU of a TCPCL 1498 node (which is supposed to represent a firm limitation of what the 1499 node will accept) and sending of a XFER_REFUSE message. A 1500 XFER_REFUSE can be used in cases where the agent's bundle storage is 1501 temporarily depleted or somehow constrained. A XFER_REFUSE can also 1502 be used after the bundle header or any bundle data is inspected by an 1503 agent and determined to be unacceptable. 1505 A receiver MAY send an XFER_REFUSE message as soon as it receives any 1506 XFER_SEGMENT message. The sender MUST be prepared for this and MUST 1507 associate the refusal with the correct bundle via the Transfer ID 1508 fields. 1510 The format of the XFER_REFUSE message is as follows in Figure 22. 1512 +-----------------------------+ 1513 | Message Header | 1514 +-----------------------------+ 1515 | Reason Code (U8) | 1516 +-----------------------------+ 1517 | Transfer ID (U64) | 1518 +-----------------------------+ 1520 Figure 22: Format of XFER_REFUSE Messages 1522 The fields of the XFER_REFUSE message are: 1524 Reason Code: A one-octet refusal reason code interpreted according 1525 to the descriptions in Table 6. 1527 Transfer ID: A 64-bit unsigned integer identifying the transfer 1528 being refused. 1530 +------------+------------------------------------------------------+ 1531 | Name | Semantics | 1532 +------------+------------------------------------------------------+ 1533 | Unknown | Reason for refusal is unknown or not specified. | 1534 | | | 1535 | Extension | A failure processing the Transfer Extension Items ha | 1536 | Failure | occurred. | 1537 | | | 1538 | Completed | The receiver already has the complete bundle. The | 1539 | | sender MAY consider the bundle as completely | 1540 | | received. | 1541 | | | 1542 | No | The receiver's resources are exhausted. The sender | 1543 | Resources | SHOULD apply reactive bundle fragmentation before | 1544 | | retrying. | 1545 | | | 1546 | Retransmit | The receiver has encountered a problem that requires | 1547 | | the bundle to be retransmitted in its entirety. | 1548 +------------+------------------------------------------------------+ 1550 Table 6: XFER_REFUSE Reason Codes 1552 The receiver MUST, for each transfer preceding the one to be refused, 1553 have either acknowledged all XFER_SEGMENTs or refused the bundle 1554 transfer. 1556 The bundle transfer refusal MAY be sent before an entire data segment 1557 is received. If a sender receives a XFER_REFUSE message, the sender 1558 MUST complete the transmission of any partially sent XFER_SEGMENT 1559 message. There is no way to interrupt an individual TCPCL message 1560 partway through sending it. The sender MUST NOT commence 1561 transmission of any further segments of the refused bundle 1562 subsequently. Note, however, that this requirement does not ensure 1563 that an entity will not receive another XFER_SEGMENT for the same 1564 bundle after transmitting a XFER_REFUSE message since messages MAY 1565 cross on the wire; if this happens, subsequent segments of the bundle 1566 SHALL also be refused with a XFER_REFUSE message. 1568 Note: If a bundle transmission is aborted in this way, the receiver 1569 MAY not receive a segment with the 'END' flag set to '1' for the 1570 aborted bundle. The beginning of the next bundle is identified by 1571 the 'START' bit set to '1', indicating the start of a new transfer, 1572 and with a distinct Transfer ID value. 1574 5.2.5. Transfer Extension Items 1576 Each of the Transfer Extension Items SHALL be encoded in an identical 1577 Type-Length-Value (TLV) container form as indicated in Figure 23. 1579 The fields of the Transfer Extension Item are: 1581 Flags: A one-octet field containing generic bit flags about the 1582 Item, which are listed in Table 7. If a TCPCL node receives a 1583 Transfer Extension Item with an unknown Item Type and the CRITICAL 1584 flag set, the node SHALL refuse the transfer with an XFER_REFUSE 1585 reason code of "Extension Failure". If the CRITICAL flag is not 1586 set, an entity SHALL skip over and ignore any item with an unknown 1587 Item Type. 1589 Item Type: A 16-bit unsigned integer field containing the type of 1590 the extension item. This specification allocates an IANA registry 1591 for such codes (see Section 9.4). 1593 Item Length: A 32-bit unsigned integer field containing the number 1594 of Item Value octets to follow. 1596 Item Value: A variable-length data field which is interpreted 1597 according to the associated Item Type. This specification places 1598 no restrictions on an extension's use of available Item Value 1599 data. Extension specifications SHOULD avoid the use of large data 1600 lengths, as the associated transfer cannot begin until the full 1601 extension data is sent. 1603 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 1604 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1605 +---------------+---------------+---------------+---------------+ 1606 | Item Flags | Item Type | Item Length...| 1607 +---------------+---------------+---------------+---------------+ 1608 | length contd. | Item Value... | 1609 +---------------+---------------+---------------+---------------+ 1610 | value contd. | 1611 +---------------+---------------+---------------+---------------+ 1613 Figure 23: Transfer Extension Item Format 1615 +----------+--------+-----------------------------------------------+ 1616 | Name | Code | Description | 1617 +----------+--------+-----------------------------------------------+ 1618 | CRITICAL | 0x01 | If bit is set, indicates that the receiving | 1619 | | | peer must handle the extension item. | 1620 | | | | 1621 | Reserved | others | 1622 +----------+--------+-----------------------------------------------+ 1624 Table 7: Transfer Extension Item Flags 1626 5.2.5.1. Transfer Length Extension 1628 The purpose of the Transfer Length extension is to allow entities to 1629 preemptively refuse bundles that would exceed their resources or to 1630 prepare storage on the receiving node for the upcoming bundle data. 1632 Multiple Transfer Length extension items SHALL NOT occurr within the 1633 same transfer. The lack of a Transfer Length extension item in any 1634 transfer SHALL NOT imply anything about the potential length of the 1635 transfer. The Transfer Length extension SHALL be assigned transfer 1636 extension type ID 0x0001. 1638 The format of the Transfer Length data is as follows in Figure 24. 1640 +----------------------+ 1641 | Total Length (U64) | 1642 +----------------------+ 1644 Figure 24: Format of Transfer Length data 1646 The fields of the Transfer Length extension are: 1648 Total Length: A 64-bit unsigned integer indicating the size of the 1649 data-to-be-transferred. The Total Length field SHALL be treated 1650 as authoritative by the receiver. If, for whatever reason, the 1651 actual total length of bundle data received differs from the value 1652 indicated by the Total Length value, the receiver SHALL treat the 1653 transmitted data as invalid. 1655 6. Session Termination 1657 This section describes the procedures for ending a TCPCL session. 1659 6.1. Session Termination Message (SESS_TERM) 1661 To cleanly shut down a session, a SESS_TERM message SHALL be 1662 transmitted by either node at any point following complete 1663 transmission of any other message. When sent to initiate a 1664 termination, the REPLY bit of a SESS_TERM message SHALL NOT be set. 1665 Upon receiving a SESS_TERM message after not sending a SESS_TERM 1666 message in the same session, an entity SHALL send an acknowledging 1667 SESS_TERM message. When sent to acknowledge a termination, a 1668 SESS_TERM message SHALL have identical data content from the message 1669 being acknowledged except for the REPLY bit, which is set to indicate 1670 acknowledgement. 1672 After sending a SESS_TERM message, an entity MAY continue a possible 1673 in-progress transfer in either direction. After sending a SESS_TERM 1674 message, an entity SHALL NOT begin any new outgoing transfer (i.e. 1675 send an XFER_SEGMENT message) for the remainder of the session. 1676 After receving a SESS_TERM message, an entity SHALL NOT accept any 1677 new incoming transfer for the remainder of the session. 1679 Instead of following a clean shutdown sequence, after transmitting a 1680 SESS_TERM message an entity MAY immediately close the associated TCP 1681 connection. When performing an unclean shutdown, a receiving node 1682 SHOULD acknowledge all received data segments before closing the TCP 1683 connection. Not acknowledging received segments can result in 1684 unnecessary retransmission. When performing an unclean shutodwn, a 1685 transmitting node SHALL treat either sending or receiving a SESS_TERM 1686 message (i.e. before the final acknowledgment) as a failure of the 1687 transfer. Any delay between request to terminate the TCP connection 1688 and actual closing of the connection (a "half-closed" state) MAY be 1689 ignored by the TCPCL node. 1691 The format of the SESS_TERM message is as follows in Figure 25. 1693 +-----------------------------+ 1694 | Message Header | 1695 +-----------------------------+ 1696 | Message Flags (U8) | 1697 +-----------------------------+ 1698 | Reason Code (U8) | 1699 +-----------------------------+ 1701 Figure 25: Format of SESS_TERM Messages 1703 The fields of the SESS_TERM message are: 1705 Message Flags: A one-octet field of single-bit flags, interpreted 1706 according to the descriptions in Table 8. 1708 Reason Code: A one-octet refusal reason code interpreted according 1709 to the descriptions in Table 9. 1711 +----------+--------+-----------------------------------------------+ 1712 | Name | Code | Description | 1713 +----------+--------+-----------------------------------------------+ 1714 | REPLY | 0x01 | If bit is set, indicates that this message is | 1715 | | | an acknowledgement of an earlier SESS_TERM | 1716 | | | message. | 1717 | | | | 1718 | Reserved | others | 1719 +----------+--------+-----------------------------------------------+ 1721 Table 8: SESS_TERM Flags 1723 +---------------+---------------------------------------------------+ 1724 | Name | Description | 1725 +---------------+---------------------------------------------------+ 1726 | Unknown | A termination reason is not available. | 1727 | | | 1728 | Idle timeout | The session is being closed due to idleness. | 1729 | | | 1730 | Version | The node cannot conform to the specified TCPCL | 1731 | mismatch | protocol version. | 1732 | | | 1733 | Busy | The node is too busy to handle the current | 1734 | | session. | 1735 | | | 1736 | Contact | The node cannot interpret or negotiate contact | 1737 | Failure | header option. | 1738 | | | 1739 | Resource | The node has run into some resource limit and | 1740 | Exhaustion | cannot continue the session. | 1741 +---------------+---------------------------------------------------+ 1743 Table 9: SESS_TERM Reason Codes 1745 A session shutdown MAY occur immediately after transmission of a 1746 contact header (and prior to any further message transmit). This 1747 MAY, for example, be used to notify that the node is currently not 1748 able or willing to communicate. However, an entity MUST always send 1749 the contact header to its peer before sending a SESS_TERM message. 1751 If reception of the contact header itself somehow fails (e.g. an 1752 invalid "magic string" is recevied), an entity SHALL close the TCP 1753 connection without sending a SESS_TERM message. If the content of 1754 the Session Extension Items data disagrees with the Session Extension 1755 Length (i.e. the last Item claims to use more octets than are present 1756 in the Session Extension Length), the reception of the contact header 1757 is considered to have failed. 1759 If a session is to be terminated before a protocol message has 1760 completed being sent, then the node MUST NOT transmit the SESS_TERM 1761 message but still SHALL close the TCP connection. Each TCPCL message 1762 is contiguous in the octet stream and has no ability to be cut short 1763 and/or preempted by an other message. This is particularly important 1764 when large segment sizes are being transmitted; either entire 1765 XFER_SEGMENT is sent before a SESS_TERM message or the connection is 1766 simply terminated mid-XFER_SEGMENT. 1768 6.2. Idle Session Shutdown 1770 The protocol includes a provision for clean shutdown of idle 1771 sessions. Determining the length of time to wait before closing idle 1772 sessions, if they are to be closed at all, is an implementation and 1773 configuration matter. 1775 If there is a configured time to close idle links and if no TCPCL 1776 messages (other than KEEPALIVE messages) has been received for at 1777 least that amount of time, then either node MAY terminate the session 1778 by transmitting a SESS_TERM message indicating the reason code of 1779 "Idle timeout" (as described in Table 9). 1781 7. Implementation Status 1783 [NOTE to the RFC Editor: please remove this section before 1784 publication, as well as the reference to [RFC7942] and 1785 [github-dtn-bpbis-tcpcl].] 1787 This section records the status of known implementations of the 1788 protocol defined by this specification at the time of posting of this 1789 Internet-Draft, and is based on a proposal described in [RFC7942]. 1790 The description of implementations in this section is intended to 1791 assist the IETF in its decision processes in progressing drafts to 1792 RFCs. Please note that the listing of any individual implementation 1793 here does not imply endorsement by the IETF. Furthermore, no effort 1794 has been spent to verify the information presented here that was 1795 supplied by IETF contributors. This is not intended as, and must not 1796 be construed to be, a catalog of available implementations or their 1797 features. Readers are advised to note that other implementations may 1798 exist. 1800 An example implementation of the this draft of TCPCLv4 has been 1801 created as a GitHub project [github-dtn-bpbis-tcpcl] and is intented 1802 to use as a proof-of-concept and as a possible source of 1803 interoperability testing. This example implementation uses D-Bus as 1804 the CL-BP Agent interface, so it only runs on hosts which provide the 1805 Python "dbus" library. 1807 8. Security Considerations 1809 One security consideration for this protocol relates to the fact that 1810 entities present their endpoint identifier as part of the contact 1811 header exchange. It would be possible for an entity to fake this 1812 value and present the identity of a singleton endpoint in which the 1813 node is not a member, essentially masquerading as another DTN node. 1814 If this identifier is used outside of a TLS-secured session or 1815 without further verification as a means to determine which bundles 1816 are transmitted over the session, then the node that has falsified 1817 its identity would be able to obtain bundles that it otherwise would 1818 not have. Therefore, an entity SHALL NOT use the EID value of an 1819 unsecured contact header to derive a peer node's identity unless it 1820 can corroborate it via other means. When TCPCL session security is 1821 mandated by a TCPCL peer, that peer SHALL transmit initial unsecured 1822 contact header values indicated in Table 10 in order. These values 1823 avoid unnecessarily leaking session parameters and will be ignored 1824 when secure contact header re-exchange occurs. 1826 +--------------------+---------------------------------------------+ 1827 | Parameter | Value | 1828 +--------------------+---------------------------------------------+ 1829 | Flags | The USE_TLS flag is set. | 1830 | | | 1831 | Keepalive Interval | Zero, indicating no keepalive. | 1832 | | | 1833 | Segment MRU | Zero, indicating all segments are refused. | 1834 | | | 1835 | Transfer MRU | Zero, indicating all transfers are refused. | 1836 | | | 1837 | EID | Empty, indicating lack of EID. | 1838 +--------------------+---------------------------------------------+ 1840 Table 10: Recommended Unsecured Contact Header 1842 TCPCL can be used to provide point-to-point transport security, but 1843 does not provide security of data-at-rest and does not guarantee end- 1844 to-end bundle security. The mechanisms defined in [RFC6257] and 1845 [I-D.ietf-dtn-bpsec] are to be used instead. 1847 Even when using TLS to secure the TCPCL session, the actual 1848 ciphersuite negotiated between the TLS peers MAY be insecure. TLS 1849 can be used to perform authentication without data confidentiality, 1850 for example. It is up to security policies within each TCPCL node to 1851 ensure that the negotiated TLS ciphersuite meets transport security 1852 requirements. This is identical behavior to STARTTLS use in 1853 [RFC2595]. 1855 Another consideration for this protocol relates to denial-of-service 1856 attacks. An entity MAY send a large amount of data over a TCPCL 1857 session, requiring the receiving entity to handle the data, attempt 1858 to stop the flood of data by sending a XFER_REFUSE message, or 1859 forcibly terminate the session. This burden could cause denial of 1860 service on other, well-behaving sessions. There is also nothing to 1861 prevent a malicious entity from continually establishing sessions and 1862 repeatedly trying to send copious amounts of bundle data. A 1863 listening entity MAY take countermeasures such as ignoring TCP SYN 1864 messages, closing TCP connections as soon as they are established, 1865 waiting before sending the contact header, sending a SESS_TERM 1866 message quickly or with a delay, etc. 1868 9. IANA Considerations 1870 In this section, registration procedures are as defined in [RFC8126]. 1872 Some of the registries below are created new for TCPCLv4 but share 1873 code values with TCPCLv3. This was done to disambiguate the use of 1874 these values between TCPCLv3 and TCPCLv4 while preserving the 1875 semantics of some values. 1877 9.1. Port Number 1879 Port number 4556 has been previously assigned as the default port for 1880 the TCP convergence layer in [RFC7242]. This assignment is unchanged 1881 by protocol version 4. Each TCPCL entity identifies its TCPCL 1882 protocol version in its initial contact (see Section 9.2), so there 1883 is no ambiguity about what protocol is being used. 1885 +------------------------+-------------------------------------+ 1886 | Parameter | Value | 1887 +------------------------+-------------------------------------+ 1888 | Service Name: | dtn-bundle | 1889 | | | 1890 | Transport Protocol(s): | TCP | 1891 | | | 1892 | Assignee: | Simon Perreault | 1893 | | | 1894 | Contact: | Simon Perreault | 1895 | | | 1896 | Description: | DTN Bundle TCP CL Protocol | 1897 | | | 1898 | Reference: | [RFC7242] | 1899 | | | 1900 | Port Number: | 4556 | 1901 +------------------------+-------------------------------------+ 1903 9.2. Protocol Versions 1905 IANA has created, under the "Bundle Protocol" registry, a sub- 1906 registry titled "Bundle Protocol TCP Convergence-Layer Version 1907 Numbers" and initialize it with the following table. The 1908 registration procedure is RFC Required. 1910 +-------+-------------+---------------------+ 1911 | Value | Description | Reference | 1912 +-------+-------------+---------------------+ 1913 | 0 | Reserved | [RFC7242] | 1914 | | | | 1915 | 1 | Reserved | [RFC7242] | 1916 | | | | 1917 | 2 | Reserved | [RFC7242] | 1918 | | | | 1919 | 3 | TCPCL | [RFC7242] | 1920 | | | | 1921 | 4 | TCPCLbis | This specification. | 1922 | | | | 1923 | 5-255 | Unassigned | 1924 +-------+-------------+---------------------+ 1926 9.3. Session Extension Types 1928 EDITOR NOTE: sub-registry to-be-created upon publication of this 1929 specification. 1931 IANA will create, under the "Bundle Protocol" registry, a sub- 1932 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 1933 Session Extension Types" and initialize it with the contents of 1934 Table 11. The registration procedure is RFC Required within the 1935 lower range 0x0001--0x7fff. Values in the range 0x8000--0xffff are 1936 reserved for use on private networks for functions not published to 1937 the IANA. 1939 +----------------+--------------------------+ 1940 | Code | Message Type | 1941 +----------------+--------------------------+ 1942 | 0x0000 | Reserved | 1943 | | | 1944 | 0x0001--0x7fff | Unassigned | 1945 | | | 1946 | 0x8000--0xffff | Private/Experimental Use | 1947 +----------------+--------------------------+ 1949 Table 11: Session Extension Type Codes 1951 9.4. Transfer Extension Types 1953 EDITOR NOTE: sub-registry to-be-created upon publication of this 1954 specification. 1956 IANA will create, under the "Bundle Protocol" registry, a sub- 1957 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 1958 Transfer Extension Types" and initialize it with the contents of 1959 Table 12. The registration procedure is RFC Required within the 1960 lower range 0x0001--0x7fff. Values in the range 0x8000--0xffff are 1961 reserved for use on private networks for functions not published to 1962 the IANA. 1964 +----------------+---------------------------+ 1965 | Code | Message Type | 1966 +----------------+---------------------------+ 1967 | 0x0000 | Reserved | 1968 | | | 1969 | 0x0001 | Transfer Length Extension | 1970 | | | 1971 | 0x0002--0x7fff | Unassigned | 1972 | | | 1973 | 0x8000--0xffff | Private/Experimental Use | 1974 +----------------+---------------------------+ 1976 Table 12: Transfer Extension Type Codes 1978 9.5. Message Types 1980 EDITOR NOTE: sub-registry to-be-created upon publication of this 1981 specification. 1983 IANA will create, under the "Bundle Protocol" registry, a sub- 1984 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 1985 Message Types" and initialize it with the contents of Table 13. The 1986 registration procedure is RFC Required. 1988 +-----------+--------------+ 1989 | Code | Message Type | 1990 +-----------+--------------+ 1991 | 0x00 | Reserved | 1992 | | | 1993 | 0x01 | XFER_SEGMENT | 1994 | | | 1995 | 0x02 | XFER_ACK | 1996 | | | 1997 | 0x03 | XFER_REFUSE | 1998 | | | 1999 | 0x04 | KEEPALIVE | 2000 | | | 2001 | 0x05 | SESS_TERM | 2002 | | | 2003 | 0x06 | MSG_REJECT | 2004 | | | 2005 | 0x07--0xf | Unassigned | 2006 +-----------+--------------+ 2008 Table 13: Message Type Codes 2010 9.6. XFER_REFUSE Reason Codes 2012 EDITOR NOTE: sub-registry to-be-created upon publication of this 2013 specification. 2015 IANA will create, under the "Bundle Protocol" registry, a sub- 2016 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 2017 XFER_REFUSE Reason Codes" and initialize it with the contents of 2018 Table 14. The registration procedure is RFC Required. 2020 +----------+---------------------------+ 2021 | Code | Refusal Reason | 2022 +----------+---------------------------+ 2023 | 0x0 | Unknown | 2024 | | | 2025 | 0x1 | Extension Failure | 2026 | | | 2027 | 0x2 | Completed | 2028 | | | 2029 | 0x3 | No Resources | 2030 | | | 2031 | 0x4 | Retransmit | 2032 | | | 2033 | 0x5--0x7 | Unassigned | 2034 | | | 2035 | 0x8--0xf | Reserved for future usage | 2036 +----------+---------------------------+ 2038 Table 14: XFER_REFUSE Reason Codes 2040 9.7. SESS_TERM Reason Codes 2042 EDITOR NOTE: sub-registry to-be-created upon publication of this 2043 specification. 2045 IANA will create, under the "Bundle Protocol" registry, a sub- 2046 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 2047 SESS_TERM Reason Codes" and initialize it with the contents of 2048 Table 15. The registration procedure is RFC Required. 2050 +------------+---------------------+ 2051 | Code | Shutdown Reason | 2052 +------------+---------------------+ 2053 | 0x00 | Unknown | 2054 | | | 2055 | 0x01 | Idle timeout | 2056 | | | 2057 | 0x02 | Version mismatch | 2058 | | | 2059 | 0x03 | Busy | 2060 | | | 2061 | 0x04 | Contact Failure | 2062 | | | 2063 | 0x05 | Resource Exhaustion | 2064 | | | 2065 | 0x06--0xFF | Unassigned | 2066 +------------+---------------------+ 2068 Table 15: SESS_TERM Reason Codes 2070 9.8. MSG_REJECT Reason Codes 2072 EDITOR NOTE: sub-registry to-be-created upon publication of this 2073 specification. 2075 IANA will create, under the "Bundle Protocol" registry, a sub- 2076 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 2077 MSG_REJECT Reason Codes" and initialize it with the contents of 2078 Table 16. The registration procedure is RFC Required. 2080 +-----------+----------------------+ 2081 | Code | Rejection Reason | 2082 +-----------+----------------------+ 2083 | 0x00 | reserved | 2084 | | | 2085 | 0x01 | Message Type Unknown | 2086 | | | 2087 | 0x02 | Message Unsupported | 2088 | | | 2089 | 0x03 | Message Unexpected | 2090 | | | 2091 | 0x04-0xFF | Unassigned | 2092 +-----------+----------------------+ 2094 Table 16: REJECT Reason Codes 2096 10. Acknowledgments 2098 This specification is based on comments on implementation of 2099 [RFC7242] provided from Scott Burleigh. 2101 11. References 2103 11.1. Normative References 2105 [BCP195] Sheffer, Y., Holz, R., and P. Saint-Andre, 2106 "Recommendations for Secure Use of Transport Layer 2107 Security (TLS) and Datagram Transport Layer Security 2108 (DTLS)", BCP 195, RFC 7525, DOI 10.17487/RFC7525, May 2109 2015. 2111 [I-D.ietf-dtn-bpbis] 2112 Burleigh, S., Fall, K., and E. Birrane, "Bundle Protocol 2113 Version 7", draft-ietf-dtn-bpbis-12 (work in progress), 2114 November 2018. 2116 [RFC0793] Postel, J., "Transmission Control Protocol", STD 7, 2117 RFC 793, DOI 10.17487/RFC0793, September 1981, 2118 . 2120 [RFC1122] Braden, R., Ed., "Requirements for Internet Hosts - 2121 Communication Layers", STD 3, RFC 1122, 2122 DOI 10.17487/RFC1122, October 1989, 2123 . 2125 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2126 Requirement Levels", BCP 14, RFC 2119, 2127 DOI 10.17487/RFC2119, March 1997, 2128 . 2130 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 2131 (TLS) Protocol Version 1.2", RFC 5246, 2132 DOI 10.17487/RFC5246, August 2008, 2133 . 2135 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2136 Writing an IANA Considerations Section in RFCs", BCP 26, 2137 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2138 . 2140 11.2. Informative References 2142 [github-dtn-bpbis-tcpcl] 2143 Sipos, B., "TCPCL Example Implementation", 2144 . 2147 [I-D.ietf-dtn-bpsec] 2148 Birrane, E. and K. McKeever, "Bundle Protocol Security 2149 Specification", draft-ietf-dtn-bpsec-09 (work in 2150 progress), February 2019. 2152 [RFC2595] Newman, C., "Using TLS with IMAP, POP3 and ACAP", 2153 RFC 2595, DOI 10.17487/RFC2595, June 1999, 2154 . 2156 [RFC4838] Cerf, V., Burleigh, S., Hooke, A., Torgerson, L., Durst, 2157 R., Scott, K., Fall, K., and H. Weiss, "Delay-Tolerant 2158 Networking Architecture", RFC 4838, DOI 10.17487/RFC4838, 2159 April 2007, . 2161 [RFC5050] Scott, K. and S. Burleigh, "Bundle Protocol 2162 Specification", RFC 5050, DOI 10.17487/RFC5050, November 2163 2007, . 2165 [RFC6257] Symington, S., Farrell, S., Weiss, H., and P. Lovell, 2166 "Bundle Security Protocol Specification", RFC 6257, 2167 DOI 10.17487/RFC6257, May 2011, 2168 . 2170 [RFC7242] Demmer, M., Ott, J., and S. Perreault, "Delay-Tolerant 2171 Networking TCP Convergence-Layer Protocol", RFC 7242, 2172 DOI 10.17487/RFC7242, June 2014, 2173 . 2175 [RFC7942] Sheffer, Y. and A. Farrel, "Improving Awareness of Running 2176 Code: The Implementation Status Section", BCP 205, 2177 RFC 7942, DOI 10.17487/RFC7942, July 2016, 2178 . 2180 Appendix A. Significant changes from RFC7242 2182 The areas in which changes from [RFC7242] have been made to existing 2183 headers and messages are: 2185 o Split contact header into pre-TLS protocol negotiation and 2186 SESS_INIT parameter negotiation. The contact header is now fixed- 2187 length. 2189 o Changed contact header content to limit number of negotiated 2190 options. 2192 o Added contact option to negotiate maximum segment size (per each 2193 direction). 2195 o Added session extension capability. 2197 o Added transfer extension capability. Moved transfer total length 2198 into an extension item. 2200 o Defined new IANA registries for message / type / reason codes to 2201 allow renaming some codes for clarity. 2203 o Expanded Message Header to octet-aligned fields instead of bit- 2204 packing. 2206 o Added a bundle transfer identification number to all bundle- 2207 related messages (XFER_SEGMENT, XFER_ACK, XFER_REFUSE). 2209 o Use flags in XFER_ACK to mirror flags from XFER_SEGMENT. 2211 o Removed all uses of SDNV fields and replaced with fixed-bit-length 2212 fields. 2214 o Renamed SHUTDOWN to SESS_TERM to deconflict term "shutdown". 2216 o Removed the notion of a re-connection delay parameter. 2218 The areas in which extensions from [RFC7242] have been made as new 2219 messages and codes are: 2221 o Added contact negotiation failure SESS_TERM reason code. 2223 o Added MSG_REJECT message to indicate an unknown or unhandled 2224 message was received. 2226 o Added TLS session security mechanism. 2228 o Added Resource Exhaustion SESS_TERM reason code. 2230 Authors' Addresses 2231 Brian Sipos 2232 RKF Engineering Solutions, LLC 2233 7500 Old Georgetown Road 2234 Suite 1275 2235 Bethesda, MD 20814-6198 2236 United States of America 2238 Email: BSipos@rkf-eng.com 2240 Michael Demmer 2241 University of California, Berkeley 2242 Computer Science Division 2243 445 Soda Hall 2244 Berkeley, CA 94720-1776 2245 United States of America 2247 Email: demmer@cs.berkeley.edu 2249 Joerg Ott 2250 Aalto University 2251 Department of Communications and Networking 2252 PO Box 13000 2253 Aalto 02015 2254 Finland 2256 Email: jo@netlab.tkk.fi 2258 Simon Perreault 2259 Quebec, QC 2260 Canada 2262 Email: simon@per.reau.lt