Exemple #1
0
        /// <summary>
        /// Creates a <see cref="TrapV1Pdu"/> instance with PDU elements.
        /// </summary>
        /// <param name="enterprise">Enterprise</param>
        /// <param name="agent">Agent address</param>
        /// <param name="generic">Generic trap type</param>
        /// <param name="specific">Specific trap type</param>
        /// <param name="timestamp">Time stamp</param>
        /// <param name="variables">Variable binds</param>
        public TrapV1Pdu(ObjectIdentifier enterprise, IP agent, Integer32 generic, Integer32 specific, TimeTicks timestamp, IList <Variable> variables)
        {
            if (enterprise == null)
            {
                throw new ArgumentNullException("enterprise");
            }

            if (agent == null)
            {
                throw new ArgumentNullException("agent");
            }

            if (generic == null)
            {
                throw new ArgumentNullException("generic");
            }

            if (specific == null)
            {
                throw new ArgumentNullException("specific");
            }

            if (timestamp == null)
            {
                throw new ArgumentNullException("timestamp");
            }

            if (variables == null)
            {
                throw new ArgumentNullException("variables");
            }

            Enterprise      = enterprise;
            AgentAddress    = agent;
            _generic        = generic;
            _specific       = specific;
            TimeStamp       = timestamp;
            _varbindSection = Variable.Transform(variables);
            Variables       = variables;
        }
Exemple #2
0
        //-----------------------------------------------------------------------------------
        public static ISnmpData CreateSnmpDataFromStringUnsafe(SnmpType type, string strValeur)
        {
            ISnmpData data = null;

            switch (type)
            {
            case SnmpType.EndMarker:
                //Non geré
                break;

            case SnmpType.Integer32:
                data = new Integer32(Int32.Parse(strValeur));
                break;

            case SnmpType.OctetString:
                data = new OctetString(strValeur);
                break;

            case SnmpType.Null:
                data = new Null();
                break;

            case SnmpType.ObjectIdentifier:
                data = new ObjectIdentifier(strValeur);
                break;

            case SnmpType.Sequence:
                //Non geré
                break;

            case SnmpType.IPAddress:
                data = new IP(IPAddress.Parse(strValeur));
                break;

            case SnmpType.Counter32:
                data = new Counter32(uint.Parse(strValeur));
                break;

            case SnmpType.Gauge32:
                data = new Gauge32(uint.Parse(strValeur));
                break;

            case SnmpType.TimeTicks:
                data = new TimeTicks(uint.Parse(strValeur));
                break;

            case SnmpType.Opaque:
                //Non geré
                break;

            case SnmpType.NetAddress:
                //Non geré
                break;

            case SnmpType.Counter64:
                data = new Counter64(ulong.Parse(strValeur));
                break;

            case SnmpType.UInt32:
                //Non geré
                break;

            case SnmpType.NoSuchObject:
                //Non geré
                break;

            case SnmpType.NoSuchInstance:
                //Non geré
                break;

            case SnmpType.EndOfMibView:
                //Non geré
                break;

            case SnmpType.GetRequestPdu:
                //Non geré
                break;

            case SnmpType.GetNextRequestPdu:
                //Non geré
                break;

            case SnmpType.ResponsePdu:
                //Non geré
                break;

            case SnmpType.SetRequestPdu:
                //Non geré
                break;

            case SnmpType.TrapV1Pdu:
                //Non geré
                break;

            case SnmpType.GetBulkRequestPdu:
                //Non geré
                break;

            case SnmpType.InformRequestPdu:
                //Non geré
                break;

            case SnmpType.TrapV2Pdu:
                //Non geré
                break;

            case SnmpType.ReportPdu:
                //Non geré
                break;

            case SnmpType.Unknown:
                //Non geré
                break;

            default:
                break;
            }

            return(data);
        }
Exemple #3
0
 public TrapV1Pdu(uint[] enterprise, IP agent, Integer32 generic, Integer32 specific, TimeTicks timestamp, IList <Variable> variables)
     : this(new ObjectIdentifier(enterprise), agent, generic, specific, timestamp, variables)
 {
 }