This commit is contained in:
Ylian Saint-Hilaire 2020-05-28 16:25:13 -07:00
commit b93187abb1
6 changed files with 40 additions and 9 deletions

View File

@ -173,6 +173,12 @@ function createMeshCore(agent) {
case 'connection':
data.result = require('MeshAgent').ConnectedServer;
this._send(data);
case 'descriptors':
require('ChainViewer').getSnapshot().then(function (f)
{
this.tag.payload.result = f;
this.tag.ipc._send(this.tag.payload);
}).parentPromise.tag = { ipc: this, payload: data };
break;
}
break;

View File

@ -117,6 +117,7 @@ function lme_heci(options) {
emitterUtils.createEvent('notify');
emitterUtils.createEvent('bind');
this.on('newListener', function (name, func) { if (name == 'connect' && this._LME._connected == true) { func.call(this);} });
if ((options != null) && (options.debug == true)) { lme_port_offset = -100; } // LMS debug mode
var heci = require('heci');
@ -124,10 +125,14 @@ function lme_heci(options) {
this._ObjectID = "lme";
this._LME = heci.create();
this._LME._connected = false;
this._LME.descriptorMetadata = "amt-lme";
this._LME._binded = {};
this._LME.LMS = this;
this._LME.on('error', function (e) { this.LMS.emit('error', e); });
this._LME.on('connect', function () {
this._LME.on('connect', function ()
{
this._connected = true;
this.on('data', function (chunk) {
// this = HECI
var cmd = chunk.readUInt8(0);
@ -173,6 +178,7 @@ function lme_heci(options) {
try {
// Bind a new server socket if not already present
this[name][port] = require('net').createServer();
this[name][port].descriptorMetadata = 'amt-lme (port: ' + port + ')';
this[name][port].HECI = this;
if (lme_port_offset == 0) {
this[name][port].listen({ port: port, host: '127.0.0.1' }); // Normal mode

View File

@ -27,6 +27,7 @@ function amt_heci() {
this._setupPTHI = function _setupPTHI()
{
this._amt = heci.create();
this._amt.descriptorMetadata = "amt-pthi";
this._amt.BiosVersionLen = 65;
this._amt.UnicodeStringLen = 20;
@ -397,20 +398,25 @@ function amt_heci() {
fn.apply(this, opt);
}, callback, optional);
}
this.getProtocolVersion = function getProtocolVersion(callback) {
this.getProtocolVersion = function getProtocolVersion(callback)
{
var optional = [];
for (var i = 1; i < arguments.length; ++i) { opt.push(arguments[i]); }
heci.doIoctl(heci.IOCTL.HECI_VERSION, Buffer.alloc(5), Buffer.alloc(5), function (status, buffer, self, fn, opt) {
if (!this._tmpSession) { this._tmpSession = heci.create(); this._tmpSession.parent = this;}
this._tmpSession.doIoctl(heci.IOCTL.HECI_VERSION, Buffer.alloc(5), Buffer.alloc(5), function (status, buffer, self, fn, opt)
{
if (status == 0) {
var result = buffer.readUInt8(0).toString() + '.' + buffer.readUInt8(1).toString() + '.' + buffer.readUInt8(2).toString() + '.' + buffer.readUInt16BE(3).toString();
opt.unshift(result);
fn.apply(self, opt);
}
else {
else
{
opt.unshift(null);
fn.apply(self, opt);
}
}, this, callback, optional);
}
}

View File

@ -117,6 +117,7 @@ function lme_heci(options) {
emitterUtils.createEvent('notify');
emitterUtils.createEvent('bind');
this.on('newListener', function (name, func) { if (name == 'connect' && this._LME._connected == true) { func.call(this);} });
if ((options != null) && (options.debug == true)) { lme_port_offset = -100; } // LMS debug mode
var heci = require('heci');
@ -124,10 +125,14 @@ function lme_heci(options) {
this._ObjectID = "lme";
this._LME = heci.create();
this._LME._connected = false;
this._LME.descriptorMetadata = "amt-lme";
this._LME._binded = {};
this._LME.LMS = this;
this._LME.on('error', function (e) { this.LMS.emit('error', e); });
this._LME.on('connect', function () {
this._LME.on('connect', function ()
{
this._connected = true;
this.on('data', function (chunk) {
// this = HECI
var cmd = chunk.readUInt8(0);
@ -173,6 +178,7 @@ function lme_heci(options) {
try {
// Bind a new server socket if not already present
this[name][port] = require('net').createServer();
this[name][port].descriptorMetadata = 'amt-lme (port: ' + port + ')';
this[name][port].HECI = this;
if (lme_port_offset == 0) {
this[name][port].listen({ port: port, host: '127.0.0.1' }); // Normal mode

View File

@ -27,6 +27,7 @@ function amt_heci() {
this._setupPTHI = function _setupPTHI()
{
this._amt = heci.create();
this._amt.descriptorMetadata = "amt-pthi";
this._amt.BiosVersionLen = 65;
this._amt.UnicodeStringLen = 20;
@ -397,20 +398,25 @@ function amt_heci() {
fn.apply(this, opt);
}, callback, optional);
}
this.getProtocolVersion = function getProtocolVersion(callback) {
this.getProtocolVersion = function getProtocolVersion(callback)
{
var optional = [];
for (var i = 1; i < arguments.length; ++i) { opt.push(arguments[i]); }
heci.doIoctl(heci.IOCTL.HECI_VERSION, Buffer.alloc(5), Buffer.alloc(5), function (status, buffer, self, fn, opt) {
if (!this._tmpSession) { this._tmpSession = heci.create(); this._tmpSession.parent = this;}
this._tmpSession.doIoctl(heci.IOCTL.HECI_VERSION, Buffer.alloc(5), Buffer.alloc(5), function (status, buffer, self, fn, opt)
{
if (status == 0) {
var result = buffer.readUInt8(0).toString() + '.' + buffer.readUInt8(1).toString() + '.' + buffer.readUInt8(2).toString() + '.' + buffer.readUInt16BE(3).toString();
opt.unshift(result);
fn.apply(self, opt);
}
else {
else
{
opt.unshift(null);
fn.apply(self, opt);
}
}, this, callback, optional);
}
}

View File

@ -12025,6 +12025,7 @@
},
{
"en": "Group Identifier",
"nl": "Groepsidentificatie",
"xloc": [
"default.handlebars->25->1532"
]
@ -31267,4 +31268,4 @@
]
}
]
}
}