SNMP version 1 TRAP Protocol Data Unit
Trap PDU for SNMP version 1 is a PDU with a unique layout requiring a dedicated class. SNMP versions 2 and 3 use standard PDU type for V2TRAP notifications.
Наследование: AsnType, ICloneable
Пример #1
0
        /// <summary> Constructs a new trap pdu that is identical to the
        /// passed pdu.
        /// </summary>
        /// <param name="second">The object to copy.
        /// </param>
        public TrapPdu(TrapPdu second)
            : this()
        {
            _enterprise.Set(second._enterprise);
            _agentAddr.Set(second._agentAddr);
            _generic.Value   = second.Generic;
            _specific.Value  = second.Specific;
            _timeStamp.Value = second.TimeStamp;

            for (int x = 0; x < second.VbList.Count; x++)
            {
                VbList = (VbCollection)second.VbList.Clone();
            }
        }
Пример #2
0
        /// <summary>Constructs a new trap pdu that is identical to the passed pdu.</summary>
        /// <param name="second">The object to copy.
        /// </param>
        public TrapPdu(TrapPdu second)
            : this()
        {
            enterprise.Set(second.enterprise);
            agentAddr.Set(second.agentAddr);
            generic.Value   = second.Generic;
            specific.Value  = second.Specific;
            timeStamp.Value = second.TimeStamp;

            for (int x = 0; x < second.variables.Count; x++)
            {
                variables = (VbCollection)second.VbList.Clone();
            }
        }
Пример #3
0
        /// <summary> Constructs a new trap pdu that is identical to the
        /// passed pdu.
        /// </summary>
        /// <param name="second">The object to copy.
        /// </param>
        public TrapPdu(TrapPdu second)
            : this()
        {
            _enterprise.Set(second._enterprise);
            _agentAddr.Set(second._agentAddr);
            _generic.Value = second.Generic;
            _specific.Value = second.Specific;
            _timeStamp.Value = second.TimeStamp;

            for (int x = 0; x < second._variables.Count; x++)
            {
                _variables = (VbCollection)second.VbList.Clone();
            }
        }
Пример #4
0
        /// <summary>
        /// Initialize the class with values from another <see cref="TrapPdu"/> class.
        /// </summary>
        /// <param name="second">TrapPdu class whose values are used to initialize this class.</param>
        public void Set(TrapPdu second)
        {
            if (second != null)
            {
                _enterprise.Set(second._enterprise);
                _agentAddr.Set(second._agentAddr);
                _generic.Value   = second.Generic;
                _specific.Value  = second.Specific;
                _timeStamp.Value = second.TimeStamp;

                VbList.Clear();

                for (int x = 0; x < second.VbList.Count; x++)
                {
                    VbList = (VbCollection)second.VbList.Clone();
                }
            }
            else
            {
                throw new ArgumentException("Invalid argument type.", "value");
            }
        }
Пример #5
0
        /// <summary>Initialize the class with values from another <see cref="TrapPdu"/> class.</summary>
        /// <param name="second">TrapPdu class whose values are used to initialize this class.</param>
        public void Set(TrapPdu second)
        {
            if (second != null)
            {
                enterprise.Set(second.enterprise);
                agentAddr.Set(second.agentAddr);
                generic.Value   = second.Generic;
                specific.Value  = second.Specific;
                timeStamp.Value = second.TimeStamp;

                variables.Clear();

                for (int x = 0; x < second.variables.Count; x++)
                {
                    variables = (VbCollection)second.VbList.Clone();
                }
            }
            else
            {
                throw new ArgumentException("Invalid argument type.", nameof(second));
            }
        }
Пример #6
0
 /// <summary>
 /// Standard constructor.
 /// </summary>
 public SnmpV1TrapPacket()
     : base(ESnmpVersion.Ver1)
 {
     snmpCommunity = new OctetString();
     pdu           = new TrapPdu();
 }
Пример #7
0
        /// <summary>
        /// Initialize the class with values from another <see cref="TrapPdu"/> class.
        /// </summary>
        /// <param name="second">TrapPdu class whose values are used to initialize this class.</param>
        public void Set(TrapPdu second)
        {
            if (second != null)
            {
                _enterprise.Set(second._enterprise);
                _agentAddr.Set(second._agentAddr);
                _generic.Value = second.Generic;
                _specific.Value = second.Specific;
                _timeStamp.Value = second.TimeStamp;

                _variables.Clear();

                for (int x = 0; x < second._variables.Count; x++)
                {
                    _variables = (VbCollection)second.VbList.Clone();
                }
            }
            else
                throw new ArgumentException("Invalid argument type.", "value");
        }
Пример #8
0
 /// <summary>
 /// Standard constructor.
 /// </summary>
 public SnmpV1TrapPacket()
     : base(SnmpVersion.Ver1)
 {
     _snmpCommunity = new OctetString();
     _pdu = new TrapPdu();
 }