Ejemplo n.º 1
0
 private void SetLextmError(SnmpException ex)
 {
     if (ex.Message.Contains("NoSuchName"))
     {
         GetLastError = string.Format("ERROR: <NoSuchName> {0}", ex.Message);
     }
     else
     {
         GetLastError = "ERROR: " + ex.Message;
     }
 }
Ejemplo n.º 2
0
        private static Oid[] ProcessSnmpv1EndOfMIB(SnmpVersion version,
                                                   Oid[] columnOids, Pdu request, SnmpException e)
        {
            int index = 0;

            if (version == SnmpVersion.SNMPv1 &&
                e.ErrorStatus == SnmpError.NoSuchName &&
                (index = e.ErrorIndex) > 0 &&
                index <= request.Count)
            {
                index--;
                for (int i = 0, j = 0; i < columnOids.Length; i++)
                {
                    if (columnOids[i] != null && j++ == index)
                    {
                        columnOids[i] = null;
                        break;
                    }
                }

                Vb[]  vbs  = request.Vbs;
                Oid[] oids = new Oid[vbs.Length - 1];
                for (int i = 0; i < index; i++)
                {
                    oids[i] = vbs[i].Oid;
                }
                for (int i = index; i < oids.Length; i++)
                {
                    oids[i] = vbs[i + 1].Oid;
                }
                return(oids);
            }
            else
            {
                return(null);
            }
        }