Exemplo n.º 1
0
        private void buttonToNext_Click(object sender, EventArgs e)
        {
            StringBuilder tempIP  = new StringBuilder();
            StringBuilder tempOID = new StringBuilder();
            IntPtr        intPtr;

            tempIP.Append(textBoxForIP.Text);
            tempOID.Append(textBoxForOID.Text);
            SnmpValue snmpInquiry = new SnmpValue(textBoxForIP.Text, textBoxForOID.Text, textBoxForInput.Text, comboBoxForSnmpOperation.Text);

            intPtr = SnmpValue.snmpGetNextOid(tempIP, tempOID);
            string temp = Marshal.PtrToStringAnsi(intPtr);

            if (!temp.Contains("Invalid"))
            {
                textBoxForOID.Text     = temp;
                snmpInquiry.inquiryOID = temp;
                if (snmpInquiry.operation == "get")
                {
                    // textBoxResult.Text = snmpInquiry.snmpInquriy();
                    snmpsession = snmpInquiry.snmpInquriy_new();
                    foreach (SnmpSession s in snmpsession)
                    {
                        if (treeViewForResult != null)
                        {
                            TreeNode t = treeViewForResult.Nodes.Add(s.address);
                            t.Nodes.Add("version:" + s.version);
                            t.Nodes.Add("ip address :" + s.address);
                            t.Nodes.Add("oid :" + s.oid);
                            t.Nodes.Add("value :" + s.value);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void GetSnmpSession()
        {
            SnmpValue snmpInquiry = new SnmpValue(buff[0], buff[1], buff[2], buff[3]);

            snmpsession = snmpInquiry.snmpInquriy_new();
        }