示例#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 (variables == null)
            {
                throw new ArgumentNullException(nameof(variables));
            }

            Enterprise      = enterprise ?? throw new ArgumentNullException(nameof(enterprise));
            AgentAddress    = agent ?? throw new ArgumentNullException(nameof(agent));
            _generic        = generic ?? throw new ArgumentNullException(nameof(generic));
            _specific       = specific ?? throw new ArgumentNullException(nameof(specific));
            TimeStamp       = timestamp ?? throw new ArgumentNullException(nameof(timestamp));
            _varbindSection = Variable.Transform(variables);
            Variables       = variables;
        }
示例#2
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;
        }
示例#3
0
 /// <summary>
 /// Converts <see cref="IP" /> to <see cref="IPAddress" />.
 /// </summary>
 /// <param name="ip">The <see cref="IP" /> object.</param>
 /// <returns>The <see cref="IPAddress" /> object.</returns>
 public static IPAddress ToIPAddress(this IP ip)
 {
     return(new IPAddress(ip.GetRaw()));
 }
示例#4
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)
 {
 }