Dart.Snmp Namespace > Agent Class : Variables Field |
Public Variables As VariableList
Dim instance As Agent Dim value As VariableList value = instance.Variables instance.Variables = value
public VariableList Variables
public: VariableList* Variables
public: VariableList^ Variables
//Add an object value instance to an agent's variables collection in one of four ways: //1. By a common object already defined in the NodeName enumeration. private void button1_Click(object sender, EventArgs e) { agent1.Variables.Add(agent1.Mib.CreateVariable(NodeName.sysContact, "Systems Admin")); } //2. By string name. Can refer to default objects, or objects from MIBs loaded at // runtime with Agent.Mib.Parse() and Agent.Mib.GenerateNodes(). private void button2_Click(object sender, EventArgs e) { agent1.Variables.Add(new Variable(agent1.Mib["sysContact"], "Systems Admin")); } //3. By enumeration from generated and imported Mib code files. // See the included Mib Treeview sample for a demonstration of generating a Mib code file from MIBs. private void button3_Click(object sender, EventArgs e) { //This would normally be called when loading your application; //demonstrated here because it's required for the subsequent line. Mib.Import(agent1.Mib); agent1.Variables.Add(agent1.Mib.CreateVariable(Mib.NodeName.testString, "Test string value")); } //4. By IID. private void button4_Click(object sender, EventArgs e) { agent1.Variables.Add(new Variable("1.3.6.1.2.1.1.4.0", new Dart.Snmp.SimpleType.OctetString("Systems Admin"))); }
'Add an object value instance to an agent's variables collection in one of four ways: '1. By a common object already defined in the NodeName enumeration. Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) agent1.Variables.Add(agent1.Mib.CreateVariable(NodeName.sysContact, "Systems Admin")) End Sub '2. By string name. Can refer to default objects, or objects from MIBs loaded at ' runtime with Agent.Mib.Parse() and Agent.Mib.GenerateNodes(). Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs) agent1.Variables.Add(New Variable(agent1.Mib("sysContact"), "Systems Admin")) End Sub '3. By enumeration from generated and imported Mib code files. ' See the included Mib Treeview sample for a demonstration of generating a Mib code file from MIBs. Private Sub button3_Click(ByVal sender As Object, ByVal e As EventArgs) 'This would normally be called when loading your application; 'demonstrated here because it's required for the subsequent line. Mib.Import(agent1.Mib) agent1.Variables.Add(agent1.Mib.CreateVariable(Mib.NodeName.testString, "Test string value")) End Sub '4. By IID. Private Sub button4_Click(ByVal sender As Object, ByVal e As EventArgs) agent1.Variables.Add(New Variable("1.3.6.1.2.1.1.4.0", New Dart.Snmp.SimpleType.OctetString("Systems Admin"))) End Sub
When a SetMessage arrives, values are updated when SnmpBase.CreateResponse is used. When a GetMessage, GetNextMessage or GetBulkMessage arrives, SnmpBase.CreateResponse uses this list to initialize the ResponseMessage. If values contain OIDs that are in Mib, then MibNode.Access is checked for read-write access to this list, and the ResponseMessage is constructed accordingly.