summaryrefslogtreecommitdiff
path: root/contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/ObjectIdentifier.cs
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/ObjectIdentifier.cs')
-rw-r--r--contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/ObjectIdentifier.cs54
1 files changed, 54 insertions, 0 deletions
diff --git a/contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/ObjectIdentifier.cs b/contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/ObjectIdentifier.cs
new file mode 100644
index 00000000000..04248043926
--- /dev/null
+++ b/contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/ObjectIdentifier.cs
@@ -0,0 +1,54 @@
+using System.Collections.Generic;
+using System.Text;
+
+namespace Lextm.SharpSnmpLib.Mib
+{
+ public class ObjectIdentifier: List<KeyValuePair<string, uint>>
+ {
+ public void Add(string name, uint oid)
+ {
+ this.Add(new KeyValuePair<string, uint>(name, oid));
+ }
+
+ public void Prepend(string name, uint oid)
+ {
+ this.Insert(0, new KeyValuePair<string, uint>(name, oid));
+ }
+
+ public void Insert(int index, string name, uint oid)
+ {
+ this.Insert(index, new KeyValuePair<string, uint>(name, oid));
+ }
+
+ public string GetOidString()
+ {
+ StringBuilder result = new StringBuilder();
+
+ foreach (KeyValuePair<string, uint> level in this)
+ {
+ result.Append(level.Value);
+ result.Append('.');
+ }
+
+ if (result.Length > 0)
+ {
+ result.Length--;
+ }
+
+ return result.ToString();
+ }
+
+ public uint[] GetOidValues()
+ {
+ List<uint> result = new List<uint>();
+
+ foreach (KeyValuePair<string, uint> level in this)
+ {
+ result.Add(level.Value);
+ }
+
+ return result.ToArray();
+ }
+
+ }
+}