blob: d9d68ec0f6ee07fb6507934a93685fb5833a5797 [file] [log] [blame]
Andreas Wundsam40e14f72013-05-06 14:49:08 -07001package org.openflow.protocol.match;
2
Yotam Harchold7b84202013-07-26 16:08:10 -07003import org.openflow.types.ArpOpcode;
Andreas Wundsam40e14f72013-05-06 14:49:08 -07004import org.openflow.types.EthType;
Yotam Harchold7b84202013-07-26 16:08:10 -07005import org.openflow.types.ICMPv4Code;
6import org.openflow.types.ICMPv4Type;
7import org.openflow.types.IPv4WithMask;
8import org.openflow.types.IPv6FlowLabel;
9import org.openflow.types.IPv6WithMask;
10import org.openflow.types.IpDscp;
11import org.openflow.types.IpEcn;
Andreas Wundsam40e14f72013-05-06 14:49:08 -070012import org.openflow.types.IpProtocol;
13import org.openflow.types.MacAddress;
Yotam Harchol161a5d52013-07-25 17:17:48 -070014import org.openflow.types.Masked;
Andreas Wundsam40e14f72013-05-06 14:49:08 -070015import org.openflow.types.OFPort;
Yotam Harchold7b84202013-07-26 16:08:10 -070016import org.openflow.types.OFValueType;
17import org.openflow.types.TransportPort;
Andreas Wundsam40e14f72013-05-06 14:49:08 -070018import org.openflow.types.VlanPcp;
19import org.openflow.types.VlanVid;
Andreas Wundsam40e14f72013-05-06 14:49:08 -070020
Yotam Harchold7b84202013-07-26 16:08:10 -070021public class MatchField<F extends OFValueType> {
Andreas Wundsam40e14f72013-05-06 14:49:08 -070022 private final String name;
23 public final int id;
24
25 public MatchField(final String name) {
26 this.name = name;
27 this.id = -1;
28 }
29
30 public MatchField(final String name, final int id) {
31 this.name = name;
32 this.id = id;
33 }
34
Yotam Harchold7b84202013-07-26 16:08:10 -070035 public final static MatchField<OFPort> IN_PORT =
36 new MatchField<OFPort>("in_port", 0);
37 public final static MatchField<OFPort> IN_PHY_PORT =
38 new MatchField<OFPort>("in_phy_port");
39 public final static MatchField<OFPort> METADATA =
40 new MatchField<OFPort>("metadata");
Andreas Wundsam40e14f72013-05-06 14:49:08 -070041
Yotam Harchold7b84202013-07-26 16:08:10 -070042 public final static MatchField<Masked<MacAddress>> ETH_DST =
43 new MatchField<Masked<MacAddress>>("eth_dst");
44 public final static MatchField<Masked<MacAddress>> ETH_SRC =
45 new MatchField<Masked<MacAddress>>("eth_src", 1);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070046
Yotam Harchold7b84202013-07-26 16:08:10 -070047 public final static MatchField<EthType> ETH_TYPE =
48 new MatchField<EthType>("eth_type");
Yotam Harchol161a5d52013-07-25 17:17:48 -070049
Yotam Harchold7b84202013-07-26 16:08:10 -070050 public final static MatchField<Masked<VlanVid>> VLAN_VID =
51 new MatchField<Masked<VlanVid>>("vlan_vid");
52 public final static MatchField<VlanPcp> VLAN_PCP =
53 new MatchField<VlanPcp>("vlan_pcp");
Yotam Harchol161a5d52013-07-25 17:17:48 -070054
55
Yotam Harchold7b84202013-07-26 16:08:10 -070056 public final static MatchField<IpDscp> IP_DSCP =
57 new MatchField<IpDscp>("ip_dscp");
58 public final static MatchField<IpEcn> IP_ECN =
59 new MatchField<IpEcn>("ip_dscp");
60 public final static MatchField<IpProtocol> IP_PROTO =
61 new MatchField<IpProtocol>("ip_proto");
Andreas Wundsam40e14f72013-05-06 14:49:08 -070062
Yotam Harchold7b84202013-07-26 16:08:10 -070063 public final static MatchField<IPv4WithMask> IPV4_SRC =
64 new MatchField<IPv4WithMask>("ipv4_src");
65 public final static MatchField<IPv4WithMask> IPV4_DST =
66 new MatchField<IPv4WithMask>("ipv4_dst");
Andreas Wundsam40e14f72013-05-06 14:49:08 -070067
Yotam Harchold7b84202013-07-26 16:08:10 -070068 public final static MatchField<TransportPort> TCP_SRC = new MatchField<TransportPort>(
Andreas Wundsam40e14f72013-05-06 14:49:08 -070069 "tcp_src");
Yotam Harchold7b84202013-07-26 16:08:10 -070070 public final static MatchField<TransportPort> TCP_DST = new MatchField<TransportPort>(
Andreas Wundsam40e14f72013-05-06 14:49:08 -070071 "tcp_dst");
72
Yotam Harchold7b84202013-07-26 16:08:10 -070073 public final static MatchField<TransportPort> UDP_SRC = new MatchField<TransportPort>(
Andreas Wundsam40e14f72013-05-06 14:49:08 -070074 "udp_src");
Yotam Harchold7b84202013-07-26 16:08:10 -070075 public final static MatchField<TransportPort> UDP_DST = new MatchField<TransportPort>(
Andreas Wundsam40e14f72013-05-06 14:49:08 -070076 "udp_dst");
77
Yotam Harchold7b84202013-07-26 16:08:10 -070078 public final static MatchField<TransportPort> SCTP_SRC = new MatchField<TransportPort>(
Andreas Wundsam40e14f72013-05-06 14:49:08 -070079 "sctp_src");
Yotam Harchold7b84202013-07-26 16:08:10 -070080 public final static MatchField<TransportPort> SCTP_DST = new MatchField<TransportPort>(
Andreas Wundsam40e14f72013-05-06 14:49:08 -070081 "sctp_dst");
82
Yotam Harchold7b84202013-07-26 16:08:10 -070083 public final static MatchField<ICMPv4Type> ICMPV4_TYPE = new MatchField<ICMPv4Type>(
Andreas Wundsam40e14f72013-05-06 14:49:08 -070084 "icmpv4_src");
Yotam Harchold7b84202013-07-26 16:08:10 -070085 public final static MatchField<ICMPv4Code> ICMPV4_CODE = new MatchField<ICMPv4Code>(
Andreas Wundsam40e14f72013-05-06 14:49:08 -070086 "icmpv4_dst");
87
Yotam Harchold7b84202013-07-26 16:08:10 -070088 public final static MatchField<ArpOpcode> ARP_OP = new MatchField<ArpOpcode>(
Andreas Wundsam40e14f72013-05-06 14:49:08 -070089 "arp_op");
Yotam Harchold7b84202013-07-26 16:08:10 -070090 public final static MatchField<IPv4WithMask> ARP_SPA =
91 new MatchField<IPv4WithMask>("arp_spa");
92 public final static MatchField<IPv4WithMask> ARP_TPA =
93 new MatchField<IPv4WithMask>("arp_tpa");
94 public final static MatchField<Masked<MacAddress>> ARP_SHA =
95 new MatchField<Masked<MacAddress>>("arp_sha");
96 public final static MatchField<Masked<MacAddress>> ARP_THA =
97 new MatchField<Masked<MacAddress>>("arp_tha");
Andreas Wundsam40e14f72013-05-06 14:49:08 -070098
Yotam Harchold7b84202013-07-26 16:08:10 -070099 public final static MatchField<IPv6WithMask> IPV6_SRC =
100 new MatchField<IPv6WithMask>("ipv6_src");
101 public final static MatchField<IPv6WithMask> IPV6_DST =
102 new MatchField<IPv6WithMask>("ipv6_dst");
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700103
Yotam Harchold7b84202013-07-26 16:08:10 -0700104 public final static MatchField<Masked<IPv6FlowLabel>> IPV6_FLABEL =
105 new MatchField<Masked<IPv6FlowLabel>>("ipv6_flabel");
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700106
107 public String getName() {
108 return name;
109 }
110
111}