Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
decode_debug: function (diagnosticInfo, stream, options) {
const tracer = options.tracer;
tracer.trace("start", options.name + "(" + "DiagnosticInfo" + ")", stream.length, stream.length);
let cursor_before = stream.length;
const encoding_mask = ec.decodeByte(stream);
tracer.trace("member", "encodingByte", "0x" + encoding_mask.toString(16), cursor_before, stream.length, "Mask");
tracer.encoding_byte(encoding_mask,DiagnosticInfo_EncodingByte,cursor_before,stream.length);
cursor_before = stream.length;
// read symbolic id
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.SymbolicId)) {
diagnosticInfo.symbolicId = ec.decodeInt32(stream);
tracer.trace("member", "symbolicId", diagnosticInfo.symbolicId, cursor_before, stream.length, "Int32");
cursor_before = stream.length;
}
// read namespace uri
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.NamespaceUri)) {
diagnosticInfo.namespaceUri = ec.decodeInt32(stream);
public decodeDebug(stream: BinaryStream, options: any) {
let cursorBefore;
const tracer = options.tracer;
tracer.trace("start", options.name + "(" + "LocalizedText" + ")", stream.length, stream.length);
cursorBefore = stream.length;
const encodingMask = decodeByte(stream);
tracer.trace("member", "encodingByte", "0x" + encodingMask.toString(16), cursorBefore, stream.length, "Mask");
cursorBefore = stream.length;
if ((encodingMask & 0x01) === 0x01) {
this.locale = decodeString(stream);
tracer.trace("member", "locale", this.locale, cursorBefore, stream.length, "locale");
cursorBefore = stream.length;
} else {
this.locale = null;
}
if ((encodingMask & 0x02) === 0x02) {
this.text = decodeString(stream);
tracer.trace("member", "text", this.text, cursorBefore, stream.length, "text");
// cursor_before = stream.length;
} else {
this.text = null;
function decode_DiagnosticInfo(diagnosticInfo: DiagnosticInfo, stream: BinaryStream): void {
const encodingMask = decodeByte(stream);
// read symbolic id
if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {
diagnosticInfo.symbolicId = decodeInt32(stream);
}
// read namespace uri
if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {
diagnosticInfo.namespaceURI = decodeInt32(stream);
}
// read locale
if (encodingMask & DiagnosticInfo_EncodingByte.Locale) {
diagnosticInfo.locale = decodeInt32(stream);
}
// read localized text
if (encodingMask & DiagnosticInfo_EncodingByte.LocalizedText) {
diagnosticInfo.localizedText = decodeInt32(stream);
decode: function (diagnosticInfo, stream, options) {
const encoding_mask = ec.decodeByte(stream);
// read symbolic id
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.SymbolicId)) {
diagnosticInfo.symbolicId = ec.decodeInt32(stream);
}
// read namespace uri
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.NamespaceUri)) {
diagnosticInfo.namespaceUri = ec.decodeInt32(stream);
}
// read locale
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.Locale)) {
diagnosticInfo.locale = ec.decodeInt32(stream);
}
// read localized text
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.LocalizedText)) {
diagnosticInfo.localizedText = ec.decodeInt32(stream);
function display_encodeable(value: any, buffer1: Buffer, start: number, end: number) {
const bufferExtract = buffer1.slice(start, end);
const stream = new BinaryStream(bufferExtract);
const nodeId = decodeNodeId(stream);
const encodingMask = decodeByte(stream); // 1 bin 2: xml
const length = decodeUInt32(stream);
display(chalk.green(" ExpandedNodId =") + " " + nodeId);
display(chalk.green(" encoding mask =") + " " + encodingMask);
display(chalk.green(" length =") + " " + length);
analyzePacket(bufferExtract.slice(stream.length), value.encodingDefaultBinary, padding + 2, start + stream.length);
}
function decodeDebug_DiagnosticInfo(diagnosticInfo: DiagnosticInfo, stream: BinaryStream, options: any): void {
const tracer = options.tracer;
tracer.trace("start", options.name + "(" + "DiagnosticInfo" + ")", stream.length, stream.length);
let cursorBefore = stream.length;
const encodingMask = decodeByte(stream);
tracer.trace("member", "encodingByte", "0x" + encodingMask.toString(16), cursorBefore, stream.length, "Mask");
tracer.encoding_byte(encodingMask, DiagnosticInfo_EncodingByte, cursorBefore, stream.length);
cursorBefore = stream.length;
// read symbolic id
if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {
diagnosticInfo.symbolicId = decodeInt32(stream);
tracer.trace("member", "symbolicId", diagnosticInfo.symbolicId, cursorBefore, stream.length, "Int32");
cursorBefore = stream.length;
}
// read namespace uri
if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {
diagnosticInfo.namespaceURI = decodeInt32(stream);
tracer.trace("member", "symbolicId", diagnosticInfo.namespaceURI, cursorBefore, stream.length, "Int32");
decode: function (self, stream) {
const encoding_mask = ec.decodeByte(stream);
if ((encoding_mask & 0x01) === 0x01) {
self.locale = ec.decodeString(stream);
} else {
self.locale = null;
}
if ((encoding_mask & 0x02) === 0x02) {
self.text = ec.decodeString(stream);
} else {
self.text = null;
}
},
toString: function () {
decode_debug: function (self, stream , options) {
let cursor_before;
const tracer = options.tracer;
tracer.trace("start", options.name + "(" + "LocalizedText" + ")", stream.length, stream.length);
cursor_before = stream.length;
const encoding_mask = ec.decodeByte(stream);
tracer.trace("member", "encodingByte", "0x" + encoding_mask.toString(16), cursor_before, stream.length, "Mask");
cursor_before = stream.length;
if ((encoding_mask & 0x01) === 0x01) {
self.locale = ec.decodeString(stream);
tracer.trace("member", "locale", self.locale, cursor_before, stream.length, "locale");
cursor_before = stream.length;
} else {
self.locale = null;
}
if ((encoding_mask & 0x02) === 0x02) {
self.text = ec.decodeString(stream);
tracer.trace("member", "text", self.text, cursor_before, stream.length, "text");
//cursor_before = stream.length;
} else {
self.text = null;