Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 1 | /* |
Ray Milkey | 34c9590 | 2015-04-15 09:47:53 -0700 | [diff] [blame] | 2 | * Copyright 2014-2015 Open Networking Laboratory |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 3 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 7 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 15 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.flow.criteria; |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 17 | |
alshabib | 99b8fdc | 2014-09-25 14:30:22 -0700 | [diff] [blame] | 18 | import static com.google.common.base.MoreObjects.toStringHelper; |
| 19 | |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 20 | import java.util.Objects; |
Michele Santuari | 4b6019e | 2014-12-19 11:31:45 +0100 | [diff] [blame] | 21 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 22 | import org.onosproject.net.PortNumber; |
| 23 | import org.onosproject.net.flow.criteria.Criterion.Type; |
Ayaka Koshibe | 1d56fe4 | 2014-09-19 16:51:58 -0700 | [diff] [blame] | 24 | import org.onlab.packet.IpPrefix; |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 25 | import org.onlab.packet.Ip6Address; |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 26 | import org.onlab.packet.MacAddress; |
Michele Santuari | 4b6019e | 2014-12-19 11:31:45 +0100 | [diff] [blame] | 27 | import org.onlab.packet.MplsLabel; |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 28 | import org.onlab.packet.VlanId; |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 29 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 30 | /** |
| 31 | * Factory class to create various traffic selection criteria. |
| 32 | */ |
| 33 | public final class Criteria { |
| 34 | |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 35 | //TODO: incomplete type implementation. Need to implement complete list from Criterion |
| 36 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 37 | // Ban construction |
| 38 | private Criteria() { |
| 39 | } |
| 40 | |
| 41 | /** |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 42 | * Creates a match on IN_PORT field using the specified value. |
| 43 | * |
| 44 | * @param port inport value |
| 45 | * @return match criterion |
| 46 | */ |
| 47 | public static Criterion matchInPort(PortNumber port) { |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 48 | return new PortCriterion(port, Type.IN_PORT); |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Creates a match on IN_PHY_PORT field using the specified value. |
| 53 | * |
| 54 | * @param port inport value |
| 55 | * @return match criterion |
| 56 | */ |
| 57 | public static Criterion matchInPhyPort(PortNumber port) { |
| 58 | return new PortCriterion(port, Type.IN_PHY_PORT); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Creates a match on METADATA field using the specified value. |
| 63 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 64 | * @param metadata metadata value (64 bits data) |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 65 | * @return match criterion |
| 66 | */ |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 67 | public static Criterion matchMetadata(long metadata) { |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 68 | return new MetadataCriterion(metadata); |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | /** |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 72 | * Creates a match on ETH_DST field using the specified value. This value |
| 73 | * may be a wildcard mask. |
| 74 | * |
tom | c104d28 | 2014-09-19 10:57:55 -0700 | [diff] [blame] | 75 | * @param mac MAC address value or wildcard mask |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 76 | * @return match criterion |
| 77 | */ |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 78 | public static Criterion matchEthDst(MacAddress mac) { |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 79 | return new EthCriterion(mac, Type.ETH_DST); |
| 80 | } |
| 81 | |
| 82 | /** |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 83 | * Creates a match on ETH_SRC field using the specified value. This value |
| 84 | * may be a wildcard mask. |
| 85 | * |
| 86 | * @param mac MAC address value or wildcard mask |
| 87 | * @return match criterion |
| 88 | */ |
| 89 | public static Criterion matchEthSrc(MacAddress mac) { |
| 90 | return new EthCriterion(mac, Type.ETH_SRC); |
| 91 | } |
| 92 | |
| 93 | /** |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 94 | * Creates a match on ETH_TYPE field using the specified value. |
| 95 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 96 | * @param ethType eth type value (16 bits unsigned integer) |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 97 | * @return match criterion |
| 98 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 99 | public static Criterion matchEthType(int ethType) { |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 100 | return new EthTypeCriterion(ethType); |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Creates a match on VLAN ID field using the specified value. |
| 105 | * |
| 106 | * @param vlanId vlan id value |
| 107 | * @return match criterion |
| 108 | */ |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 109 | public static Criterion matchVlanId(VlanId vlanId) { |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 110 | return new VlanIdCriterion(vlanId); |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * Creates a match on VLAN PCP field using the specified value. |
| 115 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 116 | * @param vlanPcp vlan pcp value (3 bits) |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 117 | * @return match criterion |
| 118 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 119 | public static Criterion matchVlanPcp(byte vlanPcp) { |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 120 | return new VlanPcpCriterion(vlanPcp); |
| 121 | } |
| 122 | |
| 123 | /** |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 124 | * Creates a match on IP DSCP field using the specified value. |
| 125 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 126 | * @param ipDscp ip dscp value (6 bits) |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 127 | * @return match criterion |
| 128 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 129 | public static Criterion matchIPDscp(byte ipDscp) { |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 130 | return new IPDscpCriterion(ipDscp); |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * Creates a match on IP ECN field using the specified value. |
| 135 | * |
Pavlin Radoslavov | ab8553a | 2015-02-20 14:13:50 -0800 | [diff] [blame] | 136 | * @param ipEcn ip ecn value (2 bits) |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 137 | * @return match criterion |
| 138 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 139 | public static Criterion matchIPEcn(byte ipEcn) { |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 140 | return new IPEcnCriterion(ipEcn); |
| 141 | } |
| 142 | |
| 143 | /** |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 144 | * Creates a match on IP proto field using the specified value. |
| 145 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 146 | * @param proto ip protocol value (8 bits unsigned integer) |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 147 | * @return match criterion |
| 148 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 149 | public static Criterion matchIPProtocol(short proto) { |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 150 | return new IPProtocolCriterion(proto); |
| 151 | } |
| 152 | |
| 153 | /** |
Charles M.C. Chan | 52fae7d | 2015-01-17 00:35:53 +0800 | [diff] [blame] | 154 | * Creates a match on IPv4 source field using the specified value. |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 155 | * |
Charles M.C. Chan | 52fae7d | 2015-01-17 00:35:53 +0800 | [diff] [blame] | 156 | * @param ip ipv4 source value |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 157 | * @return match criterion |
| 158 | */ |
Ayaka Koshibe | 1d56fe4 | 2014-09-19 16:51:58 -0700 | [diff] [blame] | 159 | public static Criterion matchIPSrc(IpPrefix ip) { |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 160 | return new IPCriterion(ip, Type.IPV4_SRC); |
| 161 | } |
| 162 | |
| 163 | /** |
Charles M.C. Chan | 52fae7d | 2015-01-17 00:35:53 +0800 | [diff] [blame] | 164 | * Creates a match on IPv4 destination field using the specified value. |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 165 | * |
Charles M.C. Chan | 52fae7d | 2015-01-17 00:35:53 +0800 | [diff] [blame] | 166 | * @param ip ipv4 source value |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 167 | * @return match criterion |
| 168 | */ |
Ayaka Koshibe | 1d56fe4 | 2014-09-19 16:51:58 -0700 | [diff] [blame] | 169 | public static Criterion matchIPDst(IpPrefix ip) { |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 170 | return new IPCriterion(ip, Type.IPV4_DST); |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 171 | } |
| 172 | |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 173 | /** |
| 174 | * Creates a match on TCP source port field using the specified value. |
| 175 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 176 | * @param tcpPort TCP source port (16 bits unsigned integer) |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 177 | * @return match criterion |
| 178 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 179 | public static Criterion matchTcpSrc(int tcpPort) { |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 180 | return new TcpPortCriterion(tcpPort, Type.TCP_SRC); |
| 181 | } |
| 182 | |
| 183 | /** |
| 184 | * Creates a match on TCP destination port field using the specified value. |
| 185 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 186 | * @param tcpPort TCP destination port (16 bits unsigned integer) |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 187 | * @return match criterion |
| 188 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 189 | public static Criterion matchTcpDst(int tcpPort) { |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 190 | return new TcpPortCriterion(tcpPort, Type.TCP_DST); |
| 191 | } |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 192 | |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 193 | /** |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 194 | * Creates a match on UDP source port field using the specified value. |
| 195 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 196 | * @param udpPort UDP source port (16 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 197 | * @return match criterion |
| 198 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 199 | public static Criterion matchUdpSrc(int udpPort) { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 200 | return new UdpPortCriterion(udpPort, Type.UDP_SRC); |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * Creates a match on UDP destination port field using the specified value. |
| 205 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 206 | * @param udpPort UDP destination port (16 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 207 | * @return match criterion |
| 208 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 209 | public static Criterion matchUdpDst(int udpPort) { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 210 | return new UdpPortCriterion(udpPort, Type.UDP_DST); |
| 211 | } |
| 212 | |
| 213 | /** |
| 214 | * Creates a match on SCTP source port field using the specified value. |
| 215 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 216 | * @param sctpPort SCTP source port (16 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 217 | * @return match criterion |
| 218 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 219 | public static Criterion matchSctpSrc(int sctpPort) { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 220 | return new SctpPortCriterion(sctpPort, Type.SCTP_SRC); |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * Creates a match on SCTP destination port field using the specified |
| 225 | * value. |
| 226 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 227 | * @param sctpPort SCTP destination port (16 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 228 | * @return match criterion |
| 229 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 230 | public static Criterion matchSctpDst(int sctpPort) { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 231 | return new SctpPortCriterion(sctpPort, Type.SCTP_DST); |
| 232 | } |
| 233 | |
| 234 | /** |
| 235 | * Creates a match on ICMP type field using the specified value. |
| 236 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 237 | * @param icmpType ICMP type (8 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 238 | * @return match criterion |
| 239 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 240 | public static Criterion matchIcmpType(short icmpType) { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 241 | return new IcmpTypeCriterion(icmpType); |
| 242 | } |
| 243 | |
| 244 | /** |
| 245 | * Creates a match on ICMP code field using the specified value. |
| 246 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 247 | * @param icmpCode ICMP code (8 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 248 | * @return match criterion |
| 249 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 250 | public static Criterion matchIcmpCode(short icmpCode) { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 251 | return new IcmpCodeCriterion(icmpCode); |
| 252 | } |
| 253 | |
| 254 | /** |
Charles M.C. Chan | 52fae7d | 2015-01-17 00:35:53 +0800 | [diff] [blame] | 255 | * Creates a match on IPv6 source field using the specified value. |
| 256 | * |
| 257 | * @param ip ipv6 source value |
| 258 | * @return match criterion |
| 259 | */ |
| 260 | public static Criterion matchIPv6Src(IpPrefix ip) { |
| 261 | return new IPCriterion(ip, Type.IPV6_SRC); |
| 262 | } |
| 263 | |
| 264 | /** |
| 265 | * Creates a match on IPv6 destination field using the specified value. |
| 266 | * |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 267 | * @param ip ipv6 destination value |
Charles M.C. Chan | 52fae7d | 2015-01-17 00:35:53 +0800 | [diff] [blame] | 268 | * @return match criterion |
| 269 | */ |
| 270 | public static Criterion matchIPv6Dst(IpPrefix ip) { |
| 271 | return new IPCriterion(ip, Type.IPV6_DST); |
| 272 | } |
| 273 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 274 | /** |
| 275 | * Creates a match on IPv6 flow label field using the specified value. |
| 276 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 277 | * @param flowLabel IPv6 flow label (20 bits) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 278 | * @return match criterion |
| 279 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 280 | public static Criterion matchIPv6FlowLabel(int flowLabel) { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 281 | return new IPv6FlowLabelCriterion(flowLabel); |
| 282 | } |
| 283 | |
| 284 | /** |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 285 | * Creates a match on ICMPv6 type field using the specified value. |
| 286 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 287 | * @param icmpv6Type ICMPv6 type (8 bits unsigned integer) |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 288 | * @return match criterion |
| 289 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 290 | public static Criterion matchIcmpv6Type(short icmpv6Type) { |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 291 | return new Icmpv6TypeCriterion(icmpv6Type); |
| 292 | } |
| 293 | |
| 294 | /** |
| 295 | * Creates a match on ICMPv6 code field using the specified value. |
| 296 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 297 | * @param icmpv6Code ICMPv6 code (8 bits unsigned integer) |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 298 | * @return match criterion |
| 299 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 300 | public static Criterion matchIcmpv6Code(short icmpv6Code) { |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 301 | return new Icmpv6CodeCriterion(icmpv6Code); |
| 302 | } |
| 303 | |
Charles M.C. Chan | 52fae7d | 2015-01-17 00:35:53 +0800 | [diff] [blame] | 304 | /** |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 305 | * Creates a match on IPv6 Neighbor Discovery target address using the |
| 306 | * specified value. |
| 307 | * |
| 308 | * @param targetAddress IPv6 Neighbor Discovery target address |
| 309 | * @return match criterion |
| 310 | */ |
| 311 | public static Criterion matchIPv6NDTargetAddress(Ip6Address targetAddress) { |
| 312 | return new IPv6NDTargetAddressCriterion(targetAddress); |
| 313 | } |
| 314 | |
| 315 | /** |
| 316 | * Creates a match on IPv6 Neighbor Discovery source link-layer address |
| 317 | * using the specified value. |
| 318 | * |
| 319 | * @param mac IPv6 Neighbor Discovery source link-layer address |
| 320 | * @return match criterion |
| 321 | */ |
| 322 | public static Criterion matchIPv6NDSourceLinkLayerAddress(MacAddress mac) { |
| 323 | return new IPv6NDLinkLayerAddressCriterion(mac, Type.IPV6_ND_SLL); |
| 324 | } |
| 325 | |
| 326 | /** |
| 327 | * Creates a match on IPv6 Neighbor Discovery target link-layer address |
| 328 | * using the specified value. |
| 329 | * |
| 330 | * @param mac IPv6 Neighbor Discovery target link-layer address |
| 331 | * @return match criterion |
| 332 | */ |
| 333 | public static Criterion matchIPv6NDTargetLinkLayerAddress(MacAddress mac) { |
| 334 | return new IPv6NDLinkLayerAddressCriterion(mac, Type.IPV6_ND_TLL); |
| 335 | } |
| 336 | |
| 337 | /** |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 338 | * Creates a match on MPLS label. |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 339 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 340 | * @param mplsLabel MPLS label (20 bits) |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 341 | * @return match criterion |
| 342 | */ |
Michele Santuari | 4b6019e | 2014-12-19 11:31:45 +0100 | [diff] [blame] | 343 | public static Criterion matchMplsLabel(MplsLabel mplsLabel) { |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 344 | return new MplsCriterion(mplsLabel); |
| 345 | } |
| 346 | |
| 347 | /** |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 348 | * Creates a match on IPv6 Extension Header pseudo-field fiags. |
| 349 | * Those are defined in Criterion.IPv6ExthdrFlags. |
| 350 | * |
| 351 | * @param exthdrFlags IPv6 Extension Header pseudo-field flags (16 bits) |
| 352 | * @return match criterion |
| 353 | */ |
| 354 | public static Criterion matchIPv6ExthdrFlags(int exthdrFlags) { |
| 355 | return new IPv6ExthdrFlagsCriterion(exthdrFlags); |
| 356 | } |
| 357 | |
| 358 | /** |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 359 | * Creates a match on lambda field using the specified value. |
| 360 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 361 | * @param lambda lambda to match on (16 bits unsigned integer) |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 362 | * @return match criterion |
| 363 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 364 | public static Criterion matchLambda(int lambda) { |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 365 | return new LambdaCriterion(lambda, Type.OCH_SIGID); |
| 366 | } |
| 367 | |
| 368 | /** |
Sho SHIMIZU | a66cb12 | 2014-12-02 18:11:15 -0800 | [diff] [blame] | 369 | * Creates a match on optical signal type using the specified value. |
Praseed Balakrishnan | 64369da | 2014-10-23 15:55:20 -0700 | [diff] [blame] | 370 | * |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 371 | * @param sigType optical signal type (8 bits unsigned integer) |
Praseed Balakrishnan | 64369da | 2014-10-23 15:55:20 -0700 | [diff] [blame] | 372 | * @return match criterion |
| 373 | */ |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 374 | public static Criterion matchOpticalSignalType(short sigType) { |
Praseed Balakrishnan | 2dd5abd | 2014-11-03 14:56:28 -0800 | [diff] [blame] | 375 | return new OpticalSignalTypeCriterion(sigType, Type.OCH_SIGTYPE); |
Praseed Balakrishnan | 64369da | 2014-10-23 15:55:20 -0700 | [diff] [blame] | 376 | } |
| 377 | |
alshabib | a3a476d | 2015-04-10 14:35:38 -0700 | [diff] [blame] | 378 | public static Criterion dummy() { |
| 379 | return new DummyCriterion(); |
| 380 | } |
| 381 | |
Praseed Balakrishnan | 64369da | 2014-10-23 15:55:20 -0700 | [diff] [blame] | 382 | /** |
Sho SHIMIZU | 06596e3 | 2014-12-02 18:07:50 -0800 | [diff] [blame] | 383 | * Implementation of input port criterion. |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 384 | */ |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 385 | public static final class PortCriterion implements Criterion { |
| 386 | private final PortNumber port; |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 387 | private final Type type; |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 388 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 389 | /** |
| 390 | * Constructor. |
| 391 | * |
| 392 | * @param port the input port number to match |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 393 | * @param type the match type. Should be either Type.IN_PORT or |
| 394 | * Type.IN_PHY_PORT |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 395 | */ |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 396 | public PortCriterion(PortNumber port, Type type) { |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 397 | this.port = port; |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 398 | this.type = type; |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 399 | } |
| 400 | |
| 401 | @Override |
| 402 | public Type type() { |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 403 | return this.type; |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 404 | } |
| 405 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 406 | /** |
| 407 | * Gets the input port number to match. |
| 408 | * |
| 409 | * @return the input port number to match |
| 410 | */ |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 411 | public PortNumber port() { |
| 412 | return this.port; |
| 413 | } |
alshabib | 99b8fdc | 2014-09-25 14:30:22 -0700 | [diff] [blame] | 414 | |
| 415 | @Override |
| 416 | public String toString() { |
| 417 | return toStringHelper(type().toString()) |
| 418 | .add("port", port).toString(); |
| 419 | } |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 420 | |
| 421 | @Override |
| 422 | public int hashCode() { |
Thomas Vachuska | 9b2da21 | 2014-11-10 19:30:25 -0800 | [diff] [blame] | 423 | return Objects.hash(type(), port); |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 424 | } |
| 425 | |
| 426 | @Override |
| 427 | public boolean equals(Object obj) { |
| 428 | if (this == obj) { |
| 429 | return true; |
| 430 | } |
| 431 | if (obj instanceof PortCriterion) { |
| 432 | PortCriterion that = (PortCriterion) obj; |
alshabib | 2020b89 | 2014-10-20 15:47:08 -0700 | [diff] [blame] | 433 | return Objects.equals(port, that.port) && |
| 434 | Objects.equals(this.type(), that.type()); |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 435 | } |
| 436 | return false; |
| 437 | } |
| 438 | } |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 439 | |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 440 | /** |
| 441 | * Implementation of Metadata criterion. |
| 442 | */ |
| 443 | public static final class MetadataCriterion implements Criterion { |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 444 | private final long metadata; |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 445 | |
| 446 | /** |
| 447 | * Constructor. |
| 448 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 449 | * @param metadata the metadata to match (64 bits data) |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 450 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 451 | public MetadataCriterion(long metadata) { |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 452 | this.metadata = metadata; |
| 453 | } |
| 454 | |
| 455 | @Override |
| 456 | public Type type() { |
| 457 | return Type.METADATA; |
| 458 | } |
| 459 | |
| 460 | /** |
| 461 | * Gets the metadata to match. |
| 462 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 463 | * @return the metadata to match (64 bits data) |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 464 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 465 | public long metadata() { |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 466 | return metadata; |
| 467 | } |
| 468 | |
| 469 | @Override |
| 470 | public String toString() { |
| 471 | return toStringHelper(type().toString()) |
| 472 | .add("metadata", Long.toHexString(metadata)) |
| 473 | .toString(); |
| 474 | } |
| 475 | |
| 476 | @Override |
| 477 | public int hashCode() { |
| 478 | return Objects.hash(type(), metadata); |
| 479 | } |
| 480 | |
| 481 | @Override |
| 482 | public boolean equals(Object obj) { |
| 483 | if (this == obj) { |
| 484 | return true; |
| 485 | } |
| 486 | if (obj instanceof MetadataCriterion) { |
| 487 | MetadataCriterion that = (MetadataCriterion) obj; |
| 488 | return Objects.equals(metadata, that.metadata) && |
| 489 | Objects.equals(this.type(), that.type()); |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 490 | } |
| 491 | return false; |
| 492 | } |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 493 | } |
| 494 | |
Sho SHIMIZU | 06596e3 | 2014-12-02 18:07:50 -0800 | [diff] [blame] | 495 | /** |
| 496 | * Implementation of MAC address criterion. |
| 497 | */ |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 498 | public static final class EthCriterion implements Criterion { |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 499 | private final MacAddress mac; |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 500 | private final Type type; |
| 501 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 502 | /** |
| 503 | * Constructor. |
| 504 | * |
| 505 | * @param mac the source or destination MAC address to match |
| 506 | * @param type the match type. Should be either Type.ETH_DST or |
| 507 | * Type.ETH_SRC |
| 508 | */ |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 509 | public EthCriterion(MacAddress mac, Type type) { |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 510 | this.mac = mac; |
| 511 | this.type = type; |
| 512 | } |
| 513 | |
| 514 | @Override |
| 515 | public Type type() { |
| 516 | return this.type; |
| 517 | } |
| 518 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 519 | /** |
| 520 | * Gets the MAC address to match. |
| 521 | * |
| 522 | * @return the MAC address to match |
| 523 | */ |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 524 | public MacAddress mac() { |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 525 | return this.mac; |
| 526 | } |
alshabib | 99b8fdc | 2014-09-25 14:30:22 -0700 | [diff] [blame] | 527 | |
| 528 | @Override |
| 529 | public String toString() { |
| 530 | return toStringHelper(type().toString()) |
| 531 | .add("mac", mac).toString(); |
| 532 | } |
| 533 | |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 534 | @Override |
| 535 | public int hashCode() { |
Thomas Vachuska | 9b2da21 | 2014-11-10 19:30:25 -0800 | [diff] [blame] | 536 | return Objects.hash(type, mac); |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 537 | } |
| 538 | |
| 539 | @Override |
| 540 | public boolean equals(Object obj) { |
| 541 | if (this == obj) { |
| 542 | return true; |
| 543 | } |
| 544 | if (obj instanceof EthCriterion) { |
| 545 | EthCriterion that = (EthCriterion) obj; |
| 546 | return Objects.equals(mac, that.mac) && |
| 547 | Objects.equals(type, that.type); |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 548 | } |
| 549 | return false; |
| 550 | } |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 551 | } |
| 552 | |
Sho SHIMIZU | 06596e3 | 2014-12-02 18:07:50 -0800 | [diff] [blame] | 553 | /** |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 554 | * Implementation of Ethernet type criterion (16 bits unsigned integer). |
Sho SHIMIZU | 06596e3 | 2014-12-02 18:07:50 -0800 | [diff] [blame] | 555 | */ |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 556 | public static final class EthTypeCriterion implements Criterion { |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 557 | private static final int MASK = 0xffff; |
| 558 | private final int ethType; // Ethernet type value: 16 bits |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 559 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 560 | /** |
| 561 | * Constructor. |
| 562 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 563 | * @param ethType the Ethernet frame type to match (16 bits unsigned |
| 564 | * integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 565 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 566 | public EthTypeCriterion(int ethType) { |
| 567 | this.ethType = ethType & MASK; |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 568 | } |
| 569 | |
| 570 | @Override |
| 571 | public Type type() { |
| 572 | return Type.ETH_TYPE; |
| 573 | } |
| 574 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 575 | /** |
| 576 | * Gets the Ethernet frame type to match. |
| 577 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 578 | * @return the Ethernet frame type to match (16 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 579 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 580 | public int ethType() { |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 581 | return ethType; |
| 582 | } |
| 583 | |
alshabib | 99b8fdc | 2014-09-25 14:30:22 -0700 | [diff] [blame] | 584 | @Override |
| 585 | public String toString() { |
| 586 | return toStringHelper(type().toString()) |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 587 | .add("ethType", Long.toHexString(ethType)) |
Charles M.C. Chan | 36eb6e1 | 2015-01-06 17:12:27 +0800 | [diff] [blame] | 588 | .toString(); |
alshabib | 99b8fdc | 2014-09-25 14:30:22 -0700 | [diff] [blame] | 589 | } |
| 590 | |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 591 | @Override |
| 592 | public int hashCode() { |
Thomas Vachuska | 9b2da21 | 2014-11-10 19:30:25 -0800 | [diff] [blame] | 593 | return Objects.hash(type(), ethType); |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 594 | } |
| 595 | |
| 596 | @Override |
| 597 | public boolean equals(Object obj) { |
| 598 | if (this == obj) { |
| 599 | return true; |
| 600 | } |
| 601 | if (obj instanceof EthTypeCriterion) { |
| 602 | EthTypeCriterion that = (EthTypeCriterion) obj; |
alshabib | 2020b89 | 2014-10-20 15:47:08 -0700 | [diff] [blame] | 603 | return Objects.equals(ethType, that.ethType) && |
| 604 | Objects.equals(this.type(), that.type()); |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 605 | } |
| 606 | return false; |
| 607 | } |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 608 | } |
| 609 | |
Sho SHIMIZU | 06596e3 | 2014-12-02 18:07:50 -0800 | [diff] [blame] | 610 | /** |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 611 | * Implementation of VLAN ID criterion. |
Sho SHIMIZU | 06596e3 | 2014-12-02 18:07:50 -0800 | [diff] [blame] | 612 | */ |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 613 | public static final class VlanIdCriterion implements Criterion { |
| 614 | private final VlanId vlanId; |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 615 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 616 | /** |
| 617 | * Constructor. |
| 618 | * |
| 619 | * @param vlanId the VLAN ID to match |
| 620 | */ |
| 621 | public VlanIdCriterion(VlanId vlanId) { |
| 622 | this.vlanId = vlanId; |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 623 | } |
| 624 | |
| 625 | @Override |
| 626 | public Type type() { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 627 | return Type.VLAN_VID; |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 628 | } |
| 629 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 630 | /** |
| 631 | * Gets the VLAN ID to match. |
| 632 | * |
| 633 | * @return the VLAN ID to match |
| 634 | */ |
| 635 | public VlanId vlanId() { |
| 636 | return vlanId; |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 637 | } |
| 638 | |
alshabib | 99b8fdc | 2014-09-25 14:30:22 -0700 | [diff] [blame] | 639 | @Override |
| 640 | public String toString() { |
| 641 | return toStringHelper(type().toString()) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 642 | .add("vlanId", vlanId).toString(); |
alshabib | 99b8fdc | 2014-09-25 14:30:22 -0700 | [diff] [blame] | 643 | } |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 644 | |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 645 | @Override |
| 646 | public int hashCode() { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 647 | return Objects.hash(type(), vlanId); |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 648 | } |
| 649 | |
| 650 | @Override |
| 651 | public boolean equals(Object obj) { |
| 652 | if (this == obj) { |
| 653 | return true; |
| 654 | } |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 655 | if (obj instanceof VlanIdCriterion) { |
| 656 | VlanIdCriterion that = (VlanIdCriterion) obj; |
| 657 | return Objects.equals(vlanId, that.vlanId) && |
| 658 | Objects.equals(this.type(), that.type()); |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 659 | } |
| 660 | return false; |
| 661 | } |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 662 | } |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 663 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 664 | /** |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 665 | * Implementation of VLAN priority criterion (3 bits). |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 666 | */ |
| 667 | public static final class VlanPcpCriterion implements Criterion { |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 668 | private static final byte MASK = 0x7; |
| 669 | private final byte vlanPcp; // VLAN pcp value: 3 bits |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 670 | |
| 671 | /** |
| 672 | * Constructor. |
| 673 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 674 | * @param vlanPcp the VLAN priority to match (3 bits) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 675 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 676 | public VlanPcpCriterion(byte vlanPcp) { |
| 677 | this.vlanPcp = (byte) (vlanPcp & MASK); |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 678 | } |
| 679 | |
| 680 | @Override |
| 681 | public Type type() { |
| 682 | return Type.VLAN_PCP; |
| 683 | } |
| 684 | |
| 685 | /** |
| 686 | * Gets the VLAN priority to match. |
| 687 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 688 | * @return the VLAN priority to match (3 bits) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 689 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 690 | public byte priority() { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 691 | return vlanPcp; |
| 692 | } |
| 693 | |
| 694 | @Override |
| 695 | public String toString() { |
| 696 | return toStringHelper(type().toString()) |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 697 | .add("priority", Long.toHexString(vlanPcp)).toString(); |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 698 | } |
| 699 | |
| 700 | @Override |
| 701 | public int hashCode() { |
| 702 | return Objects.hash(type(), vlanPcp); |
| 703 | } |
| 704 | |
| 705 | @Override |
| 706 | public boolean equals(Object obj) { |
| 707 | if (this == obj) { |
| 708 | return true; |
| 709 | } |
| 710 | if (obj instanceof VlanPcpCriterion) { |
| 711 | VlanPcpCriterion that = (VlanPcpCriterion) obj; |
| 712 | return Objects.equals(vlanPcp, that.vlanPcp) && |
| 713 | Objects.equals(this.type(), that.type()); |
| 714 | } |
| 715 | return false; |
| 716 | } |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 717 | } |
| 718 | |
Sho SHIMIZU | 06596e3 | 2014-12-02 18:07:50 -0800 | [diff] [blame] | 719 | /** |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 720 | * Implementation of IP DSCP (Differentiated Services Code Point) |
| 721 | * criterion (6 bits). |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 722 | */ |
| 723 | public static final class IPDscpCriterion implements Criterion { |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 724 | private static final byte MASK = 0x3f; |
| 725 | private final byte ipDscp; // IP DSCP value: 6 bits |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 726 | |
| 727 | /** |
| 728 | * Constructor. |
| 729 | * |
| 730 | * @param ipDscp the IP DSCP value to match |
| 731 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 732 | public IPDscpCriterion(byte ipDscp) { |
| 733 | this.ipDscp = (byte) (ipDscp & MASK); |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 734 | } |
| 735 | |
| 736 | @Override |
| 737 | public Type type() { |
| 738 | return Type.IP_DSCP; |
| 739 | } |
| 740 | |
| 741 | /** |
| 742 | * Gets the IP DSCP value to match. |
| 743 | * |
| 744 | * @return the IP DSCP value to match |
| 745 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 746 | public byte ipDscp() { |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 747 | return ipDscp; |
| 748 | } |
| 749 | |
| 750 | @Override |
| 751 | public String toString() { |
| 752 | return toStringHelper(type().toString()) |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 753 | .add("ipDscp", Long.toHexString(ipDscp)).toString(); |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 754 | } |
| 755 | |
| 756 | @Override |
| 757 | public int hashCode() { |
| 758 | return Objects.hash(type(), ipDscp); |
| 759 | } |
| 760 | |
| 761 | @Override |
| 762 | public boolean equals(Object obj) { |
| 763 | if (this == obj) { |
| 764 | return true; |
| 765 | } |
| 766 | if (obj instanceof IPDscpCriterion) { |
| 767 | IPDscpCriterion that = (IPDscpCriterion) obj; |
| 768 | return Objects.equals(ipDscp, that.ipDscp) && |
| 769 | Objects.equals(this.type(), that.type()); |
| 770 | } |
| 771 | return false; |
| 772 | } |
| 773 | } |
| 774 | |
| 775 | /** |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 776 | * Implementation of IP ECN (Explicit Congestion Notification) criterion |
Pavlin Radoslavov | ab8553a | 2015-02-20 14:13:50 -0800 | [diff] [blame] | 777 | * (2 bits). |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 778 | */ |
| 779 | public static final class IPEcnCriterion implements Criterion { |
Pavlin Radoslavov | ab8553a | 2015-02-20 14:13:50 -0800 | [diff] [blame] | 780 | private static final byte MASK = 0x3; |
| 781 | private final byte ipEcn; // IP ECN value: 2 bits |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 782 | |
| 783 | /** |
| 784 | * Constructor. |
| 785 | * |
Pavlin Radoslavov | ab8553a | 2015-02-20 14:13:50 -0800 | [diff] [blame] | 786 | * @param ipEcn the IP ECN value to match (2 bits) |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 787 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 788 | public IPEcnCriterion(byte ipEcn) { |
| 789 | this.ipEcn = (byte) (ipEcn & MASK); |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 790 | } |
| 791 | |
| 792 | @Override |
| 793 | public Type type() { |
| 794 | return Type.IP_ECN; |
| 795 | } |
| 796 | |
| 797 | /** |
| 798 | * Gets the IP ECN value to match. |
| 799 | * |
Pavlin Radoslavov | ab8553a | 2015-02-20 14:13:50 -0800 | [diff] [blame] | 800 | * @return the IP ECN value to match (2 bits) |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 801 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 802 | public byte ipEcn() { |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 803 | return ipEcn; |
| 804 | } |
| 805 | |
| 806 | @Override |
| 807 | public String toString() { |
| 808 | return toStringHelper(type().toString()) |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 809 | .add("ipEcn", Long.toHexString(ipEcn)).toString(); |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 810 | } |
| 811 | |
| 812 | @Override |
| 813 | public int hashCode() { |
| 814 | return Objects.hash(type(), ipEcn); |
| 815 | } |
| 816 | |
| 817 | @Override |
| 818 | public boolean equals(Object obj) { |
| 819 | if (this == obj) { |
| 820 | return true; |
| 821 | } |
| 822 | if (obj instanceof IPEcnCriterion) { |
| 823 | IPEcnCriterion that = (IPEcnCriterion) obj; |
| 824 | return Objects.equals(ipEcn, that.ipEcn) && |
| 825 | Objects.equals(this.type(), that.type()); |
| 826 | } |
| 827 | return false; |
| 828 | } |
| 829 | } |
| 830 | |
| 831 | /** |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 832 | * Implementation of Internet Protocol Number criterion (8 bits unsigned) |
| 833 | * integer. |
Sho SHIMIZU | 06596e3 | 2014-12-02 18:07:50 -0800 | [diff] [blame] | 834 | */ |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 835 | public static final class IPProtocolCriterion implements Criterion { |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 836 | private static final short MASK = 0xff; |
| 837 | private final short proto; // IP protocol number: 8 bits |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 838 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 839 | /** |
| 840 | * Constructor. |
| 841 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 842 | * @param protocol the IP protocol (e.g., TCP=6, UDP=17) to match |
| 843 | * (8 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 844 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 845 | public IPProtocolCriterion(short protocol) { |
| 846 | this.proto = (short) (protocol & MASK); |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 847 | } |
| 848 | |
| 849 | @Override |
| 850 | public Type type() { |
| 851 | return Type.IP_PROTO; |
| 852 | } |
| 853 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 854 | /** |
| 855 | * Gets the IP protocol to match. |
| 856 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 857 | * @return the IP protocol to match (8 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 858 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 859 | public short protocol() { |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 860 | return proto; |
| 861 | } |
| 862 | |
alshabib | 99b8fdc | 2014-09-25 14:30:22 -0700 | [diff] [blame] | 863 | @Override |
| 864 | public String toString() { |
| 865 | return toStringHelper(type().toString()) |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 866 | .add("protocol", proto).toString(); |
alshabib | 99b8fdc | 2014-09-25 14:30:22 -0700 | [diff] [blame] | 867 | } |
| 868 | |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 869 | @Override |
| 870 | public int hashCode() { |
Thomas Vachuska | 9b2da21 | 2014-11-10 19:30:25 -0800 | [diff] [blame] | 871 | return Objects.hash(type(), proto); |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 872 | } |
| 873 | |
| 874 | @Override |
| 875 | public boolean equals(Object obj) { |
| 876 | if (this == obj) { |
| 877 | return true; |
| 878 | } |
| 879 | if (obj instanceof IPProtocolCriterion) { |
| 880 | IPProtocolCriterion that = (IPProtocolCriterion) obj; |
| 881 | return Objects.equals(proto, that.proto); |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 882 | } |
| 883 | return false; |
| 884 | } |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 885 | } |
| 886 | |
Sho SHIMIZU | 06596e3 | 2014-12-02 18:07:50 -0800 | [diff] [blame] | 887 | /** |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 888 | * Implementation of IP address criterion. |
Sho SHIMIZU | 06596e3 | 2014-12-02 18:07:50 -0800 | [diff] [blame] | 889 | */ |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 890 | public static final class IPCriterion implements Criterion { |
| 891 | private final IpPrefix ip; |
| 892 | private final Type type; |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 893 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 894 | /** |
| 895 | * Constructor. |
| 896 | * |
| 897 | * @param ip the IP prefix to match. Could be either IPv4 or IPv6 |
| 898 | * @param type the match type. Should be one of the following: |
| 899 | * Type.IPV4_SRC, Type.IPV4_DST, Type.IPV6_SRC, Type.IPV6_DST |
| 900 | */ |
| 901 | public IPCriterion(IpPrefix ip, Type type) { |
| 902 | this.ip = ip; |
| 903 | this.type = type; |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 904 | } |
| 905 | |
| 906 | @Override |
| 907 | public Type type() { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 908 | return this.type; |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 909 | } |
| 910 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 911 | /** |
| 912 | * Gets the IP prefix to match. |
| 913 | * |
| 914 | * @return the IP prefix to match |
| 915 | */ |
| 916 | public IpPrefix ip() { |
| 917 | return this.ip; |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 918 | } |
| 919 | |
alshabib | 99b8fdc | 2014-09-25 14:30:22 -0700 | [diff] [blame] | 920 | @Override |
| 921 | public String toString() { |
| 922 | return toStringHelper(type().toString()) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 923 | .add("ip", ip).toString(); |
alshabib | 99b8fdc | 2014-09-25 14:30:22 -0700 | [diff] [blame] | 924 | } |
| 925 | |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 926 | @Override |
| 927 | public int hashCode() { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 928 | return Objects.hash(type, ip); |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 929 | } |
| 930 | |
| 931 | @Override |
| 932 | public boolean equals(Object obj) { |
| 933 | if (this == obj) { |
| 934 | return true; |
| 935 | } |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 936 | if (obj instanceof IPCriterion) { |
| 937 | IPCriterion that = (IPCriterion) obj; |
| 938 | return Objects.equals(ip, that.ip) && |
| 939 | Objects.equals(type, that.type); |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 940 | } |
| 941 | return false; |
| 942 | } |
alshabib | 7b79549 | 2014-09-16 14:38:39 -0700 | [diff] [blame] | 943 | } |
| 944 | |
Sho SHIMIZU | 06596e3 | 2014-12-02 18:07:50 -0800 | [diff] [blame] | 945 | /** |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 946 | * Implementation of TCP port criterion (16 bits unsigned integer). |
Sho SHIMIZU | 06596e3 | 2014-12-02 18:07:50 -0800 | [diff] [blame] | 947 | */ |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 948 | public static final class TcpPortCriterion implements Criterion { |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 949 | private static final int MASK = 0xffff; |
| 950 | private final int tcpPort; // Port value: 16 bits |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 951 | private final Type type; |
| 952 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 953 | /** |
| 954 | * Constructor. |
| 955 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 956 | * @param tcpPort the TCP port to match (16 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 957 | * @param type the match type. Should be either Type.TCP_SRC or |
| 958 | * Type.TCP_DST |
| 959 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 960 | public TcpPortCriterion(int tcpPort, Type type) { |
| 961 | this.tcpPort = tcpPort & MASK; |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 962 | this.type = type; |
| 963 | } |
| 964 | |
| 965 | @Override |
| 966 | public Type type() { |
| 967 | return this.type; |
| 968 | } |
| 969 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 970 | /** |
| 971 | * Gets the TCP port to match. |
| 972 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 973 | * @return the TCP port to match (16 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 974 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 975 | public int tcpPort() { |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 976 | return this.tcpPort; |
| 977 | } |
| 978 | |
| 979 | @Override |
| 980 | public String toString() { |
| 981 | return toStringHelper(type().toString()) |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 982 | .add("tcpPort", tcpPort).toString(); |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 983 | } |
| 984 | |
| 985 | @Override |
| 986 | public int hashCode() { |
Thomas Vachuska | 9b2da21 | 2014-11-10 19:30:25 -0800 | [diff] [blame] | 987 | return Objects.hash(type, tcpPort); |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 988 | } |
| 989 | |
| 990 | @Override |
| 991 | public boolean equals(Object obj) { |
| 992 | if (this == obj) { |
| 993 | return true; |
| 994 | } |
| 995 | if (obj instanceof TcpPortCriterion) { |
| 996 | TcpPortCriterion that = (TcpPortCriterion) obj; |
| 997 | return Objects.equals(tcpPort, that.tcpPort) && |
| 998 | Objects.equals(type, that.type); |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 999 | } |
| 1000 | return false; |
| 1001 | } |
| 1002 | } |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 1003 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1004 | /** |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1005 | * Implementation of UDP port criterion (16 bits unsigned integer). |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1006 | */ |
| 1007 | public static final class UdpPortCriterion implements Criterion { |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1008 | private static final int MASK = 0xffff; |
| 1009 | private final int udpPort; // Port value: 16 bits |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1010 | private final Type type; |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 1011 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1012 | /** |
| 1013 | * Constructor. |
| 1014 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1015 | * @param udpPort the UDP port to match (16 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1016 | * @param type the match type. Should be either Type.UDP_SRC or |
| 1017 | * Type.UDP_DST |
| 1018 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1019 | public UdpPortCriterion(int udpPort, Type type) { |
| 1020 | this.udpPort = udpPort & MASK; |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1021 | this.type = type; |
| 1022 | } |
| 1023 | |
| 1024 | @Override |
| 1025 | public Type type() { |
| 1026 | return this.type; |
| 1027 | } |
| 1028 | |
| 1029 | /** |
| 1030 | * Gets the UDP port to match. |
| 1031 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1032 | * @return the UDP port to match (16 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1033 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1034 | public int udpPort() { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1035 | return this.udpPort; |
| 1036 | } |
| 1037 | |
| 1038 | @Override |
| 1039 | public String toString() { |
| 1040 | return toStringHelper(type().toString()) |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1041 | .add("udpPort", udpPort).toString(); |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1042 | } |
| 1043 | |
| 1044 | @Override |
| 1045 | public int hashCode() { |
| 1046 | return Objects.hash(type, udpPort); |
| 1047 | } |
| 1048 | |
| 1049 | @Override |
| 1050 | public boolean equals(Object obj) { |
| 1051 | if (this == obj) { |
| 1052 | return true; |
| 1053 | } |
| 1054 | if (obj instanceof UdpPortCriterion) { |
| 1055 | UdpPortCriterion that = (UdpPortCriterion) obj; |
| 1056 | return Objects.equals(udpPort, that.udpPort) && |
| 1057 | Objects.equals(type, that.type); |
| 1058 | } |
| 1059 | return false; |
| 1060 | } |
| 1061 | } |
| 1062 | |
| 1063 | /** |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1064 | * Implementation of SCTP port criterion (16 bits unsigned integer). |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1065 | */ |
| 1066 | public static final class SctpPortCriterion implements Criterion { |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1067 | private static final int MASK = 0xffff; |
| 1068 | private final int sctpPort; // Port value: 16 bits |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1069 | private final Type type; |
| 1070 | |
| 1071 | /** |
| 1072 | * Constructor. |
| 1073 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1074 | * @param sctpPort the SCTP port to match (16 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1075 | * @param type the match type. Should be either Type.SCTP_SRC or |
| 1076 | * Type.SCTP_DST |
| 1077 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1078 | public SctpPortCriterion(int sctpPort, Type type) { |
| 1079 | this.sctpPort = sctpPort & MASK; |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1080 | this.type = type; |
| 1081 | } |
| 1082 | |
| 1083 | @Override |
| 1084 | public Type type() { |
| 1085 | return this.type; |
| 1086 | } |
| 1087 | |
| 1088 | /** |
| 1089 | * Gets the SCTP port to match. |
| 1090 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1091 | * @return the SCTP port to match (16 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1092 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1093 | public int sctpPort() { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1094 | return this.sctpPort; |
| 1095 | } |
| 1096 | |
| 1097 | @Override |
| 1098 | public String toString() { |
| 1099 | return toStringHelper(type().toString()) |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1100 | .add("sctpPort", sctpPort).toString(); |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1101 | } |
| 1102 | |
| 1103 | @Override |
| 1104 | public int hashCode() { |
| 1105 | return Objects.hash(type, sctpPort); |
| 1106 | } |
| 1107 | |
| 1108 | @Override |
| 1109 | public boolean equals(Object obj) { |
| 1110 | if (this == obj) { |
| 1111 | return true; |
| 1112 | } |
| 1113 | if (obj instanceof SctpPortCriterion) { |
| 1114 | SctpPortCriterion that = (SctpPortCriterion) obj; |
| 1115 | return Objects.equals(sctpPort, that.sctpPort) && |
| 1116 | Objects.equals(type, that.type); |
| 1117 | } |
| 1118 | return false; |
| 1119 | } |
| 1120 | } |
| 1121 | |
| 1122 | /** |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1123 | * Implementation of ICMP type criterion (8 bits unsigned integer). |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1124 | */ |
| 1125 | public static final class IcmpTypeCriterion implements Criterion { |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1126 | private static final short MASK = 0xff; |
| 1127 | private final short icmpType; // The ICMP type: 8 bits |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1128 | |
| 1129 | /** |
| 1130 | * Constructor. |
| 1131 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1132 | * @param icmpType the ICMP type to match (8 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1133 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1134 | public IcmpTypeCriterion(short icmpType) { |
| 1135 | this.icmpType = (short) (icmpType & MASK); |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1136 | } |
| 1137 | |
| 1138 | @Override |
| 1139 | public Type type() { |
| 1140 | return Type.ICMPV4_TYPE; |
| 1141 | } |
| 1142 | |
| 1143 | /** |
| 1144 | * Gets the ICMP type to match. |
| 1145 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1146 | * @return the ICMP type to match (8 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1147 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1148 | public short icmpType() { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1149 | return icmpType; |
| 1150 | } |
| 1151 | |
| 1152 | @Override |
| 1153 | public String toString() { |
| 1154 | return toStringHelper(type().toString()) |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1155 | .add("icmpType", icmpType).toString(); |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1156 | } |
| 1157 | |
| 1158 | @Override |
| 1159 | public int hashCode() { |
| 1160 | return Objects.hash(type(), icmpType); |
| 1161 | } |
| 1162 | |
| 1163 | @Override |
| 1164 | public boolean equals(Object obj) { |
| 1165 | if (this == obj) { |
| 1166 | return true; |
| 1167 | } |
| 1168 | if (obj instanceof IcmpTypeCriterion) { |
| 1169 | IcmpTypeCriterion that = (IcmpTypeCriterion) obj; |
| 1170 | return Objects.equals(icmpType, that.icmpType) && |
| 1171 | Objects.equals(this.type(), that.type()); |
| 1172 | } |
| 1173 | return false; |
| 1174 | } |
| 1175 | } |
| 1176 | |
| 1177 | /** |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1178 | * Implementation of ICMP code criterion (8 bits unsigned integer). |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1179 | */ |
| 1180 | public static final class IcmpCodeCriterion implements Criterion { |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1181 | private static final short MASK = 0xff; |
| 1182 | private final short icmpCode; // The ICMP code: 8 bits |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1183 | |
| 1184 | /** |
| 1185 | * Constructor. |
| 1186 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1187 | * @param icmpCode the ICMP code to match (8 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1188 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1189 | public IcmpCodeCriterion(short icmpCode) { |
| 1190 | this.icmpCode = (short) (icmpCode & MASK); |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1191 | } |
| 1192 | |
| 1193 | @Override |
| 1194 | public Type type() { |
| 1195 | return Type.ICMPV4_CODE; |
| 1196 | } |
| 1197 | |
| 1198 | /** |
| 1199 | * Gets the ICMP code to match. |
| 1200 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1201 | * @return the ICMP code to match (8 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1202 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1203 | public short icmpCode() { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1204 | return icmpCode; |
| 1205 | } |
| 1206 | |
| 1207 | @Override |
| 1208 | public String toString() { |
| 1209 | return toStringHelper(type().toString()) |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1210 | .add("icmpCode", icmpCode).toString(); |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1211 | } |
| 1212 | |
| 1213 | @Override |
| 1214 | public int hashCode() { |
| 1215 | return Objects.hash(type(), icmpCode); |
| 1216 | } |
| 1217 | |
| 1218 | @Override |
| 1219 | public boolean equals(Object obj) { |
| 1220 | if (this == obj) { |
| 1221 | return true; |
| 1222 | } |
| 1223 | if (obj instanceof IcmpCodeCriterion) { |
| 1224 | IcmpCodeCriterion that = (IcmpCodeCriterion) obj; |
| 1225 | return Objects.equals(icmpCode, that.icmpCode) && |
| 1226 | Objects.equals(this.type(), that.type()); |
| 1227 | } |
| 1228 | return false; |
| 1229 | } |
| 1230 | } |
| 1231 | |
| 1232 | /** |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1233 | * Implementation of IPv6 Flow Label (RFC 6437) criterion (20 bits unsigned |
| 1234 | * integer). |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1235 | */ |
| 1236 | public static final class IPv6FlowLabelCriterion implements Criterion { |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1237 | private static final int MASK = 0xfffff; |
| 1238 | private final int flowLabel; // IPv6 flow label: 20 bits |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1239 | |
| 1240 | /** |
| 1241 | * Constructor. |
| 1242 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1243 | * @param flowLabel the IPv6 flow label to match (20 bits) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1244 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1245 | public IPv6FlowLabelCriterion(int flowLabel) { |
| 1246 | this.flowLabel = flowLabel & MASK; |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1247 | } |
| 1248 | |
| 1249 | @Override |
| 1250 | public Type type() { |
| 1251 | return Type.IPV6_FLABEL; |
| 1252 | } |
| 1253 | |
| 1254 | /** |
| 1255 | * Gets the IPv6 flow label to match. |
| 1256 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1257 | * @return the IPv6 flow label to match (20 bits) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1258 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1259 | public int flowLabel() { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1260 | return flowLabel; |
| 1261 | } |
| 1262 | |
| 1263 | @Override |
| 1264 | public String toString() { |
| 1265 | return toStringHelper(type().toString()) |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1266 | .add("flowLabel", Long.toHexString(flowLabel)).toString(); |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1267 | } |
| 1268 | |
| 1269 | @Override |
| 1270 | public int hashCode() { |
| 1271 | return Objects.hash(type(), flowLabel); |
| 1272 | } |
| 1273 | |
| 1274 | @Override |
| 1275 | public boolean equals(Object obj) { |
| 1276 | if (this == obj) { |
| 1277 | return true; |
| 1278 | } |
| 1279 | if (obj instanceof IPv6FlowLabelCriterion) { |
| 1280 | IPv6FlowLabelCriterion that = (IPv6FlowLabelCriterion) obj; |
| 1281 | return Objects.equals(flowLabel, that.flowLabel) && |
| 1282 | Objects.equals(this.type(), that.type()); |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 1283 | } |
| 1284 | return false; |
| 1285 | } |
| 1286 | } |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 1287 | |
Sho SHIMIZU | 06596e3 | 2014-12-02 18:07:50 -0800 | [diff] [blame] | 1288 | /** |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1289 | * Implementation of ICMPv6 type criterion (8 bits unsigned integer). |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 1290 | */ |
| 1291 | public static final class Icmpv6TypeCriterion implements Criterion { |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1292 | private static final short MASK = 0xff; |
| 1293 | private final short icmpv6Type; // ICMPv6 type: 8 bits |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 1294 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1295 | /** |
| 1296 | * Constructor. |
| 1297 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1298 | * @param icmpv6Type the ICMPv6 type to match (8 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1299 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1300 | public Icmpv6TypeCriterion(short icmpv6Type) { |
| 1301 | this.icmpv6Type = (short) (icmpv6Type & MASK); |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 1302 | } |
| 1303 | |
| 1304 | @Override |
| 1305 | public Type type() { |
| 1306 | return Type.ICMPV6_TYPE; |
| 1307 | } |
| 1308 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1309 | /** |
| 1310 | * Gets the ICMPv6 type to match. |
| 1311 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1312 | * @return the ICMPv6 type to match (8 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1313 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1314 | public short icmpv6Type() { |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 1315 | return icmpv6Type; |
| 1316 | } |
| 1317 | |
| 1318 | @Override |
| 1319 | public String toString() { |
| 1320 | return toStringHelper(type().toString()) |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1321 | .add("icmpv6Type", icmpv6Type).toString(); |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 1322 | } |
| 1323 | |
| 1324 | @Override |
| 1325 | public int hashCode() { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1326 | return Objects.hash(type(), icmpv6Type); |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 1327 | } |
| 1328 | |
| 1329 | @Override |
| 1330 | public boolean equals(Object obj) { |
| 1331 | if (this == obj) { |
| 1332 | return true; |
| 1333 | } |
| 1334 | if (obj instanceof Icmpv6TypeCriterion) { |
| 1335 | Icmpv6TypeCriterion that = (Icmpv6TypeCriterion) obj; |
| 1336 | return Objects.equals(icmpv6Type, that.icmpv6Type) && |
| 1337 | Objects.equals(this.type(), that.type()); |
| 1338 | } |
| 1339 | return false; |
| 1340 | } |
| 1341 | } |
| 1342 | |
| 1343 | /** |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1344 | * Implementation of ICMPv6 code criterion (8 bits unsigned integer). |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 1345 | */ |
| 1346 | public static final class Icmpv6CodeCriterion implements Criterion { |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1347 | private static final short MASK = 0xff; |
| 1348 | private final short icmpv6Code; // ICMPv6 code: 8 bits |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 1349 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1350 | /** |
| 1351 | * Constructor. |
| 1352 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1353 | * @param icmpv6Code the ICMPv6 code to match (8 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1354 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1355 | public Icmpv6CodeCriterion(short icmpv6Code) { |
| 1356 | this.icmpv6Code = (short) (icmpv6Code & MASK); |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 1357 | } |
| 1358 | |
| 1359 | @Override |
| 1360 | public Type type() { |
| 1361 | return Type.ICMPV6_CODE; |
| 1362 | } |
| 1363 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1364 | /** |
| 1365 | * Gets the ICMPv6 code to match. |
| 1366 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1367 | * @return the ICMPv6 code to match (8 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1368 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1369 | public short icmpv6Code() { |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 1370 | return icmpv6Code; |
| 1371 | } |
| 1372 | |
| 1373 | @Override |
| 1374 | public String toString() { |
| 1375 | return toStringHelper(type().toString()) |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1376 | .add("icmpv6Code", icmpv6Code).toString(); |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 1377 | } |
| 1378 | |
| 1379 | @Override |
| 1380 | public int hashCode() { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1381 | return Objects.hash(type(), icmpv6Code); |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 1382 | } |
| 1383 | |
| 1384 | @Override |
| 1385 | public boolean equals(Object obj) { |
| 1386 | if (this == obj) { |
| 1387 | return true; |
| 1388 | } |
| 1389 | if (obj instanceof Icmpv6CodeCriterion) { |
| 1390 | Icmpv6CodeCriterion that = (Icmpv6CodeCriterion) obj; |
| 1391 | return Objects.equals(icmpv6Code, that.icmpv6Code) && |
| 1392 | Objects.equals(this.type(), that.type()); |
| 1393 | } |
| 1394 | return false; |
| 1395 | } |
| 1396 | } |
| 1397 | |
| 1398 | /** |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1399 | * Implementation of IPv6 Neighbor Discovery target address criterion. |
| 1400 | */ |
| 1401 | public static final class IPv6NDTargetAddressCriterion |
| 1402 | implements Criterion { |
| 1403 | private final Ip6Address targetAddress; |
| 1404 | |
| 1405 | /** |
| 1406 | * Constructor. |
| 1407 | * |
| 1408 | * @param targetAddress the IPv6 target address to match |
| 1409 | */ |
| 1410 | public IPv6NDTargetAddressCriterion(Ip6Address targetAddress) { |
| 1411 | this.targetAddress = targetAddress; |
| 1412 | } |
| 1413 | |
| 1414 | @Override |
| 1415 | public Type type() { |
| 1416 | return Type.IPV6_ND_TARGET; |
| 1417 | } |
| 1418 | |
| 1419 | /** |
| 1420 | * Gets the IPv6 target address to match. |
| 1421 | * |
| 1422 | * @return the IPv6 target address to match |
| 1423 | */ |
| 1424 | public Ip6Address targetAddress() { |
| 1425 | return this.targetAddress; |
| 1426 | } |
| 1427 | |
| 1428 | @Override |
| 1429 | public String toString() { |
| 1430 | return toStringHelper(type().toString()) |
| 1431 | .add("targetAddress", targetAddress).toString(); |
| 1432 | } |
| 1433 | |
| 1434 | @Override |
| 1435 | public int hashCode() { |
| 1436 | return Objects.hash(type(), targetAddress); |
| 1437 | } |
| 1438 | |
| 1439 | @Override |
| 1440 | public boolean equals(Object obj) { |
| 1441 | if (this == obj) { |
| 1442 | return true; |
| 1443 | } |
| 1444 | if (obj instanceof IPv6NDTargetAddressCriterion) { |
| 1445 | IPv6NDTargetAddressCriterion that = |
| 1446 | (IPv6NDTargetAddressCriterion) obj; |
| 1447 | return Objects.equals(targetAddress, that.targetAddress) && |
| 1448 | Objects.equals(type(), that.type()); |
| 1449 | } |
| 1450 | return false; |
| 1451 | } |
| 1452 | } |
| 1453 | |
| 1454 | /** |
| 1455 | * Implementation of IPv6 Neighbor Discovery link-layer address criterion. |
| 1456 | */ |
| 1457 | public static final class IPv6NDLinkLayerAddressCriterion |
| 1458 | implements Criterion { |
| 1459 | private final MacAddress mac; |
| 1460 | private final Type type; |
| 1461 | |
| 1462 | /** |
| 1463 | * Constructor. |
| 1464 | * |
| 1465 | * @param mac the source or destination link-layer address to match |
| 1466 | * @param type the match type. Should be either Type.IPV6_ND_SLL or |
| 1467 | * Type.IPV6_ND_TLL |
| 1468 | */ |
| 1469 | public IPv6NDLinkLayerAddressCriterion(MacAddress mac, Type type) { |
| 1470 | this.mac = mac; |
| 1471 | this.type = type; |
| 1472 | } |
| 1473 | |
| 1474 | @Override |
| 1475 | public Type type() { |
| 1476 | return this.type; |
| 1477 | } |
| 1478 | |
| 1479 | /** |
| 1480 | * Gets the MAC link-layer address to match. |
| 1481 | * |
| 1482 | * @return the MAC link-layer address to match |
| 1483 | */ |
| 1484 | public MacAddress mac() { |
| 1485 | return this.mac; |
| 1486 | } |
| 1487 | |
| 1488 | @Override |
| 1489 | public String toString() { |
| 1490 | return toStringHelper(type().toString()) |
| 1491 | .add("mac", mac).toString(); |
| 1492 | } |
| 1493 | |
| 1494 | @Override |
| 1495 | public int hashCode() { |
| 1496 | return Objects.hash(type, mac); |
| 1497 | } |
| 1498 | |
| 1499 | @Override |
| 1500 | public boolean equals(Object obj) { |
| 1501 | if (this == obj) { |
| 1502 | return true; |
| 1503 | } |
| 1504 | if (obj instanceof IPv6NDLinkLayerAddressCriterion) { |
| 1505 | IPv6NDLinkLayerAddressCriterion that = |
| 1506 | (IPv6NDLinkLayerAddressCriterion) obj; |
| 1507 | return Objects.equals(mac, that.mac) && |
| 1508 | Objects.equals(type, that.type); |
| 1509 | } |
| 1510 | return false; |
| 1511 | } |
| 1512 | } |
| 1513 | |
| 1514 | /** |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1515 | * Implementation of MPLS tag criterion (20 bits). |
Sho SHIMIZU | 06596e3 | 2014-12-02 18:07:50 -0800 | [diff] [blame] | 1516 | */ |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 1517 | public static final class MplsCriterion implements Criterion { |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1518 | private static final int MASK = 0xfffff; |
Michele Santuari | 4b6019e | 2014-12-19 11:31:45 +0100 | [diff] [blame] | 1519 | private final MplsLabel mplsLabel; |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 1520 | |
Michele Santuari | 4b6019e | 2014-12-19 11:31:45 +0100 | [diff] [blame] | 1521 | public MplsCriterion(MplsLabel mplsLabel) { |
| 1522 | this.mplsLabel = mplsLabel; |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 1523 | } |
| 1524 | |
| 1525 | @Override |
| 1526 | public Type type() { |
| 1527 | return Type.MPLS_LABEL; |
| 1528 | } |
| 1529 | |
Michele Santuari | 4b6019e | 2014-12-19 11:31:45 +0100 | [diff] [blame] | 1530 | public MplsLabel label() { |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 1531 | return mplsLabel; |
| 1532 | } |
| 1533 | |
| 1534 | @Override |
| 1535 | public String toString() { |
| 1536 | return toStringHelper(type().toString()) |
Michele Santuari | 4b6019e | 2014-12-19 11:31:45 +0100 | [diff] [blame] | 1537 | .add("mpls", mplsLabel).toString(); |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 1538 | } |
| 1539 | |
| 1540 | @Override |
| 1541 | public int hashCode() { |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1542 | return Objects.hash(type(), mplsLabel); |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 1543 | } |
| 1544 | |
| 1545 | @Override |
| 1546 | public boolean equals(Object obj) { |
| 1547 | if (this == obj) { |
| 1548 | return true; |
| 1549 | } |
| 1550 | if (obj instanceof MplsCriterion) { |
| 1551 | MplsCriterion that = (MplsCriterion) obj; |
| 1552 | return Objects.equals(mplsLabel, that.mplsLabel) && |
| 1553 | Objects.equals(this.type(), that.type()); |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 1554 | } |
| 1555 | return false; |
| 1556 | } |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 1557 | } |
| 1558 | |
Sho SHIMIZU | 06596e3 | 2014-12-02 18:07:50 -0800 | [diff] [blame] | 1559 | /** |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 1560 | * Implementation of IPv6 Extension Header pseudo-field criterion |
| 1561 | * (16 bits). Those are defined in Criterion.IPv6ExthdrFlags. |
| 1562 | */ |
| 1563 | public static final class IPv6ExthdrFlagsCriterion implements Criterion { |
| 1564 | private static final int MASK = 0xffff; |
| 1565 | private final int exthdrFlags; // IPv6 Exthdr flags: 16 bits |
| 1566 | |
| 1567 | /** |
| 1568 | * Constructor. |
| 1569 | * |
| 1570 | * @param exthdrFlags the IPv6 Extension Header pseudo-field flags |
| 1571 | * to match (16 bits). Those are defined in Criterion.IPv6ExthdrFlags |
| 1572 | */ |
| 1573 | public IPv6ExthdrFlagsCriterion(int exthdrFlags) { |
| 1574 | this.exthdrFlags = exthdrFlags & MASK; |
| 1575 | } |
| 1576 | |
| 1577 | @Override |
| 1578 | public Type type() { |
| 1579 | return Type.IPV6_EXTHDR; |
| 1580 | } |
| 1581 | |
| 1582 | /** |
| 1583 | * Gets the IPv6 Extension Header pseudo-field flags to match. |
| 1584 | * |
| 1585 | * @return the IPv6 Extension Header pseudo-field flags to match |
| 1586 | * (16 bits). Those are defined in Criterion.IPv6ExthdrFlags |
| 1587 | */ |
| 1588 | public int exthdrFlags() { |
| 1589 | return exthdrFlags; |
| 1590 | } |
| 1591 | |
| 1592 | @Override |
| 1593 | public String toString() { |
| 1594 | return toStringHelper(type().toString()) |
| 1595 | .add("exthdrFlags", Long.toHexString(exthdrFlags)).toString(); |
| 1596 | } |
| 1597 | |
| 1598 | @Override |
| 1599 | public int hashCode() { |
| 1600 | return Objects.hash(type(), exthdrFlags); |
| 1601 | } |
| 1602 | |
| 1603 | @Override |
| 1604 | public boolean equals(Object obj) { |
| 1605 | if (this == obj) { |
| 1606 | return true; |
| 1607 | } |
| 1608 | if (obj instanceof IPv6ExthdrFlagsCriterion) { |
| 1609 | IPv6ExthdrFlagsCriterion that = (IPv6ExthdrFlagsCriterion) obj; |
| 1610 | return Objects.equals(exthdrFlags, that.exthdrFlags) && |
| 1611 | Objects.equals(this.type(), that.type()); |
| 1612 | } |
| 1613 | return false; |
| 1614 | } |
| 1615 | } |
| 1616 | |
| 1617 | /** |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1618 | * Implementation of lambda (wavelength) criterion (16 bits unsigned |
| 1619 | * integer). |
Sho SHIMIZU | 06596e3 | 2014-12-02 18:07:50 -0800 | [diff] [blame] | 1620 | */ |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 1621 | public static final class LambdaCriterion implements Criterion { |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1622 | private static final int MASK = 0xffff; |
| 1623 | private final int lambda; // Lambda value: 16 bits |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 1624 | private final Type type; |
| 1625 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1626 | /** |
| 1627 | * Constructor. |
| 1628 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1629 | * @param lambda the lambda (wavelength) to match (16 bits unsigned |
| 1630 | * integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1631 | * @param type the match type. Should be Type.OCH_SIGID |
| 1632 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1633 | public LambdaCriterion(int lambda, Type type) { |
| 1634 | this.lambda = lambda & MASK; |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 1635 | this.type = type; |
| 1636 | } |
| 1637 | |
| 1638 | @Override |
| 1639 | public Type type() { |
| 1640 | return this.type; |
| 1641 | } |
| 1642 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1643 | /** |
| 1644 | * Gets the lambda (wavelength) to match. |
| 1645 | * |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1646 | * @return the lambda (wavelength) to match (16 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1647 | */ |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1648 | public int lambda() { |
| 1649 | return lambda; |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 1650 | } |
| 1651 | |
| 1652 | @Override |
| 1653 | public String toString() { |
| 1654 | return toStringHelper(type().toString()) |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1655 | .add("lambda", lambda).toString(); |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 1656 | } |
| 1657 | |
| 1658 | @Override |
| 1659 | public int hashCode() { |
Thomas Vachuska | 9b2da21 | 2014-11-10 19:30:25 -0800 | [diff] [blame] | 1660 | return Objects.hash(type, lambda); |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 1661 | } |
| 1662 | |
| 1663 | @Override |
| 1664 | public boolean equals(Object obj) { |
| 1665 | if (this == obj) { |
| 1666 | return true; |
| 1667 | } |
| 1668 | if (obj instanceof LambdaCriterion) { |
| 1669 | LambdaCriterion that = (LambdaCriterion) obj; |
| 1670 | return Objects.equals(lambda, that.lambda) && |
| 1671 | Objects.equals(type, that.type); |
| 1672 | } |
| 1673 | return false; |
| 1674 | } |
| 1675 | } |
| 1676 | |
Sho SHIMIZU | 06596e3 | 2014-12-02 18:07:50 -0800 | [diff] [blame] | 1677 | /** |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 1678 | * Implementation of optical signal type criterion (8 bits unsigned |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1679 | * integer). |
Sho SHIMIZU | 06596e3 | 2014-12-02 18:07:50 -0800 | [diff] [blame] | 1680 | */ |
Praseed Balakrishnan | 64369da | 2014-10-23 15:55:20 -0700 | [diff] [blame] | 1681 | public static final class OpticalSignalTypeCriterion implements Criterion { |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 1682 | private static final short MASK = 0xff; |
| 1683 | private final short signalType; // Signal type value: 8 bits |
Praseed Balakrishnan | 64369da | 2014-10-23 15:55:20 -0700 | [diff] [blame] | 1684 | private final Type type; |
| 1685 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1686 | /** |
| 1687 | * Constructor. |
| 1688 | * |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 1689 | * @param signalType the optical signal type to match (8 bits unsigned |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1690 | * integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1691 | * @param type the match type. Should be Type.OCH_SIGTYPE |
| 1692 | */ |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 1693 | public OpticalSignalTypeCriterion(short signalType, Type type) { |
| 1694 | this.signalType = (short) (signalType & MASK); |
Praseed Balakrishnan | 64369da | 2014-10-23 15:55:20 -0700 | [diff] [blame] | 1695 | this.type = type; |
| 1696 | } |
| 1697 | |
| 1698 | @Override |
| 1699 | public Type type() { |
| 1700 | return this.type; |
| 1701 | } |
| 1702 | |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1703 | /** |
| 1704 | * Gets the optical signal type to match. |
| 1705 | * |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 1706 | * @return the optical signal type to match (8 bits unsigned integer) |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 1707 | */ |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 1708 | public short signalType() { |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1709 | return signalType; |
Praseed Balakrishnan | 64369da | 2014-10-23 15:55:20 -0700 | [diff] [blame] | 1710 | } |
| 1711 | |
| 1712 | @Override |
| 1713 | public String toString() { |
| 1714 | return toStringHelper(type().toString()) |
Pavlin Radoslavov | f3b6933 | 2015-02-06 15:47:05 -0800 | [diff] [blame] | 1715 | .add("signalType", signalType).toString(); |
Praseed Balakrishnan | 64369da | 2014-10-23 15:55:20 -0700 | [diff] [blame] | 1716 | } |
| 1717 | |
| 1718 | @Override |
| 1719 | public int hashCode() { |
Thomas Vachuska | 9b2da21 | 2014-11-10 19:30:25 -0800 | [diff] [blame] | 1720 | return Objects.hash(type, signalType); |
Praseed Balakrishnan | 64369da | 2014-10-23 15:55:20 -0700 | [diff] [blame] | 1721 | } |
| 1722 | |
| 1723 | @Override |
| 1724 | public boolean equals(Object obj) { |
| 1725 | if (this == obj) { |
| 1726 | return true; |
| 1727 | } |
| 1728 | if (obj instanceof OpticalSignalTypeCriterion) { |
| 1729 | OpticalSignalTypeCriterion that = (OpticalSignalTypeCriterion) obj; |
| 1730 | return Objects.equals(signalType, that.signalType) && |
| 1731 | Objects.equals(type, that.type); |
| 1732 | } |
| 1733 | return false; |
| 1734 | } |
| 1735 | } |
alshabib | a3a476d | 2015-04-10 14:35:38 -0700 | [diff] [blame] | 1736 | |
| 1737 | /** |
| 1738 | * Dummy Criterion used with @see{FilteringObjective}. |
| 1739 | */ |
| 1740 | private static class DummyCriterion implements Criterion { |
| 1741 | |
| 1742 | @Override |
| 1743 | public Type type() { |
| 1744 | return Type.DUMMY; |
| 1745 | } |
| 1746 | } |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 1747 | } |