blob: 071eaa09653e3c6e1c464e35547bbfd0ed3d5f41 [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;
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 Harchol5c9d6f42013-08-01 11:09:20 -070021public class MatchField<F extends OFValueType<F>> {
Andreas Wundsam40e14f72013-05-06 14:49:08 -070022 private final String name;
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070023 public final MatchFields id;
Andreas Wundsam40e14f72013-05-06 14:49:08 -070024
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070025 private MatchField(final String name, final MatchFields id) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -070026 this.name = name;
27 this.id = id;
28 }
29
Yotam Harchold7b84202013-07-26 16:08:10 -070030 public final static MatchField<OFPort> IN_PORT =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070031 new MatchField<OFPort>("in_port", MatchFields.IN_PORT);
Yotam Harchold7b84202013-07-26 16:08:10 -070032 public final static MatchField<OFPort> IN_PHY_PORT =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070033 new MatchField<OFPort>("in_phy_port", MatchFields.PHYSICAL_PORT);
Yotam Harchold7b84202013-07-26 16:08:10 -070034 public final static MatchField<OFPort> METADATA =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070035 new MatchField<OFPort>("metadata", MatchFields.METADATA);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070036
Yotam Harchold7b84202013-07-26 16:08:10 -070037 public final static MatchField<Masked<MacAddress>> ETH_DST =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070038 new MatchField<Masked<MacAddress>>("eth_dst", MatchFields.ETH_DST);
Yotam Harchold7b84202013-07-26 16:08:10 -070039 public final static MatchField<Masked<MacAddress>> ETH_SRC =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070040 new MatchField<Masked<MacAddress>>("eth_src", MatchFields.ETH_SRC);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070041
Yotam Harchold7b84202013-07-26 16:08:10 -070042 public final static MatchField<EthType> ETH_TYPE =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070043 new MatchField<EthType>("eth_type", MatchFields.ETH_TYPE);
Yotam Harchol161a5d52013-07-25 17:17:48 -070044
Yotam Harchold7b84202013-07-26 16:08:10 -070045 public final static MatchField<Masked<VlanVid>> VLAN_VID =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070046 new MatchField<Masked<VlanVid>>("vlan_vid", MatchFields.VLAN_VID);
Yotam Harchold7b84202013-07-26 16:08:10 -070047 public final static MatchField<VlanPcp> VLAN_PCP =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070048 new MatchField<VlanPcp>("vlan_pcp", MatchFields.VLAN_PCP);
Yotam Harchol161a5d52013-07-25 17:17:48 -070049
50
Yotam Harchold7b84202013-07-26 16:08:10 -070051 public final static MatchField<IpDscp> IP_DSCP =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070052 new MatchField<IpDscp>("ip_dscp", MatchFields.IP_DSCP);
Yotam Harchold7b84202013-07-26 16:08:10 -070053 public final static MatchField<IpEcn> IP_ECN =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070054 new MatchField<IpEcn>("ip_dscp", MatchFields.IP_ECN);
Yotam Harchold7b84202013-07-26 16:08:10 -070055 public final static MatchField<IpProtocol> IP_PROTO =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070056 new MatchField<IpProtocol>("ip_proto", MatchFields.IP_PROTO);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070057
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070058 public final static MatchField<Masked<IPv4>> IPV4_SRC =
59 new MatchField<Masked<IPv4>>("ipv4_src", MatchFields.IPV4_SRC);
60 public final static MatchField<Masked<IPv4>> IPV4_DST =
61 new MatchField<Masked<IPv4>>("ipv4_dst", MatchFields.IPV4_DST);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070062
Yotam Harchold7b84202013-07-26 16:08:10 -070063 public final static MatchField<TransportPort> TCP_SRC = new MatchField<TransportPort>(
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070064 "tcp_src", MatchFields.TCP_SRC);
Yotam Harchold7b84202013-07-26 16:08:10 -070065 public final static MatchField<TransportPort> TCP_DST = new MatchField<TransportPort>(
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070066 "tcp_dst", MatchFields.TCP_DST);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070067
Yotam Harchold7b84202013-07-26 16:08:10 -070068 public final static MatchField<TransportPort> UDP_SRC = new MatchField<TransportPort>(
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070069 "udp_src", MatchFields.UDP_SRC);
Yotam Harchold7b84202013-07-26 16:08:10 -070070 public final static MatchField<TransportPort> UDP_DST = new MatchField<TransportPort>(
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070071 "udp_dst", MatchFields.UDP_DST);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070072
Yotam Harchold7b84202013-07-26 16:08:10 -070073 public final static MatchField<TransportPort> SCTP_SRC = new MatchField<TransportPort>(
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070074 "sctp_src", MatchFields.SCTP_SRC);
Yotam Harchold7b84202013-07-26 16:08:10 -070075 public final static MatchField<TransportPort> SCTP_DST = new MatchField<TransportPort>(
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070076 "sctp_dst", MatchFields.SCTP_DST);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070077
Yotam Harchold7b84202013-07-26 16:08:10 -070078 public final static MatchField<ICMPv4Type> ICMPV4_TYPE = new MatchField<ICMPv4Type>(
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070079 "icmpv4_src", MatchFields.ICMPV4_TYPE);
Yotam Harchold7b84202013-07-26 16:08:10 -070080 public final static MatchField<ICMPv4Code> ICMPV4_CODE = new MatchField<ICMPv4Code>(
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070081 "icmpv4_dst", MatchFields.ICMPV4_CODE);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070082
Yotam Harchold7b84202013-07-26 16:08:10 -070083 public final static MatchField<ArpOpcode> ARP_OP = new MatchField<ArpOpcode>(
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070084 "arp_op", MatchFields.ARP_OP);
85 public final static MatchField<Masked<IPv4>> ARP_SPA =
86 new MatchField<Masked<IPv4>>("arp_spa", MatchFields.ARP_SPA);
87 public final static MatchField<Masked<IPv4>> ARP_TPA =
88 new MatchField<Masked<IPv4>>("arp_tpa", MatchFields.ARP_TPA);
Yotam Harchold7b84202013-07-26 16:08:10 -070089 public final static MatchField<Masked<MacAddress>> ARP_SHA =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070090 new MatchField<Masked<MacAddress>>("arp_sha", MatchFields.ARP_SHA);
Yotam Harchold7b84202013-07-26 16:08:10 -070091 public final static MatchField<Masked<MacAddress>> ARP_THA =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070092 new MatchField<Masked<MacAddress>>("arp_tha", MatchFields.ARP_THA);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070093
Yotam Harchol5c9d6f42013-08-01 11:09:20 -070094 public final static MatchField<Masked<IPv6>> IPV6_SRC =
95 new MatchField<Masked<IPv6>>("ipv6_src", MatchFields.IPV6_SRC);
96 public final static MatchField<Masked<IPv6>> IPV6_DST =
97 new MatchField<Masked<IPv6>>("ipv6_dst", MatchFields.IPV6_DST);
Andreas Wundsam40e14f72013-05-06 14:49:08 -070098
Yotam Harchold7b84202013-07-26 16:08:10 -070099 public final static MatchField<Masked<IPv6FlowLabel>> IPV6_FLABEL =
Yotam Harchol5c9d6f42013-08-01 11:09:20 -0700100 new MatchField<Masked<IPv6FlowLabel>>("ipv6_flabel", MatchFields.IPV6_FLOWLABEL);
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700101
102 public String getName() {
103 return name;
104 }
105
106}