/// <summary> /// Match a header against an acl line. /// </summary> /// <param name="hdr">The header.</param> /// <returns>Whether matched.</returns> public Zen <bool> Matches(Zen <IpHeader> hdr) { Zen <bool> dstMatch = this.DstIp != null?this.DstIp.Match(hdr.GetDstIp()) : true; Zen <bool> srcMatch = this.SrcIp != null?this.SrcIp.Match(hdr.GetSrcIp()) : true; Zen <bool> dstPortLowMatch = this.DstPortLow.HasValue ? hdr.GetDstPort() >= this.DstPortLow.Value : true; Zen <bool> dstPortHighMatch = this.DstPortHigh.HasValue ? hdr.GetDstPort() <= this.DstPortHigh.Value : true; Zen <bool> srcPortLowMatch = this.SrcPortLow.HasValue ? hdr.GetSrcPort() >= this.SrcPortLow.Value : true; Zen <bool> srcPortHighMatch = this.SrcPortHigh.HasValue ? hdr.GetSrcPort() <= this.SrcPortHigh.Value : true; Zen <bool> protoLowMatch = this.ProtocolLow.HasValue ? hdr.GetProtocol() >= this.ProtocolLow.Value : true; Zen <bool> protoHighMatch = this.ProtocolHigh.HasValue ? hdr.GetProtocol() <= this.ProtocolHigh.Value : true; return(And( dstMatch, srcMatch, dstPortHighMatch, dstPortLowMatch, srcPortHighMatch, srcPortLowMatch, protoHighMatch, protoLowMatch)); }