-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FOLD] move receipt asn.1 definition to separate file
- Loading branch information
1 parent
67e7dce
commit b4952fd
Showing
2 changed files
with
48 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
StreamReceipt | ||
DEFINITIONS | ||
AUTOMATIC TAGS ::= | ||
BEGIN | ||
|
||
IMPORTS | ||
UInt8, | ||
UInt64, | ||
UInt128, | ||
UInt256 | ||
FROM GenericTypes | ||
; | ||
|
||
RECEIPT ::= CLASS { | ||
&typeId UInt8 UNIQUE, | ||
&Type | ||
} WITH SYNTAX {&typeId &Type} | ||
|
||
ReceiptSet RECEIPT ::= { | ||
{1 ReceiptV1} | ||
} | ||
|
||
Receipt ::= SEQUENCE { | ||
type RECEIPT.&typeId ({ReceiptSet}), | ||
-- NOT length-prefixed | ||
data RECEIPT.&Type ({ReceiptSet}{@type}) | ||
} | ||
|
||
ReceiptV1 ::= SEQUENCE { | ||
-- Identifier of the connection | ||
nonce UInt128, | ||
|
||
-- Identifier of the stream | ||
streamId UInt8, | ||
|
||
-- Total amount the stream has received so far | ||
totalReceived UInt64, | ||
|
||
-- HMAC-SHA256 using a 32 byte Secret | ||
-- The message is the concatenation of the 1 byte type/version (always 1) and all other fields, | ||
-- in the order listed above | ||
hmac UInt256 | ||
} | ||
|
||
END |