blob: 4d4935c1c45a9606a0a4c58b71b069505fee0794 [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;
Yotam Harchol5c9d6f42013-08-01 11:09:20 -07007import org.openflow.types.IPv4;
8import org.openflow.types.IPv6;
Yotam Harchold7b84202013-07-26 16:08:10 -07009import org.openflow.types.IPv6FlowLabel;
Yotam Harchold7b84202013-07-26 16:08:10 -070010import 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;
Andreas Wundsam40e14f72013-05-06 14:49:08 -070014import org.openflow.types.OFPort;
Yotam Harchold7b84202013-07-26 16:08:10 -070015import org.openflow.types.OFValueType;
16import org.openflow.types.TransportPort;
Andreas Wundsam40e14f72013-05-06 14:49:08 -070017import org.openflow.types.VlanPcp;
18import org.openflow.types.VlanVid;
Andreas Wundsam40e14f72013-05-06 14:49:08 -070019
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070020public class MatchField<F extends OFValueType<F>> {
Andreas Wundsam40e14f72013-05-06 14:49:08 -070021 private final String name;
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070022 public final MatchFields id;
Andreas Wundsam40e14f72013-05-06 14:49:08 -070023
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070024 private MatchField(final String name, final MatchFields id) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -070025 this.name = name;
26 this.id = id;
27 }
28
Yotam Harchold7b84202013-07-26 16:08:10 -070029 public final static MatchField<OFPort> IN_PORT =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070030 new MatchField<OFPort>("in_port", MatchFields.IN_PORT);
Yotam Harchold7b84202013-07-26 16:08:10 -070031 public final static MatchField<OFPort> IN_PHY_PORT =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070032 new MatchField<OFPort>("in_phy_port", MatchFields.PHYSICAL_PORT);
Yotam Harchold7b84202013-07-26 16:08:10 -070033 public final static MatchField<OFPort> METADATA =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070034 new MatchField<OFPort>("metadata", MatchFields.METADATA);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070035
Yotam Harcholfb4bfb92013-08-01 14:02:04 -070036 public final static MatchField<MacAddress> ETH_DST =
37 new MatchField<MacAddress>("eth_dst", MatchFields.ETH_DST);
38 public final static MatchField<MacAddress> ETH_SRC =
39 new MatchField<MacAddress>("eth_src", MatchFields.ETH_SRC);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070040
Yotam Harchold7b84202013-07-26 16:08:10 -070041 public final static MatchField<EthType> ETH_TYPE =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070042 new MatchField<EthType>("eth_type", MatchFields.ETH_TYPE);
Yotam Harchol161a5d52013-07-25 17:17:48 -070043
Yotam Harcholfb4bfb92013-08-01 14:02:04 -070044 public final static MatchField<VlanVid> VLAN_VID =
45 new MatchField<VlanVid>("vlan_vid", MatchFields.VLAN_VID);
Yotam Harchold7b84202013-07-26 16:08:10 -070046 public final static MatchField<VlanPcp> VLAN_PCP =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070047 new MatchField<VlanPcp>("vlan_pcp", MatchFields.VLAN_PCP);
Yotam Harchol161a5d52013-07-25 17:17:48 -070048
49
Yotam Harchold7b84202013-07-26 16:08:10 -070050 public final static MatchField<IpDscp> IP_DSCP =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070051 new MatchField<IpDscp>("ip_dscp", MatchFields.IP_DSCP);
Yotam Harchold7b84202013-07-26 16:08:10 -070052 public final static MatchField<IpEcn> IP_ECN =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070053 new MatchField<IpEcn>("ip_dscp", MatchFields.IP_ECN);
Yotam Harchold7b84202013-07-26 16:08:10 -070054 public final static MatchField<IpProtocol> IP_PROTO =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070055 new MatchField<IpProtocol>("ip_proto", MatchFields.IP_PROTO);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070056
Yotam Harcholfb4bfb92013-08-01 14:02:04 -070057 public final static MatchField<IPv4> IPV4_SRC =
58 new MatchField<IPv4>("ipv4_src", MatchFields.IPV4_SRC);
59 public final static MatchField<IPv4> IPV4_DST =
60 new MatchField<IPv4>("ipv4_dst", MatchFields.IPV4_DST);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070061
Yotam Harchold7b84202013-07-26 16:08:10 -070062 public final static MatchField<TransportPort> TCP_SRC = new MatchField<TransportPort>(
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070063 "tcp_src", MatchFields.TCP_SRC);
Yotam Harchold7b84202013-07-26 16:08:10 -070064 public final static MatchField<TransportPort> TCP_DST = new MatchField<TransportPort>(
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070065 "tcp_dst", MatchFields.TCP_DST);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070066
Yotam Harchold7b84202013-07-26 16:08:10 -070067 public final static MatchField<TransportPort> UDP_SRC = new MatchField<TransportPort>(
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070068 "udp_src", MatchFields.UDP_SRC);
Yotam Harchold7b84202013-07-26 16:08:10 -070069 public final static MatchField<TransportPort> UDP_DST = new MatchField<TransportPort>(
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070070 "udp_dst", MatchFields.UDP_DST);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070071
Yotam Harchold7b84202013-07-26 16:08:10 -070072 public final static MatchField<TransportPort> SCTP_SRC = new MatchField<TransportPort>(
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070073 "sctp_src", MatchFields.SCTP_SRC);
Yotam Harchold7b84202013-07-26 16:08:10 -070074 public final static MatchField<TransportPort> SCTP_DST = new MatchField<TransportPort>(
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070075 "sctp_dst", MatchFields.SCTP_DST);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070076
Yotam Harchold7b84202013-07-26 16:08:10 -070077 public final static MatchField<ICMPv4Type> ICMPV4_TYPE = new MatchField<ICMPv4Type>(
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070078 "icmpv4_src", MatchFields.ICMPV4_TYPE);
Yotam Harchold7b84202013-07-26 16:08:10 -070079 public final static MatchField<ICMPv4Code> ICMPV4_CODE = new MatchField<ICMPv4Code>(
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070080 "icmpv4_dst", MatchFields.ICMPV4_CODE);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070081
Yotam Harchold7b84202013-07-26 16:08:10 -070082 public final static MatchField<ArpOpcode> ARP_OP = new MatchField<ArpOpcode>(
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070083 "arp_op", MatchFields.ARP_OP);
Yotam Harcholfb4bfb92013-08-01 14:02:04 -070084 public final static MatchField<IPv4> ARP_SPA =
85 new MatchField<IPv4>("arp_spa", MatchFields.ARP_SPA);
86 public final static MatchField<IPv4> ARP_TPA =
87 new MatchField<IPv4>("arp_tpa", MatchFields.ARP_TPA);
88 public final static MatchField<MacAddress> ARP_SHA =
89 new MatchField<MacAddress>("arp_sha", MatchFields.ARP_SHA);
90 public final static MatchField<MacAddress> ARP_THA =
91 new MatchField<MacAddress>("arp_tha", MatchFields.ARP_THA);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070092
Yotam Harcholfb4bfb92013-08-01 14:02:04 -070093 public final static MatchField<IPv6> IPV6_SRC =
94 new MatchField<IPv6>("ipv6_src", MatchFields.IPV6_SRC);
95 public final static MatchField<IPv6> IPV6_DST =
96 new MatchField<IPv6>("ipv6_dst", MatchFields.IPV6_DST);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070097
Yotam Harcholfb4bfb92013-08-01 14:02:04 -070098 public final static MatchField<IPv6FlowLabel> IPV6_FLABEL =
99 new MatchField<IPv6FlowLabel>("ipv6_flabel", MatchFields.IPV6_FLOWLABEL);
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700100
101 public String getName() {
102 return name;
103 }
104
105}