Credit(stream: uint2_t, amount: uint2_t)
, type nibble: 14 (0b1110
)
Give a certain amount of credit to a stream that was opened by this endpoint (or the top-level).
If stream == 3
, give the credit to the top-level. Else, the 2 ^ stream
bytes following the tag are an integer specifying which stream to give the credit.
The 2 ^ amount
bytes following the stream id bytes (which may be zero bytes) are an unsigned integer indicating how much credit to give.
Credit:Peer(stream: uint2_t, amount: uint2_t)
, type nibble: 15 (0b1111
)
Give a certain amount of credit to a stream that was opened by the peer.
If stream != 3
, this uses the same encoding as the regular Credit
chunk.
If stream == 3
, the chunk activates partial mode for the next chunk following it. The amount ^ 2
bytes following the tag specify the total length of the following payload.
If the next chunk is a Msg
or Msg:Peer
chunk, the sink on which the message is sent is put into partial mode. All message payloads on that sink are considered part of a single message's payload, until the total length has been reached. At that point, the sink switches back to normal operation.
If the next chunk is any other payload-carrying chunk, the entity specified by the combination of chunk type and id is put into partial mode, and all further chunks of matching type and id contribute to the payload, until the total length has been reached.
Following the partial mode activation with a non-payload-carrying chunk is invalid. Writing partial payloads that exceed the total length is invalid.
Cancel:Req(req: uint2_t, len: uint2_t)
, type nibble: 0 (0b0000
)
Cancel a request that originated from this endpoint. Note that the endpoint issuing this chunk can not consider the request cancelled (for resource clean-up and id allocation) until it has received a confirmation from the peer. Otherwise, there would be race conditions with responses sent before the cancellation arrived. This note applies to all Cancel
chunks.
If req != 3
, the 2 ^ req
bytes following the tag are an integer specifying the id of the request you are cancelling.
The 2 ^ len
bytes following the request id bytes are an unsigned integer indicating the length of the payload.
After the len
bytes, place that many bytes of payload. This consumes as much top-level credit.
If req == 3
, the chunk acknowledges the cancellation of a response previously awaited by the peer. The 2 ^ len
bytes following the tag specify the id of the request on which to acknowledge the cancellation. len
may not be 3.
Close:Res(req: uint2_t, len: uint2_t)
, type nibble: 1 (0b0001
)
Close the response to a request that originated from the peer. This signifies that no response will be sent to the request. Note that the endpoint issuing this chunk can not consider the response closed (for resource clean-up and id allocation) until it has received a confirmation from the peer. Otherwise, there would be race conditions with cancellations sent before the closing arrived. This note applies to all Close
chunks.
If req != 3
, the 2 ^ req
bytes following the tag are an integer specifying the id of the request whose response you are closing.
The 2 ^ len
bytes following the request id bytes are an unsigned integer indicating the length of the payload.
After the len
bytes, place that many bytes of payload. This consumes as much top-level credit.
If req == 3
, the chunk acknowledges the closing of a request sent by this endpoint. The 2 ^ len
bytes following the tag specify the id of the request on which to acknowledge the closing. len
may not be 3.
Cancel:Stream(stream: uint2_t, len: uint2_t)
, type nibble: 2 (0b0010
)
Cancel a stream that was opened by this endpoint (or the top-level).
If stream == 3
, this cancels the top-level. Else, the 2 ^ stream
bytes following the tag specify the id of the stream to cancel.
The 2 ^ len
bytes following the stream id bytes are an unsigned integer indicating the length of the payload.
After the len
bytes, place that many bytes of payload. This consumes as much top-level credit.
Cancel:Stream:Peer(stream: uint2_t, len: uint2_t)
, type nibble: 3 (0b0011
)
Cancel a stream that was opened by the peer.
If stream != 3
, this uses the same encoding as the regular Cancel:Stream
chunk.
If stream == 3
, the chunk acknowledges the closing of a sink opened by this endpoint. The 2 ^ len
bytes following the tag specify the id of the sink on which to acknowledge the closing. len
may not be 3. Note that it is neither necessary nor possible to acknowledge the closing of the top-level.
Close:Sink(sink: uint2_t, len: uint2_t)
, type nibble: 4 (0b0100
)
Close a sink that was opened by this endpoint (or the top-level).
If sink == 3
, this cancels the top-level. Else, the 2 ^ sink
bytes following the tag specify the id of the stream to cancel.
The 2 ^ len
bytes following the sink id bytes are an unsigned integer indicating the length of the payload.
After the len
bytes, place that many bytes of payload. This consumes as much top-level credit.
Close:Sink:Peer(sink: uint2_t, len: uint2_t)
, type nibble: 5 (0b0101
)
Close a sink that was opened by the peer.
If sink != 3
, this uses the same encoding as the regular Close:Sink
chunk.
If sink == 3
, the chunk acknowledges a cancellation on a stream opened by this endpoint. The 2 ^ len
bytes following the tag specify the id of the stream on which to acknowledge the cancellation. len
may not be 3. Note that it is neither necessary nor possible to acknowledge cancellation of the top-level.
Hearbeat(pong: bool, peer: bool, stream: uint2_t)
, type nibble: 13 (0b1101
)
Handles heartbeats on streams. If pong
is 0
, this is a ping, else a pong. If peer
is 0
, stream
refers to a stream opened by this endpoint, else stream
refers to a stream opened by the peer.
If sink == 3
, this refers to the top-level. Else, the 2 ^ sink
bytes following the tag specify the id of the stream to cancel.
If peer
is 1
, sink
may not be 3
.