52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
// This file has been automatically generated by writePacketClasses.js
|
|
|
|
import {IPAddress} from '../IPAddress';
|
|
import {MessageFlags} from '../../enums/MessageFlags';
|
|
import {Packet} from '../Packet';
|
|
|
|
export class OpenCircuitPacket implements Packet
|
|
{
|
|
name = 'OpenCircuit';
|
|
flags = MessageFlags.Blacklisted | MessageFlags.FrequencyFixed;
|
|
id = 4294967292;
|
|
|
|
CircuitInfo: {
|
|
IP: IPAddress;
|
|
Port: number;
|
|
};
|
|
|
|
getSize(): number
|
|
{
|
|
return 6;
|
|
}
|
|
|
|
writeToBuffer(buf: Buffer, pos: number): number
|
|
{
|
|
const startPos = pos;
|
|
this.CircuitInfo['IP'].writeToBuffer(buf, pos);
|
|
pos += 4;
|
|
buf.writeUInt16LE(this.CircuitInfo['Port'], pos);
|
|
pos += 2;
|
|
return pos - startPos;
|
|
}
|
|
|
|
readFromBuffer(buf: Buffer, pos: number): number
|
|
{
|
|
const startPos = pos;
|
|
const newObjCircuitInfo: {
|
|
IP: IPAddress,
|
|
Port: number
|
|
} = {
|
|
IP: IPAddress.zero(),
|
|
Port: 0
|
|
};
|
|
newObjCircuitInfo['IP'] = new IPAddress(buf, pos);
|
|
pos += 4;
|
|
newObjCircuitInfo['Port'] = buf.readUInt16LE(pos);
|
|
pos += 2;
|
|
this.CircuitInfo = newObjCircuitInfo;
|
|
return pos - startPos;
|
|
}
|
|
}
|
|
|