blob: be7b8b0fc88d1347e82eca6449ec10148fe73269 [file] [log] [blame]
Andreas Wundsam40e14f72013-05-06 14:49:08 -07001package org.openflow.protocol.match;
2
Yotam Harcholfb4bfb92013-08-01 14:02:04 -07003import org.openflow.types.Masked;
Yotam Harchold7b84202013-07-26 16:08:10 -07004import org.openflow.types.OFValueType;
Andreas Wundsam40e14f72013-05-06 14:49:08 -07005
Andreas Wundsama94273b2013-08-01 22:11:33 -07006public 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 Wundsam40e14f72013-05-06 14:49:08 -070014
Andreas Wundsama94273b2013-08-01 22:11:33 -070015 /**
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 Harcholfb4bfb92013-08-01 14:02:04 -070075
76 public <F extends OFValueType<F>> MatchBuilder wildcard(MatchField<F> field);
Andreas Wundsama94273b2013-08-01 22:11:33 -070077
Andreas Wundsam40e14f72013-05-06 14:49:08 -070078 public Match getMatch();
79}