net-snmp 3.13.0 → 3.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -4
- package/index.js +19 -8
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1554,9 +1554,12 @@ in the `rinfo` field. For example:
|
|
1554
1554
|
Returns the receiver's `Authorizer` instance, used to control access
|
1555
1555
|
to the receiver. See the `Authorizer` section for further details.
|
1556
1556
|
|
1557
|
-
## receiver.close ()
|
1557
|
+
## receiver.close (callback)
|
1558
1558
|
|
1559
|
-
Closes the receiver's listening socket, ending the operation of the receiver.
|
1559
|
+
Closes the receiver's listening socket(s), ending the operation of the receiver. The optionnal
|
1560
|
+
`callback` parameter is a callback function of the form `function (socket)`, which will be
|
1561
|
+
called once for each socket that the receiver is listening on, after the socket is closed.
|
1562
|
+
The `socket` argument will be given as an object triple of `address`, `family` and `port`.
|
1560
1563
|
|
1561
1564
|
# Application: SNMP Agent
|
1562
1565
|
|
@@ -1657,9 +1660,12 @@ its existing `Mib` instance.
|
|
1657
1660
|
Returns the agent's singleton `Forwarder` instance, which holds a list of registered
|
1658
1661
|
proxies that specify context-based forwarding to remote hosts.
|
1659
1662
|
|
1660
|
-
## agent.close ()
|
1663
|
+
## agent.close (callback)
|
1661
1664
|
|
1662
|
-
Closes the agent's listening socket, ending the operation of the agent.
|
1665
|
+
Closes the agent's listening socket(s), ending the operation of the agent. The optionnal
|
1666
|
+
`callback` parameter is a callback function of the form `function (socket)`, which will be
|
1667
|
+
called once for each socket that the agent is listening on, after the socket is closed.
|
1668
|
+
The `socket` argument will be given as an object triple of `address`, `family` and `port`.
|
1663
1669
|
|
1664
1670
|
# Authorizer Module
|
1665
1671
|
|
@@ -3389,6 +3395,14 @@ Example programs are included under the module's `example` directory.
|
|
3389
3395
|
|
3390
3396
|
* Add support for out-of-order MIB dependencies
|
3391
3397
|
|
3398
|
+
## Version 3.13.1 - 03/09/2024
|
3399
|
+
|
3400
|
+
* Add close callback for agent and receiver
|
3401
|
+
|
3402
|
+
## Version 3.13.2 - 05/09/2024
|
3403
|
+
|
3404
|
+
* Fix AgentX signed integer writing
|
3405
|
+
|
3392
3406
|
# License
|
3393
3407
|
|
3394
3408
|
Copyright (c) 2020 Mark Abrahams <mark@abrahams.co.nz>
|
package/index.js
CHANGED
@@ -2882,9 +2882,17 @@ Listener.processIncoming = function (buffer, authorizer, callback) {
|
|
2882
2882
|
return message;
|
2883
2883
|
};
|
2884
2884
|
|
2885
|
-
Listener.prototype.close = function () {
|
2885
|
+
Listener.prototype.close = function (callback) {
|
2886
2886
|
for ( const socket of Object.values(this.sockets) ) {
|
2887
|
-
|
2887
|
+
if ( callback ) {
|
2888
|
+
const socketInfo = socket.address();
|
2889
|
+
const socketCallback = () => {
|
2890
|
+
callback(socketInfo);
|
2891
|
+
};
|
2892
|
+
socket.close (socketCallback);
|
2893
|
+
} else {
|
2894
|
+
socket.close();
|
2895
|
+
}
|
2888
2896
|
}
|
2889
2897
|
};
|
2890
2898
|
|
@@ -3168,8 +3176,8 @@ Receiver.prototype.formatCallbackData = function (message, rinfo) {
|
|
3168
3176
|
return formattedData;
|
3169
3177
|
};
|
3170
3178
|
|
3171
|
-
Receiver.prototype.close = function() {
|
3172
|
-
this.listener.close ();
|
3179
|
+
Receiver.prototype.close = function (callback) {
|
3180
|
+
this.listener.close (callback);
|
3173
3181
|
};
|
3174
3182
|
|
3175
3183
|
Receiver.create = function (options, callback) {
|
@@ -3764,6 +3772,7 @@ MibNode.prototype.getNextInstanceNode = function () {
|
|
3764
3772
|
// end of MIB
|
3765
3773
|
return null;
|
3766
3774
|
} else {
|
3775
|
+
// Move to next sibling
|
3767
3776
|
childrenAddresses = Object.keys (node.children).sort ( (a, b) => a - b);
|
3768
3777
|
var siblingPosition = childrenAddresses.indexOf(siblingIndex.toString());
|
3769
3778
|
if ( siblingPosition + 1 < childrenAddresses.length ) {
|
@@ -3773,11 +3782,11 @@ MibNode.prototype.getNextInstanceNode = function () {
|
|
3773
3782
|
}
|
3774
3783
|
}
|
3775
3784
|
}
|
3776
|
-
// Descent
|
3777
3785
|
while ( node ) {
|
3778
3786
|
if ( node.value != null ) {
|
3779
3787
|
return node;
|
3780
3788
|
}
|
3789
|
+
// Descend to first child if not at leaf
|
3781
3790
|
childrenAddresses = Object.keys (node.children).sort ( (a, b) => a - b);
|
3782
3791
|
node = node.children[childrenAddresses[0]];
|
3783
3792
|
if ( ! node ) {
|
@@ -5393,8 +5402,8 @@ Agent.prototype.getForwarder = function () {
|
|
5393
5402
|
return this.forwarder;
|
5394
5403
|
};
|
5395
5404
|
|
5396
|
-
Agent.prototype.close
|
5397
|
-
this.listener.close ();
|
5405
|
+
Agent.prototype.close = function (callback) {
|
5406
|
+
this.listener.close (callback);
|
5398
5407
|
};
|
5399
5408
|
|
5400
5409
|
Agent.create = function (options, callback, mib) {
|
@@ -5676,7 +5685,9 @@ AgentXPdu.writeVarBind = function (buffer, varbind) {
|
|
5676
5685
|
if (varbind.type && varbind.oid) {
|
5677
5686
|
|
5678
5687
|
switch (varbind.type) {
|
5679
|
-
case ObjectType.Integer: // also Integer32
|
5688
|
+
case ObjectType.Integer: // also Integer32 (signed 32-bit)
|
5689
|
+
buffer.writeInt32BE (varbind.value);
|
5690
|
+
break;
|
5680
5691
|
case ObjectType.Counter: // also Counter32
|
5681
5692
|
case ObjectType.Gauge: // also Gauge32 & Unsigned32
|
5682
5693
|
case ObjectType.TimeTicks:
|