idnits 2.17.1 draft-ietf-dtn-tcpclv4-10.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 (November 5, 2018) is 1997 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 586, but not defined == Missing Reference: 'SESSTERM' is mentioned on line 639, but not defined == Missing Reference: 'I1' is mentioned on line 787, but not defined == Missing Reference: 'L1' is mentioned on line 775, but not defined == Missing Reference: 'L2' is mentioned on line 775, but not defined == Missing Reference: 'L3' is mentioned on line 781, 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-11 ** 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-08 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: May 9, 2019 J. Ott 7 Aalto University 8 S. Perreault 9 November 5, 2018 11 Delay-Tolerant Networking TCP Convergence Layer Protocol Version 4 12 draft-ietf-dtn-tcpclv4-10 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 May 9, 2019. 44 Copyright Notice 46 Copyright (c) 2018 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.6.1. Session Extension Items . . . . . . . . . . . . . . . 26 80 4.7. Session Parameter Negotiation . . . . . . . . . . . . . . 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. Transfer Initialization (XFER_INIT) . . . . . . . . . 31 88 5.2.3. Data Transmission (XFER_SEGMENT) . . . . . . . . . . 34 89 5.2.4. Data Acknowledgments (XFER_ACK) . . . . . . . . . . . 35 90 5.2.5. Transfer Refusal (XFER_REFUSE) . . . . . . . . . . . 36 91 6. Session Termination . . . . . . . . . . . . . . . . . . . . . 38 92 6.1. Session Termination Message (SESS_TERM) . . . . . . . . . 38 93 6.2. Idle Session Shutdown . . . . . . . . . . . . . . . . . . 41 94 7. Implementation Status . . . . . . . . . . . . . . . . . . . . 41 95 8. Security Considerations . . . . . . . . . . . . . . . . . . . 41 96 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 43 97 9.1. Port Number . . . . . . . . . . . . . . . . . . . . . . . 43 98 9.2. Protocol Versions . . . . . . . . . . . . . . . . . . . . 43 99 9.3. Session Extension Types . . . . . . . . . . . . . . . . . 44 100 9.4. Transfer Extension Types . . . . . . . . . . . . . . . . 44 101 9.5. Message Types . . . . . . . . . . . . . . . . . . . . . . 45 102 9.6. XFER_REFUSE Reason Codes . . . . . . . . . . . . . . . . 46 103 9.7. SESS_TERM Reason Codes . . . . . . . . . . . . . . . . . 47 104 9.8. MSG_REJECT Reason Codes . . . . . . . . . . . . . . . . . 48 105 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 49 106 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 49 107 11.1. Normative References . . . . . . . . . . . . . . . . . . 49 108 11.2. Informative References . . . . . . . . . . . . . . . . . 49 109 Appendix A. Significant changes from RFC7242 . . . . . . . . . . 50 110 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 51 112 1. Introduction 114 This document describes the TCP-based convergence-layer protocol for 115 Delay-Tolerant Networking. Delay-Tolerant Networking is an end-to- 116 end architecture providing communications in and/or through highly 117 stressed environments, including those with intermittent 118 connectivity, long and/or variable delays, and high bit error rates. 119 More detailed descriptions of the rationale and capabilities of these 120 networks can be found in "Delay-Tolerant Network Architecture" 121 [RFC4838]. 123 An important goal of the DTN architecture is to accommodate a wide 124 range of networking technologies and environments. The protocol used 125 for DTN communications is the Bundle Protocol Version 7 (BPv7) 126 [I-D.ietf-dtn-bpbis], an application-layer protocol that is used to 127 construct a store-and-forward overlay network. BPv7 requires the 128 services of a "convergence-layer adapter" (CLA) to send and receive 129 bundles using the service of some "native" link, network, or Internet 130 protocol. This document describes one such convergence-layer adapter 131 that uses the well-known Transmission Control Protocol (TCP). This 132 convergence layer is referred to as TCP Convergence Layer Version 4 133 (TCPCLv4). For the remainder of this document, the abbreviation "BP" 134 without the version suffix refers to BPv7. For the remainder of this 135 document, the abbreviation "TCPCL" without the version suffix refers 136 to TCPCLv4. 138 The locations of the TCPCL and the BP in the Internet model protocol 139 stack (described in [RFC1122]) are shown in Figure 1. In particular, 140 when BP is using TCP as its bearer with TCPCL as its convergence 141 layer, both BP and TCPCL reside at the application layer of the 142 Internet model. 144 +-------------------------+ 145 | DTN Application | -\ 146 +-------------------------| | 147 | Bundle Protocol (BP) | -> Application Layer 148 +-------------------------+ | 149 | TCP Conv. Layer (TCPCL) | | 150 +-------------------------+ | 151 | TLS (optional) | -/ 152 +-------------------------+ 153 | TCP | ---> Transport Layer 154 +-------------------------+ 155 | IPv4/IPv6 | ---> Network Layer 156 +-------------------------+ 157 | Link-Layer Protocol | ---> Link Layer 158 +-------------------------+ 160 Figure 1: The Locations of the Bundle Protocol and the TCP 161 Convergence-Layer Protocol above the Internet Protocol Stack 163 This document describes the format of the protocol data units passed 164 between entities participating in TCPCL communications. This 165 document does not address: 167 o The format of protocol data units of the Bundle Protocol, as those 168 are defined elsewhere in [RFC5050] and [I-D.ietf-dtn-bpbis]. This 169 includes the concept of bundle fragmentation or bundle 170 encapsulation. The TCPCL transfers bundles as opaque data blocks. 172 o Mechanisms for locating or identifying other bundle entities 173 within an internet. 175 1.1. Convergence Layer Services 177 This version of the TCPCL provides the following services to support 178 the overlaying Bundle Protocol agent. In all cases, this is not an 179 API defintion but a logical description of how the CL may interact 180 with the BP agent. Each of these interactions may be associated with 181 any number of additional metadata items as necessary to support the 182 operation of the CL or BP agent. 184 Attempt Session The TCPCL allows a BP agent to pre-emptively attempt 185 to establish a TCPCL session with a peer entity. Each session 186 attempt can send a different set of session negotiation parameters 187 as directed by the BP agent. 189 Terminate Session The TCPCL allows a BP agent to pre-emptively 190 terminate an established TCPCL session with a peer entity. The 191 terminate request is on a per-session basis. 193 Session State Changed The TCPCL supports indication when the session 194 state changes. The top-level session states indicated are: 196 Contact Negotating: A TCP connection has been made (as either 197 active or passive entity) and contact negotiation has begun. 199 Session Negotiating: Contact negotation has been completed 200 (including possible TLS use) and session negotiation has begun. 202 Established: The session has been fully established and is ready 203 for its first transfer. 205 Closing: The entity received a SESS_TERM message and is in the 206 closing state. 208 Terminated: The session has finished normal termination 209 sequencing.. 211 Failed: The session ended without normal termination sequencing. 213 Session Idle Changed The TCPCL supports indication when the live/ 214 idle sub-state changes. This occurs only when the top-level 215 session state is Established. Because TCPCL transmits serially 216 over a TCP connection, it suffers from "head of queue blocking" 217 this indication provides information about when a session is 218 available for immediate transfer start. 220 Begin Transmission The principal purpose of the TCPCL is to allow a 221 BP agent to transmit bundle data over an established TCPCL 222 session. Transmission request is on a per-session basis, the CL 223 does not necessarily perform any per-session or inter-session 224 queueing. Any queueing of transmissions is the obligation of the 225 BP agent. 227 Transmission Success The TCPCL supports positive indication when a 228 bundle has been fully transferred to a peer entity. 230 Transmission Intermediate Progress The TCPCL supports positive 231 indication of intermediate progress of transferr to a peer entity. 232 This intermediate progress is at the granularity of each 233 transferred segment. 235 Transmission Failure The TCPCL supports positive indication of 236 certain reasons for bundle transmission failure, notably when the 237 peer entity rejects the bundle or when a TCPCL session ends before 238 transferr success. The TCPCL itself does not have a notion of 239 transfer timeout. 241 Reception Initialized The TCPCL supports indication to the reciver 242 just before any transmssion data is sent. This corresponds to 243 reception of the XFER_INIT message. 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 initialization (XFER_INIT) message followed by one or 441 more logical segments of data within an XFER_SEGMENT message. 442 Multiple bundles can be transmitted consecutively on a single TCPCL 443 connection. Segments from different bundles are never interleaved. 444 Bundle interleaving can be accomplished by fragmentation at the BP 445 layer or by establishing multiple TCPCL sessions between the same 446 peers. 448 A feature of this protocol is for the receiving node to send 449 acknowledgment (XFER_ACK) messages as bundle data segments arrive . 450 The rationale behind these acknowledgments is to enable the sender 451 node to determine how much of the bundle has been received, so that 452 in case the session is interrupted, it can perform reactive 453 fragmentation to avoid re-sending the already transmitted part of the 454 bundle. In addition, there is no explicit flow control on the TCPCL 455 layer. 457 A TCPCL receiver can interrupt the transmission of a bundle at any 458 point in time by replying with a XFER_REFUSE message, which causes 459 the sender to stop transmission of the associated bundle (if it 460 hasn't already finished transmission) Note: This enables a cross- 461 layer optimization in that it allows a receiver that detects that it 462 already has received a certain bundle to interrupt transmission as 463 early as possible and thus save transmission capacity for other 464 bundles. 466 For sessions that are idle, a KEEPALIVE message is sent at a 467 negotiated interval. This is used to convey node live-ness 468 information during otherwise message-less time intervals. 470 A SESS_TERM message is used to start the closing of a TCPCL session 471 (see Section 6.1). During shutdown sequencing, in-progress transfers 472 can be completed but no new transfers can be initiated. A SESS_TERM 473 message can also be used to refuse a session setup by a peer (see 474 Section 4.3). It is an implementation matter to determine whether or 475 not to close a TCPCL session while there are no transfers queued or 476 in-progress. 478 Once a session is established established, TCPCL is a symmetric 479 protocol between the peers. Both sides can start sending data 480 segments in a session, and one side's bundle transfer does not have 481 to complete before the other side can start sending data segments on 482 its own. Hence, the protocol allows for a bi-directional mode of 483 communication. Note that in the case of concurrent bidirectional 484 transmission, acknowledgment segments MAY be interleaved with data 485 segments. 487 3.2. TCPCL States and Transitions 489 The states of a nominal TCPCL session (i.e. without session failures) 490 are indicated in Figure 4. 492 +-------+ 493 | START | 494 +-------+ 495 | 496 TCP Establishment 497 | 498 V 499 +-----------+ +---------------------+ 500 | TCP |----------->| Contact / Session | 501 | Connected | | Negotiation | 502 +-----------+ +---------------------+ 503 | 504 +-----Session Parameters-----+ 505 | Negotiated 506 V 507 +-------------+ +-------------+ 508 | Established |----New Transfer---->| Established | 509 | Session | | Session | 510 | Idle |<---Transfers Done---| Live | 511 +-------------+ +-------------+ 512 | | 513 +------------------------------------+ 514 | 515 SESS_TERM Exchange 516 | 517 V 518 +-------------+ 519 | Established | +-------------+ 520 | Session |----Transfers------>| TCP | 521 | Ending | Done | Terminating | 522 +-------------+ +-------------+ 523 | 524 +------------Close Message------------+ 525 | 526 V 527 +-------+ 528 | END | 529 +-------+ 531 Figure 4: Top-level states of a TCPCL session 533 Notes on Established Session states: 535 Session "Live" means transmitting or reeiving over a transfer 536 stream. 538 Session "Idle" means no transmission/reception over a transfer 539 stream. 541 Session "Closing" means no new transfers will be allowed. 543 The contact negotiation sequencing is performed either as the active 544 or passive peer, and is illustrated in Figure 5 and Figure 6 545 respectively which both share the data validation and analyze final 546 states of Figure 7. 548 +-------+ 549 | START |-----TCP-----+ 550 +-------+ Connecting | 551 V 552 +-----------+ +---------+ 553 | Connected |--OK-->| Send CH |--OK-->[PCH] 554 +-----------+ +---------+ 555 | | 556 Error Error 557 | | 558 V | 559 [TCPTERM]<-------------+ 561 Figure 5: Contact Initiation as Active peer 563 +-------+ 564 | START |-----TCP----->[PCH] 565 +-------+ Connected 567 Figure 6: Contact Initiation as Passive peer 568 +-------->[TCPTERM]<----------+ 569 | | 570 Timeout Error 571 or Error | 572 | | 573 +-------+ +---------+ Contact +----------+ 574 | START |---->| Waiting |---- Header --->| Validate | 575 +-------+ +---------+ Received +----------+ 576 | 577 +---------------------------+ 578 | 579 V 580 +---------+ 581 +--Error--| Analyze |---No TLS---->[SI] 582 | | | ^ 583 | +---------+ | 584 | | | 585 V TLS | 586 [TCPTERM] Negotiated | 587 ^ | | 588 | V | 589 | +-----------+ | 590 | | Establish |---Success---+ 591 +--Error--| TLS | 592 +-----------+ 594 Figure 7: Processing of Contact Header (PCH) 596 The session negotiation sequencing is performed either as the active 597 or passive peer, and is illustrated in Figure 8 and Figure 9 598 respectively which both share the data validation and analyze final 599 states of Figure 10. 601 +-------+ TCPCL 602 | START |--Messaging--+ 603 +-------+ Available | 604 V 605 +----------------+ 606 | Send SESS_INIT |--OK-->[PSI] 607 +----------------+ 608 | 609 Error 610 | 611 V 612 [SESSTERM] 614 Figure 8: Session Initiation as Active peer 616 +-------+ TCPCL 617 | START |---Messaging-->[PSI] 618 +-------+ Available 620 Figure 9: Session Initiation as Passive peer 622 +------->[SESSTERM]<--------+ 623 | | 624 Timeout Error 625 or Error | 626 | | 627 +-------+ +---------+ +----------+ 628 | START |---->| Waiting |---SESS_INIT--->| Validate | 629 +-------+ +---------+ Received +----------+ 630 | 631 +---------------------------+ 632 | 633 V 634 +---------+ +--------------+ 635 +--Error--| Analyze |---->| Established | 636 | | | | Session Idle | 637 | +---------+ +--------------+ 638 V 639 [SESSTERM] 641 Figure 10: Processing of Session Initiation (PSI) 643 Transfers can occur after a session is established and it's not in 644 the ending state. Each transfer occurs within a single logical 645 transfer stream between a sender and a receiver, as illustrated in 646 Figure 11 and Figure 12 respectively. 648 +--Send XFER_DATA--+ 649 +--------+ | | 650 | Stream | +-------------+ | 651 | Idle |---Send XFER_INIT-->| In Progress |<---------+ 652 +--------+ +-------------+ 653 | 654 +------All segments sent-------+ 655 | 656 V 657 +---------+ +--------+ 658 | Waiting |---- Receive Final---->| Stream | 659 | for Ack | Ack | IDLE | 660 +---------+ +--------+ 662 Figure 11: Transfer sender states 664 Notes on transfer sending: 666 Pipelining of transfers can occur when the sending entity begins a 667 new transfer while in the "Waiting for Ack" state. 669 +-Receive XFER_DATA-+ 670 +--------+ | Send Ack | 671 | Stream | +-------------+ | 672 | IDLE |--Receive XFER_INIT-->| In Progress |<----------+ 673 +--------+ +-------------+ 674 | 675 +---------Sent Final Ack---------+ 676 | 677 V 678 +--------+ 679 | Stream | 680 | IDLE | 681 +--------+ 683 Figure 12: Transfer receiver states 685 3.3. Transfer Segmentation Policies 687 Each TCPCL session allows a negotiated transfer segmentation polcy to 688 be applied in each transfer direction. A receiving node can set the 689 Segment MRU in its contact header to determine the largest acceptable 690 segment size, and a transmitting node can segment a transfer into any 691 sizes smaller than the receiver's Segment MRU. It is a network 692 administration matter to determine an appropriate segmentation policy 693 for entities operating TCPCL, but guidance given here can be used to 694 steer policy toward performance goals. It is also advised to 695 consider the Segment MRU in relation to chunking/packetization 696 performed by TLS, TCP, and any intermediate network-layer nodes. 698 Minimum Overhead For a simple network expected to exchange 699 relatively small bundles, the Segment MRU can be set to be 700 identical to the Transfer MRU which indicates that all transfers 701 can be sent with a single data segment (i.e. no actual 702 segmentation). If the network is closed and all transmitters are 703 known to follow a single-segment transfer policy, then receivers 704 can avoid the necessity of segment reassembly. Because this CL 705 operates over a TCP stream, which suffers from a form of head-of- 706 queue blocking between messages, while one node is transmitting a 707 single XFER_SEGMENT message it is not able to transmit any 708 XFER_ACK or XFER_REFUSE for any associated received transfers. 710 Predictable Message Sizing In situations where the maximum message 711 size is desired to be well-controlled, the Segment MRU can be set 712 to the largest acceptable size (the message size less XFER_SEGMENT 713 header size) and transmitters can always segment a transfer into 714 maximum-size chunks no larger than the Segment MRU. This 715 guarantees that any single XFER_SEGMENT will not monopolize the 716 TCP stream for too long, which would prevent outgoing XFER_ACK and 717 XFER_REFUSE associated with received transfers. 719 Dynamic Segmentation Even after negotiation of a Segment MRU for 720 each receiving node, the actual transfer segmentation only needs 721 to guarantee than any individual segment is no larger than that 722 MRU. In a situation where network "goodput" is dynamic, the 723 transfer segmentation size can also be dynamic in order to control 724 message transmission duration. 726 Many other policies can be established in a TCPCL network between 727 these two extremes. Different policies can be applied to each 728 direction to/from any particular node. Additionally, future header 729 and transfer extension types can apply further nuance to transfer 730 policies and policy negotiation. 732 3.4. Example Message Exchange 734 The following figure depicts the protocol exchange for a simple 735 session, showing the session establishment and the transmission of a 736 single bundle split into three data segments (of lengths "L1", "L2", 737 and "L3") from Entity A to Entity B. 739 Note that the sending node MAY transmit multiple XFER_SEGMENT 740 messages without necessarily waiting for the corresponding XFER_ACK 741 responses. This enables pipelining of messages on a transfer stream. 742 Although this example only demonstrates a single bundle transmission, 743 it is also possible to pipeline multiple XFER_SEGMENT messages for 744 different bundles without necessarily waiting for XFER_ACK messages 745 to be returned for each one. However, interleaving data segments 746 from different bundles is not allowed. 748 No errors or rejections are shown in this example. 750 Entity A Entity B 751 ======== ======== 752 +-------------------------+ 753 | Contact Header | -> +-------------------------+ 754 +-------------------------+ <- | Contact Header | 755 +-------------------------+ 756 +-------------------------+ 757 | SESS_INIT | -> +-------------------------+ 758 +-------------------------+ <- | SESS_INIT | 759 +-------------------------+ 761 +-------------------------+ 762 | XFER_INIT | -> 763 | Transfer ID [I1] | 764 | Total Length [L1] | 765 +-------------------------+ 766 +-------------------------+ 767 | XFER_SEGMENT (start) | -> 768 | Transfer ID [I1] | 769 | Length [L1] | 770 | Bundle Data 0..(L1-1) | 771 +-------------------------+ 772 +-------------------------+ +-------------------------+ 773 | XFER_SEGMENT | -> <- | XFER_ACK (start) | 774 | Transfer ID [I1] | | Transfer ID [I1] | 775 | Length [L2] | | Length [L1] | 776 |Bundle Data L1..(L1+L2-1)| +-------------------------+ 777 +-------------------------+ 778 +-------------------------+ +-------------------------+ 779 | XFER_SEGMENT (end) | -> <- | XFER_ACK | 780 | Transfer ID [I1] | | Transfer ID [I1] | 781 | Length [L3] | | Length [L1+L2] | 782 |Bundle Data | +-------------------------+ 783 | (L1+L2)..(L1+L2+L3-1)| 784 +-------------------------+ 785 +-------------------------+ 786 <- | XFER_ACK (end) | 787 | Transfer ID [I1] | 788 | Length [L1+L2+L3] | 789 +-------------------------+ 791 +-------------------------+ 792 | SESS_TERM | -> +-------------------------+ 793 +-------------------------+ <- | SESS_TERM | 794 +-------------------------+ 796 Figure 13: An example of the flow of protocol messages on a single 797 TCP Session between two entities 799 4. Session Establishment 801 For bundle transmissions to occur using the TCPCL, a TCPCL session 802 MUST first be established between communicating entities. It is up 803 to the implementation to decide how and when session setup is 804 triggered. For example, some sessions MAY be opened proactively and 805 maintained for as long as is possible given the network conditions, 806 while other sessions MAY be opened only when there is a bundle that 807 is queued for transmission and the routing algorithm selects a 808 certain next-hop node. 810 4.1. TCP Connection 812 To establish a TCPCL session, an entity MUST first establish a TCP 813 connection with the intended peer entity, typically by using the 814 services provided by the operating system. Destination port number 815 4556 has been assigned by IANA as the Registered Port number for the 816 TCP convergence layer. Other destination port numbers MAY be used 817 per local configuration. Determining a peer's destination port 818 number (if different from the registered TCPCL port number) is up to 819 the implementation. Any source port number MAY be used for TCPCL 820 sessions. Typically an operating system assigned number in the TCP 821 Ephemeral range (49152-65535) is used. 823 If the entity is unable to establish a TCP connection for any reason, 824 then it is an implementation matter to determine how to handle the 825 connection failure. An entity MAY decide to re-attempt to establish 826 the connection. If it does so, it MUST NOT overwhelm its target with 827 repeated connection attempts. Therefore, the entity MUST retry the 828 connection setup no earlier than some delay time from the last 829 attempt, and it SHOULD use a (binary) exponential backoff mechanism 830 to increase this delay in case of repeated failures. 832 Once a TCP connection is established, each entity MUST immediately 833 transmit a contact header over the TCP connection. The format of the 834 contact header is described in Section 4.2. 836 4.2. Contact Header 838 Once a TCP connection is established, both parties exchange a contact 839 header. This section describes the format of the contact header and 840 the meaning of its fields. 842 Upon receipt of the contact header, both entities perform the 843 validation and negotiation procedures defined in Section 4.3. After 844 receiving the contact header from the other entity, either entity MAY 845 refuse the session by sending a SESS_TERM message with an appropriate 846 reason code. 848 The format for the Contact Header is as follows: 850 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 851 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 852 +---------------+---------------+---------------+---------------+ 853 | magic='dtn!' | 854 +---------------+---------------+---------------+---------------+ 855 | Version | Flags | 856 +---------------+---------------+ 858 Figure 14: Contact Header Format 860 See Section 4.3 for details on the use of each of these contact 861 header fields. The fields of the contact header are: 863 magic: A four-octet field that always contains the octet sequence 864 0x64 0x74 0x6e 0x21, i.e., the text string "dtn!" in US-ASCII (and 865 UTF-8). 867 Version: A one-octet field value containing the value 4 (current 868 version of the protocol). 870 Flags: A one-octet field of single-bit flags, interpreted according 871 to the descriptions in Table 1. 873 +----------+--------+-----------------------------------------------+ 874 | Name | Code | Description | 875 +----------+--------+-----------------------------------------------+ 876 | CAN_TLS | 0x01 | If bit is set, indicates that the sending | 877 | | | peer is capable of TLS security. | 878 | | | | 879 | Reserved | others | 880 +----------+--------+-----------------------------------------------+ 882 Table 1: Contact Header Flags 884 4.3. Contact Validation and Negotiation 886 Upon reception of the contact header, each node follows the following 887 procedures to ensure the validity of the TCPCL session and to 888 negotiate values for the session parameters. 890 If the magic string is not present or is not valid, the connection 891 MUST be terminated. The intent of the magic string is to provide 892 some protection against an inadvertent TCP connection by a different 893 protocol than the one described in this document. To prevent a flood 894 of repeated connections from a misconfigured application, an entity 895 MAY elect to hold an invalid connection open and idle for some time 896 before closing it. 898 The first negotiation is on the TCPCL protocol version to use. The 899 active node always sends its Contact Header first and waits for a 900 response from the passive node. The active node can repeatedly 901 attempt different protocol versions in descending order until the 902 passive node accepts one with a corresponding Contact Header reply. 903 Only upon response of a Contact Header from the passive node is the 904 TCPCL protocol version established and parameter negotiation begun. 906 During contact initiation, the active TCPCL node SHALL send the 907 highest TCPCL protocol version on a first session attempt for a TCPCL 908 peer. If the active node receives a Contact Header with a different 909 protocol version than the one sent earlier on the TCP connection, the 910 TCP connection SHALL be terminated. If the active node receives a 911 SESS_TERM message with reason of "Version Mismatch", that node MAY 912 attempt further TCPCL sessions with the peer using earlier protocol 913 version numbers in decreasing order. Managing multi-TCPCL-session 914 state such as this is an implementation matter. 916 If the passive node receives a contact header containing a version 917 that is greater than the current version of the protocol that the 918 node implements, then the node SHALL shutdown the session with a 919 reason code of "Version mismatch". If the passive node receives a 920 contact header with a version that is lower than the version of the 921 protocol that the node implements, the node MAY either terminate the 922 session (with a reason code of "Version mismatch") or the node MAY 923 adapt its operation to conform to the older version of the protocol. 924 The decision of version fall-back is an implementation matter. 926 4.4. Session Security 928 This version of the TCPCL supports establishing a Transport Layer 929 Security (TLS) session within an existing TCP connection. When TLS 930 is used within the TCPCL it affects the entire session. Once 931 established, there is no mechanism available to downgrade a TCPCL 932 session to non-TLS operation. If this is desired, the entire TCPCL 933 session MUST be terminated and a new non-TLS-negotiated session 934 established. 936 The use of TLS is negotated using the Contact Header as described in 937 Section 4.3. After negotiating an Enable TLS parameter of true, and 938 before any other TCPCL messages are sent within the session, the 939 session entities SHALL begin a TLS handshake in accordance with 940 [RFC5246]. The parameters within each TLS negotiation are 941 implementation dependent but any TCPCL node SHALL follow all 942 recommended practices of [BCP195], or any updates or successors that 943 become part of [BCP195]. By convention, this protocol uses the node 944 which initiated the underlying TCP connection as the "client" role of 945 the TLS handshake request. 947 The TLS handshake, if it occurs, is considered to be part of the 948 contact negotiation before the TCPCL session itself is established. 949 Specifics about sensitive data exposure are discussed in Section 8. 951 4.4.1. TLS Handshake Result 953 If a TLS handshake cannot negotiate a TLS session, both entities of 954 the TCPCL session SHALL terminate the TCP connection. At this point 955 the TCPCL session has not yet been established so there is no TCPCL 956 session to terminate. This also avoids any potential security issues 957 assoicated with further TCP communication with an untrusted peer. 959 After a TLS session is successfully established, the active peer 960 SHALL send a SESS_INIT message to begin session negotiation. This 961 session negotation and all subsequent messaging are secured. 963 4.4.2. Example TLS Initiation 965 A summary of a typical CAN_TLS usage is shown in the sequence in 966 Figure 15 below. 968 Entity A Entity B 969 ======== ======== 971 +-------------------------+ 972 | Open TCP Connnection | -> 973 +-------------------------+ +-------------------------+ 974 <- | Accept Connection | 975 +-------------------------+ 977 +-------------------------+ 978 | Contact Header | -> 979 +-------------------------+ +-------------------------+ 980 <- | Contact Header | 981 +-------------------------+ 983 +-------------------------+ +-------------------------+ 984 | TLS Negotiation | -> <- | TLS Negotiation | 985 | (as client) | | (as server) | 986 +-------------------------+ +-------------------------+ 988 ... secured TCPCL messaging, starting with SESS_INIT ... 990 +-------------------------+ +-------------------------+ 991 | SESS_TERM | -> <- | SESS_TERM | 992 +-------------------------+ +-------------------------+ 994 Figure 15: A simple visual example of TCPCL TLS Establishment between 995 two entities 997 4.5. Message Type Codes 999 After the initial exchange of a contact header, all messages 1000 transmitted over the session are identified by a one-octet header 1001 with the following structure: 1003 0 1 2 3 4 5 6 7 1004 +---------------+ 1005 | Message Type | 1006 +---------------+ 1008 Figure 16: Format of the Message Header 1010 The message header fields are as follows: 1012 Message Type: Indicates the type of the message as per Table 2 1013 below. Encoded values are listed in Section 9.5. 1015 +--------------+----------------------------------------------------+ 1016 | Type | Description | 1017 +--------------+----------------------------------------------------+ 1018 | SESS_INIT | Contains the session parameter inputs from one of | 1019 | | the entities, as described in Section 4.6. | 1020 | | | 1021 | XFER_INIT | Contains the length (in octets) of the next | 1022 | | transfer, as described in Section 5.2.2. | 1023 | | | 1024 | XFER_SEGMENT | Indicates the transmission of a segment of bundle | 1025 | | data, as described in Section 5.2.3. | 1026 | | | 1027 | XFER_ACK | Acknowledges reception of a data segment, as | 1028 | | described in Section 5.2.4. | 1029 | | | 1030 | XFER_REFUSE | Indicates that the transmission of the current | 1031 | | bundle SHALL be stopped, as described in Section | 1032 | | 5.2.5. | 1033 | | | 1034 | KEEPALIVE | Used to keep TCPCL session active, as described in | 1035 | | Section 5.1.1. | 1036 | | | 1037 | SESS_TERM | Indicates that one of the entities participating | 1038 | | in the session wishes to cleanly terminate the | 1039 | | session, as described in Section 6. | 1040 | | | 1041 | MSG_REJECT | Contains a TCPCL message rejection, as described | 1042 | | in Section 5.1.2. | 1043 +--------------+----------------------------------------------------+ 1045 Table 2: TCPCL Message Types 1047 4.6. Session Initialization Message (SESS_INIT) 1049 Before a session is established and ready to transfer bundles, the 1050 session parameters are negotiated between the connected entities. 1051 The SESS_INIT message is used to convey the per-entity parameters 1052 which are used together to negotiate the per-session parameters. 1054 The format of a SESS_INIT message is as follows in Figure 17. 1056 +-------------------------------+ 1057 | Message Header | 1058 +-------------------------------+ 1059 | Keepalive Interval (U16) | 1060 +-------------------------------+ 1061 | Segment MRU (U64) | 1062 +-------------------------------+ 1063 | Transfer MRU (U64) | 1064 +-------------------------------+ 1065 | EID Length (U16) | 1066 +-------------------------------+ 1067 | EID Data (variable) | 1068 +-------------------------------+ 1069 | Session Extension Length (U64)| 1070 +-------------------------------+ 1071 | Session Extension Items (var.)| 1072 +-------------------------------+ 1074 Figure 17: SESS_INIT Format 1076 A 16-bit unsigned integer indicating the interval, in seconds, 1077 between any subsequent messages being transmitted by the peer. 1078 The peer receiving this contact header uses this interval to 1079 determine how long to wait after any last-message transmission and 1080 a necessary subsequent KEEPALIVE message transmission. 1082 A 64-bit unsigned integer indicating the largest allowable single- 1083 segment data payload size to be received in this session. Any 1084 XFER_SEGMENT sent to this peer SHALL have a data payload no longer 1085 than the peer's Segment MRU. The two entities of a single session 1086 MAY have different Segment MRUs, and no relation between the two 1087 is required. 1089 A 64-bit unsigned integer indicating the largest allowable total- 1090 bundle data size to be received in this session. Any bundle 1091 transfer sent to this peer SHALL have a Total Bundle Length 1092 payload no longer than the peer's Transfer MRU. This value can be 1093 used to perform proactive bundle fragmentation. The two entities 1094 of a single session MAY have different Transfer MRUs, and no 1095 relation between the two is required. 1097 Together these fields represent a variable-length text string. 1098 The EID Length is a 16-bit unsigned integer indicating the number 1099 of octets of EID Data to follow. A zero EID Length SHALL be used 1100 to indicate the lack of EID rather than a truly empty EID. This 1101 case allows an entity to avoid exposing EID information on an 1102 untrusted network. A non-zero-length EID Data SHALL contain the 1103 UTF-8 encoded EID of some singleton endpoint in which the sending 1104 entity is a member, in the canonical format of :. This EID encoding is consistent 1106 with [I-D.ietf-dtn-bpbis]. 1108 Together these fields represent protocol extension data not 1109 defined by this specification. The Session Extension Length is 1110 the total number of octets to follow which are used to encode the 1111 Session Extension Item list. The encoding of each Session 1112 Extension Item is within a consistent data container as described 1113 in Section 4.6.1. The full set of Session Extension Items apply 1114 for the duration of the TCPCL session to follow. The order and 1115 mulitplicity of these Session Extension Items MAY be significant, 1116 as defined in the associated type specification(s). 1118 4.6.1. Session Extension Items 1120 Each of the Session Extension Items SHALL be encoded in an identical 1121 Type-Length-Value (TLV) container form as indicated in Figure 18. 1122 The fields of the Session Extension Item are: 1124 Flags: A one-octet field containing generic bit flags about the 1125 Item, which are listed in Table 3. If a TCPCL entity receives a 1126 Session Extension Item with an unknown Item Type and the CRITICAL 1127 flag set, the entity SHALL close the TCPCL session with SESS_TERM 1128 reason code of "Contact Failure". If the CRITICAL flag is not 1129 set, an entity SHALL skip over and ignore any item with an unknown 1130 Item Type. 1132 Item Type: A 16-bit unsigned integer field containing the type of 1133 the extension item. This specification does not define any 1134 extension types directly, but does allocate an IANA registry for 1135 such codes (see Section 9.3). 1137 Item Length: A 32-bit unsigned integer field containing the number 1138 of Item Value octets to follow. 1140 Item Value: A variable-length data field which is interpreted 1141 according to the associated Item Type. This specification places 1142 no restrictions on an extension's use of available Item Value 1143 data. Extension specification SHOULD avoid the use of large data 1144 exchanges within the TCPCL contact header as no bundle transfers 1145 can begin until the full contact exchange and negotiation has been 1146 completed. 1148 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 1149 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 1150 +---------------+---------------+---------------+---------------+ 1151 | Item Flags | Item Type | Item Length...| 1152 +---------------+---------------+---------------+---------------+ 1153 | length contd. | Item Value... | 1154 +---------------+---------------+---------------+---------------+ 1155 | value contd. | 1156 +---------------+---------------+---------------+---------------+ 1158 Figure 18: Session Extension Item Format 1160 +----------+--------+-----------------------------------------------+ 1161 | Name | Code | Description | 1162 +----------+--------+-----------------------------------------------+ 1163 | CRITICAL | 0x01 | If bit is set, indicates that the receiving | 1164 | | | peer must handle the extension item. | 1165 | | | | 1166 | Reserved | others | 1167 +----------+--------+-----------------------------------------------+ 1169 Table 3: Session Extension Item Flags 1171 4.7. Session Parameter Negotiation 1173 An entity calculates the parameters for a TCPCL session by 1174 negotiating the values from its own preferences (conveyed by the 1175 contact header it sent to the peer) with the preferences of the peer 1176 node (expressed in the contact header that it received from the 1177 peer). The negotiated parameters defined by this specification are 1178 described in the following paragraphs. 1180 Transfer MTU and Segment MTU: The maximum transmit unit (MTU) for 1181 whole transfers and individual segments are idententical to the 1182 Transfer MRU and Segment MRU, respectively, of the recevied 1183 contact header. A transmitting peer can send individual segments 1184 with any size smaller than the Segment MTU, depending on local 1185 policy, dynamic network conditions, etc. Determining the size of 1186 each transmitted segment is an implementation matter. 1188 Session Keepalive: Negotiation of the Session Keepalive parameter is 1189 performed by taking the minimum of this two contact headers' 1190 Keepalive Interval. The Session Keepalive interval is a parameter 1191 for the behavior described in Section 5.1.1. 1193 Enable TLS: Negotiation of the Enable TLS parameter is performed by 1194 taking the logical AND of the two contact headers' CAN_TLS flags. 1195 A local security policy is then applied to determine of the 1196 negotated value of Enable TLS is acceptable. It can be a 1197 reasonable security policy to both require or disallow the use of 1198 TLS depending upon the desired network flows. If the Enable TLS 1199 state is unacceptable, the node SHALL terminate the session with a 1200 reason code of "Contact Failure". Note that this contact failure 1201 is different than a failure of TLS handshake after an agreed-upon 1202 and acceptable Enable TLS state. If the negotiated Enable TLS 1203 value is true and acceptable then TLS negotiation feature 1204 (described in Section 4.4) begins immediately following the 1205 contact header exchange. 1207 Once this process of parameter negotiation is completed (which 1208 includes a possible completed TLS handshake of the connection to use 1209 TLS), this protocol defines no additional mechanism to change the 1210 parameters of an established session; to effect such a change, the 1211 TCPCL session MUST be terminated and a new session established. 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 SHOULD send a KEEPALIVE message whenever the negotiated 1249 interval has elapsed with no transmission of any message (KEEPALIVE 1250 or other). 1252 If no message (KEEPALIVE or other) has been received in a session 1253 after some implementation-defined time duration, then the node SHOULD 1254 terminate the session by transmitting a SESS_TERM message (as 1255 described in Section 6.1) with reason code "Idle Timeout". If 1256 configurable, the idle timeout duration SHOULD be no shorter than 1257 twice the keepalive interval. If not configurable, the idle timeout 1258 duration SHOULD be exactly twice the keepout interval. 1260 5.1.2. Message Rejection (MSG_REJECT) 1262 If a TCPCL node receives a message which is unknown to it (possibly 1263 due to an unhandled protocol mismatch) or is inappropriate for the 1264 current session state (e.g. a KEEPALIVE message received after 1265 contact header negotiation has disabled that feature), there is a 1266 protocol-level message to signal this condition in the form of a 1267 MSG_REJECT reply. 1269 The format of a MSG_REJECT message is as follows in Figure 19. 1271 +-----------------------------+ 1272 | Message Header | 1273 +-----------------------------+ 1274 | Reason Code (U8) | 1275 +-----------------------------+ 1276 | Rejected Message Header | 1277 +-----------------------------+ 1279 Figure 19: Format of MSG_REJECT Messages 1281 The fields of the MSG_REJECT message are: 1283 Reason Code: A one-octet refusal reason code interpreted according 1284 to the descriptions in Table 4. 1286 Rejected Message Header: The Rejected Message Header is a copy of 1287 the Message Header to which the MSG_REJECT message is sent as a 1288 response. 1290 +-------------+------+----------------------------------------------+ 1291 | Name | Code | Description | 1292 +-------------+------+----------------------------------------------+ 1293 | Message | 0x01 | A message was received with a Message Type | 1294 | Type | | code unknown to the TCPCL node. | 1295 | Unknown | | | 1296 | | | | 1297 | Message | 0x02 | A message was received but the TCPCL node | 1298 | Unsupported | | cannot comply with the message contents. | 1299 | | | | 1300 | Message | 0x03 | A message was received while the session is | 1301 | Unexpected | | in a state in which the message is not | 1302 | | | expected. | 1303 +-------------+------+----------------------------------------------+ 1305 Table 4: MSG_REJECT Reason Codes 1307 5.2. Bundle Transfer 1309 All of the messages in this section are directly associated with 1310 transferring a bundle between TCPCL entities. 1312 A single TCPCL transfer results in a bundle (handled by the 1313 convergence layer as opaque data) being exchanged from one node to 1314 the other. In TCPCL a transfer is accomplished by dividing a single 1315 bundle up into "segments" based on the receiving-side Segment MRU 1316 (see Section 4.2). The choice of the length to use for segments is 1317 an implementation matter, but each segment MUST be no larger than the 1318 receiving node's maximum receive unit (MRU) (see the field "Segment 1319 MRU" of Section 4.2). The first segment for a bundle MUST set the 1320 'START' flag, and the last one MUST set the 'end' flag in the 1321 XFER_SEGMENT message flags. 1323 A single transfer (and by extension a single segment) SHALL NOT 1324 contain data of more than a single bundle. This requirement is 1325 imposed on the agent using the TCPCL rather than TCPCL itself. 1327 If multiple bundles are transmitted on a single TCPCL connection, 1328 they MUST be transmitted consecutively without interleaving of 1329 segments from multiple bundles. 1331 5.2.1. Bundle Transfer ID 1333 Each of the bundle transfer messages contains a Transfer ID which is 1334 used to correlate messages (from both sides of a transfer) for each 1335 bundle. A Transfer ID does not attempt to address uniqueness of the 1336 bundle data itself and has no relation to concepts such as bundle 1337 fragmentation. Each invocation of TCPCL by the bundle protocol 1338 agent, requesting transmission of a bundle (fragmentary or 1339 otherwise), results in the initiation of a single TCPCL transfer. 1340 Each transfer entails the sending of a XFER_INIT message and some 1341 number of XFER_SEGMENT and XFER_ACK messages; all are correlated by 1342 the same Transfer ID. 1344 Transfer IDs from each node SHALL be unique within a single TCPCL 1345 session. The initial Transfer ID from each node SHALL have value 1346 zero. Subsequent Transfer ID values SHALL be incremented from the 1347 prior Transfer ID value by one. Upon exhaustion of the entire 64-bit 1348 Transfer ID space, the sending node SHALL terminate the session with 1349 SESS_TERM reason code "Resource Exhaustion". 1351 For bidirectional bundle transfers, a TCPCL node SHOULD NOT rely on 1352 any relation between Transfer IDs originating from each side of the 1353 TCPCL session. 1355 5.2.2. Transfer Initialization (XFER_INIT) 1357 The XFER_INIT message contains the total length, in octets, of the 1358 bundle data in the associated transfer. The total length is 1359 formatted as a 64-bit unsigned integer. 1361 The purpose of the XFER_INIT message is to allow entities to 1362 preemptively refuse bundles that would exceed their resources or to 1363 prepare storage on the receiving node for the upcoming bundle data. 1364 See Section 5.2.5 for details on when refusal based on XFER_INIT 1365 content is acceptable. 1367 The Total Bundle Length field within a XFER_INIT message SHALL be 1368 treated as authoritative by the receiver. If, for whatever reason, 1369 the actual total length of bundle data received differs from the 1370 value indicated by the XFER_INIT message, the receiver SHOULD treat 1371 the transmitted data as invalid. 1373 The format of the XFER_INIT message is as follows in Figure 20. 1375 +-----------------------------+ 1376 | Message Header | 1377 +-----------------------------+ 1378 | Transfer ID (U64) | 1379 +-----------------------------+ 1380 | Total Bundle Length (U64) | 1381 +-----------------------------+ 1382 | Transfer Extension | 1383 | Length (U64) | 1384 +-----------------------------+ 1385 | Transfer Extension Items... | 1386 +-----------------------------+ 1388 Figure 20: Format of XFER_INIT Messages 1390 The fields of the XFER_INIT message are: 1392 Transfer ID: A 64-bit unsigned integer identifying the transfer 1393 about to begin. 1395 Total Bundle Length: A 64-bit unsigned integer indicating the size 1396 of the data-to-be-transferred. 1398 Transfer Extension Length and Transfer Extension Items: Together 1399 these fields represent protocol extension data not defined by this 1400 specification. The Transfer Extension Length is the total number 1401 of octets to follow which are used to encode the Transfer 1402 Extension Item list. The encoding of each Transfer Extension Item 1403 is within a consistent data container as described in 1404 Section 5.2.2.1. The full set of transfer extension items apply 1405 only to the assoicated single transfer. The order and 1406 mulitplicity of these transfer extension items MAY be significant, 1407 as defined in the associated type specification(s). 1409 An XFER_INIT message SHALL be sent as the first message in a transfer 1410 sequence, before transmission of any XFER_SEGMENT messages for the 1411 same Transfer ID. XFER_INIT messages MUST NOT be sent unless the 1412 next XFER_SEGMENT message has the 'START' bit set to "1" (i.e., just 1413 before the start of a new transfer). 1415 5.2.2.1. Transfer Extension Items 1417 Each of the Transfer Extension Items SHALL be encoded in an identical 1418 Type-Length-Value (TLV) container form as indicated in Figure 21. 1419 The fields of the Transfer Extension Item are: 1421 Flags: A one-octet field containing generic bit flags about the 1422 Item, which are listed in Table 5. If a TCPCL node receives a 1423 Transfer Extension Item with an unknown Item Type and the CRITICAL 1424 flag set, the node SHALL refuse the transfer with an XFER_REFUSE 1425 reason code of "Extension Failure". If the CRITICAL flag is not 1426 set, an entity SHALL skip over and ignore any item with an unknown 1427 Item Type. 1429 Item Type: A 16-bit unsigned integer field containing the type of 1430 the extension item. This specification does not define any 1431 extension types directly, but does allocate an IANA registry for 1432 such codes (see Section 9.4). 1434 Item Length: A 32-bit unsigned integer field containing the number 1435 of Item Value octets to follow. 1437 Item Value: A variable-length data field which is interpreted 1438 according to the associated Item Type. This specification places 1439 no restrictions on an extension's use of available Item Value 1440 data. Extension specification SHOULD avoid the use of large data 1441 exchanges within the XFER_INIT as the associated transfer cannot 1442 begin until the full initialization message is sent. 1444 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 1445 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 1446 +---------------+---------------+---------------+---------------+ 1447 | Item Flags | Item Type | Item Length...| 1448 +---------------+---------------+---------------+---------------+ 1449 | length contd. | Item Value... | 1450 +---------------+---------------+---------------+---------------+ 1451 | value contd. | 1452 +---------------+---------------+---------------+---------------+ 1454 Figure 21: Transfer Extension Item Format 1456 +----------+--------+-----------------------------------------------+ 1457 | Name | Code | Description | 1458 +----------+--------+-----------------------------------------------+ 1459 | CRITICAL | 0x01 | If bit is set, indicates that the receiving | 1460 | | | peer must handle the extension item. | 1461 | | | | 1462 | Reserved | others | 1463 +----------+--------+-----------------------------------------------+ 1465 Table 5: Transfer Extension Item Flags 1467 5.2.3. Data Transmission (XFER_SEGMENT) 1469 Each bundle is transmitted in one or more data segments. The format 1470 of a XFER_SEGMENT message follows in Figure 22. 1472 +------------------------------+ 1473 | Message Header | 1474 +------------------------------+ 1475 | Message Flags (U8) | 1476 +------------------------------+ 1477 | Transfer ID (U64) | 1478 +------------------------------+ 1479 | Data length (U64) | 1480 +------------------------------+ 1481 | Data contents (octet string) | 1482 +------------------------------+ 1484 Figure 22: Format of XFER_SEGMENT Messages 1486 The fields of the XFER_SEGMENT message are: 1488 Message Flags: A one-octet field of single-bit flags, interpreted 1489 according to the descriptions in Table 6. 1491 Transfer ID: A 64-bit unsigned integer identifying the transfer 1492 being made. 1494 Data length: A 64-bit unsigned integer indicating the number of 1495 octets in the Data contents to follow. 1497 Data contents: The variable-length data payload of the message. 1499 +----------+--------+-----------------------------------------------+ 1500 | Name | Code | Description | 1501 +----------+--------+-----------------------------------------------+ 1502 | END | 0x01 | If bit is set, indicates that this is the | 1503 | | | last segment of the transfer. | 1504 | | | | 1505 | START | 0x02 | If bit is set, indicates that this is the | 1506 | | | first segment of the transfer. | 1507 | | | | 1508 | Reserved | others | 1509 +----------+--------+-----------------------------------------------+ 1511 Table 6: XFER_SEGMENT Flags 1513 The flags portion of the message contains two optional values in the 1514 two low-order bits, denoted 'START' and 'END' in Table 6. The 1515 'START' bit MUST be set to one if it precedes the transmission of the 1516 first segment of a transfer. The 'END' bit MUST be set to one when 1517 transmitting the last segment of a transfer. In the case where an 1518 entire transfer is accomplished in a single segment, both the 'START' 1519 and 'END' bits MUST be set to one. 1521 Once a transfer of a bundle has commenced, the node MUST only send 1522 segments containing sequential portions of that bundle until it sends 1523 a segment with the 'END' bit set. No interleaving of multiple 1524 transfers from the same node is possible within a single TCPCL 1525 session. Simultaneous transfers between two entities MAY be achieved 1526 using multiple TCPCL sessions. 1528 5.2.4. Data Acknowledgments (XFER_ACK) 1530 Although the TCP transport provides reliable transfer of data between 1531 transport peers, the typical BSD sockets interface provides no means 1532 to inform a sending application of when the receiving application has 1533 processed some amount of transmitted data. Thus, after transmitting 1534 some data, the TCPCL needs an additional mechanism to determine 1535 whether the receiving agent has successfully received the segment. 1536 To this end, the TCPCL protocol provides feedback messaging whereby a 1537 receiving node transmits acknowledgments of reception of data 1538 segments. 1540 The format of an XFER_ACK message follows in Figure 23. 1542 +-----------------------------+ 1543 | Message Header | 1544 +-----------------------------+ 1545 | Message Flags (U8) | 1546 +-----------------------------+ 1547 | Transfer ID (U64) | 1548 +-----------------------------+ 1549 | Acknowledged length (U64) | 1550 +-----------------------------+ 1552 Figure 23: Format of XFER_ACK Messages 1554 The fields of the XFER_ACK message are: 1556 Message Flags: A one-octet field of single-bit flags, interpreted 1557 according to the descriptions in Table 6. 1559 Transfer ID: A 64-bit unsigned integer identifying the transfer 1560 being acknowledged. 1562 Acknowledged length: A 64-bit unsigned integer indicating the total 1563 number of octets in the transfer which are being acknowledged. 1565 A receiving TCPCL node SHALL send an XFER_ACK message in response to 1566 each received XFER_SEGMENT message. The flags portion of the 1567 XFER_ACK header SHALL be set to match the corresponding DATA_SEGMENT 1568 message being acknowledged. The acknowledged length of each XFER_ACK 1569 contains the sum of the data length fields of all XFER_SEGMENT 1570 messages received so far in the course of the indicated transfer. 1571 The sending node MAY transmit multiple XFER_SEGMENT messages without 1572 necessarily waiting for the corresponding XFER_ACK responses. This 1573 enables pipelining of messages on a transfer stream. 1575 For example, suppose the sending node transmits four segments of 1576 bundle data with lengths 100, 200, 500, and 1000, respectively. 1577 After receiving the first segment, the node sends an acknowledgment 1578 of length 100. After the second segment is received, the node sends 1579 an acknowledgment of length 300. The third and fourth 1580 acknowledgments are of length 800 and 1800, respectively. 1582 5.2.5. Transfer Refusal (XFER_REFUSE) 1584 The TCPCL supports a mechanism by which a receiving node can indicate 1585 to the sender that it does not want to receive the corresponding 1586 bundle. To do so, upon receiving a XFER_INIT or XFER_SEGMENT 1587 message, the node MAY transmit a XFER_REFUSE message. As data 1588 segments and acknowledgments MAY cross on the wire, the bundle that 1589 is being refused SHALL be identified by the Transfer ID of the 1590 refusal. 1592 There is no required relation between the Transfer MRU of a TCPCL 1593 node (which is supposed to represent a firm limitation of what the 1594 node will accept) and sending of a XFER_REFUSE message. A 1595 XFER_REFUSE can be used in cases where the agent's bundle storage is 1596 temporarily depleted or somehow constrained. A XFER_REFUSE can also 1597 be used after the bundle header or any bundle data is inspected by an 1598 agent and determined to be unacceptable. 1600 A receiver MAY send an XFER_REFUSE message as soon as it receives a 1601 XFER_INIT message without waiting for the next XFER_SEGMENT message. 1602 The sender MUST be prepared for this and MUST associate the refusal 1603 with the correct bundle via the Transfer ID fields. 1605 The format of the XFER_REFUSE message is as follows in Figure 24. 1607 +-----------------------------+ 1608 | Message Header | 1609 +-----------------------------+ 1610 | Reason Code (U8) | 1611 +-----------------------------+ 1612 | Transfer ID (U64) | 1613 +-----------------------------+ 1615 Figure 24: Format of XFER_REFUSE Messages 1617 The fields of the XFER_REFUSE message are: 1619 Reason Code: A one-octet refusal reason code interpreted according 1620 to the descriptions in Table 7. 1622 Transfer ID: A 64-bit unsigned integer identifying the transfer 1623 being refused. 1625 +------------+------------------------------------------------------+ 1626 | Name | Semantics | 1627 +------------+------------------------------------------------------+ 1628 | Unknown | Reason for refusal is unknown or not specified. | 1629 | | | 1630 | Extension | A failure processing the Transfer Extension Items ha | 1631 | Failure | occurred. | 1632 | | | 1633 | Completed | The receiver already has the complete bundle. The | 1634 | | sender MAY consider the bundle as completely | 1635 | | received. | 1636 | | | 1637 | No | The receiver's resources are exhausted. The sender | 1638 | Resources | SHOULD apply reactive bundle fragmentation before | 1639 | | retrying. | 1640 | | | 1641 | Retransmit | The receiver has encountered a problem that requires | 1642 | | the bundle to be retransmitted in its entirety. | 1643 +------------+------------------------------------------------------+ 1645 Table 7: XFER_REFUSE Reason Codes 1647 The receiver MUST, for each transfer preceding the one to be refused, 1648 have either acknowledged all XFER_SEGMENTs or refused the bundle 1649 transfer. 1651 The bundle transfer refusal MAY be sent before an entire data segment 1652 is received. If a sender receives a XFER_REFUSE message, the sender 1653 MUST complete the transmission of any partially sent XFER_SEGMENT 1654 message. There is no way to interrupt an individual TCPCL message 1655 partway through sending it. The sender MUST NOT commence 1656 transmission of any further segments of the refused bundle 1657 subsequently. Note, however, that this requirement does not ensure 1658 that an entity will not receive another XFER_SEGMENT for the same 1659 bundle after transmitting a XFER_REFUSE message since messages MAY 1660 cross on the wire; if this happens, subsequent segments of the bundle 1661 SHOULD also be refused with a XFER_REFUSE message. 1663 Note: If a bundle transmission is aborted in this way, the receiver 1664 MAY not receive a segment with the 'END' flag set to '1' for the 1665 aborted bundle. The beginning of the next bundle is identified by 1666 the 'START' bit set to '1', indicating the start of a new transfer, 1667 and with a distinct Transfer ID value. 1669 6. Session Termination 1671 This section describes the procedures for ending a TCPCL session. 1673 6.1. Session Termination Message (SESS_TERM) 1675 To cleanly shut down a session, a SESS_TERM message SHALL be 1676 transmitted by either node at any point following complete 1677 transmission of any other message. When sent to initiate a 1678 termination, the REPLY bit of a SESS_TERM message SHALL NOT be set. 1679 Upon receiving a SESS_TERM message after not sending a SESS_TERM 1680 message in the same session, an entity SHOULD send an acknowledging 1681 SESS_TERM message. When sent to acknowledge a termination, a 1682 SESS_TERM message SHALL have identical data content from the message 1683 being acknowledged except for the REPLY bit, which is set to indicate 1684 acknowledgement. 1686 After sending a SESS_TERM message, an entity MAY continue a possible 1687 in-progress transfer in either direction. After sending a SESS_TERM 1688 message, an entity SHALL NOT begin any new outgoing transfer (i.e. 1689 send an XFER_INIT message) for the remainder of the session. After 1690 receving a SESS_TERM message, an entity SHALL NOT accept any new 1691 incoming transfer for the remainder of the session. 1693 Instead of following a clean shutdown sequence, after transmitting a 1694 SESS_TERM message an entity MAY immediately close the associated TCP 1695 connection. When performing an unclean shutdown, a receiving node 1696 SHOULD acknowledge all received data segments before closing the TCP 1697 connection. When performing an unclean shutodwn, a transmitting node 1698 SHALL treat either sending or receiving a SESS_TERM message (i.e. 1699 before the final acknowledgment) as a failure of the transfer. Any 1700 delay between request to terminate the TCP connection and actual 1701 closing of the connection (a "half-closed" state) MAY be ignored by 1702 the TCPCL node. 1704 The format of the SESS_TERM message is as follows in Figure 25. 1706 +-----------------------------+ 1707 | Message Header | 1708 +-----------------------------+ 1709 | Message Flags (U8) | 1710 +-----------------------------+ 1711 | Reason Code (U8) | 1712 +-----------------------------+ 1714 Figure 25: Format of SESS_TERM Messages 1716 The fields of the SESS_TERM message are: 1718 Message Flags: A one-octet field of single-bit flags, interpreted 1719 according to the descriptions in Table 8. 1721 Reason Code: A one-octet refusal reason code interpreted according 1722 to the descriptions in Table 9. 1724 +----------+--------+-----------------------------------------------+ 1725 | Name | Code | Description | 1726 +----------+--------+-----------------------------------------------+ 1727 | REPLY | 0x01 | If bit is set, indicates that this message is | 1728 | | | an acknowledgement of an earlier SESS_TERM | 1729 | | | message. | 1730 | | | | 1731 | Reserved | others | 1732 +----------+--------+-----------------------------------------------+ 1734 Table 8: SESS_TERM Flags 1736 +---------------+---------------------------------------------------+ 1737 | Name | Description | 1738 +---------------+---------------------------------------------------+ 1739 | Unknown | A termination reason is not available. | 1740 | | | 1741 | Idle timeout | The session is being closed due to idleness. | 1742 | | | 1743 | Version | The node cannot conform to the specified TCPCL | 1744 | mismatch | protocol version. | 1745 | | | 1746 | Busy | The node is too busy to handle the current | 1747 | | session. | 1748 | | | 1749 | Contact | The node cannot interpret or negotiate contact | 1750 | Failure | header option. | 1751 | | | 1752 | Resource | The node has run into some resource limit and | 1753 | Exhaustion | cannot continue the session. | 1754 +---------------+---------------------------------------------------+ 1756 Table 9: SESS_TERM Reason Codes 1758 A session shutdown MAY occur immediately after transmission of a 1759 contact header (and prior to any further message transmit). This 1760 MAY, for example, be used to notify that the node is currently not 1761 able or willing to communicate. However, an entity MUST always send 1762 the contact header to its peer before sending a SESS_TERM message. 1764 If reception of the contact header itself somehow fails (e.g. an 1765 invalid "magic string" is recevied), an entity SHOULD close the TCP 1766 connection without sending a SESS_TERM message. If the content of 1767 the Session Extension Items data disagrees with the Session Extension 1768 Length (i.e. the last Item claims to use more octets than are present 1769 in the Session Extension Length), the reception of the contact header 1770 is considered to have failed. 1772 If a session is to be terminated before a protocol message has 1773 completed being sent, then the node MUST NOT transmit the SESS_TERM 1774 message but still SHOULD close the TCP connection. Each TCPCL 1775 message is contiguous in the octet stream and has no ability to be 1776 cut short and/or preempted by an other message. This is particularly 1777 important when large segment sizes are being transmitted; either 1778 entire XFER_SEGMENT is sent before a SESS_TERM message or the 1779 connection is simply terminated mid-XFER_SEGMENT. 1781 6.2. Idle Session Shutdown 1783 The protocol includes a provision for clean shutdown of idle 1784 sessions. Determining the length of time to wait before closing idle 1785 sessions, if they are to be closed at all, is an implementation and 1786 configuration matter. 1788 If there is a configured time to close idle links and if no TCPCL 1789 messages (other than KEEPALIVE messages) has been received for at 1790 least that amount of time, then either node MAY terminate the session 1791 by transmitting a SESS_TERM message indicating the reason code of 1792 "Idle timeout" (as described in Table 9). 1794 7. Implementation Status 1796 [NOTE to the RFC Editor: please remove this section before 1797 publication, as well as the reference to [RFC7942] and 1798 [github-dtn-bpbis-tcpcl].] 1800 This section records the status of known implementations of the 1801 protocol defined by this specification at the time of posting of this 1802 Internet-Draft, and is based on a proposal described in [RFC7942]. 1803 The description of implementations in this section is intended to 1804 assist the IETF in its decision processes in progressing drafts to 1805 RFCs. Please note that the listing of any individual implementation 1806 here does not imply endorsement by the IETF. Furthermore, no effort 1807 has been spent to verify the information presented here that was 1808 supplied by IETF contributors. This is not intended as, and must not 1809 be construed to be, a catalog of available implementations or their 1810 features. Readers are advised to note that other implementations may 1811 exist. 1813 An example implementation of the this draft of TCPCLv4 has been 1814 created as a GitHub project [github-dtn-bpbis-tcpcl] and is intented 1815 to use as a proof-of-concept and as a possible source of 1816 interoperability testing. This example implementation uses D-Bus as 1817 the CL-BP Agent interface, so it only runs on hosts which provide the 1818 Python "dbus" library. 1820 8. Security Considerations 1822 One security consideration for this protocol relates to the fact that 1823 entities present their endpoint identifier as part of the contact 1824 header exchange. It would be possible for an entity to fake this 1825 value and present the identity of a singleton endpoint in which the 1826 node is not a member, essentially masquerading as another DTN node. 1827 If this identifier is used outside of a TLS-secured session or 1828 without further verification as a means to determine which bundles 1829 are transmitted over the session, then the node that has falsified 1830 its identity would be able to obtain bundles that it otherwise would 1831 not have. Therefore, an entity SHALL NOT use the EID value of an 1832 unsecured contact header to derive a peer node's identity unless it 1833 can corroborate it via other means. When TCPCL session security is 1834 mandated by a TCPCL peer, that peer SHALL transmit initial unsecured 1835 contact header values indicated in Table 10 in order. These values 1836 avoid unnecessarily leaking session parameters and will be ignored 1837 when secure contact header re-exchange occurs. 1839 +--------------------+---------------------------------------------+ 1840 | Parameter | Value | 1841 +--------------------+---------------------------------------------+ 1842 | Flags | The USE_TLS flag is set. | 1843 | | | 1844 | Keepalive Interval | Zero, indicating no keepalive. | 1845 | | | 1846 | Segment MRU | Zero, indicating all segments are refused. | 1847 | | | 1848 | Transfer MRU | Zero, indicating all transfers are refused. | 1849 | | | 1850 | EID | Empty, indicating lack of EID. | 1851 +--------------------+---------------------------------------------+ 1853 Table 10: Recommended Unsecured Contact Header 1855 TCPCL can be used to provide point-to-point transport security, but 1856 does not provide security of data-at-rest and does not guarantee end- 1857 to-end bundle security. The mechanisms defined in [RFC6257] and 1858 [I-D.ietf-dtn-bpsec] are to be used instead. 1860 Even when using TLS to secure the TCPCL session, the actual 1861 ciphersuite negotiated between the TLS peers MAY be insecure. TLS 1862 can be used to perform authentication without data confidentiality, 1863 for example. It is up to security policies within each TCPCL node to 1864 ensure that the negotiated TLS ciphersuite meets transport security 1865 requirements. This is identical behavior to STARTTLS use in 1866 [RFC2595]. 1868 Another consideration for this protocol relates to denial-of-service 1869 attacks. An entity MAY send a large amount of data over a TCPCL 1870 session, requiring the receiving entity to handle the data, attempt 1871 to stop the flood of data by sending a XFER_REFUSE message, or 1872 forcibly terminate the session. This burden could cause denial of 1873 service on other, well-behaving sessions. There is also nothing to 1874 prevent a malicious entity from continually establishing sessions and 1875 repeatedly trying to send copious amounts of bundle data. A 1876 listening entity MAY take countermeasures such as ignoring TCP SYN 1877 messages, closing TCP connections as soon as they are established, 1878 waiting before sending the contact header, sending a SESS_TERM 1879 message quickly or with a delay, etc. 1881 9. IANA Considerations 1883 In this section, registration procedures are as defined in [RFC8126]. 1885 Some of the registries below are created new for TCPCLv4 but share 1886 code values with TCPCLv3. This was done to disambiguate the use of 1887 these values between TCPCLv3 and TCPCLv4 while preserving the 1888 semantics of some values. 1890 9.1. Port Number 1892 Port number 4556 has been previously assigned as the default port for 1893 the TCP convergence layer in [RFC7242]. This assignment is unchanged 1894 by protocol version 4. Each TCPCL entity identifies its TCPCL 1895 protocol version in its initial contact (see Section 9.2), so there 1896 is no ambiguity about what protocol is being used. 1898 +------------------------+-------------------------------------+ 1899 | Parameter | Value | 1900 +------------------------+-------------------------------------+ 1901 | Service Name: | dtn-bundle | 1902 | | | 1903 | Transport Protocol(s): | TCP | 1904 | | | 1905 | Assignee: | Simon Perreault | 1906 | | | 1907 | Contact: | Simon Perreault | 1908 | | | 1909 | Description: | DTN Bundle TCP CL Protocol | 1910 | | | 1911 | Reference: | [RFC7242] | 1912 | | | 1913 | Port Number: | 4556 | 1914 +------------------------+-------------------------------------+ 1916 9.2. Protocol Versions 1918 IANA has created, under the "Bundle Protocol" registry, a sub- 1919 registry titled "Bundle Protocol TCP Convergence-Layer Version 1920 Numbers" and initialize it with the following table. The 1921 registration procedure is RFC Required. 1923 +-------+-------------+---------------------+ 1924 | Value | Description | Reference | 1925 +-------+-------------+---------------------+ 1926 | 0 | Reserved | [RFC7242] | 1927 | | | | 1928 | 1 | Reserved | [RFC7242] | 1929 | | | | 1930 | 2 | Reserved | [RFC7242] | 1931 | | | | 1932 | 3 | TCPCL | [RFC7242] | 1933 | | | | 1934 | 4 | TCPCLbis | This specification. | 1935 | | | | 1936 | 5-255 | Unassigned | 1937 +-------+-------------+---------------------+ 1939 9.3. Session Extension Types 1941 EDITOR NOTE: sub-registry to-be-created upon publication of this 1942 specification. 1944 IANA will create, under the "Bundle Protocol" registry, a sub- 1945 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 1946 Session Extension Types" and initialize it with the contents of 1947 Table 11. The registration procedure is RFC Required within the 1948 lower range 0x0001--0x7fff. Values in the range 0x8000--0xffff are 1949 reserved for use on private networks for functions not published to 1950 the IANA. 1952 +----------------+--------------------------+ 1953 | Code | Message Type | 1954 +----------------+--------------------------+ 1955 | 0x0000 | Reserved | 1956 | | | 1957 | 0x0001--0x7fff | Unassigned | 1958 | | | 1959 | 0x8000--0xffff | Private/Experimental Use | 1960 +----------------+--------------------------+ 1962 Table 11: Session Extension Type Codes 1964 9.4. Transfer Extension Types 1966 EDITOR NOTE: sub-registry to-be-created upon publication of this 1967 specification. 1969 IANA will create, under the "Bundle Protocol" registry, a sub- 1970 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 1971 Transfer Extension Types" and initialize it with the contents of 1972 Table 12. The registration procedure is RFC Required within the 1973 lower range 0x0001--0x7fff. Values in the range 0x8000--0xffff are 1974 reserved for use on private networks for functions not published to 1975 the IANA. 1977 +----------------+--------------------------+ 1978 | Code | Message Type | 1979 +----------------+--------------------------+ 1980 | 0x0000 | Reserved | 1981 | | | 1982 | 0x0001--0x7fff | Unassigned | 1983 | | | 1984 | 0x8000--0xffff | Private/Experimental Use | 1985 +----------------+--------------------------+ 1987 Table 12: Transfer Extension Type Codes 1989 9.5. Message Types 1991 EDITOR NOTE: sub-registry to-be-created upon publication of this 1992 specification. 1994 IANA will create, under the "Bundle Protocol" registry, a sub- 1995 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 1996 Message Types" and initialize it with the contents of Table 13. The 1997 registration procedure is RFC Required. 1999 +-----------+--------------+ 2000 | Code | Message Type | 2001 +-----------+--------------+ 2002 | 0x00 | Reserved | 2003 | | | 2004 | 0x01 | XFER_SEGMENT | 2005 | | | 2006 | 0x02 | XFER_ACK | 2007 | | | 2008 | 0x03 | XFER_REFUSE | 2009 | | | 2010 | 0x04 | KEEPALIVE | 2011 | | | 2012 | 0x05 | SESS_TERM | 2013 | | | 2014 | 0x06 | XFER_INIT | 2015 | | | 2016 | 0x07 | MSG_REJECT | 2017 | | | 2018 | 0x08--0xf | Unassigned | 2019 +-----------+--------------+ 2021 Table 13: Message Type Codes 2023 9.6. XFER_REFUSE Reason Codes 2025 EDITOR NOTE: sub-registry to-be-created upon publication of this 2026 specification. 2028 IANA will create, under the "Bundle Protocol" registry, a sub- 2029 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 2030 XFER_REFUSE Reason Codes" and initialize it with the contents of 2031 Table 14. The registration procedure is RFC Required. 2033 +----------+---------------------------+ 2034 | Code | Refusal Reason | 2035 +----------+---------------------------+ 2036 | 0x0 | Unknown | 2037 | | | 2038 | 0x1 | Extension Failure | 2039 | | | 2040 | 0x2 | Completed | 2041 | | | 2042 | 0x3 | No Resources | 2043 | | | 2044 | 0x4 | Retransmit | 2045 | | | 2046 | 0x5--0x7 | Unassigned | 2047 | | | 2048 | 0x8--0xf | Reserved for future usage | 2049 +----------+---------------------------+ 2051 Table 14: XFER_REFUSE Reason Codes 2053 9.7. SESS_TERM Reason Codes 2055 EDITOR NOTE: sub-registry to-be-created upon publication of this 2056 specification. 2058 IANA will create, under the "Bundle Protocol" registry, a sub- 2059 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 2060 SESS_TERM Reason Codes" and initialize it with the contents of 2061 Table 15. The registration procedure is RFC Required. 2063 +------------+---------------------+ 2064 | Code | Shutdown Reason | 2065 +------------+---------------------+ 2066 | 0x00 | Unknown | 2067 | | | 2068 | 0x01 | Idle timeout | 2069 | | | 2070 | 0x02 | Version mismatch | 2071 | | | 2072 | 0x03 | Busy | 2073 | | | 2074 | 0x04 | Contact Failure | 2075 | | | 2076 | 0x05 | Resource Exhaustion | 2077 | | | 2078 | 0x06--0xFF | Unassigned | 2079 +------------+---------------------+ 2081 Table 15: SESS_TERM Reason Codes 2083 9.8. MSG_REJECT Reason Codes 2085 EDITOR NOTE: sub-registry to-be-created upon publication of this 2086 specification. 2088 IANA will create, under the "Bundle Protocol" registry, a sub- 2089 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 2090 MSG_REJECT Reason Codes" and initialize it with the contents of 2091 Table 16. The registration procedure is RFC Required. 2093 +-----------+----------------------+ 2094 | Code | Rejection Reason | 2095 +-----------+----------------------+ 2096 | 0x00 | reserved | 2097 | | | 2098 | 0x01 | Message Type Unknown | 2099 | | | 2100 | 0x02 | Message Unsupported | 2101 | | | 2102 | 0x03 | Message Unexpected | 2103 | | | 2104 | 0x04-0xFF | Unassigned | 2105 +-----------+----------------------+ 2107 Table 16: REJECT Reason Codes 2109 10. Acknowledgments 2111 This specification is based on comments on implementation of 2112 [RFC7242] provided from Scott Burleigh. 2114 11. References 2116 11.1. Normative References 2118 [BCP195] Sheffer, Y., Holz, R., and P. Saint-Andre, 2119 "Recommendations for Secure Use of Transport Layer 2120 Security (TLS) and Datagram Transport Layer Security 2121 (DTLS)", BCP 195, RFC 7525, DOI 10.17487/RFC7525, May 2122 2015. 2124 [I-D.ietf-dtn-bpbis] 2125 Fall, K. and E. Birrane, "Bundle Protocol Version 7", 2126 draft-ietf-dtn-bpbis-11 (work in progress), May 2018. 2128 [RFC0793] Postel, J., "Transmission Control Protocol", STD 7, 2129 RFC 793, DOI 10.17487/RFC0793, September 1981, 2130 . 2132 [RFC1122] Braden, R., Ed., "Requirements for Internet Hosts - 2133 Communication Layers", STD 3, RFC 1122, 2134 DOI 10.17487/RFC1122, October 1989, 2135 . 2137 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2138 Requirement Levels", BCP 14, RFC 2119, 2139 DOI 10.17487/RFC2119, March 1997, 2140 . 2142 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 2143 (TLS) Protocol Version 1.2", RFC 5246, 2144 DOI 10.17487/RFC5246, August 2008, 2145 . 2147 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2148 Writing an IANA Considerations Section in RFCs", BCP 26, 2149 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2150 . 2152 11.2. Informative References 2154 [github-dtn-bpbis-tcpcl] 2155 Sipos, B., "TCPCL Example Implementation", 2156 . 2159 [I-D.ietf-dtn-bpsec] 2160 Birrane, E. and K. McKeever, "Bundle Protocol Security 2161 Specification", draft-ietf-dtn-bpsec-08 (work in 2162 progress), October 2018. 2164 [RFC2595] Newman, C., "Using TLS with IMAP, POP3 and ACAP", 2165 RFC 2595, DOI 10.17487/RFC2595, June 1999, 2166 . 2168 [RFC4838] Cerf, V., Burleigh, S., Hooke, A., Torgerson, L., Durst, 2169 R., Scott, K., Fall, K., and H. Weiss, "Delay-Tolerant 2170 Networking Architecture", RFC 4838, DOI 10.17487/RFC4838, 2171 April 2007, . 2173 [RFC5050] Scott, K. and S. Burleigh, "Bundle Protocol 2174 Specification", RFC 5050, DOI 10.17487/RFC5050, November 2175 2007, . 2177 [RFC6257] Symington, S., Farrell, S., Weiss, H., and P. Lovell, 2178 "Bundle Security Protocol Specification", RFC 6257, 2179 DOI 10.17487/RFC6257, May 2011, 2180 . 2182 [RFC7242] Demmer, M., Ott, J., and S. Perreault, "Delay-Tolerant 2183 Networking TCP Convergence-Layer Protocol", RFC 7242, 2184 DOI 10.17487/RFC7242, June 2014, 2185 . 2187 [RFC7942] Sheffer, Y. and A. Farrel, "Improving Awareness of Running 2188 Code: The Implementation Status Section", BCP 205, 2189 RFC 7942, DOI 10.17487/RFC7942, July 2016, 2190 . 2192 Appendix A. Significant changes from RFC7242 2194 The areas in which changes from [RFC7242] have been made to existing 2195 headers and messages are: 2197 o Split contact header into pre-TLS protocol negotiation and 2198 SESS_INIT parameter negotiation. The contact header is now fixed- 2199 length. 2201 o Changed contact header content to limit number of negotiated 2202 options. 2204 o Added contact option to negotiate maximum segment size (per each 2205 direction). 2207 o Added session extension capability. 2209 o Added transfer extension capability. 2211 o Defined new IANA registries for message / type / reason codes to 2212 allow renaming some codes for clarity. 2214 o Expanded Message Header to octet-aligned fields instead of bit- 2215 packing. 2217 o Added a bundle transfer identification number to all bundle- 2218 related messages (XFER_INIT, XFER_SEGMENT, XFER_ACK, XFER_REFUSE). 2220 o Use flags in XFER_ACK to mirror flags from XFER_SEGMENT. 2222 o Removed all uses of SDNV fields and replaced with fixed-bit-length 2223 fields. 2225 o Renamed SHUTDOWN to SESS_TERM to deconflict term "shutdown". 2227 o Removed the notion of a re-connection delay parameter. 2229 The areas in which extensions from [RFC7242] have been made as new 2230 messages and codes are: 2232 o Added contact negotiation failure SESS_TERM reason code. 2234 o Added MSG_REJECT message to indicate an unknown or unhandled 2235 message was received. 2237 o Added TLS session security mechanism. 2239 o Added Resource Exhaustion SESS_TERM reason code. 2241 Authors' Addresses 2242 Brian Sipos 2243 RKF Engineering Solutions, LLC 2244 7500 Old Georgetown Road 2245 Suite 1275 2246 Bethesda, MD 20814-6198 2247 United States of America 2249 Email: BSipos@rkf-eng.com 2251 Michael Demmer 2252 University of California, Berkeley 2253 Computer Science Division 2254 445 Soda Hall 2255 Berkeley, CA 94720-1776 2256 United States of America 2258 Email: demmer@cs.berkeley.edu 2260 Joerg Ott 2261 Aalto University 2262 Department of Communications and Networking 2263 PO Box 13000 2264 Aalto 02015 2265 Finland 2267 Email: jo@netlab.tkk.fi 2269 Simon Perreault 2270 Quebec, QC 2271 Canada 2273 Email: simon@per.reau.lt