Treat transport codes and path as their own segments
This commit is contained in:
@@ -119,7 +119,10 @@ export class Packet implements IPacket {
|
|||||||
|
|
||||||
this.structure = [
|
this.structure = [
|
||||||
/* Header segment */
|
/* Header segment */
|
||||||
{ name: "header", data: new Uint8Array([this.header, this.pathLength, ...this.path]), fields: [
|
{
|
||||||
|
name: "header",
|
||||||
|
data: new Uint8Array([this.header]),
|
||||||
|
fields: [
|
||||||
/* Header flags */
|
/* Header flags */
|
||||||
{
|
{
|
||||||
name: "flags",
|
name: "flags",
|
||||||
@@ -131,21 +134,37 @@ export class Packet implements IPacket {
|
|||||||
{ name: "route type", size: 2 },
|
{ name: "route type", size: 2 },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
/* Transport codes */
|
/* Transport codes */
|
||||||
...(Packet.hasTransportCodes(this.routeType) ? [
|
...(Packet.hasTransportCodes(this.routeType) ? [{
|
||||||
|
name: "transport codes",
|
||||||
|
data: new Uint8Array([
|
||||||
|
(this.transport![0] >> 8) & 0xff, this.transport![0] & 0xff,
|
||||||
|
(this.transport![1] >> 8) & 0xff, this.transport![1] & 0xff
|
||||||
|
]),
|
||||||
|
fields: [
|
||||||
{
|
{
|
||||||
name: "transport code 1",
|
name: "transport code 1",
|
||||||
type: FieldType.UINT16_BE,
|
type: FieldType.UINT16_BE,
|
||||||
size: 2
|
size: 2,
|
||||||
|
value: this.transport![0]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "transport code 2",
|
name: "transport code 2",
|
||||||
type: FieldType.UINT16_BE,
|
type: FieldType.UINT16_BE,
|
||||||
size: 2
|
size: 2,
|
||||||
|
value: this.transport![1]
|
||||||
},
|
},
|
||||||
] : []),
|
]
|
||||||
|
}] : []),
|
||||||
|
|
||||||
/* Path length and hashes */
|
/* Path length and hashes */
|
||||||
|
{
|
||||||
|
name: "path",
|
||||||
|
data: new Uint8Array([this.pathLength, ...this.path]),
|
||||||
|
fields: [
|
||||||
{
|
{
|
||||||
name: "path length",
|
name: "path length",
|
||||||
type: FieldType.UINT8,
|
type: FieldType.UINT8,
|
||||||
@@ -160,7 +179,8 @@ export class Packet implements IPacket {
|
|||||||
type: pathHashType,
|
type: pathHashType,
|
||||||
size: this.path.length
|
size: this.path.length
|
||||||
}
|
}
|
||||||
]},
|
]
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user