summaryrefslogtreecommitdiffstats
path: root/node.d
diff options
context:
space:
mode:
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2018-06-11 20:50:02 +0300
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2018-06-11 20:50:02 +0300
commit26c69b7ec1ad670df9b9400ee034efd61c13e283 (patch)
tree77e5b2cbe2791f09341d49e1fb151b5111d87b1f /node.d
parentb28142fe0c77d15de9074394617ed8df9325b79a (diff)
updated net-snmp.js to latest version
Diffstat (limited to 'node.d')
-rw-r--r--node.d/node_modules/net-snmp.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/node.d/node_modules/net-snmp.js b/node.d/node_modules/net-snmp.js
index c43044fdd4..484597dcb0 100644
--- a/node.d/node_modules/net-snmp.js
+++ b/node.d/node_modules/net-snmp.js
@@ -578,6 +578,10 @@ var Session = function (target, community, options) {
? parseInt(options.sourcePort)
: undefined;
+ this.idBitsSize = (options && options.idBitsSize)
+ ? parseInt(options.idBitsSize)
+ : 32;
+
this.reqs = {};
this.reqCount = 0;
@@ -609,8 +613,11 @@ Session.prototype.cancelRequests = function (error) {
}
};
-function _generateId () {
- return Math.floor (Math.random () + Math.random () * 10000000)
+function _generateId (bitSize) {
+ if (bitSize === 16) {
+ return Math.floor(Math.random() * 10000) % 65535;
+ }
+ return Math.floor(Math.random() * 100000000) % 4294967295;
}
Session.prototype.get = function (oids, responseCb) {
@@ -1044,7 +1051,7 @@ Session.prototype.simpleGet = function (pduClass, feedCb, varbinds,
var req = {};
try {
- var id = _generateId ();
+ var id = _generateId (this.idBitsSize);
var pdu = new pduClass (id, varbinds, options);
var message = new RequestMessage (this.version, this.community, pdu);
@@ -1290,7 +1297,7 @@ Session.prototype.trap = function () {
pduVarbinds.push (varbind);
}
- var id = _generateId ();
+ var id = _generateId (this.idBitsSize);
if (this.version == Version2c) {
if (typeof typeOrOid != "string")