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.
Inheritance: AsnType, ICloneable
コード例 #1
0
ファイル: TrapPdu.cs プロジェクト: mspratap6/SnmpSharpNet
        /// <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
ファイル: TrapPdu.cs プロジェクト: wowthur/SnmpSharpNet
        /// <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
ファイル: TrapPdu.cs プロジェクト: griffina/SnmpSharpNet
        /// <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
ファイル: TrapPdu.cs プロジェクト: mspratap6/SnmpSharpNet
        /// <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
ファイル: TrapPdu.cs プロジェクト: wowthur/SnmpSharpNet
        /// <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
ファイル: TrapPdu.cs プロジェクト: griffina/SnmpSharpNet
        /// <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();
 }