2017-11-26 01:14:02 +00:00
|
|
|
// This file has been automatically generated by writeMessageClasses.js
|
|
|
|
|
|
2020-01-06 12:10:40 +00:00
|
|
|
import { UUID } from '../UUID';
|
|
|
|
|
import { MessageFlags } from '../../enums/MessageFlags';
|
|
|
|
|
import { MessageBase } from '../MessageBase';
|
|
|
|
|
import { Message } from '../../enums/Message';
|
2017-11-26 01:14:02 +00:00
|
|
|
|
|
|
|
|
export class DirFindQueryMessage implements MessageBase
|
|
|
|
|
{
|
|
|
|
|
name = 'DirFindQuery';
|
|
|
|
|
messageFlags = MessageFlags.Zerocoded | MessageFlags.FrequencyLow;
|
|
|
|
|
id = Message.DirFindQuery;
|
|
|
|
|
|
|
|
|
|
AgentData: {
|
|
|
|
|
AgentID: UUID;
|
|
|
|
|
SessionID: UUID;
|
|
|
|
|
};
|
|
|
|
|
QueryData: {
|
|
|
|
|
QueryID: UUID;
|
2017-11-26 19:47:41 +00:00
|
|
|
QueryText: Buffer;
|
2017-11-26 01:14:02 +00:00
|
|
|
QueryFlags: number;
|
|
|
|
|
QueryStart: number;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
getSize(): number
|
|
|
|
|
{
|
|
|
|
|
return (this.QueryData['QueryText'].length + 1) + 56;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
writeToBuffer(buf: Buffer, pos: number): number
|
|
|
|
|
{
|
|
|
|
|
const startPos = pos;
|
|
|
|
|
this.AgentData['AgentID'].writeToBuffer(buf, pos);
|
|
|
|
|
pos += 16;
|
|
|
|
|
this.AgentData['SessionID'].writeToBuffer(buf, pos);
|
|
|
|
|
pos += 16;
|
|
|
|
|
this.QueryData['QueryID'].writeToBuffer(buf, pos);
|
|
|
|
|
pos += 16;
|
|
|
|
|
buf.writeUInt8(this.QueryData['QueryText'].length, pos++);
|
2017-11-26 19:47:41 +00:00
|
|
|
this.QueryData['QueryText'].copy(buf, pos);
|
2017-11-26 01:14:02 +00:00
|
|
|
pos += this.QueryData['QueryText'].length;
|
|
|
|
|
buf.writeUInt32LE(this.QueryData['QueryFlags'], pos);
|
|
|
|
|
pos += 4;
|
|
|
|
|
buf.writeInt32LE(this.QueryData['QueryStart'], pos);
|
|
|
|
|
pos += 4;
|
|
|
|
|
return pos - startPos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
readFromBuffer(buf: Buffer, pos: number): number
|
|
|
|
|
{
|
|
|
|
|
const startPos = pos;
|
|
|
|
|
let varLength = 0;
|
|
|
|
|
const newObjAgentData: {
|
|
|
|
|
AgentID: UUID,
|
|
|
|
|
SessionID: UUID
|
|
|
|
|
} = {
|
|
|
|
|
AgentID: UUID.zero(),
|
|
|
|
|
SessionID: UUID.zero()
|
|
|
|
|
};
|
|
|
|
|
newObjAgentData['AgentID'] = new UUID(buf, pos);
|
|
|
|
|
pos += 16;
|
|
|
|
|
newObjAgentData['SessionID'] = new UUID(buf, pos);
|
|
|
|
|
pos += 16;
|
|
|
|
|
this.AgentData = newObjAgentData;
|
|
|
|
|
const newObjQueryData: {
|
|
|
|
|
QueryID: UUID,
|
2017-11-26 19:47:41 +00:00
|
|
|
QueryText: Buffer,
|
2017-11-26 01:14:02 +00:00
|
|
|
QueryFlags: number,
|
|
|
|
|
QueryStart: number
|
|
|
|
|
} = {
|
|
|
|
|
QueryID: UUID.zero(),
|
2017-11-26 19:47:41 +00:00
|
|
|
QueryText: Buffer.allocUnsafe(0),
|
2017-11-26 01:14:02 +00:00
|
|
|
QueryFlags: 0,
|
|
|
|
|
QueryStart: 0
|
|
|
|
|
};
|
|
|
|
|
newObjQueryData['QueryID'] = new UUID(buf, pos);
|
|
|
|
|
pos += 16;
|
|
|
|
|
varLength = buf.readUInt8(pos++);
|
2017-11-30 04:11:59 +00:00
|
|
|
newObjQueryData['QueryText'] = buf.slice(pos, pos + varLength);
|
2017-11-26 01:14:02 +00:00
|
|
|
pos += varLength;
|
|
|
|
|
newObjQueryData['QueryFlags'] = buf.readUInt32LE(pos);
|
|
|
|
|
pos += 4;
|
|
|
|
|
newObjQueryData['QueryStart'] = buf.readInt32LE(pos);
|
|
|
|
|
pos += 4;
|
|
|
|
|
this.QueryData = newObjQueryData;
|
|
|
|
|
return pos - startPos;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|