예제 #1
0
        public TrapV1Message(VersionCode version, IPAddress agent, OctetString community, ObjectIdentifier enterprise, GenericCode generic, int specific, uint time, IList <Variable> variables)
        {
            if (variables == null)
            {
                throw new ArgumentNullException(nameof(variables));
            }

            if (version != VersionCode.V1)
            {
                throw new ArgumentException($"TRAP v1 is not supported in this SNMP version: {version}", nameof(version));
            }

            Version      = version;
            AgentAddress = agent ?? throw new ArgumentNullException(nameof(agent));
            Community    = community ?? throw new ArgumentNullException(nameof(community));
            Enterprise   = enterprise ?? throw new ArgumentNullException(nameof(enterprise));
            Generic      = generic;
            Specific     = specific;
            TimeStamp    = time;
            var pdu = new TrapV1Pdu(
                Enterprise,
                new IP(AgentAddress.GetAddressBytes()),
                new Integer32((int)Generic),
                new Integer32(Specific),
                new TimeTicks(TimeStamp),
                variables);

            _pdu       = pdu;
            Parameters = SecurityParameters.Create(Community);
        }
예제 #2
0
 protected bool Equals(RankingInfo other)
 {
     return(AvatarAddress.Equals(other.AvatarAddress) && AgentAddress.Equals(other.AgentAddress) &&
            ArmorId == other.ArmorId && Level == other.Level && AvatarName == other.AvatarName &&
            Exp == other.Exp && StageClearedBlockIndex == other.StageClearedBlockIndex &&
            UpdatedAt.Equals(other.UpdatedAt));
 }
예제 #3
0
 public string ToString(IObjectRegistry objects)
 {
     return(string.Format(
                CultureInfo.InvariantCulture,
                "SNMPv1 trap from {0} :  {1}",
                AgentAddress != null?AgentAddress.ToString():" ? ",
                ((TrapV1Pdu)_pdu).ToString(objects)));
 }
예제 #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = AvatarAddress.GetHashCode();
         hashCode = (hashCode * 397) ^ AgentAddress.GetHashCode();
         hashCode = (hashCode * 397) ^ ArmorId;
         hashCode = (hashCode * 397) ^ Level;
         hashCode = (hashCode * 397) ^ (AvatarName != null ? AvatarName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Exp.GetHashCode();
         hashCode = (hashCode * 397) ^ StageClearedBlockIndex.GetHashCode();
         hashCode = (hashCode * 397) ^ UpdatedAt.GetHashCode();
         return(hashCode);
     }
 }