Esempio n. 1
0
            public ICmp BuildICmp(Value left, Value right, IcmpType icmpType, AST.Node contextNode, string name = null)
            {
                var result = new ICmp(left, right, icmpType, name);

                result.isConst = left.isConst && right.isConst;
                AddOp(result, name, contextNode: contextNode);
                return(result);
            }
Esempio n. 2
0
		/// <summary>
		/// Initializes a new instance of the IcmpPacket class using the specified
		/// values.
		/// </summary>
		/// <param name="type">The ICMP type of the packet.</param>
		/// <param name="code">The subtype to the type of the packet.</param>
		/// <param name="data">The data to transfer as part of the ICMP
		/// packet.</param>
		/// <exception cref="ArgumentNullException">Thrown if the data parameter
		/// is null.</exception>
		public IcmpPacket(IcmpType type, IcmpCode code, byte[] data) {
			data.ThrowIfNull("data");
			Type = type;
			Code = code;
			// Many ICMP packets include the IP header and the first 8 bytes of
			// an IP packet as data.
			Data = data;
			Checksum = ComputeChecksum(this);
		}
Esempio n. 3
0
 /// <summary>
 /// Private constructor used for deserialization.
 /// </summary>
 private IcmpPacket(IcmpType type, IcmpCode code, ushort checksum,
                    byte[] data)
 {
     data.ThrowIfNull("data");
     Type     = type;
     Code     = code;
     Checksum = checksum;
     Data     = data;
 }
        public override string ToCheckPointPortInfo()
        {
            if (IcmpCode != 0)
            {
                return(ToString());
            }

            return(Name().ToUpper() + "_" + IcmpType.ToString() + "_" + IcmpCode.ToString());
        }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the IcmpPacket class using the specified
 /// values.
 /// </summary>
 /// <param name="type">The ICMP type of the packet.</param>
 /// <param name="code">The subtype to the type of the packet.</param>
 /// <param name="data">The data to transfer as part of the ICMP
 /// packet.</param>
 /// <exception cref="ArgumentNullException">Thrown if the data parameter
 /// is null.</exception>
 public IcmpPacket(IcmpType type, IcmpCode code, byte[] data)
 {
     data.ThrowIfNull("data");
     Type = type;
     Code = code;
     // Many ICMP packets include the IP header and the first 8 bytes of
     // an IP packet as data.
     Data     = data;
     Checksum = ComputeChecksum(this);
 }
        public IcmpAction(string host, IcmpType icmpType, int nbrEcho, int weightPacket, int updatePeriod, int timeout, int maxTTL)
        {
            if (weightPacket < 1)
            {
                WeightPacket = 1;
            }

            Host         = host;
            IcmpType     = icmpType;
            NbrEcho      = nbrEcho;
            UpdatePeriod = updatePeriod;
            Timeout      = timeout;
            MaxTTL       = maxTTL;
        }
Esempio n. 7
0
        private IIcmpActionHandler GetIcmpActionHandler(IcmpType icmpType)
        {
            switch (icmpType)
            {
            case IcmpType.traceRoute:
                return(new TraceRouteHandler());

            case IcmpType.ping:
                return(new PingHandler());

            default:
                return(new PingHandler());
            }
        }
Esempio n. 8
0
		/// <summary>
		/// Private constructor used for deserialization.
		/// </summary>
		private IcmpPacket(IcmpType type, IcmpCode code, ushort checksum,
			byte[] data) {
				data.ThrowIfNull("data");
				Type = type;
				Code = code;
				Checksum = checksum;
				Data = data;
		}
Esempio n. 9
0
 public ICmp(Value left, Value right, IcmpType icmpType, string name)
     : base(Op.ICmp, Const.bool_t, left, right)
 {
     this.name     = name;
     this.icmpType = icmpType;
 }
 /// <summary>
 /// Creates an ICMP packet of the specified type.
 /// </summary>
 /// <param name="type">The packet type.</param>
 protected ProtoPacketIcmp(IcmpType type)
     : base(ProtoPacketIp.Protocols.Icmp)
 {
     this.Type = (byte)type;
 }
Esempio n. 11
0
        private IEnumerable <IcmpResult> HandleIcmpAction(string host, IcmpType icmpType, int nbrEcho, int weightPacket, int updatePeriod, int timeout, int maxTTL)
        {
            IcmpAction icmpAction = new IcmpAction(host, icmpType, nbrEcho, weightPacket, updatePeriod, timeout, maxTTL);

            return(GetIcmpActionHandler(icmpType).Handle(icmpAction));
        }
Esempio n. 12
0
 public override string ToString()
 {
     return(Name() + "_T" + IcmpType.ToString() + "_C" + IcmpCode.ToString());
 }