[ONOS-5939] added traffic selector bitwise match on TCP/UDP/SCTP source/destination port

Change-Id: Ibf5947f7a6cac86fab77d15990116040fd8e5ef5
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java
index 88ab0e6..f38b442 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java
@@ -238,6 +238,17 @@
     }
 
     /**
+     * Creates a masked match on TCP source port field using the specified value and mask.
+     *
+     * @param tcpPort TCP source port
+     * @param mask TCP source port masking
+     * @return match criterion
+     */
+    public static Criterion matchTcpSrcMasked(TpPort tcpPort, TpPort mask) {
+        return new TcpPortCriterion(tcpPort, mask, Type.TCP_SRC_MASKED);
+    }
+
+    /**
      * Creates a match on TCP destination port field using the specified value.
      *
      * @param tcpPort TCP destination port
@@ -248,6 +259,17 @@
     }
 
     /**
+     * Creates a masked match on TCP destination port field using the specified value and mask.
+     *
+     * @param tcpPort TCP destination port
+     * @param mask TCP destination port masking
+     * @return match criterion
+     */
+    public static Criterion matchTcpDstMasked(TpPort tcpPort, TpPort mask) {
+        return new TcpPortCriterion(tcpPort, mask, Type.TCP_DST_MASKED);
+    }
+
+    /**
      * Creates a match on TCP flags using the specified value.
      *
      * @param flags TCP flags
@@ -268,6 +290,17 @@
     }
 
     /**
+     * Creates a masked match on UDP source port field using the specified value and mask.
+     *
+     * @param udpPort UDP source port
+     * @param mask UDP source port masking
+     * @return match criterion
+     */
+    public static Criterion matchUdpSrcMasked(TpPort udpPort, TpPort mask) {
+        return new UdpPortCriterion(udpPort, mask, Type.UDP_SRC_MASKED);
+    }
+
+    /**
      * Creates a match on UDP destination port field using the specified value.
      *
      * @param udpPort UDP destination port
@@ -278,6 +311,17 @@
     }
 
     /**
+     * Creates a masked match on UDP destination port field using the specified value and mask.
+     *
+     * @param udpPort UDP destination port
+     * @param mask UDP destination port masking
+     * @return match criterion
+     */
+    public static Criterion matchUdpDstMasked(TpPort udpPort, TpPort mask) {
+        return new UdpPortCriterion(udpPort, mask, Type.UDP_DST_MASKED);
+    }
+
+    /**
      * Creates a match on SCTP source port field using the specified value.
      *
      * @param sctpPort SCTP source port
@@ -288,6 +332,17 @@
     }
 
     /**
+     * Creates a masked match on SCTP source port field using the specified value and mask.
+     *
+     * @param sctpPort SCTP source port
+     * @param mask SCTP source port masking
+     * @return match criterion
+     */
+    public static Criterion matchSctpSrcMasked(TpPort sctpPort, TpPort mask) {
+        return new SctpPortCriterion(sctpPort, mask, Type.SCTP_SRC_MASKED);
+    }
+
+    /**
      * Creates a match on SCTP destination port field using the specified
      * value.
      *
@@ -299,6 +354,17 @@
     }
 
     /**
+     * Creates a masked match on SCTP destination port field using the specified value and mask.
+     *
+     * @param sctpPort SCTP destination port
+     * @param mask SCTP destination port masking
+     * @return match criterion
+     */
+    public static Criterion matchSctpDstMasked(TpPort sctpPort, TpPort mask) {
+        return new SctpPortCriterion(sctpPort, mask, Type.SCTP_DST_MASKED);
+    }
+
+    /**
      * Creates a match on ICMP type field using the specified value.
      *
      * @param icmpType ICMP type (8 bits unsigned integer)