idnits 2.17.1 draft-ietf-dtn-tcpclv4-12.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 (March 31, 2019) is 1845 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: October 2, 2019 J. Ott 7 Aalto University 8 S. Perreault 9 March 31, 2019 11 Delay-Tolerant Networking TCP Convergence Layer Protocol Version 4 12 draft-ietf-dtn-tcpclv4-12 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 October 2, 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 . . . . . . . . . . . . . . . . . 30 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 . . . . . . . . . . . . . . 36 91 6. Session Termination . . . . . . . . . . . . . . . . . . . . . 38 92 6.1. Session Termination Message (SESS_TERM) . . . . . . . . . 38 93 6.2. Idle Session Shutdown . . . . . . . . . . . . . . . . . . 40 94 7. Implementation Status . . . . . . . . . . . . . . . . . . . . 40 95 8. Security Considerations . . . . . . . . . . . . . . . . . . . 41 96 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 42 97 9.1. Port Number . . . . . . . . . . . . . . . . . . . . . . . 42 98 9.2. Protocol Versions . . . . . . . . . . . . . . . . . . . . 43 99 9.3. Session Extension Types . . . . . . . . . . . . . . . . . 43 100 9.4. Transfer Extension Types . . . . . . . . . . . . . . . . 44 101 9.5. Message Types . . . . . . . . . . . . . . . . . . . . . . 45 102 9.6. XFER_REFUSE Reason Codes . . . . . . . . . . . . . . . . 45 103 9.7. SESS_TERM Reason Codes . . . . . . . . . . . . . . . . . 46 104 9.8. MSG_REJECT Reason Codes . . . . . . . . . . . . . . . . . 47 105 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 48 106 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 48 107 11.1. Normative References . . . . . . . . . . . . . . . . . . 48 108 11.2. Informative References . . . . . . . . . . . . . . . . . 49 109 Appendix A. Significant changes from RFC7242 . . . . . . . . . . 49 110 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 50 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 | Name | Code | Description | 1013 +--------------+------+---------------------------------------------+ 1014 | SESS_INIT | 0x07 | Contains the session parameter inputs from | 1015 | | | one of the entities, as described in | 1016 | | | Section 4.6. | 1017 | | | | 1018 | SESS_TERM | 0x05 | Indicates that one of the entities | 1019 | | | participating in the session wishes to | 1020 | | | cleanly terminate the session, as described | 1021 | | | in Section 6. | 1022 | | | | 1023 | XFER_SEGMENT | 0x01 | Indicates the transmission of a segment of | 1024 | | | bundle data, as described in Section 5.2.2. | 1025 | | | | 1026 | XFER_ACK | 0x02 | Acknowledges reception of a data segment, | 1027 | | | as described in Section 5.2.3. | 1028 | | | | 1029 | XFER_REFUSE | 0x03 | Indicates that the transmission of the | 1030 | | | current bundle SHALL be stopped, as | 1031 | | | described in Section 5.2.4. | 1032 | | | | 1033 | KEEPALIVE | 0x04 | Used to keep TCPCL session active, as | 1034 | | | described in Section 5.1.1. | 1035 | | | | 1036 | MSG_REJECT | 0x06 | Contains a TCPCL message rejection, as | 1037 | | | described in Section 5.1.2. | 1038 +--------------+------+---------------------------------------------+ 1040 Table 2: TCPCL Message Types 1042 4.6. Session Initialization Message (SESS_INIT) 1044 Before a session is established and ready to transfer bundles, the 1045 session parameters are negotiated between the connected entities. 1046 The SESS_INIT message is used to convey the per-entity parameters 1047 which are used together to negotiate the per-session parameters as 1048 described in Section 4.7. 1050 The format of a SESS_INIT message is as follows in Figure 17. 1052 +-----------------------------+ 1053 | Message Header | 1054 +-----------------------------+ 1055 | Keepalive Interval (U16) | 1056 +-----------------------------+ 1057 | Segment MRU (U64) | 1058 +-----------------------------+ 1059 | Transfer MRU (U64) | 1060 +-----------------------------+ 1061 | EID Length (U16) | 1062 +-----------------------------+ 1063 | EID Data (variable) | 1064 +-----------------------------+ 1065 | Session Extension | 1066 | Items Length (U32) | 1067 +-----------------------------+ 1068 | Session Extension | 1069 | Items (var.) | 1070 +-----------------------------+ 1072 Figure 17: SESS_INIT Format 1074 The fields of the SESS_INIT message are: 1076 Keepalive Interval: A 16-bit unsigned integer indicating the 1077 interval, in seconds, between any subsequent messages being 1078 transmitted by the peer. The peer receiving this contact header 1079 uses this interval to determine how long to wait after any last- 1080 message transmission and a necessary subsequent KEEPALIVE message 1081 transmission. 1083 Segment MRU: A 64-bit unsigned integer indicating the largest 1084 allowable single-segment data payload size to be received in this 1085 session. Any XFER_SEGMENT sent to this peer SHALL have a data 1086 payload no longer than the peer's Segment MRU. The two entities 1087 of a single session MAY have different Segment MRUs, and no 1088 relation between the two is required. 1090 Transfer MRU: A 64-bit unsigned integer indicating the largest 1091 allowable total-bundle data size to be received in this session. 1092 Any bundle transfer sent to this peer SHALL have a Total Bundle 1093 Length payload no longer than the peer's Transfer MRU. This value 1094 can be used to perform proactive bundle fragmentation. The two 1095 entities of a single session MAY have different Transfer MRUs, and 1096 no relation between the two is required. 1098 EID Length and EID Data: Together these fields represent a variable- 1099 length text string. The EID Length is a 16-bit unsigned integer 1100 indicating the number of octets of EID Data to follow. A zero EID 1101 Length SHALL be used to indicate the lack of EID rather than a 1102 truly empty EID. This case allows an entity to avoid exposing EID 1103 information on an untrusted network. A non-zero-length EID Data 1104 SHALL contain the UTF-8 encoded EID of some singleton endpoint in 1105 which the sending entity is a member, in the canonical format of 1106 :. This EID encoding is 1107 consistent with [I-D.ietf-dtn-bpbis]. 1109 Session Extension Length and Session Extension Items: Together these 1110 fields represent protocol extension data not defined by this 1111 specification. The Session Extension Length is the total number 1112 of octets to follow which are used to encode the Session Extension 1113 Item list. The encoding of each Session Extension Item is within 1114 a consistent data container as described in Section 4.8. The full 1115 set of Session Extension Items apply for the duration of the TCPCL 1116 session to follow. The order and mulitplicity of these Session 1117 Extension Items MAY be significant, as defined in the associated 1118 type specification(s). 1120 4.7. Session Parameter Negotiation 1122 An entity calculates the parameters for a TCPCL session by 1123 negotiating the values from its own preferences (conveyed by the 1124 contact header it sent to the peer) with the preferences of the peer 1125 node (expressed in the contact header that it received from the 1126 peer). The negotiated parameters defined by this specification are 1127 described in the following paragraphs. 1129 Transfer MTU and Segment MTU: The maximum transmit unit (MTU) for 1130 whole transfers and individual segments are idententical to the 1131 Transfer MRU and Segment MRU, respectively, of the recevied 1132 contact header. A transmitting peer can send individual segments 1133 with any size smaller than the Segment MTU, depending on local 1134 policy, dynamic network conditions, etc. Determining the size of 1135 each transmitted segment is an implementation matter. 1137 Session Keepalive: Negotiation of the Session Keepalive parameter is 1138 performed by taking the minimum of this two contact headers' 1139 Keepalive Interval. The Session Keepalive interval is a parameter 1140 for the behavior described in Section 5.1.1. 1142 Enable TLS: Negotiation of the Enable TLS parameter is performed by 1143 taking the logical AND of the two contact headers' CAN_TLS flags. 1144 A local security policy is then applied to determine of the 1145 negotated value of Enable TLS is acceptable. It can be a 1146 reasonable security policy to both require or disallow the use of 1147 TLS depending upon the desired network flows. If the Enable TLS 1148 state is unacceptable, the node SHALL terminate the session with a 1149 reason code of "Contact Failure". Note that this contact failure 1150 is different than a failure of TLS handshake after an agreed-upon 1151 and acceptable Enable TLS state. If the negotiated Enable TLS 1152 value is true and acceptable then TLS negotiation feature 1153 (described in Section 4.4) begins immediately following the 1154 contact header exchange. 1156 Once this process of parameter negotiation is completed (which 1157 includes a possible completed TLS handshake of the connection to use 1158 TLS), this protocol defines no additional mechanism to change the 1159 parameters of an established session; to effect such a change, the 1160 TCPCL session MUST be terminated and a new session established. 1162 4.8. Session Extension Items 1164 Each of the Session Extension Items SHALL be encoded in an identical 1165 Type-Length-Value (TLV) container form as indicated in Figure 18. 1167 The fields of the Session Extension Item are: 1169 Flags: A one-octet field containing generic bit flags about the 1170 Item, which are listed in Table 3. If a TCPCL entity receives a 1171 Session Extension Item with an unknown Item Type and the CRITICAL 1172 flag set, the entity SHALL close the TCPCL session with SESS_TERM 1173 reason code of "Contact Failure". If the CRITICAL flag is not 1174 set, an entity SHALL skip over and ignore any item with an unknown 1175 Item Type. 1177 Item Type: A 16-bit unsigned integer field containing the type of 1178 the extension item. This specification does not define any 1179 extension types directly, but does allocate an IANA registry for 1180 such codes (see Section 9.3). 1182 Item Length: A 16-bit unsigned integer field containing the number 1183 of Item Value octets to follow. 1185 Item Value: A variable-length data field which is interpreted 1186 according to the associated Item Type. This specification places 1187 no restrictions on an extension's use of available Item Value 1188 data. Extension specifications SHOULD avoid the use of large data 1189 lengths, as no bundle transfers can begin until the full extension 1190 data is sent. 1192 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 1193 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 1194 +---------------+---------------+---------------+---------------+ 1195 | Item Flags | Item Type | Item Length...| 1196 +---------------+---------------+---------------+---------------+ 1197 | length contd. | Item Value... | 1198 +---------------+---------------+---------------+---------------+ 1200 Figure 18: Session Extension Item Format 1202 +----------+--------+-----------------------------------------------+ 1203 | Name | Code | Description | 1204 +----------+--------+-----------------------------------------------+ 1205 | CRITICAL | 0x01 | If bit is set, indicates that the receiving | 1206 | | | peer must handle the extension item. | 1207 | | | | 1208 | Reserved | others | 1209 +----------+--------+-----------------------------------------------+ 1211 Table 3: Session Extension Item Flags 1213 5. Established Session Operation 1215 This section describes the protocol operation for the duration of an 1216 established session, including the mechanism for transmitting bundles 1217 over the session. 1219 5.1. Upkeep and Status Messages 1221 5.1.1. Session Upkeep (KEEPALIVE) 1223 The protocol includes a provision for transmission of KEEPALIVE 1224 messages over the TCPCL session to help determine if the underlying 1225 TCP connection has been disrupted. 1227 As described in Section 4.3, a negotiated parameter of each session 1228 is the Session Keepalive interval. If the negotiated Session 1229 Keepalive is zero (i.e. one or both contact headers contains a zero 1230 Keepalive Interval), then the keepalive feature is disabled. There 1231 is no logical minimum value for the keepalive interval, but when used 1232 for many sessions on an open, shared network a short interval could 1233 lead to excessive traffic. For shared network use, entities SHOULD 1234 choose a keepalive interval no shorter than 30 seconds. There is no 1235 logical maximum value for the keepalive interval, but an idle TCP 1236 connection is liable for closure by the host operating system if the 1237 keepalive time is longer than tens-of-minutes. Entities SHOULD 1238 choose a keepalive interval no longer than 10 minutes (600 seconds). 1240 Note: The Keepalive Interval SHOULD NOT be chosen too short as TCP 1241 retransmissions MAY occur in case of packet loss. Those will have to 1242 be triggered by a timeout (TCP retransmission timeout (RTO)), which 1243 is dependent on the measured RTT for the TCP connection so that 1244 KEEPALIVE messages MAY experience noticeable latency. 1246 The format of a KEEPALIVE message is a one-octet message type code of 1247 KEEPALIVE (as described in Table 2) with no additional data. Both 1248 sides SHALL send a KEEPALIVE message whenever the negotiated interval 1249 has elapsed with no transmission of any message (KEEPALIVE or other). 1251 If no message (KEEPALIVE or other) has been received in a session 1252 after some implementation-defined time duration, then the node SHALL 1253 terminate the session by transmitting a SESS_TERM message (as 1254 described in Section 6.1) with reason code "Idle Timeout". If 1255 configurable, the idle timeout duration SHOULD be no shorter than 1256 twice the keepalive interval. If not configurable, the idle timeout 1257 duration SHOULD be exactly twice the keepalive interval. 1259 5.1.2. Message Rejection (MSG_REJECT) 1261 If a TCPCL node receives a message which is unknown to it (possibly 1262 due to an unhandled protocol mismatch) or is inappropriate for the 1263 current session state (e.g. a KEEPALIVE message received after 1264 contact header negotiation has disabled that feature), there is a 1265 protocol-level message to signal this condition in the form of a 1266 MSG_REJECT reply. 1268 The format of a MSG_REJECT message is as follows in Figure 19. 1270 +-----------------------------+ 1271 | Message Header | 1272 +-----------------------------+ 1273 | Reason Code (U8) | 1274 +-----------------------------+ 1275 | Rejected Message Header | 1276 +-----------------------------+ 1278 Figure 19: Format of MSG_REJECT Messages 1280 The fields of the MSG_REJECT message are: 1282 Reason Code: A one-octet refusal reason code interpreted according 1283 to the descriptions in Table 4. 1285 Rejected Message Header: The Rejected Message Header is a copy of 1286 the Message Header to which the MSG_REJECT message is sent as a 1287 response. 1289 +-------------+------+----------------------------------------------+ 1290 | Name | Code | Description | 1291 +-------------+------+----------------------------------------------+ 1292 | Message | 0x01 | A message was received with a Message Type | 1293 | Type | | code unknown to the TCPCL node. | 1294 | Unknown | | | 1295 | | | | 1296 | Message | 0x02 | A message was received but the TCPCL node | 1297 | Unsupported | | cannot comply with the message contents. | 1298 | | | | 1299 | Message | 0x03 | A message was received while the session is | 1300 | Unexpected | | in a state in which the message is not | 1301 | | | expected. | 1302 +-------------+------+----------------------------------------------+ 1304 Table 4: MSG_REJECT Reason Codes 1306 5.2. Bundle Transfer 1308 All of the messages in this section are directly associated with 1309 transferring a bundle between TCPCL entities. 1311 A single TCPCL transfer results in a bundle (handled by the 1312 convergence layer as opaque data) being exchanged from one node to 1313 the other. In TCPCL a transfer is accomplished by dividing a single 1314 bundle up into "segments" based on the receiving-side Segment MRU 1315 (see Section 4.2). The choice of the length to use for segments is 1316 an implementation matter, but each segment MUST be no larger than the 1317 receiving node's maximum receive unit (MRU) (see the field "Segment 1318 MRU" of Section 4.2). The first segment for a bundle MUST set the 1319 'START' flag, and the last one MUST set the 'end' flag in the 1320 XFER_SEGMENT message flags. 1322 A single transfer (and by extension a single segment) SHALL NOT 1323 contain data of more than a single bundle. This requirement is 1324 imposed on the agent using the TCPCL rather than TCPCL itself. 1326 If multiple bundles are transmitted on a single TCPCL connection, 1327 they MUST be transmitted consecutively without interleaving of 1328 segments from multiple bundles. 1330 5.2.1. Bundle Transfer ID 1332 Each of the bundle transfer messages contains a Transfer ID which is 1333 used to correlate messages (from both sides of a transfer) for each 1334 bundle. A Transfer ID does not attempt to address uniqueness of the 1335 bundle data itself and has no relation to concepts such as bundle 1336 fragmentation. Each invocation of TCPCL by the bundle protocol 1337 agent, requesting transmission of a bundle (fragmentary or 1338 otherwise), results in the initiation of a single TCPCL transfer. 1339 Each transfer entails the sending of a sequence of some number of 1340 XFER_SEGMENT and XFER_ACK messages; all are correlated by the same 1341 Transfer ID. 1343 Transfer IDs from each node SHALL be unique within a single TCPCL 1344 session. The initial Transfer ID from each node SHALL have value 1345 zero. Subsequent Transfer ID values SHALL be incremented from the 1346 prior Transfer ID value by one. Upon exhaustion of the entire 64-bit 1347 Transfer ID space, the sending node SHALL terminate the session with 1348 SESS_TERM reason code "Resource Exhaustion". 1350 For bidirectional bundle transfers, a TCPCL node SHOULD NOT rely on 1351 any relation between Transfer IDs originating from each side of the 1352 TCPCL session. 1354 5.2.2. Data Transmission (XFER_SEGMENT) 1356 Each bundle is transmitted in one or more data segments. The format 1357 of a XFER_SEGMENT message follows in Figure 20. 1359 +------------------------------+ 1360 | Message Header | 1361 +------------------------------+ 1362 | Message Flags (U8) | 1363 +------------------------------+ 1364 | Transfer ID (U64) | 1365 +------------------------------+ 1366 | Transfer Extension | 1367 | Items Length (U32) | 1368 | (only for START segment) | 1369 +------------------------------+ 1370 | Transfer Extension | 1371 | Items (var.) | 1372 | (only for START segment) | 1373 +------------------------------+ 1374 | Data length (U64) | 1375 +------------------------------+ 1376 | Data contents (octet string) | 1377 +------------------------------+ 1379 Figure 20: Format of XFER_SEGMENT Messages 1381 The fields of the XFER_SEGMENT message are: 1383 Message Flags: A one-octet field of single-bit flags, interpreted 1384 according to the descriptions in Table 5. 1386 Transfer ID: A 64-bit unsigned integer identifying the transfer 1387 being made. 1389 Transfer Extension Length and Transfer Extension Items: Together 1390 these fields represent protocol extension data for this 1391 specification. The Transfer Extension Length and Transfer 1392 Extension Item fields SHALL only be present when the 'START' flag 1393 is set on the message. The Transfer Extension Length is the total 1394 number of octets to follow which are used to encode the Transfer 1395 Extension Item list. The encoding of each Transfer Extension Item 1396 is within a consistent data container as described in 1397 Section 5.2.5. The full set of transfer extension items apply 1398 only to the assoicated single transfer. The order and 1399 mulitplicity of these transfer extension items MAY be significant, 1400 as defined in the associated type specification(s). 1402 Data length: A 64-bit unsigned integer indicating the number of 1403 octets in the Data contents to follow. 1405 Data contents: The variable-length data payload of the message. 1407 +----------+--------+-----------------------------------------------+ 1408 | Name | Code | Description | 1409 +----------+--------+-----------------------------------------------+ 1410 | END | 0x01 | If bit is set, indicates that this is the | 1411 | | | last segment of the transfer. | 1412 | | | | 1413 | START | 0x02 | If bit is set, indicates that this is the | 1414 | | | first segment of the transfer. | 1415 | | | | 1416 | Reserved | others | 1417 +----------+--------+-----------------------------------------------+ 1419 Table 5: XFER_SEGMENT Flags 1421 The flags portion of the message contains two optional values in the 1422 two low-order bits, denoted 'START' and 'END' in Table 5. The 1423 'START' bit MUST be set to one if it precedes the transmission of the 1424 first segment of a transfer. The 'END' bit MUST be set to one when 1425 transmitting the last segment of a transfer. In the case where an 1426 entire transfer is accomplished in a single segment, both the 'START' 1427 and 'END' bits MUST be set to one. 1429 Once a transfer of a bundle has commenced, the node MUST only send 1430 segments containing sequential portions of that bundle until it sends 1431 a segment with the 'END' bit set. No interleaving of multiple 1432 transfers from the same node is possible within a single TCPCL 1433 session. Simultaneous transfers between two entities MAY be achieved 1434 using multiple TCPCL sessions. 1436 5.2.3. Data Acknowledgments (XFER_ACK) 1438 Although the TCP transport provides reliable transfer of data between 1439 transport peers, the typical BSD sockets interface provides no means 1440 to inform a sending application of when the receiving application has 1441 processed some amount of transmitted data. Thus, after transmitting 1442 some data, the TCPCL needs an additional mechanism to determine 1443 whether the receiving agent has successfully received the segment. 1444 To this end, the TCPCL protocol provides feedback messaging whereby a 1445 receiving node transmits acknowledgments of reception of data 1446 segments. 1448 The format of an XFER_ACK message follows in Figure 21. 1450 +-----------------------------+ 1451 | Message Header | 1452 +-----------------------------+ 1453 | Message Flags (U8) | 1454 +-----------------------------+ 1455 | Transfer ID (U64) | 1456 +-----------------------------+ 1457 | Acknowledged length (U64) | 1458 +-----------------------------+ 1460 Figure 21: Format of XFER_ACK Messages 1462 The fields of the XFER_ACK message are: 1464 Message Flags: A one-octet field of single-bit flags, interpreted 1465 according to the descriptions in Table 5. 1467 Transfer ID: A 64-bit unsigned integer identifying the transfer 1468 being acknowledged. 1470 Acknowledged length: A 64-bit unsigned integer indicating the total 1471 number of octets in the transfer which are being acknowledged. 1473 A receiving TCPCL node SHALL send an XFER_ACK message in response to 1474 each received XFER_SEGMENT message. The flags portion of the 1475 XFER_ACK header SHALL be set to match the corresponding DATA_SEGMENT 1476 message being acknowledged. The acknowledged length of each XFER_ACK 1477 contains the sum of the data length fields of all XFER_SEGMENT 1478 messages received so far in the course of the indicated transfer. 1479 The sending node SHOULD transmit multiple XFER_SEGMENT messages 1480 without waiting for the corresponding XFER_ACK responses. This 1481 enables pipelining of messages on a transfer stream. 1483 For example, suppose the sending node transmits four segments of 1484 bundle data with lengths 100, 200, 500, and 1000, respectively. 1485 After receiving the first segment, the node sends an acknowledgment 1486 of length 100. After the second segment is received, the node sends 1487 an acknowledgment of length 300. The third and fourth 1488 acknowledgments are of length 800 and 1800, respectively. 1490 5.2.4. Transfer Refusal (XFER_REFUSE) 1492 The TCPCL supports a mechanism by which a receiving node can indicate 1493 to the sender that it does not want to receive the corresponding 1494 bundle. To do so, upon receiving an XFER_SEGMENT message, the node 1495 MAY transmit a XFER_REFUSE message. As data segments and 1496 acknowledgments MAY cross on the wire, the bundle that is being 1497 refused SHALL be identified by the Transfer ID of the refusal. 1499 There is no required relation between the Transfer MRU of a TCPCL 1500 node (which is supposed to represent a firm limitation of what the 1501 node will accept) and sending of a XFER_REFUSE message. A 1502 XFER_REFUSE can be used in cases where the agent's bundle storage is 1503 temporarily depleted or somehow constrained. A XFER_REFUSE can also 1504 be used after the bundle header or any bundle data is inspected by an 1505 agent and determined to be unacceptable. 1507 A receiver MAY send an XFER_REFUSE message as soon as it receives any 1508 XFER_SEGMENT message. The sender MUST be prepared for this and MUST 1509 associate the refusal with the correct bundle via the Transfer ID 1510 fields. 1512 The format of the XFER_REFUSE message is as follows in Figure 22. 1514 +-----------------------------+ 1515 | Message Header | 1516 +-----------------------------+ 1517 | Reason Code (U8) | 1518 +-----------------------------+ 1519 | Transfer ID (U64) | 1520 +-----------------------------+ 1522 Figure 22: Format of XFER_REFUSE Messages 1524 The fields of the XFER_REFUSE message are: 1526 Reason Code: A one-octet refusal reason code interpreted according 1527 to the descriptions in Table 6. 1529 Transfer ID: A 64-bit unsigned integer identifying the transfer 1530 being refused. 1532 +------------+------+-----------------------------------------------+ 1533 | Name | Code | Description | 1534 +------------+------+-----------------------------------------------+ 1535 | Unknown | 0x00 | Reason for refusal is unknown or not | 1536 | | | specified. | 1537 | | | | 1538 | Extension | 0x01 | A failure processing the Transfer Extension | 1539 | Failure | | Items ha occurred. | 1540 | | | | 1541 | Completed | 0x02 | The receiver already has the complete bundle. | 1542 | | | The sender MAY consider the bundle as | 1543 | | | completely received. | 1544 | | | | 1545 | No | 0x03 | The receiver's resources are exhausted. The | 1546 | Resources | | sender SHOULD apply reactive bundle | 1547 | | | fragmentation before retrying. | 1548 | | | | 1549 | Retransmit | 0x04 | The receiver has encountered a problem that | 1550 | | | requires the bundle to be retransmitted in | 1551 | | | its entirety. | 1552 +------------+------+-----------------------------------------------+ 1554 Table 6: XFER_REFUSE Reason Codes 1556 The receiver MUST, for each transfer preceding the one to be refused, 1557 have either acknowledged all XFER_SEGMENTs or refused the bundle 1558 transfer. 1560 The bundle transfer refusal MAY be sent before an entire data segment 1561 is received. If a sender receives a XFER_REFUSE message, the sender 1562 MUST complete the transmission of any partially sent XFER_SEGMENT 1563 message. There is no way to interrupt an individual TCPCL message 1564 partway through sending it. The sender MUST NOT commence 1565 transmission of any further segments of the refused bundle 1566 subsequently. Note, however, that this requirement does not ensure 1567 that an entity will not receive another XFER_SEGMENT for the same 1568 bundle after transmitting a XFER_REFUSE message since messages MAY 1569 cross on the wire; if this happens, subsequent segments of the bundle 1570 SHALL also be refused with a XFER_REFUSE message. 1572 Note: If a bundle transmission is aborted in this way, the receiver 1573 MAY not receive a segment with the 'END' flag set to '1' for the 1574 aborted bundle. The beginning of the next bundle is identified by 1575 the 'START' bit set to '1', indicating the start of a new transfer, 1576 and with a distinct Transfer ID value. 1578 5.2.5. Transfer Extension Items 1580 Each of the Transfer Extension Items SHALL be encoded in an identical 1581 Type-Length-Value (TLV) container form as indicated in Figure 23. 1583 The fields of the Transfer Extension Item are: 1585 Flags: A one-octet field containing generic bit flags about the 1586 Item, which are listed in Table 7. If a TCPCL node receives a 1587 Transfer Extension Item with an unknown Item Type and the CRITICAL 1588 flag set, the node SHALL refuse the transfer with an XFER_REFUSE 1589 reason code of "Extension Failure". If the CRITICAL flag is not 1590 set, an entity SHALL skip over and ignore any item with an unknown 1591 Item Type. 1593 Item Type: A 16-bit unsigned integer field containing the type of 1594 the extension item. This specification allocates an IANA registry 1595 for such codes (see Section 9.4). 1597 Item Length: A 16-bit unsigned integer field containing the number 1598 of Item Value octets to follow. 1600 Item Value: A variable-length data field which is interpreted 1601 according to the associated Item Type. This specification places 1602 no restrictions on an extension's use of available Item Value 1603 data. Extension specifications SHOULD avoid the use of large data 1604 lengths, as the associated transfer cannot begin until the full 1605 extension data is sent. 1607 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 1608 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 1609 +---------------+---------------+---------------+---------------+ 1610 | Item Flags | Item Type | Item Length...| 1611 +---------------+---------------+---------------+---------------+ 1612 | length contd. | Item Value... | 1613 +---------------+---------------+---------------+---------------+ 1615 Figure 23: Transfer Extension Item Format 1617 +----------+--------+-----------------------------------------------+ 1618 | Name | Code | Description | 1619 +----------+--------+-----------------------------------------------+ 1620 | CRITICAL | 0x01 | If bit is set, indicates that the receiving | 1621 | | | peer must handle the extension item. | 1622 | | | | 1623 | Reserved | others | 1624 +----------+--------+-----------------------------------------------+ 1626 Table 7: Transfer Extension Item Flags 1628 5.2.5.1. Transfer Length Extension 1630 The purpose of the Transfer Length extension is to allow entities to 1631 preemptively refuse bundles that would exceed their resources or to 1632 prepare storage on the receiving node for the upcoming bundle data. 1634 Multiple Transfer Length extension items SHALL NOT occur within the 1635 same transfer. The lack of a Transfer Length extension item in any 1636 transfer SHALL NOT imply anything about the potential length of the 1637 transfer. The Transfer Length extension SHALL be assigned transfer 1638 extension type ID 0x0001. 1640 If a transfer occupies exactly one segment (i.e. both START and END 1641 bits are set) the Transfer Length extension SHOULD NOT be present. 1642 The extension does not provide any additional information for single- 1643 segment transfers. 1645 The format of the Transfer Length data is as follows in Figure 24. 1647 +----------------------+ 1648 | Total Length (U64) | 1649 +----------------------+ 1651 Figure 24: Format of Transfer Length data 1653 The fields of the Transfer Length extension are: 1655 Total Length: A 64-bit unsigned integer indicating the size of the 1656 data-to-be-transferred. The Total Length field SHALL be treated 1657 as authoritative by the receiver. If, for whatever reason, the 1658 actual total length of bundle data received differs from the value 1659 indicated by the Total Length value, the receiver SHALL treat the 1660 transmitted data as invalid. 1662 6. Session Termination 1664 This section describes the procedures for ending a TCPCL session. 1666 6.1. Session Termination Message (SESS_TERM) 1668 To cleanly shut down a session, a SESS_TERM message SHALL be 1669 transmitted by either node at any point following complete 1670 transmission of any other message. When sent to initiate a 1671 termination, the REPLY bit of a SESS_TERM message SHALL NOT be set. 1672 Upon receiving a SESS_TERM message after not sending a SESS_TERM 1673 message in the same session, an entity SHALL send an acknowledging 1674 SESS_TERM message. When sent to acknowledge a termination, a 1675 SESS_TERM message SHALL have identical data content from the message 1676 being acknowledged except for the REPLY bit, which is set to indicate 1677 acknowledgement. 1679 After sending a SESS_TERM message, an entity MAY continue a possible 1680 in-progress transfer in either direction. After sending a SESS_TERM 1681 message, an entity SHALL NOT begin any new outgoing transfer (i.e. 1682 send an XFER_SEGMENT message) for the remainder of the session. 1683 After receving a SESS_TERM message, an entity SHALL NOT accept any 1684 new incoming transfer for the remainder of the session. 1686 Instead of following a clean shutdown sequence, after transmitting a 1687 SESS_TERM message an entity MAY immediately close the associated TCP 1688 connection. When performing an unclean shutdown, a receiving node 1689 SHOULD acknowledge all received data segments before closing the TCP 1690 connection. Not acknowledging received segments can result in 1691 unnecessary retransmission. When performing an unclean shutodwn, a 1692 transmitting node SHALL treat either sending or receiving a SESS_TERM 1693 message (i.e. before the final acknowledgment) as a failure of the 1694 transfer. Any delay between request to terminate the TCP connection 1695 and actual closing of the connection (a "half-closed" state) MAY be 1696 ignored by the TCPCL node. 1698 The format of the SESS_TERM message is as follows in Figure 25. 1700 +-----------------------------+ 1701 | Message Header | 1702 +-----------------------------+ 1703 | Message Flags (U8) | 1704 +-----------------------------+ 1705 | Reason Code (U8) | 1706 +-----------------------------+ 1708 Figure 25: Format of SESS_TERM Messages 1710 The fields of the SESS_TERM message are: 1712 Message Flags: A one-octet field of single-bit flags, interpreted 1713 according to the descriptions in Table 8. 1715 Reason Code: A one-octet refusal reason code interpreted according 1716 to the descriptions in Table 9. 1718 +----------+--------+-----------------------------------------------+ 1719 | Name | Code | Description | 1720 +----------+--------+-----------------------------------------------+ 1721 | REPLY | 0x01 | If bit is set, indicates that this message is | 1722 | | | an acknowledgement of an earlier SESS_TERM | 1723 | | | message. | 1724 | | | | 1725 | Reserved | others | 1726 +----------+--------+-----------------------------------------------+ 1728 Table 8: SESS_TERM Flags 1730 +--------------+------+---------------------------------------------+ 1731 | Name | Code | Description | 1732 +--------------+------+---------------------------------------------+ 1733 | Unknown | 0x00 | A termination reason is not available. | 1734 | | | | 1735 | Idle timeout | 0x01 | The session is being closed due to | 1736 | | | idleness. | 1737 | | | | 1738 | Version | 0x02 | The node cannot conform to the specified | 1739 | mismatch | | TCPCL protocol version. | 1740 | | | | 1741 | Busy | 0x03 | The node is too busy to handle the current | 1742 | | | session. | 1743 | | | | 1744 | Contact | 0x04 | The node cannot interpret or negotiate | 1745 | Failure | | contact header option. | 1746 | | | | 1747 | Resource | 0x05 | The node has run into some resource limit | 1748 | Exhaustion | | and cannot continue the session. | 1749 +--------------+------+---------------------------------------------+ 1751 Table 9: SESS_TERM Reason Codes 1753 A session shutdown MAY occur immediately after transmission of a 1754 contact header (and prior to any further message transmit). This 1755 MAY, for example, be used to notify that the node is currently not 1756 able or willing to communicate. However, an entity MUST always send 1757 the contact header to its peer before sending a SESS_TERM message. 1759 If reception of the contact header itself somehow fails (e.g. an 1760 invalid "magic string" is recevied), an entity SHALL close the TCP 1761 connection without sending a SESS_TERM message. If the content of 1762 the Session Extension Items data disagrees with the Session Extension 1763 Length (i.e. the last Item claims to use more octets than are present 1764 in the Session Extension Length), the reception of the contact header 1765 is considered to have failed. 1767 If a session is to be terminated before a protocol message has 1768 completed being sent, then the node MUST NOT transmit the SESS_TERM 1769 message but still SHALL close the TCP connection. Each TCPCL message 1770 is contiguous in the octet stream and has no ability to be cut short 1771 and/or preempted by an other message. This is particularly important 1772 when large segment sizes are being transmitted; either entire 1773 XFER_SEGMENT is sent before a SESS_TERM message or the connection is 1774 simply terminated mid-XFER_SEGMENT. 1776 6.2. Idle Session Shutdown 1778 The protocol includes a provision for clean shutdown of idle 1779 sessions. Determining the length of time to wait before closing idle 1780 sessions, if they are to be closed at all, is an implementation and 1781 configuration matter. 1783 If there is a configured time to close idle links and if no TCPCL 1784 messages (other than KEEPALIVE messages) has been received for at 1785 least that amount of time, then either node MAY terminate the session 1786 by transmitting a SESS_TERM message indicating the reason code of 1787 "Idle timeout" (as described in Table 9). 1789 7. Implementation Status 1791 [NOTE to the RFC Editor: please remove this section before 1792 publication, as well as the reference to [RFC7942] and 1793 [github-dtn-bpbis-tcpcl].] 1795 This section records the status of known implementations of the 1796 protocol defined by this specification at the time of posting of this 1797 Internet-Draft, and is based on a proposal described in [RFC7942]. 1798 The description of implementations in this section is intended to 1799 assist the IETF in its decision processes in progressing drafts to 1800 RFCs. Please note that the listing of any individual implementation 1801 here does not imply endorsement by the IETF. Furthermore, no effort 1802 has been spent to verify the information presented here that was 1803 supplied by IETF contributors. This is not intended as, and must not 1804 be construed to be, a catalog of available implementations or their 1805 features. Readers are advised to note that other implementations may 1806 exist. 1808 An example implementation of the this draft of TCPCLv4 has been 1809 created as a GitHub project [github-dtn-bpbis-tcpcl] and is intented 1810 to use as a proof-of-concept and as a possible source of 1811 interoperability testing. This example implementation uses D-Bus as 1812 the CL-BP Agent interface, so it only runs on hosts which provide the 1813 Python "dbus" library. 1815 8. Security Considerations 1817 One security consideration for this protocol relates to the fact that 1818 entities present their endpoint identifier as part of the contact 1819 header exchange. It would be possible for an entity to fake this 1820 value and present the identity of a singleton endpoint in which the 1821 node is not a member, essentially masquerading as another DTN node. 1822 If this identifier is used outside of a TLS-secured session or 1823 without further verification as a means to determine which bundles 1824 are transmitted over the session, then the node that has falsified 1825 its identity would be able to obtain bundles that it otherwise would 1826 not have. Therefore, an entity SHALL NOT use the EID value of an 1827 unsecured contact header to derive a peer node's identity unless it 1828 can corroborate it via other means. When TCPCL session security is 1829 mandated by a TCPCL peer, that peer SHALL transmit initial unsecured 1830 contact header values indicated in Table 10 in order. These values 1831 avoid unnecessarily leaking session parameters and will be ignored 1832 when secure contact header re-exchange occurs. 1834 +--------------------+---------------------------------------------+ 1835 | Parameter | Value | 1836 +--------------------+---------------------------------------------+ 1837 | Flags | The USE_TLS flag is set. | 1838 | | | 1839 | Keepalive Interval | Zero, indicating no keepalive. | 1840 | | | 1841 | Segment MRU | Zero, indicating all segments are refused. | 1842 | | | 1843 | Transfer MRU | Zero, indicating all transfers are refused. | 1844 | | | 1845 | EID | Empty, indicating lack of EID. | 1846 +--------------------+---------------------------------------------+ 1848 Table 10: Recommended Unsecured Contact Header 1850 TCPCL can be used to provide point-to-point transport security, but 1851 does not provide security of data-at-rest and does not guarantee end- 1852 to-end bundle security. The mechanisms defined in [RFC6257] and 1853 [I-D.ietf-dtn-bpsec] are to be used instead. 1855 Even when using TLS to secure the TCPCL session, the actual 1856 ciphersuite negotiated between the TLS peers MAY be insecure. TLS 1857 can be used to perform authentication without data confidentiality, 1858 for example. It is up to security policies within each TCPCL node to 1859 ensure that the negotiated TLS ciphersuite meets transport security 1860 requirements. This is identical behavior to STARTTLS use in 1861 [RFC2595]. 1863 Another consideration for this protocol relates to denial-of-service 1864 attacks. An entity MAY send a large amount of data over a TCPCL 1865 session, requiring the receiving entity to handle the data, attempt 1866 to stop the flood of data by sending a XFER_REFUSE message, or 1867 forcibly terminate the session. This burden could cause denial of 1868 service on other, well-behaving sessions. There is also nothing to 1869 prevent a malicious entity from continually establishing sessions and 1870 repeatedly trying to send copious amounts of bundle data. A 1871 listening entity MAY take countermeasures such as ignoring TCP SYN 1872 messages, closing TCP connections as soon as they are established, 1873 waiting before sending the contact header, sending a SESS_TERM 1874 message quickly or with a delay, etc. 1876 9. IANA Considerations 1878 In this section, registration procedures are as defined in [RFC8126]. 1880 Some of the registries below are created new for TCPCLv4 but share 1881 code values with TCPCLv3. This was done to disambiguate the use of 1882 these values between TCPCLv3 and TCPCLv4 while preserving the 1883 semantics of some values. 1885 9.1. Port Number 1887 Port number 4556 has been previously assigned as the default port for 1888 the TCP convergence layer in [RFC7242]. This assignment is unchanged 1889 by protocol version 4. Each TCPCL entity identifies its TCPCL 1890 protocol version in its initial contact (see Section 9.2), so there 1891 is no ambiguity about what protocol is being used. 1893 +------------------------+-------------------------------------+ 1894 | Parameter | Value | 1895 +------------------------+-------------------------------------+ 1896 | Service Name: | dtn-bundle | 1897 | | | 1898 | Transport Protocol(s): | TCP | 1899 | | | 1900 | Assignee: | Simon Perreault | 1901 | | | 1902 | Contact: | Simon Perreault | 1903 | | | 1904 | Description: | DTN Bundle TCP CL Protocol | 1905 | | | 1906 | Reference: | [RFC7242] | 1907 | | | 1908 | Port Number: | 4556 | 1909 +------------------------+-------------------------------------+ 1911 9.2. Protocol Versions 1913 IANA has created, under the "Bundle Protocol" registry, a sub- 1914 registry titled "Bundle Protocol TCP Convergence-Layer Version 1915 Numbers" and initialize it with the following table. The 1916 registration procedure is RFC Required. 1918 +-------+-------------+---------------------+ 1919 | Value | Description | Reference | 1920 +-------+-------------+---------------------+ 1921 | 0 | Reserved | [RFC7242] | 1922 | | | | 1923 | 1 | Reserved | [RFC7242] | 1924 | | | | 1925 | 2 | Reserved | [RFC7242] | 1926 | | | | 1927 | 3 | TCPCL | [RFC7242] | 1928 | | | | 1929 | 4 | TCPCLv4 | This specification. | 1930 | | | | 1931 | 5-255 | Unassigned | 1932 +-------+-------------+---------------------+ 1934 9.3. Session Extension Types 1936 EDITOR NOTE: sub-registry to-be-created upon publication of this 1937 specification. 1939 IANA will create, under the "Bundle Protocol" registry, a sub- 1940 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 1941 Session Extension Types" and initialize it with the contents of 1942 Table 11. The registration procedure is RFC Required within the 1943 lower range 0x0001--0x7FFF. Values in the range 0x8000--0xFFFF are 1944 reserved for use on private networks for functions not published to 1945 the IANA. 1947 +----------------+--------------------------+ 1948 | Code | Session Extension Type | 1949 +----------------+--------------------------+ 1950 | 0x0000 | Reserved | 1951 | | | 1952 | 0x0001--0x7FFF | Unassigned | 1953 | | | 1954 | 0x8000--0xFFFF | Private/Experimental Use | 1955 +----------------+--------------------------+ 1957 Table 11: Session Extension Type Codes 1959 9.4. Transfer Extension Types 1961 EDITOR NOTE: sub-registry to-be-created upon publication of this 1962 specification. 1964 IANA will create, under the "Bundle Protocol" registry, a sub- 1965 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 1966 Transfer Extension Types" and initialize it with the contents of 1967 Table 12. The registration procedure is RFC Required within the 1968 lower range 0x0001--0x7FFF. Values in the range 0x8000--0xFFFF are 1969 reserved for use on private networks for functions not published to 1970 the IANA. 1972 +----------------+---------------------------+ 1973 | Code | Transfer Extension Type | 1974 +----------------+---------------------------+ 1975 | 0x0000 | Reserved | 1976 | | | 1977 | 0x0001 | Transfer Length Extension | 1978 | | | 1979 | 0x0002--0x7FFF | Unassigned | 1980 | | | 1981 | 0x8000--0xFFFF | Private/Experimental Use | 1982 +----------------+---------------------------+ 1984 Table 12: Transfer Extension Type Codes 1986 9.5. Message Types 1988 EDITOR NOTE: sub-registry to-be-created upon publication of this 1989 specification. 1991 IANA will create, under the "Bundle Protocol" registry, a sub- 1992 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 1993 Message Types" and initialize it with the contents of Table 13. The 1994 registration procedure is RFC Required. 1996 +-----------+--------------+ 1997 | Code | Message Type | 1998 +-----------+--------------+ 1999 | 0x00 | Reserved | 2000 | | | 2001 | 0x01 | XFER_SEGMENT | 2002 | | | 2003 | 0x02 | XFER_ACK | 2004 | | | 2005 | 0x03 | XFER_REFUSE | 2006 | | | 2007 | 0x04 | KEEPALIVE | 2008 | | | 2009 | 0x05 | SESS_TERM | 2010 | | | 2011 | 0x06 | MSG_REJECT | 2012 | | | 2013 | 0x07 | SESS_INIT | 2014 | | | 2015 | 0x08--0xf | Unassigned | 2016 +-----------+--------------+ 2018 Table 13: Message Type Codes 2020 9.6. XFER_REFUSE Reason Codes 2022 EDITOR NOTE: sub-registry to-be-created upon publication of this 2023 specification. 2025 IANA will create, under the "Bundle Protocol" registry, a sub- 2026 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 2027 XFER_REFUSE Reason Codes" and initialize it with the contents of 2028 Table 14. The registration procedure is RFC Required. 2030 +------------+---------------------------+ 2031 | Code | Refusal Reason | 2032 +------------+---------------------------+ 2033 | 0x00 | Unknown | 2034 | | | 2035 | 0x01 | Extension Failure | 2036 | | | 2037 | 0x02 | Completed | 2038 | | | 2039 | 0x03 | No Resources | 2040 | | | 2041 | 0x04 | Retransmit | 2042 | | | 2043 | 0x05--0x07 | Unassigned | 2044 | | | 2045 | 0x08--0xFF | Reserved for future usage | 2046 +------------+---------------------------+ 2048 Table 14: XFER_REFUSE Reason Codes 2050 9.7. SESS_TERM Reason Codes 2052 EDITOR NOTE: sub-registry to-be-created upon publication of this 2053 specification. 2055 IANA will create, under the "Bundle Protocol" registry, a sub- 2056 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 2057 SESS_TERM Reason Codes" and initialize it with the contents of 2058 Table 15. The registration procedure is RFC Required. 2060 +------------+---------------------+ 2061 | Code | Termination Reason | 2062 +------------+---------------------+ 2063 | 0x00 | Unknown | 2064 | | | 2065 | 0x01 | Idle timeout | 2066 | | | 2067 | 0x02 | Version mismatch | 2068 | | | 2069 | 0x03 | Busy | 2070 | | | 2071 | 0x04 | Contact Failure | 2072 | | | 2073 | 0x05 | Resource Exhaustion | 2074 | | | 2075 | 0x06--0xFF | Unassigned | 2076 +------------+---------------------+ 2078 Table 15: SESS_TERM Reason Codes 2080 9.8. MSG_REJECT Reason Codes 2082 EDITOR NOTE: sub-registry to-be-created upon publication of this 2083 specification. 2085 IANA will create, under the "Bundle Protocol" registry, a sub- 2086 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 2087 MSG_REJECT Reason Codes" and initialize it with the contents of 2088 Table 16. The registration procedure is RFC Required. 2090 +-----------+----------------------+ 2091 | Code | Rejection Reason | 2092 +-----------+----------------------+ 2093 | 0x00 | reserved | 2094 | | | 2095 | 0x01 | Message Type Unknown | 2096 | | | 2097 | 0x02 | Message Unsupported | 2098 | | | 2099 | 0x03 | Message Unexpected | 2100 | | | 2101 | 0x04-0xFF | Unassigned | 2102 +-----------+----------------------+ 2104 Table 16: MSG_REJECT Reason Codes 2106 10. Acknowledgments 2108 This specification is based on comments on implementation of 2109 [RFC7242] provided from Scott Burleigh. 2111 11. References 2113 11.1. Normative References 2115 [BCP195] Sheffer, Y., Holz, R., and P. Saint-Andre, 2116 "Recommendations for Secure Use of Transport Layer 2117 Security (TLS) and Datagram Transport Layer Security 2118 (DTLS)", BCP 195, RFC 7525, DOI 10.17487/RFC7525, May 2119 2015. 2121 [I-D.ietf-dtn-bpbis] 2122 Burleigh, S., Fall, K., and E. Birrane, "Bundle Protocol 2123 Version 7", draft-ietf-dtn-bpbis-12 (work in progress), 2124 November 2018. 2126 [RFC0793] Postel, J., "Transmission Control Protocol", STD 7, 2127 RFC 793, DOI 10.17487/RFC0793, September 1981, 2128 . 2130 [RFC1122] Braden, R., Ed., "Requirements for Internet Hosts - 2131 Communication Layers", STD 3, RFC 1122, 2132 DOI 10.17487/RFC1122, October 1989, 2133 . 2135 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2136 Requirement Levels", BCP 14, RFC 2119, 2137 DOI 10.17487/RFC2119, March 1997, 2138 . 2140 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 2141 (TLS) Protocol Version 1.2", RFC 5246, 2142 DOI 10.17487/RFC5246, August 2008, 2143 . 2145 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2146 Writing an IANA Considerations Section in RFCs", BCP 26, 2147 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2148 . 2150 11.2. Informative References 2152 [github-dtn-bpbis-tcpcl] 2153 Sipos, B., "TCPCL Example Implementation", 2154 . 2157 [I-D.ietf-dtn-bpsec] 2158 Birrane, E. and K. McKeever, "Bundle Protocol Security 2159 Specification", draft-ietf-dtn-bpsec-09 (work in 2160 progress), February 2019. 2162 [RFC2595] Newman, C., "Using TLS with IMAP, POP3 and ACAP", 2163 RFC 2595, DOI 10.17487/RFC2595, June 1999, 2164 . 2166 [RFC4838] Cerf, V., Burleigh, S., Hooke, A., Torgerson, L., Durst, 2167 R., Scott, K., Fall, K., and H. Weiss, "Delay-Tolerant 2168 Networking Architecture", RFC 4838, DOI 10.17487/RFC4838, 2169 April 2007, . 2171 [RFC5050] Scott, K. and S. Burleigh, "Bundle Protocol 2172 Specification", RFC 5050, DOI 10.17487/RFC5050, November 2173 2007, . 2175 [RFC6257] Symington, S., Farrell, S., Weiss, H., and P. Lovell, 2176 "Bundle Security Protocol Specification", RFC 6257, 2177 DOI 10.17487/RFC6257, May 2011, 2178 . 2180 [RFC7242] Demmer, M., Ott, J., and S. Perreault, "Delay-Tolerant 2181 Networking TCP Convergence-Layer Protocol", RFC 7242, 2182 DOI 10.17487/RFC7242, June 2014, 2183 . 2185 [RFC7942] Sheffer, Y. and A. Farrel, "Improving Awareness of Running 2186 Code: The Implementation Status Section", BCP 205, 2187 RFC 7942, DOI 10.17487/RFC7942, July 2016, 2188 . 2190 Appendix A. Significant changes from RFC7242 2192 The areas in which changes from [RFC7242] have been made to existing 2193 headers and messages are: 2195 o Split contact header into pre-TLS protocol negotiation and 2196 SESS_INIT parameter negotiation. The contact header is now fixed- 2197 length. 2199 o Changed contact header content to limit number of negotiated 2200 options. 2202 o Added contact option to negotiate maximum segment size (per each 2203 direction). 2205 o Added session extension capability. 2207 o Added transfer extension capability. Moved transfer total length 2208 into an extension item. 2210 o Defined new IANA registries for message / type / reason codes to 2211 allow renaming some codes for clarity. 2213 o Expanded Message Header to octet-aligned fields instead of bit- 2214 packing. 2216 o Added a bundle transfer identification number to all bundle- 2217 related messages (XFER_SEGMENT, XFER_ACK, XFER_REFUSE). 2219 o Use flags in XFER_ACK to mirror flags from XFER_SEGMENT. 2221 o Removed all uses of SDNV fields and replaced with fixed-bit-length 2222 fields. 2224 o Renamed SHUTDOWN to SESS_TERM to deconflict term "shutdown". 2226 o Removed the notion of a re-connection delay parameter. 2228 The areas in which extensions from [RFC7242] have been made as new 2229 messages and codes are: 2231 o Added contact negotiation failure SESS_TERM reason code. 2233 o Added MSG_REJECT message to indicate an unknown or unhandled 2234 message was received. 2236 o Added TLS session security mechanism. 2238 o Added Resource Exhaustion SESS_TERM reason code. 2240 Authors' Addresses 2241 Brian Sipos 2242 RKF Engineering Solutions, LLC 2243 7500 Old Georgetown Road 2244 Suite 1275 2245 Bethesda, MD 20814-6198 2246 United States of America 2248 Email: BSipos@rkf-eng.com 2250 Michael Demmer 2251 University of California, Berkeley 2252 Computer Science Division 2253 445 Soda Hall 2254 Berkeley, CA 94720-1776 2255 United States of America 2257 Email: demmer@cs.berkeley.edu 2259 Joerg Ott 2260 Aalto University 2261 Department of Communications and Networking 2262 PO Box 13000 2263 Aalto 02015 2264 Finland 2266 Email: ott@in.tum.de 2268 Simon Perreault 2269 Quebec, QC 2270 Canada 2272 Email: simon@per.reau.lt