Skip to content

Commit

Permalink
docs(asn1): update with final ilp payment packet
Browse files Browse the repository at this point in the history
Also includes draft of ILQP formats.
  • Loading branch information
justmoon committed Mar 15, 2017
1 parent 6f6bba7 commit 9716fb7
Show file tree
Hide file tree
Showing 9 changed files with 322 additions and 243 deletions.
145 changes: 0 additions & 145 deletions asn1/CryptoConditions.asn

This file was deleted.

14 changes: 0 additions & 14 deletions asn1/GenericExtensionHeaderFormat.asn

This file was deleted.

45 changes: 45 additions & 0 deletions asn1/GenericPacket.asn
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
GenericPacket
DEFINITIONS
AUTOMATIC TAGS ::=
BEGIN

IMPORTS
UInt8,
VarBytes
FROM GenericTypes

InterledgerProtocolPaymentMessage
FROM InterledgerProtocol

QuoteLiquidityRequest,
QuoteLiquidityResponse,
QuoteBySourceAmountRequest,
QuoteBySourceAmountResponse,
QuoteByDestinationAmountRequest,
QuoteByDestinationAmountResponse
FROM InterledgerQuotingProtocol
;

PACKET ::= CLASS {
&typeId UInt8 UNIQUE,
&Type
} WITH SYNTAX {&typeId &Type}

PacketSet PACKET ::= {
{1 InterledgerProtocolPaymentMessage} |
{2 QuoteLiquidityRequest} |
{3 QuoteLiquidityResponse} |
{4 QuoteBySourceAmountRequest} |
{5 QuoteBySourceAmountResponse} |
{6 QuoteByDestinationAmountRequest} |
{7 QuoteByDestinationAmountResponse}
}

InterledgerPacket ::= SEQUENCE {
-- One byte type ID
type PACKET.&typeId ({PacketSet}),
-- Length-prefixed header
data PACKET.&Type ({PacketSet}{@type})
}

END
35 changes: 34 additions & 1 deletion asn1/GenericTypes.asn
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
GenericTypes DEFINITIONS AUTOMATIC TAGS ::=
GenericTypes
DEFINITIONS
AUTOMATIC TAGS ::=
BEGIN

-- Small Integers
Expand Down Expand Up @@ -27,6 +29,37 @@ UInt512 ::= OCTET STRING (SIZE(64))
VarInt ::= INTEGER
VarUInt ::= INTEGER (0..MAX)

-- Binary Floating Point (IEEE 754)

Float32 ::= REAL ( -- binary32
0 |
WITH COMPONENTS {
mantissa (-16777215..16777215), -- 23 bits + 1 sign bit
base (2),
-- Note that the exponent range in ASN.1 is given as the exponent relative to
-- the integer mantissa, i.e. mantissa * 2 ^ exponent, whereas in IEEE 754, the
-- exponent is relative to a binary fraction using the 23 fractional bits and
-- an implicit integer part of one. This is why the exponent range is offset
-- by 23, i.e. -149..104 instead of -126..127.
exponent (-149..104)
}
)

Float64 ::= REAL ( -- binary64
0 |
WITH COMPONENTS {
mantissa (-9007199254740991..9007199254740991), -- 52 bits + 1 sign bit
base (2),
-- Note the exponent range in ASN.1 is given as the exponent relative to the
-- integer mantissa, i.e. mantissa * 2 ^ exponent, whereas in IEEE 754, the
-- exponent is relative to a binary fraction using the 52 fractional bits and
-- an implicit integer part of one. This is why the exponent range is offset
-- by 53, i.e. -1075..970 instead of -1022..1023.
-- TODO: Why isn't this offset by 52 instead of 53?
exponent (-1075..970)
}
)

-- Variable-Length Data
VarBytes ::= OCTET STRING

Expand Down
31 changes: 31 additions & 0 deletions asn1/InterledgerProtocol.asn
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
InterledgerProtocol
DEFINITIONS
AUTOMATIC TAGS ::=
BEGIN

IMPORTS
UInt64
FROM GenericTypes

Address,
Amount
FROM InterledgerTypes

MetadataEntry
FROM MetadataEntry
;

InterledgerProtocolPaymentMessage ::= SEQUENCE {
-- Amount which must be received at the destination
amount UInt64,
-- Destination ILP Address
account Address,
-- Information for recipient (transport layer information)
data OCTET STRING (SIZE (0..32767)),
-- Enable ASN.1 Extensibility
extensions SEQUENCE {
...
}
}

END
19 changes: 0 additions & 19 deletions asn1/InterledgerProtocolHeader.asn

This file was deleted.

0 comments on commit 9716fb7

Please sign in to comment.