blob: 3ff65abc7f61407abd1b71ab202c5b2167ae8a84 [file] [log] [blame]
Andreas Wundsam40e14f72013-05-06 14:49:08 -07001package org.openflow.protocol.match;
2
3import org.openflow.protocol.OFObject;
Yotam Harchold7b84202013-07-26 16:08:10 -07004import org.openflow.types.OFValueType;
Andreas Wundsam40e14f72013-05-06 14:49:08 -07005
6public interface Match extends OFObject {
Yotam Harchol5c9d6f42013-08-01 11:09:20 -07007
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 Wundsam40e14f72013-05-06 14:49:08 -070028
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070029 /**
30 * Returns true if this match object supports the given match field.
31 *
32 * @param field Match field
33 * @return
34 */
Yotam Harchold7b84202013-07-26 16:08:10 -070035 public boolean supports(MatchField<?> field);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070036
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070037 /**
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 Harchold7b84202013-07-26 16:08:10 -070044 public boolean supportsMasked(MatchField<?> field);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070045
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070046 /**
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 Harchold7b84202013-07-26 16:08:10 -070053 public boolean isExact(MatchField<?> field);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070054
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070055 /**
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 Harchold7b84202013-07-26 16:08:10 -070063 public boolean isFullyWildcarded(MatchField<?> field);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070064
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070065 /**
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 Harchold7b84202013-07-26 16:08:10 -070072 public boolean isPartiallyMasked(MatchField<?> field);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070073
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070074 /**
75 * Returns a builder to build new instances of this type of match object.
76 * @return Match builder
77 */
Andreas Wundsam40e14f72013-05-06 14:49:08 -070078 public MatchBuilder getBuilder();
79}