52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
// This file has been automatically generated by writePacketClasses.js
|
|
|
|
import {UUID} from '../UUID';
|
|
import {MessageFlags} from '../../enums/MessageFlags';
|
|
import {Packet} from '../Packet';
|
|
|
|
export class CreateTrustedCircuitPacket implements Packet
|
|
{
|
|
name = 'CreateTrustedCircuit';
|
|
flags = MessageFlags.FrequencyLow;
|
|
id = 4294902152;
|
|
|
|
DataBlock: {
|
|
EndPointID: UUID;
|
|
Digest: Buffer;
|
|
};
|
|
|
|
getSize(): number
|
|
{
|
|
return 48;
|
|
}
|
|
|
|
writeToBuffer(buf: Buffer, pos: number): number
|
|
{
|
|
const startPos = pos;
|
|
this.DataBlock['EndPointID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
this.DataBlock['Digest'].copy(buf, pos);
|
|
pos += 32;
|
|
return pos - startPos;
|
|
}
|
|
|
|
readFromBuffer(buf: Buffer, pos: number): number
|
|
{
|
|
const startPos = pos;
|
|
const newObjDataBlock: {
|
|
EndPointID: UUID,
|
|
Digest: Buffer
|
|
} = {
|
|
EndPointID: UUID.zero(),
|
|
Digest: Buffer.allocUnsafe(0)
|
|
};
|
|
newObjDataBlock['EndPointID'] = new UUID(buf, pos);
|
|
pos += 16;
|
|
newObjDataBlock['Digest'] = buf.slice(pos, pos + 32);
|
|
pos += 32;
|
|
this.DataBlock = newObjDataBlock;
|
|
return pos - startPos;
|
|
}
|
|
}
|
|
|