Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 1 | package org.openflow.protocol.match; |
| 2 | |
Yotam Harchol | fb4bfb9 | 2013-08-01 14:02:04 -0700 | [diff] [blame] | 3 | import org.openflow.types.Masked; |
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 | |
Andreas Wundsam | a94273b | 2013-08-01 22:11:33 -0700 | [diff] [blame^] | 6 | public interface MatchBuilder { |
| 7 | /** |
| 8 | * Returns the value for the given field from this match. |
| 9 | * |
| 10 | * @param field Match field to retrieve |
| 11 | * @return Value of match field |
| 12 | */ |
| 13 | public <F extends OFValueType<F>> F get(MatchField<F> field) throws UnsupportedOperationException; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 14 | |
Andreas Wundsam | a94273b | 2013-08-01 22:11:33 -0700 | [diff] [blame^] | 15 | /** |
| 16 | * Returns the masked value for the given field from this match. |
| 17 | * Precondition: field is partially wildcarded. |
| 18 | * |
| 19 | * @param field Match field to retrieve |
| 20 | * @return Masked value of match field or null if no mask |
| 21 | */ |
| 22 | public <F extends OFValueType<F>> Masked<F> getMasked(MatchField<F> field) throws UnsupportedOperationException; |
| 23 | |
| 24 | /** |
| 25 | * Returns true if this match object supports the given match field. |
| 26 | * |
| 27 | * @param field Match field |
| 28 | * @return |
| 29 | */ |
| 30 | public boolean supports(MatchField<?> field); |
| 31 | |
| 32 | /** |
| 33 | * true iff field supports a bitmask mask that wildcards part of the field |
| 34 | * (note: not all possible values of this bitmask have to be acceptable) |
| 35 | * |
| 36 | * @param field Match field |
| 37 | * @return |
| 38 | */ |
| 39 | public boolean supportsMasked(MatchField<?> field); |
| 40 | |
| 41 | /** |
| 42 | * True iff this field is currently fully specified in the match, i.e., the |
| 43 | * match will only select packets that match the exact value of getField(field). |
| 44 | * |
| 45 | * @param field Match field |
| 46 | * @return |
| 47 | */ |
| 48 | public boolean isExact(MatchField<?> field); |
| 49 | |
| 50 | /** |
| 51 | * True if this field is currently logically unspecified in the match, i.e, the |
| 52 | * value returned by getValue(f) has no impact on whether a packet will be selected |
| 53 | * by the match or not. |
| 54 | * |
| 55 | * @param field |
| 56 | * @return |
| 57 | */ |
| 58 | public boolean isFullyWildcarded(MatchField<?> field); |
| 59 | |
| 60 | /** |
| 61 | * True if this field is currently partially specified in the match, i.e, the |
| 62 | * match will select packets that match (p.value & getMask(field)) == getValue(field). |
| 63 | * |
| 64 | * @param field |
| 65 | * @return |
| 66 | */ |
| 67 | public boolean isPartiallyMasked(MatchField<?> field); |
| 68 | |
| 69 | |
| 70 | public <F extends OFValueType<F>> MatchBuilder setExact(MatchField<F> field, F value); |
| 71 | |
| 72 | public <F extends OFValueType<F>> MatchBuilder setMasked(MatchField<F> field, F value, F mask); |
| 73 | |
| 74 | public <F extends OFValueType<F>> MatchBuilder setMasked(MatchField<F> field, Masked<F> valueWithMask); |
Yotam Harchol | fb4bfb9 | 2013-08-01 14:02:04 -0700 | [diff] [blame] | 75 | |
| 76 | public <F extends OFValueType<F>> MatchBuilder wildcard(MatchField<F> field); |
Andreas Wundsam | a94273b | 2013-08-01 22:11:33 -0700 | [diff] [blame^] | 77 | |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 78 | public Match getMatch(); |
| 79 | } |