The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in IETF BCP14 (RFC2119 & RFC8174)
Copyright (c) 2023 General Motors GTO LLC Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. SPDX-FileType: DOCUMENTATION SPDX-FileCopyrightText: 2023 General Motors GTO LLC SPDX-License-Identifier: Apache-2.0
Important
|
This specification is a work in progress and needs to be updated to uProtocol 1.5 (uAttributes, uPayload, , etc…) |
Transport & Session Layer is responsible for bidirectional point-2-point communication between uEs. What gets sent between uEs vary considerably depending on the type of payload (Safety, Security, fire & forget, etc…) as well as the deployment environment where the uEs are located (Android, Linux, MCU, etc…).
The Purpose of this layer of the protocol is to define a common ubiquitous language for sending and receiving a messages in a common way across transports, heterogeneous system the uEs are deployed on, or the programming language used.
This specification shall define the data models (types) and interfaces.
uProtocol programming language specific libraries (SDKs) declare the transport layer interfaces and define the data model, while transport technologies (ex. Binder, MQTT, Zenoh, SOME/IP, DDS, HTTP, etc…) implement said interfaces per language.
Note
|
We will define the various interfaces in this specification using pseudo code in lieu of a particular IDL such as protobuf as we expect the implementations of this spec to vary slightly between languages. |
We will use the following terminology during this document:
Term | Description |
---|---|
|
Input parameter |
|
Output parameter |
|
Input/output parameter |
|
Parameter passed by reference |
|
Language specific mechanism to access the result of asynchronous operations, ex. |
-
[UStatus] is defined in uProtocol Error Model
Note
|
uProtocol data model used by the uTransport interface are declared in up-core-api |
UListener
is an interface used for receiving messages by the client uE from the uTransport layer. Listeners are used for receiving messages asynchronously by the uTransport layer.
-
Type name MUST be
UListener
-
MUST contain the method
void onReceive(UMessage&)
that is called by the Transport to notify (callback) the client
The transport layer API responsible for point-2-point communication. The interface provides common functionality across all transport implementations.
-
MUST implement all APIs defined in this section
Transmit a UMessage.
Communication protocols (a.k.a. uProtocol Transports) define their own Protocol Data Unit (PDU) that comprises of header and payload. Some transports header parameters map already to uProtocol UAttributes. Sending UAttributes in the transport’s payload as well as in the header increases overhead for little to no gain. To address this issue, Send() allows flexibility for uTransport implementers to define however they see fit what gets mapped into their transport header vs payload.
For example, if HartleyTransport can map only UPriority to its PDU header, then HartleyTransport would define a PDU payload type that includes UPayload and all the other UAttributes and send that new type in its PDU payload such that the receiver will not loose any metadata.
The API signature:
OUT UStatus send(UMessage&)
Parameter | Description |
---|---|
UMessage |
UProtocol message containing the header (UAttributes) and payload (UPayload) * MUST be passed by reference |
-
All UMessage attributes metadata MUST be preserved during transmission and available to the receiver
-
MUST not manipulate the UMessage payload during transmission
-
SHOULD pass resolved UUris (contains both names and numbers)
-
SHOULD use the Miro Uri serialization format
Register a UListener to receive message(s) for a given UUri (topic). This API is used to implement the push Delivery Method.
API Signature:
OUT UStatus registerListener(IN UUri, IN UListener&)
-
MUST support registering more than one listener per topic
-
MUST support registering more than one topic per listener
-
Transport implementations MUST declare the maximum number of listeners per topic that it can support. If the maximum number of listeners is reached, the transport MUST return
RESOURCE_EXHAUSTED
status code
Parameter | Description |
---|---|
UUri |
Topic to register the listener for |
Listener to be registered |
API used to unregister a UListener for a given topic.
API Signature:
Parameter | Description |
---|---|
UUri |
Topic to unregister the listener for |
Listener to be unregistered |
Implements the pull Delivery Method to fetch a message from the transport for a given UUri (topic).
OUT [UStatus] receive(IN UUri, OUT UPayload&, OUT UAttributes&)
-
uTransport
send()
API MUST support , meaning the caller of this API is guaranteed the message was successfully delivered to the next-hop only. End-2-end delivery, when messages are sent across multiple transports, is not guaranteed by the transport layer -
Transport MUST support retransmission of messages that are no able to be delivered to the next-hop
If the uP-L1 transport layer is above OSI Session layer 5:
-
MUST use Transmission Control Protocols (TCP) and SHOULD NOT User Datagram Protocol (UDP) for message delivery, this is to ensure At-least-once delivery of messages
-
Transport MUST support either push or pull delivery method
-
MAY support both push or pull delivery methods between uEs
-
Delivery method SHOULD be known by uEs at design time
-
Receivers MAY select which delivery method they prefer if the transport between sender and receiver supports more than one delivery method
Note
|
Delivery method advertising shall be defined later |