Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 1 | package org.openflow.protocol.match; |
| 2 | |
| 3 | import org.openflow.protocol.OFObject; |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 4 | import org.openflow.types.OFValueType; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 5 | |
| 6 | public interface Match extends OFObject { |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame^] | 7 | |
| 8 | /* |
| 9 | * Preconditions |
| 10 | * On preconditions (from the OF1.1 spec, page 28, the OF1.0 spec failed to explicitly |
| 11 | * specify this, but it is the behavior of Of1.0 switches): |
| 12 | * Protocol-specific fields within ofp_match will be ignored within a single table when |
| 13 | * the corresponding protocol is not specified in the match. The MPLS match fields will |
| 14 | * be ignored unless the Ethertype is specified as MPLS. Likewise, the IP header and |
| 15 | * transport header fields will be ignored unless the Ethertype is specified as either |
| 16 | * IPv4 or ARP. The tp_src and tp_dst fields will be ignored unless the network protocol |
| 17 | * specified is as TCP, UDP or SCTP. Fields that are ignored donÕt need to be wildcarded |
| 18 | * and should be set to 0. |
| 19 | */ |
| 20 | |
| 21 | /** |
| 22 | * Returns the value for the given field from this match. |
| 23 | * |
| 24 | * @param field Match field to retrieve |
| 25 | * @return Value of match field |
| 26 | */ |
| 27 | public <F extends OFValueType<F>> F get(MatchField<F> field) throws UnsupportedOperationException; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 28 | |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame^] | 29 | /** |
| 30 | * Returns true if this match object supports the given match field. |
| 31 | * |
| 32 | * @param field Match field |
| 33 | * @return |
| 34 | */ |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 35 | public boolean supports(MatchField<?> field); |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 36 | |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame^] | 37 | /** |
| 38 | * true iff field supports a bitmask mask that wildcards part of the field |
| 39 | * (note: not all possible values of this bitmask have to be acceptable) |
| 40 | * |
| 41 | * @param field Match field |
| 42 | * @return |
| 43 | */ |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 44 | public boolean supportsMasked(MatchField<?> field); |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 45 | |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame^] | 46 | /** |
| 47 | * True iff this field is currently fully specified in the match, i.e., the |
| 48 | * match will only select packets that match the exact value of getField(field). |
| 49 | * |
| 50 | * @param field Match field |
| 51 | * @return |
| 52 | */ |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 53 | public boolean isExact(MatchField<?> field); |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 54 | |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame^] | 55 | /** |
| 56 | * True if this field is currently logically unspecified in the match, i.e, the |
| 57 | * value returned by getValue(f) has no impact on whether a packet will be selected |
| 58 | * by the match or not. |
| 59 | * |
| 60 | * @param field |
| 61 | * @return |
| 62 | */ |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 63 | public boolean isFullyWildcarded(MatchField<?> field); |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 64 | |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame^] | 65 | /** |
| 66 | * True if this field is currently partially specified in the match, i.e, the |
| 67 | * match will select packets that match (p.value & getMask(field)) == getValue(field). |
| 68 | * |
| 69 | * @param field |
| 70 | * @return |
| 71 | */ |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 72 | public boolean isPartiallyMasked(MatchField<?> field); |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 73 | |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame^] | 74 | /** |
| 75 | * Returns a builder to build new instances of this type of match object. |
| 76 | * @return Match builder |
| 77 | */ |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 78 | public MatchBuilder getBuilder(); |
| 79 | } |