/// <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(nameof(enterprise)); } if (agent == null) { throw new ArgumentNullException(nameof(agent)); } if (generic == null) { throw new ArgumentNullException(nameof(generic)); } if (specific == null) { throw new ArgumentNullException(nameof(specific)); } if (timestamp == null) { throw new ArgumentNullException(nameof(timestamp)); } if (variables == null) { throw new ArgumentNullException(nameof(variables)); } Enterprise = enterprise; AgentAddress = agent; _generic = generic; _specific = specific; TimeStamp = timestamp; _varbindSection = Variable.Transform(variables); Variables = variables; }
/// <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())); }
public TrapV1Pdu(uint[] enterprise, IP agent, Integer32 generic, Integer32 specific, TimeTicks timestamp, IList <Variable> variables) : this(new ObjectIdentifier(enterprise), agent, generic, specific, timestamp, variables) { }