net-snmp 3.17.0 → 3.18.1

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/index.js CHANGED
@@ -587,55 +587,79 @@ function writeVarbinds (buffer, varbinds) {
587
587
 
588
588
  const ObjectTypeUtil = {};
589
589
 
590
- ObjectTypeUtil.castSetValue = function (type, value) {
590
+ ObjectTypeUtil.castSetValue = function (type, value, constraints) {
591
591
 
592
592
  switch (type) {
593
- case ObjectType.Boolean:
593
+
594
+ case ObjectType.Boolean: {
594
595
  return !! value;
596
+ }
595
597
 
596
598
  case ObjectType.Integer:
599
+ case ObjectType.Integer32: {
597
600
  if ( typeof value != "number" && typeof value != "string" ) {
598
601
  throw new Error("Invalid Integer", value);
599
602
  }
600
- return typeof value == "number" ? value : parseInt(value, 10);
603
+ const parsedValue = typeof value == "number" ? value : parseInt(value, 10);
604
+ if ( isNaN(parsedValue) ) {
605
+ throw new Error("Invalid Integer", value);
606
+ }
607
+ if ( constraints && ObjectTypeUtil.doesIntegerMeetConstraints (parsedValue, constraints) ) {
608
+ throw new Error("Integer does not meet constraints", value);
609
+ }
610
+ return parsedValue;
611
+ }
601
612
 
602
- case ObjectType.OctetString:
603
- if ( value instanceof Buffer) {
604
- return value.toString();
605
- } else if ( typeof value != "string" ) {
613
+ case ObjectType.OctetString: {
614
+ if ( ! value instanceof Buffer && typeof value != "string" ) {
606
615
  throw new Error("Invalid OctetString", value);
616
+ }
617
+ if ( constraints && ObjectTypeUtil.doesStringMeetConstraints (value, constraints) ) {
618
+ throw new Error("OctetString does not meet constraints", value);
619
+ }
620
+ if ( value instanceof Buffer ) {
621
+ return value.toString();
607
622
  } else {
608
623
  return value;
609
624
  }
625
+ }
610
626
 
611
- case ObjectType.OID:
627
+ case ObjectType.OID: {
612
628
  if ( typeof value != "string" || ! value.match(/^([0-9]+)(\.[0-9]+)+$/) ) {
613
629
  throw new Error("Invalid OID", value);
614
630
  }
615
631
  return value;
632
+ }
616
633
 
617
634
  case ObjectType.Counter:
618
- case ObjectType.Counter64:
635
+ case ObjectType.Counter32:
636
+ case ObjectType.Gauge:
637
+ case ObjectType.Gauge32:
638
+ case ObjectType.Unsigned32:
639
+ case ObjectType.Counter64: {
619
640
  // Counters should be initialized to 0 (RFC2578, end of section 7.9)
620
641
  // We'll do so.
621
642
  return 0;
643
+ }
622
644
 
623
- case ObjectType.IpAddress:
645
+ case ObjectType.IpAddress: {
624
646
  // A 32-bit internet address represented as OCTET STRING of length 4
625
647
  var bytes = value.split(".");
626
648
  if ( typeof value != "string" || bytes.length != 4 ) {
627
649
  throw new Error("Invalid IpAddress", value);
628
650
  }
629
651
  return value;
652
+ }
630
653
 
631
- default :
654
+ default: {
632
655
  // Assume the caller knows what he's doing
633
656
  return value;
657
+ }
634
658
  }
635
659
 
636
660
  };
637
661
 
638
- ObjectTypeUtil.isValid = function (type, value) {
662
+ ObjectTypeUtil.isValid = function (type, value, constraints) {
639
663
 
640
664
  switch (type) {
641
665
  case ObjectType.Boolean: {
@@ -644,12 +668,24 @@ ObjectTypeUtil.isValid = function (type, value) {
644
668
  case ObjectType.Integer:
645
669
  case ObjectType.Integer32: {
646
670
  // Allow strings that can be parsed as integers
647
- const parsed = Number(value);
648
- return ! isNaN (parsed) && Number.isInteger (parsed) && parsed >= MIN_SIGNED_INT32 && parsed <= MAX_SIGNED_INT32;
671
+ const parsedValue = Number(value);
672
+ if ( isNaN(parsedValue) || ! Number.isInteger(parsedValue) || parsedValue < MIN_SIGNED_INT32 || parsedValue > MAX_SIGNED_INT32 ) {
673
+ return false;
674
+ }
675
+ if ( constraints && ObjectTypeUtil.doesIntegerMeetConstraints (parsedValue, constraints) ) {
676
+ return false;
677
+ }
678
+ return true;
649
679
  }
650
680
  case ObjectType.OctetString: {
651
681
  // Allow string or buffer
652
- return typeof value == "string" || value instanceof Buffer;
682
+ if ( typeof value != "string" && ! (value instanceof Buffer) ) {
683
+ return false;
684
+ }
685
+ if ( constraints && ObjectTypeUtil.doesStringMeetConstraints (value, constraints) ) {
686
+ return false;
687
+ }
688
+ return true;
653
689
  }
654
690
  case ObjectType.OID: {
655
691
  return typeof value == "string" && value.match (/^([0-9]+)(\.[0-9]+)+$/);
@@ -696,6 +732,57 @@ ObjectTypeUtil.isValid = function (type, value) {
696
732
 
697
733
  };
698
734
 
735
+ ObjectTypeUtil.doesIntegerMeetConstraints = function (value, constraints) {
736
+
737
+ if ( ! constraints ) {
738
+ return true;
739
+ }
740
+
741
+ if ( constraints.enumeration ) {
742
+ if ( constraints.enumeration[value] ) {
743
+ return true;
744
+ } else {
745
+ return false;
746
+ }
747
+ } else if ( constraints.ranges ) {
748
+ for ( const range of constraints.ranges ) {
749
+ const min = "min" in range ? range.min : Number.MIN_SAFE_INTEGER;
750
+ const max = "max" in range ? range.max : Number.MAX_SAFE_INTEGER;
751
+ if ( value >= min && value <= max ) {
752
+ return true;
753
+ }
754
+ }
755
+ return false;
756
+ }
757
+
758
+ return true;
759
+ };
760
+
761
+ ObjectTypeUtil.doesStringMeetConstraints = function (value, constraints) {
762
+
763
+ if ( ! constraints ) {
764
+ return true;
765
+ }
766
+
767
+ if ( constraints.sizes ) {
768
+ // if size is constrained, value must have a length property
769
+ if ( value.length === undefined ) {
770
+ return false;
771
+ }
772
+ const len = value.length;
773
+ for ( const range of constraints.sizes ) {
774
+ const min = "min" in range ? range.min : Number.MIN_SAFE_INTEGER;
775
+ const max = "max" in range ? range.max : Number.MAX_SAFE_INTEGER;
776
+ if ( len >= min && len <= max ) {
777
+ return true;
778
+ }
779
+ }
780
+ return false;
781
+ }
782
+
783
+ return true;
784
+ };
785
+
699
786
  /*****************************************************************************
700
787
  ** PDU class definitions
701
788
  **/
@@ -3770,53 +3857,17 @@ MibNode.prototype.getConstraintsFromProvider = function () {
3770
3857
  }
3771
3858
  };
3772
3859
 
3773
- MibNode.prototype.setValue = function (newValue) {
3774
- var len;
3775
- var min;
3776
- var max;
3777
- var range;
3778
- var found = false;
3779
- var constraints = this.getConstraintsFromProvider ();
3780
- if ( ! constraints ) {
3781
- this.value = newValue;
3860
+ MibNode.prototype.setValue = function (typeFromSet, valueFromSet) {
3861
+ const constraints = this.getConstraintsFromProvider ();
3862
+ try {
3863
+ const castValue = ObjectTypeUtil.castSetValue (typeFromSet, valueFromSet, constraints);
3864
+ this.value = castValue;
3782
3865
  return true;
3866
+ } catch (error) {
3867
+ console.error ("Error setting value: " + error.message);
3868
+ return false;
3783
3869
  }
3784
- if ( constraints.enumeration ) {
3785
- if ( ! constraints.enumeration[newValue] ) {
3786
- return false;
3787
- }
3788
- } else if ( constraints.ranges ) {
3789
- for ( range of constraints.ranges ) {
3790
- min = "min" in range ? range.min : Number.MIN_SAFE_INTEGER;
3791
- max = "max" in range ? range.max : Number.MAX_SAFE_INTEGER;
3792
- if ( newValue >= min && newValue <= max ) {
3793
- found = true;
3794
- break;
3795
- }
3796
- }
3797
- if ( ! found ) {
3798
- return false;
3799
- }
3800
- } else if ( constraints.sizes ) {
3801
- // if size is constrained, value must have a length property
3802
- if ( newValue.length === undefined ) {
3803
- return false;
3804
- }
3805
- len = newValue.length;
3806
- for ( range of constraints.sizes ) {
3807
- min = "min" in range ? range.min : Number.MIN_SAFE_INTEGER;
3808
- max = "max" in range ? range.max : Number.MAX_SAFE_INTEGER;
3809
- if ( len >= min && len <= max ) {
3810
- found = true;
3811
- break;
3812
- }
3813
- }
3814
- if ( ! found ) {
3815
- return false;
3816
- }
3817
- }
3818
- this.value = newValue;
3819
- return true;
3870
+
3820
3871
  };
3821
3872
 
3822
3873
  MibNode.prototype.getInstanceNodeForTableRow = function () {
@@ -3974,10 +4025,11 @@ MibNode.oidIsDescended = function (oid, ancestor) {
3974
4025
  return isAncestor;
3975
4026
  };
3976
4027
 
3977
- var Mib = function () {
4028
+ var Mib = function (options) {
3978
4029
  var providersByOid;
3979
4030
  this.root = new MibNode ([], null);
3980
4031
  this.providerNodes = {};
4032
+ this.options = options;
3981
4033
 
3982
4034
  // this.providers will be modified throughout this code.
3983
4035
  // Keep this.providersByOid in sync with it
@@ -4083,8 +4135,13 @@ Mib.prototype.addProviderToNode = function (provider) {
4083
4135
  return node;
4084
4136
  };
4085
4137
 
4086
- Mib.prototype.getColumnFromProvider = function (provider, indexEntry) {
4087
- var column = null;
4138
+ Mib.prototype.getColumnForColumnNumberFromTableProvider = function (provider, columnNumber) {
4139
+ const column = provider.tableColumns.find (column => column.number == columnNumber );
4140
+ return column;
4141
+ };
4142
+
4143
+ Mib.prototype.getColumnForIndexEntryFromTableProvider = function (provider, indexEntry) {
4144
+ let column = null;
4088
4145
  if ( indexEntry.columnName ) {
4089
4146
  column = provider.tableColumns.filter (column => column.name == indexEntry.columnName )[0];
4090
4147
  } else if ( indexEntry.columnNumber !== undefined && indexEntry.columnNumber !== null ) {
@@ -4101,16 +4158,16 @@ Mib.prototype.populateIndexEntryFromColumn = function (localProvider, indexEntry
4101
4158
  }
4102
4159
  if ( indexEntry.foreign ) {
4103
4160
  // Explicit foreign table is first to search
4104
- column = this.getColumnFromProvider (this.providers[indexEntry.foreign], indexEntry);
4161
+ column = this.getColumnForIndexEntryFromTableProvider (this.providers[indexEntry.foreign], indexEntry);
4105
4162
  } else {
4106
4163
  // If foreign table isn't given, search the local table next
4107
- column = this.getColumnFromProvider (localProvider, indexEntry);
4164
+ column = this.getColumnForIndexEntryFromTableProvider (localProvider, indexEntry);
4108
4165
  if ( ! column ) {
4109
4166
  // as a last resort, try to find the column in a foreign table
4110
4167
  tableProviders = Object.values(this.providers).
4111
4168
  filter ( prov => prov.type == MibProviderType.Table );
4112
4169
  for ( var provider of tableProviders ) {
4113
- column = this.getColumnFromProvider (provider, indexEntry);
4170
+ column = this.getColumnForIndexEntryFromTableProvider (provider, indexEntry);
4114
4171
  if ( column ) {
4115
4172
  indexEntry.foreign = provider.name;
4116
4173
  break;
@@ -4141,7 +4198,13 @@ Mib.prototype.populateIndexEntryFromColumn = function (localProvider, indexEntry
4141
4198
 
4142
4199
  Mib.prototype.registerProvider = function (provider) {
4143
4200
  this.providers[provider.name] = provider;
4144
- if ( provider.type == MibProviderType.Table ) {
4201
+ if ( provider.type == MibProviderType.Scalar ) {
4202
+ if ( this.options?.addScalarDefaultsOnRegistration ) {
4203
+ if ( provider.defVal ) {
4204
+ this.setScalarValue (provider.name, provider.defVal);
4205
+ }
4206
+ }
4207
+ } else if ( provider.type == MibProviderType.Table ) {
4145
4208
  if ( provider.tableAugments ) {
4146
4209
  if ( provider.tableAugments == provider.name ) {
4147
4210
  throw new Error ("Table " + provider.name + " cannot augment itself");
@@ -4288,7 +4351,7 @@ Mib.prototype.setScalarValue = function (scalarName, newValue) {
4288
4351
  instanceNode = this.lookup (instanceAddress);
4289
4352
  instanceNode.valueType = provider.scalarType;
4290
4353
  }
4291
- const isValidValue = ObjectTypeUtil.isValid(instanceNode.valueType, newValue);
4354
+ const isValidValue = ObjectTypeUtil.isValid(instanceNode.valueType, newValue, provider.constraints);
4292
4355
  if ( ! isValidValue ) {
4293
4356
  throw new TypeError(`Invalid value for ${scalarName} of type ${instanceNode.valueType}: ${newValue}`);
4294
4357
  }
@@ -4425,13 +4488,13 @@ Mib.prototype.validateTableRow = function (table, row) {
4425
4488
  const tableIndex = provider.tableIndex;
4426
4489
  const foreignIndexOffset = tableIndex.filter ( indexPart => indexPart.foreign ).length;
4427
4490
  for ( let i = 0; i < provider.tableColumns.length ; i++ ) {
4428
- const column = provider.tableColumns[i];
4429
- const isColumnIndex = tableIndex.some ( indexPart => indexPart.columnNumber == column.number );
4430
- if ( ! isColumnIndex || ! (column.maxAccess === MaxAccess['not-accessible'] || column.maxAccess === MaxAccess['accessible-for-notify']) ) {
4491
+ const providerColumn = provider.tableColumns[i];
4492
+ const isColumnIndex = tableIndex.some ( indexPart => indexPart.columnNumber == providerColumn.number );
4493
+ if ( ! isColumnIndex || ! (providerColumn.maxAccess === MaxAccess['not-accessible'] || providerColumn.maxAccess === MaxAccess['accessible-for-notify']) ) {
4431
4494
  const rowValueIndex = foreignIndexOffset + i;
4432
- const isValidValue = ObjectTypeUtil.isValid(column.type, row[rowValueIndex]);
4495
+ const isValidValue = ObjectTypeUtil.isValid(providerColumn.type, row[rowValueIndex], providerColumn.constraints);
4433
4496
  if ( ! isValidValue ) {
4434
- throw new TypeError(`Invalid value for ${table} column ${column.name} (index ${rowValueIndex}): ${row[rowValueIndex]} (in row [${row}])`);
4497
+ throw new TypeError(`Invalid value for ${table} column ${providerColumn.name} (index ${rowValueIndex}): ${row[rowValueIndex]} (in row [${row}])`);
4435
4498
  }
4436
4499
  }
4437
4500
  }
@@ -4471,11 +4534,7 @@ Mib.prototype.addTableRow = function (table, row) {
4471
4534
  };
4472
4535
 
4473
4536
  Mib.prototype.getTableColumnDefinitions = function (table) {
4474
- var providerNode;
4475
- var provider;
4476
-
4477
- providerNode = this.getProviderNodeForTable (table);
4478
- provider = providerNode.provider;
4537
+ const provider = this.providers[table];
4479
4538
  return provider.tableColumns;
4480
4539
  };
4481
4540
 
@@ -4584,7 +4643,8 @@ Mib.prototype.setTableSingleCell = function (table, columnNumber, rowIndex, valu
4584
4643
  const instanceAddress = this.getTableRowInstanceFromRowIndex (provider, rowIndex);
4585
4644
  const columnNode = providerNode.children[columnNumber];
4586
4645
  const instanceNode = columnNode.getInstanceNodeForTableRowIndex (instanceAddress);
4587
- const isValidValue = ObjectTypeUtil.isValid(instanceNode.valueType, value);
4646
+ const providerColumn = this.getColumnForColumnNumberFromTableProvider (provider, columnNumber);
4647
+ const isValidValue = ObjectTypeUtil.isValid(instanceNode.valueType, value, providerColumn?.constraints);
4588
4648
  if ( ! isValidValue ) {
4589
4649
  throw new TypeError(`Invalid value for ${table} column ${columnNumber} of type ${instanceNode.valueType}: ${value}`);
4590
4650
  }
@@ -4709,8 +4769,8 @@ Mib.getSubOidFromBaseOid = function (oid, base) {
4709
4769
  return oid.substring (base.length + 1);
4710
4770
  };
4711
4771
 
4712
- Mib.create = function () {
4713
- return new Mib ();
4772
+ Mib.create = function (options) {
4773
+ return new Mib (options);
4714
4774
  };
4715
4775
 
4716
4776
  var MibRequest = function (requestDefinition) {
@@ -4738,7 +4798,8 @@ var Agent = function (options, callback, mib) {
4738
4798
  this.engine = new Engine (options.engineID);
4739
4799
  this.authorizer = new Authorizer (options);
4740
4800
  this.callback = callback || function () {};
4741
- this.mib = mib || new Mib ();
4801
+ const mibOptions = mib?.options || options?.mibOptions || {};
4802
+ this.mib = mib || new Mib (mibOptions);
4742
4803
  this.context = "";
4743
4804
  this.forwarder = new Forwarder (this.listener, this.callback);
4744
4805
  };
@@ -5297,10 +5358,10 @@ Agent.prototype.request = function (socket, requestMessage, rinfo) {
5297
5358
 
5298
5359
  } else {
5299
5360
  // No special handling required. Just save the new value.
5300
- let setResult = mibRequests[savedIndex].instanceNode.setValue (ObjectTypeUtil.castSetValue (
5361
+ const setResult = mibRequests[savedIndex].instanceNode.setValue (
5301
5362
  requestPdu.varbinds[savedIndex].type,
5302
5363
  requestPdu.varbinds[savedIndex].value
5303
- ));
5364
+ );
5304
5365
  if ( ! setResult ) {
5305
5366
  if ( typeof responsePdu.errorStatus == "undefined" || responsePdu.errorStatus == ErrorStatus.NoError ) {
5306
5367
  responsePdu.errorStatus = ErrorStatus.WrongValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "net-snmp",
3
- "version": "3.17.0",
3
+ "version": "3.18.1",
4
4
  "description": "JavaScript implementation of the Simple Network Management Protocol (SNMP)",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -0,0 +1,210 @@
1
+ TEST-MIB DEFINITIONS ::= BEGIN
2
+
3
+ IMPORTS
4
+ MODULE-IDENTITY, OBJECT-TYPE, Integer32, IpAddress, TimeTicks
5
+ FROM SNMPv2-SMI
6
+ DisplayString, TEXTUAL-CONVENTION
7
+ FROM SNMPv2-TC;
8
+
9
+ testMIB MODULE-IDENTITY
10
+ LAST-UPDATED "202501060000Z"
11
+ ORGANIZATION "Example Organization"
12
+ CONTACT-INFO "support@example.org"
13
+ DESCRIPTION "A test MIB for node-net-snmp library"
14
+ REVISION "202501060000Z"
15
+ DESCRIPTION "Initial version of the test MIB"
16
+ ::= { enterprises 99999 }
17
+
18
+ -- Scalars
19
+ testScalarInteger OBJECT-TYPE
20
+ SYNTAX Integer32
21
+ MAX-ACCESS read-write
22
+ STATUS current
23
+ DESCRIPTION "An integer scalar"
24
+ ::= { testMIB 1 }
25
+
26
+ testScalarEnum OBJECT-TYPE
27
+ SYNTAX INTEGER { up(1), down(2), unknown(3) }
28
+ MAX-ACCESS read-write
29
+ STATUS current
30
+ DESCRIPTION "An integer scalar with enumerated type"
31
+ ::= { testMIB 2 }
32
+
33
+ testScalarRange OBJECT-TYPE
34
+ SYNTAX Integer32 (1..100)
35
+ MAX-ACCESS read-write
36
+ STATUS current
37
+ DESCRIPTION "An integer scalar with a range constraint"
38
+ ::= { testMIB 3 }
39
+
40
+ testScalarString OBJECT-TYPE
41
+ SYNTAX DisplayString
42
+ MAX-ACCESS read-write
43
+ STATUS current
44
+ DESCRIPTION "A string scalar"
45
+ ::= { testMIB 4 }
46
+
47
+ testScalarStringSize OBJECT-TYPE
48
+ SYNTAX OCTET STRING (SIZE(1..32))
49
+ MAX-ACCESS read-write
50
+ STATUS current
51
+ DESCRIPTION "A string scalar with a size constraint"
52
+ ::= { testMIB 5 }
53
+
54
+ testScalarIntegerDefval OBJECT-TYPE
55
+ SYNTAX Integer32
56
+ MAX-ACCESS read-write
57
+ STATUS current
58
+ DESCRIPTION "An integer scalar"
59
+ DEFVAL { 49 }
60
+ ::= { testMIB 6 }
61
+
62
+
63
+ -- Tables
64
+ testTable1 OBJECT-TYPE
65
+ SYNTAX SEQUENCE OF TestEntry1
66
+ MAX-ACCESS not-accessible
67
+ STATUS current
68
+ DESCRIPTION "A table with a single integer index"
69
+ ::= { testMIB 10 }
70
+
71
+ testEntry1 OBJECT-TYPE
72
+ SYNTAX TestEntry1
73
+ MAX-ACCESS not-accessible
74
+ STATUS current
75
+ DESCRIPTION "An entry in testTable1"
76
+ INDEX { testTable1Index }
77
+ ::= { testTable1 1 }
78
+
79
+ TestEntry1 ::= SEQUENCE {
80
+ testTable1Index Integer32,
81
+ testTable1Value DisplayString
82
+ }
83
+
84
+ testTable1Index OBJECT-TYPE
85
+ SYNTAX Integer32
86
+ MAX-ACCESS not-accessible
87
+ STATUS current
88
+ DESCRIPTION "Index for testTable1"
89
+ ::= { testEntry1 1 }
90
+
91
+ testTable1Value OBJECT-TYPE
92
+ SYNTAX DisplayString
93
+ MAX-ACCESS read-write
94
+ STATUS current
95
+ DESCRIPTION "Value in testTable1"
96
+ ::= { testEntry1 2 }
97
+
98
+ testTable2 OBJECT-TYPE
99
+ SYNTAX SEQUENCE OF TestEntry2
100
+ MAX-ACCESS not-accessible
101
+ STATUS current
102
+ DESCRIPTION "A table with a string index"
103
+ ::= { testMIB 11 }
104
+
105
+ testEntry2 OBJECT-TYPE
106
+ SYNTAX TestEntry2
107
+ MAX-ACCESS not-accessible
108
+ STATUS current
109
+ DESCRIPTION "An entry in testTable2"
110
+ INDEX { testTable2Index }
111
+ ::= { testTable2 1 }
112
+
113
+ TestEntry2 ::= SEQUENCE {
114
+ testTable2Index DisplayString,
115
+ testTable2Value Integer32
116
+ }
117
+
118
+ testTable2Index OBJECT-TYPE
119
+ SYNTAX DisplayString
120
+ MAX-ACCESS not-accessible
121
+ STATUS current
122
+ DESCRIPTION "String index for testTable2"
123
+ ::= { testEntry2 1 }
124
+
125
+ testTable2Value OBJECT-TYPE
126
+ SYNTAX Integer32
127
+ MAX-ACCESS read-write
128
+ STATUS current
129
+ DESCRIPTION "Value in testTable2"
130
+ ::= { testEntry2 2 }
131
+
132
+ testTableForeignKey OBJECT-TYPE
133
+ SYNTAX SEQUENCE OF TestEntryForeignKey
134
+ MAX-ACCESS not-accessible
135
+ STATUS current
136
+ DESCRIPTION "A table with a foreign key"
137
+ ::= { testMIB 12 }
138
+
139
+ testEntryForeignKey OBJECT-TYPE
140
+ SYNTAX TestEntryForeignKey
141
+ MAX-ACCESS not-accessible
142
+ STATUS current
143
+ DESCRIPTION "An entry with a foreign key"
144
+ INDEX { testTable1Index }
145
+ ::= { testTableForeignKey 1 }
146
+
147
+ TestEntryForeignKey ::= SEQUENCE {
148
+ testForeignKeyValue DisplayString
149
+ }
150
+
151
+ testForeignKeyValue OBJECT-TYPE
152
+ SYNTAX DisplayString
153
+ MAX-ACCESS read-write
154
+ STATUS current
155
+ DESCRIPTION "Foreign key value"
156
+ ::= { testEntryForeignKey 2 }
157
+
158
+ testTableComposite OBJECT-TYPE
159
+ SYNTAX SEQUENCE OF TestEntryComposite
160
+ MAX-ACCESS not-accessible
161
+ STATUS current
162
+ DESCRIPTION "A table with a composite key"
163
+ ::= { testMIB 13 }
164
+
165
+ testEntryComposite OBJECT-TYPE
166
+ SYNTAX TestEntryComposite
167
+ MAX-ACCESS not-accessible
168
+ STATUS current
169
+ DESCRIPTION "An entry in the composite key table"
170
+ INDEX { testTable1Index, testTable2Index }
171
+ ::= { testTableComposite 1 }
172
+
173
+ TestEntryComposite ::= SEQUENCE {
174
+ testCompositeValue Integer32
175
+ }
176
+
177
+ testCompositeValue OBJECT-TYPE
178
+ SYNTAX Integer32
179
+ MAX-ACCESS read-write
180
+ STATUS current
181
+ DESCRIPTION "Composite key value"
182
+ ::= { testEntryComposite 2 }
183
+
184
+ testTableAugment OBJECT-TYPE
185
+ SYNTAX SEQUENCE OF TestEntryAugment
186
+ MAX-ACCESS not-accessible
187
+ STATUS current
188
+ DESCRIPTION "A table that augments testTable1"
189
+ ::= { testMIB 14 }
190
+
191
+ testEntryAugment OBJECT-TYPE
192
+ SYNTAX TestEntryAugment
193
+ MAX-ACCESS not-accessible
194
+ STATUS current
195
+ DESCRIPTION "An augmented entry"
196
+ AUGMENTS { testEntry1 }
197
+ ::= { testTableAugment 1 }
198
+
199
+ TestEntryAugment ::= SEQUENCE {
200
+ testAugmentValue TimeTicks
201
+ }
202
+
203
+ testAugmentValue OBJECT-TYPE
204
+ SYNTAX TimeTicks
205
+ MAX-ACCESS read-write
206
+ STATUS current
207
+ DESCRIPTION "Augmented value"
208
+ ::= { testEntryAugment 2 }
209
+
210
+ END