55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
// This file has been automatically generated by writeMessageClasses.js
|
|
|
|
import { IPAddress } from '../IPAddress';
|
|
import { MessageFlags } from '../../enums/MessageFlags';
|
|
import { MessageBase } from '../MessageBase';
|
|
import { Message } from '../../enums/Message';
|
|
|
|
export class OpenCircuitMessage implements MessageBase
|
|
{
|
|
name = 'OpenCircuit';
|
|
messageFlags = MessageFlags.Blacklisted | MessageFlags.FrequencyFixed;
|
|
id = Message.OpenCircuit;
|
|
|
|
CircuitInfo: {
|
|
IP: IPAddress;
|
|
Port: number;
|
|
};
|
|
|
|
getSize(): number
|
|
{
|
|
return 6;
|
|
}
|
|
|
|
// @ts-ignore
|
|
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;
|
|
}
|
|
|
|
// @ts-ignore
|
|
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;
|
|
}
|
|
}
|
|
|