|
libe3 0.6.1
C++ library for E3AP RAN vendor integration
|
How an implementation turns an E3AP message into bytes, how the bytes cross a link, and the limits on their size. Worked examples are checked against the pinned test vectors.
This is clause 8 of the specification. The index is README.md. The messages are in 02-ie-mapping.md. The validation rules are in 05-semantics-and-constraints.md. Code pointers and build switches are in integrator-guide.md.
Every E3AP message is one E3-PDU. An implementation shall encode the E3-PDU with one of three encodings.
Table: The three encodings of an E3-PDU
| Encoding | Rules | Reference |
|---|---|---|
| APER | Aligned Packed Encoding Rules of the ASN.1 grammar in the last clause of this chapter | X.691 [3] |
| JSON | One flat JSON object for each message. The keys are the ASN.1 field names | RFC 8259 [4] |
| Protobuf | One E3Pdu message of the proto3 schema of E3AP. The oneof case names the message | [i.1] |
The encoding is not part of the message. There is no indicator on the wire. Both sides shall use the same encoding on a link. A receiver that gets bytes in another encoding cannot decode them. An E3 Agent shall answer such a SETUP REQUEST message with a negative SETUP RESPONSE message, if it can still send a response.
The payloads (ranFunctionData, protocolData, actionData, reportData, xAppControlData and controlOutcome) follow the encoding of the link. APER carries them as octet strings. JSON carries them as nested JSON values, not as hexadecimal text. Protobuf carries them as bytes.
Table: APER bits for each construct of the grammar
| Construct | APER encoding | Where it appears |
|---|---|---|
| INTEGER (1..65535) | 16 bits, aligned: the value minus 1 | dApp, RAN function, telemetry, control and subscription identifiers |
| INTEGER (1..4294967295) | a 2 bit length code (octets minus 1), padding to the octet boundary, then the value minus 1 in that many octets | message identifier, sequence identifier |
| INTEGER (0..86400) | a 2 bit length code, padding, then the value in 1 to 3 octets | subscriptionTime |
| INTEGER (0..60000000) | a 2 bit length code, padding, then the value in 1 to 4 octets | periodicity |
| INTEGER with no constraint | a length octet, then the value in the fewest octets | timestamp |
| ENUMERATED with two values and no extension | 1 bit | E3-ResponseCode |
| CHOICE with 12 alternatives and an extension marker | 1 extension bit, then the index in 4 bits | msg |
| SEQUENCE (SIZE (0..256)) OF | the count in 16 bits, aligned, then the elements | identifier lists |
| SEQUENCE (SIZE (0..64)) OF | the count in 7 bits, then the elements | RAN function list |
| OCTET STRING (SIZE (1..64)) | the length minus 1 in 6 bits, padding, then the octets | E3-Name |
| OCTET STRING (SIZE (1..32)) | the length minus 1 in 5 bits, padding, then the octets | E3-Version |
| OCTET STRING (SIZE (1..32768)) | the length minus 1 in 15 bits, padding, then the octets | payload fields |
| OCTET STRING (SIZE (1..262144)) | the length in an aligned length determinant, then the octets | ranFunctionData |
The examples below pin the rows for the identifiers, the time limit, the interval, the response code, the choice index and the short counts. The rows for the long lists and for the payload strings come from X.691. No test vector covers them. They are not checked.
Each example is a complete E3-PDU. The message identifier is 42 and the timestamp is 1756800000123456789 nanoseconds. The bytes equal the pinned test vectors.
Example 1: RELEASE message for dApp 7.
Table: Release message, byte by byte
| Bytes | Meaning |
|---|---|
| 40 | extension bit 0, timestamp present 1, length code 00 (one octet), 4 padding bits |
| 29 | message identifier 42, sent as 41 (42 minus 1) |
| 08 | the timestamp is 8 octets long |
| 18 61 68 4a cc c3 cd 15 | the timestamp, 1756800000123456789 |
| 48 | msg extension bit 0, index 1001 (9, the RELEASE message), message extension bit 0, 2 padding bits |
| 00 06 | dApp identifier 7, sent as 6 |
Example 2: CONTROL RESPONSE, "positive", for the control with message identifier 42, from dApp 7, RAN function 1, control 1. No cause, no detail and no outcome.
Table: Control response, byte by byte
| Bytes | Meaning |
|---|---|
| 40 29 08 18 61 68 4a cc c3 cd 15 | the envelope, as in example 1 |
| 58 | msg extension bit 0, index 1011 (11, the CONTROL RESPONSE message), message extension bit 0, presence bits 00 for cause and detail |
| 00 | presence bit 0 for controlOutcome, length code 00 (one octet), 5 padding bits |
| 29 | requestId 42, sent as 41 |
| 00 06 | dAppIdentifier 7, sent as 6 |
| 00 00 | ranFunctionIdentifier 1, sent as 0 |
| 00 00 | controlIdentifier 1, sent as 0 |
| 00 | responseCode "positive" as bit 0, 7 padding bits |
Example 3: dApp CONTROL ACTION with requestAck. dApp 7, RAN function 1, control 1, payload aa bb, no sequence identifier.
Table: Control action that asks for an answer, byte by byte
| Bytes | Meaning |
|---|---|
| 40 29 08 18 61 68 4a cc c3 cd 15 | the envelope, as in example 1 |
| 34 | msg extension bit 0, index 0110 (6, the dApp CONTROL ACTION message), message extension bit 1 (an extension addition is present), presence bit 0 for sequenceId, 1 padding bit |
| 00 06, 00 00, 00 00 | dApp 7, RAN function 1 and control 1 |
| 00 01 | actionData is 2 octets long, sent as 1 |
| aa bb | the payload |
| 01 | the number of extension additions minus 1, as 7 bits 0000000, then presence bit 1 for requestAck |
| 01 | requestAck is 1 octet long |
| 80 | requestAck "true" as bit 1, 7 padding bits |
A control that does not ask ends after aa bb and starts with 30: its bytes are the bytes of a control before requestAck existed.
Example 4: SUBSCRIPTION REQUEST. dApp 7, RAN function 1, telemetry identifiers 1 and 2, no control identifiers, time limit 60 seconds, interval 100 microseconds.
Table: Subscription request, byte by byte
| Bytes | Meaning |
|---|---|
| 40 29 08 18 61 68 4a cc c3 cd 15 | the envelope, as in example 1 |
| 13 | msg extension bit 0, index 0010 (2, the SUBSCRIPTION REQUEST message), message extension bit 0, presence bits 11 for subscriptionTime and periodicity |
| 00 06 | dApp identifier 7 |
| 00 00 | RAN function identifier 1 |
| 00 02 | the telemetry list has 2 elements |
| 00 00, 00 01 | telemetry identifiers 1 and 2 |
| 00 00 | the control list has 0 elements |
| 00 3c | length code 00 (one octet) with padding, then subscriptionTime 60 |
| 00 64 | length code 00 with padding, then periodicity 100 |
The envelope with a timestamp of 1756800000123456789 takes 11 octets before the message: 1 octet for the extension, presence and length bits, 1 octet for the message identifier, 1 length octet and 8 octets of timestamp. A message without a timestamp is 9 octets shorter. A message identifier up to 256 takes 1 octet, up to 65536 takes 2, up to 16777216 takes 3, and a larger one takes 4. A long list or a payload grows the message by the size of its elements.
A decoder shall ignore an extension addition that it does not know. cause and detail are the first extension additions of E3-SetupResponse and E3-SubscriptionResponse and E3-MessageAck, in that order. In E3-SubscriptionResponse ranFunctionIdentifier and periodicity follow them. requestAck is the first and only extension addition of E3-DAppControlAction and E3-XAppControlAction. A sender writes it only when it is "true", so the bytes of a control that does not ask do not change. APER sends one presence bit for each extension addition of the grammar, so the order is part of the encoding: a decoder that has the additions in another order reads one field as another. A change of a constraint is not an extension addition either. It changes the bytes.
An implementation shall encode an E3-PDU as one flat JSON object. The object has the members type, id and timestamp. The members of the message follow at the same level.
Table: Rules of the JSON encoding
| Rule | Value |
|---|---|
| type | the name of the message in camel case: setupRequest, setupResponse, subscriptionRequest, subscriptionDelete, subscriptionResponse, indicationMessage, dAppControlAction, dAppReport, xAppControlAction, releaseMessage, messageAck (deprecated), controlResponse |
| Keys | the ASN.1 field names, for example dAppIdentifier, ranFunctionIdentifier, telemetryIdentifierList, subscriptionTime, periodicity, subscriptionId, requestId, sequenceId, controlIdentifier, requestAck |
| responseCode | the string "positive" or the string "negative". An unknown string means "negative" |
| cause | the name of the E3-Cause value in camel case, for example unsupportedIdentifier. A name that the decoder does not know reads as unspecified. A decoder reads it from a SETUP RESPONSE, SUBSCRIPTION RESPONSE, MESSAGE ACK or CONTROL RESPONSE message |
| detail | the text, as a JSON string. A decoder also reads the key message as detail, when detail is not there |
| timestamp | written on every message. The value 0 means that there is no timestamp |
| Payload fields | a JSON object or array. ranFunctionData, actionData, reportData, xAppControlData and controlOutcome shall be an object or an array. An empty payload does not encode, and an empty controlOutcome is not written. protocolData may be any valid JSON value |
| requestAck | the JSON value true, written only when it is true. A decoder reads a missing member and false as "false" |
| Wrapper | a message with a nested data wrapper is refused |
| Granted lists | telemetryIdentifierList and controlIdentifierList of a SUBSCRIPTION RESPONSE are present when the E3 Agent reports them. A missing list means "not reported". An empty list means "none granted". A decoder may also read the names telemetryGrantedList and controlGrantedList |
| Missing fields | a decoder sets a missing field to 0 or to the empty string. It does not refuse the message |
Example of a SUBSCRIPTION REQUEST message (not checked against a pinned vector; the order of the members does not matter):
JSON and Protobuf do not check the ranges of the grammar. A sender shall keep every value inside the range of 02-ie-mapping.md, so that the same message can move to APER.
The proto3 schema of E3AP has one message for each E3AP message and one E3Pdu envelope. The oneof case of E3Pdu follows the order of the CHOICE tags.
Table: Rules of the Protobuf encoding
| Rule | Value |
|---|---|
| Names | the field names are the ASN.1 names in snake case, for example dapp_identifier |
| Optional fields | optional fields keep their presence |
| Zero values | timestamp and sequence_id of a dApp CONTROL ACTION message use the value 0 for "absent", and request_ack the value false |
| Control outcome | optional bytes control_outcome of CONTROL RESPONSE. The oneof case 13 of the envelope is the deprecated MESSAGE ACK and case 14 the CONTROL RESPONSE |
| Granted lists | a wrapper message IdentifierList makes "not reported" differ from "none granted" |
| Response code | an enumeration with the values "positive" (0) and "negative" (1). A value that is not "negative" reads as "positive" |
| Cause | an enumeration Cause with the values of E3-Cause, and an optional string detail, on the four messages that carry them (SETUP RESPONSE, SUBSCRIPTION RESPONSE, MESSAGE ACK and CONTROL RESPONSE). A value that is not in the enumeration reads as unspecified |
| Unknown fields | a decoder ignores them |
| Empty envelope | an envelope with no oneof case does not decode |
Table: Connections, endpoints and message boundaries of each link
| Link and transport | Connections of a dApp | Default endpoint | One E3-PDU is | Length prefix |
|---|---|---|---|---|
| ZeroMQ over IPC | 3, one for each channel | ipc:///tmp/dapps/setup, ipc:///tmp/dapps/dapp_socket, ipc:///tmp/dapps/e3_socket | one ZeroMQ message | none |
| ZeroMQ over TCP | 3, one for each channel | port 9990 (setup), port 9999 (inbound to the E3 Agent), port 9991 (outbound from the E3 Agent) | one ZeroMQ message | none |
| POSIX over IPC | 1 | ipc:///tmp/dapps/e3 | one message of a sequenced-packet Unix domain socket | none |
| POSIX over TCP | 1 | port 9990 | the length prefix and the E3-PDU, on a byte stream | 4 octets, in both directions |
| POSIX over SCTP | 1 | port 9990 | one SCTP message | none |
The length prefix differs between the POSIX transports. TCP is a byte stream, so every E3-PDU on it starts with its length. IPC and SCTP keep message boundaries, so nothing is added. A sender shall not add a prefix on IPC or on SCTP, and a receiver shall not look for one.
An implementation may use other endpoints and ports. Both sides shall use the same values. On a TCP or SCTP link the E3 Agent listens on all addresses of the host, on IPv4 and on IPv6, unless it is told one. The three channels of 01-identity-and-registration.md are the same on every link; what differs is how many connections carry them.
One E3AP message is one ZeroMQ message. There is no extra framing. The setup channel uses the request and reply pattern, and the two other channels use publish and subscribe. A subscriber shall subscribe to every message (an empty filter).
On a ZeroMQ link the E3 Agent binds all three sockets and the dApp connects to them. On a link over TCP the E3 Agent listens on the port of each channel. On a link over IPC the endpoints are the paths of the table above. Every message of the outbound channel reaches every dApp, and each dApp keeps the messages that name its own dApp identifier.
The POSIX link layer uses one connection for each dApp, to one endpoint. The setup channel, the inbound channel and the outbound channel all travel on it. The E3 Agent listens, and the dApp connects.
The first E3-PDU of a connection is the SETUP REQUEST message of the dApp. Every later E3-PDU of the connection belongs to the dApp that sent it. A dApp that sends its SETUP REQUEST again, after a refusal, uses a new connection. The E3 Agent ties the dApp identifier it assigns to the connection of the SETUP REQUEST. It acts on a message that names a dApp only if the message came on the connection of that dApp, and it removes a dApp whose connection has closed without a RELEASE message.
The E3 Agent sends each E3-PDU on the connection of the dApp the E3-PDU is for. An E3-PDU that names no dApp that the E3 Agent can tie to a connection goes to every connection, and each dApp keeps the ones that name its own identifier. The E3 Agent closes the connection to a dApp whose socket stalls for 500 ms.
An E3 Agent may close, at once, a connection from an address that is not on a list that it holds, and a connection that would exceed a limit of connections that it holds. Neither is a part of E3AP.
The socket is a sequenced-packet Unix domain socket. One send is one E3-PDU and one receive is one E3-PDU. A receiver shall refuse an E3-PDU that does not fit in 65536 octets, and shall treat an empty message as the end of the connection.
Every E3-PDU is the length of the E3-PDU in 4 octets, in network byte order, then the E3-PDU. This holds in both directions and for the SETUP REQUEST and the SETUP RESPONSE. A receiver shall refuse a length of 0 and a length above 65536. TCP does not keep message boundaries, so a sender may write the prefix and the E3-PDU together, and a receiver shall expect two E3-PDUs in one read and one E3-PDU in two.
The socket is an SCTP socket in one-to-one mode, and one E3-PDU is one SCTP message. A sender shall not split an E3-PDU over messages. A receiver joins the partial deliveries of a message up to the end of the message.
Table: What a sender sets on an SCTP message
| Item | Value |
|---|---|
| Payload protocol identifier | 0x00E3A001 on every message. The value is private to this specification: no payload protocol identifier is registered for E3AP |
| Stream, from the E3 Agent | 1 for an INDICATION message, 0 for every other message |
| Stream, from the dApp | 0 for every message |
Both peers shall request two streams when they set up the association. A receiver accepts the payload protocol identifier 0 on stream 0, so that a sender that stamps nothing is served. A receiver shall close the association when a message carries another payload protocol identifier. A receiver does not use the stream number of a message to tell one E3-PDU from another.
Table: Size limits
| Item | Limit | Where it is enforced |
|---|---|---|
| Payload (protocolData, actionData, reportData, xAppControlData, controlOutcome) | 1 to 32768 octets | APER |
| ranFunctionData | 1 to 262144 octets in the grammar | APER |
| Name | 1 to 64 octets | APER |
| Version | 1 to 32 octets | APER |
| Telemetry list, control list | 0 to 256 entries | APER |
| RAN function list | 0 to 64 entries | APER |
| Encoded E3-PDU | at most 65536 octets for an encoder buffer | implementation |
| E3-PDU on POSIX | 1 to 65536 octets, on every transport and in both directions | the receiver |
The ASN.1 definition of E3AP conforms to ITU-T X.680 [1] and X.681 [2]. If a table and the grammar disagree, the grammar takes precedence, except for the conditions of presence, where the table takes precedence.