Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 1 | package org.openflow.protocol.match; |
| 2 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 3 | import org.openflow.types.ArpOpcode; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 4 | import org.openflow.types.EthType; |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 5 | import org.openflow.types.ICMPv4Code; |
| 6 | import org.openflow.types.ICMPv4Type; |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 7 | import org.openflow.types.IPv4; |
| 8 | import org.openflow.types.IPv6; |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 9 | import org.openflow.types.IPv6FlowLabel; |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 10 | import org.openflow.types.IpDscp; |
| 11 | import org.openflow.types.IpEcn; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 12 | import org.openflow.types.IpProtocol; |
| 13 | import org.openflow.types.MacAddress; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 14 | import org.openflow.types.OFPort; |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 15 | import org.openflow.types.OFValueType; |
| 16 | import org.openflow.types.TransportPort; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 17 | import org.openflow.types.VlanPcp; |
| 18 | import org.openflow.types.VlanVid; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 19 | |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 20 | public class MatchField<F extends OFValueType<F>> { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 21 | private final String name; |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 22 | public final MatchFields id; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 23 | |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 24 | private MatchField(final String name, final MatchFields id) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 25 | this.name = name; |
| 26 | this.id = id; |
| 27 | } |
| 28 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 29 | public final static MatchField<OFPort> IN_PORT = |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 30 | new MatchField<OFPort>("in_port", MatchFields.IN_PORT); |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 31 | public final static MatchField<OFPort> IN_PHY_PORT = |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 32 | new MatchField<OFPort>("in_phy_port", MatchFields.PHYSICAL_PORT); |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 33 | public final static MatchField<OFPort> METADATA = |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 34 | new MatchField<OFPort>("metadata", MatchFields.METADATA); |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 35 | |
Yotam Harchol | fb4bfb9 | 2013-08-01 14:02:04 -0700 | [diff] [blame^] | 36 | 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 Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 40 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 41 | public final static MatchField<EthType> ETH_TYPE = |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 42 | new MatchField<EthType>("eth_type", MatchFields.ETH_TYPE); |
Yotam Harchol | 161a5d5 | 2013-07-25 17:17:48 -0700 | [diff] [blame] | 43 | |
Yotam Harchol | fb4bfb9 | 2013-08-01 14:02:04 -0700 | [diff] [blame^] | 44 | public final static MatchField<VlanVid> VLAN_VID = |
| 45 | new MatchField<VlanVid>("vlan_vid", MatchFields.VLAN_VID); |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 46 | public final static MatchField<VlanPcp> VLAN_PCP = |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 47 | new MatchField<VlanPcp>("vlan_pcp", MatchFields.VLAN_PCP); |
Yotam Harchol | 161a5d5 | 2013-07-25 17:17:48 -0700 | [diff] [blame] | 48 | |
| 49 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 50 | public final static MatchField<IpDscp> IP_DSCP = |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 51 | new MatchField<IpDscp>("ip_dscp", MatchFields.IP_DSCP); |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 52 | public final static MatchField<IpEcn> IP_ECN = |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 53 | new MatchField<IpEcn>("ip_dscp", MatchFields.IP_ECN); |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 54 | public final static MatchField<IpProtocol> IP_PROTO = |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 55 | new MatchField<IpProtocol>("ip_proto", MatchFields.IP_PROTO); |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 56 | |
Yotam Harchol | fb4bfb9 | 2013-08-01 14:02:04 -0700 | [diff] [blame^] | 57 | 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 Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 61 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 62 | public final static MatchField<TransportPort> TCP_SRC = new MatchField<TransportPort>( |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 63 | "tcp_src", MatchFields.TCP_SRC); |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 64 | public final static MatchField<TransportPort> TCP_DST = new MatchField<TransportPort>( |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 65 | "tcp_dst", MatchFields.TCP_DST); |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 66 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 67 | public final static MatchField<TransportPort> UDP_SRC = new MatchField<TransportPort>( |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 68 | "udp_src", MatchFields.UDP_SRC); |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 69 | public final static MatchField<TransportPort> UDP_DST = new MatchField<TransportPort>( |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 70 | "udp_dst", MatchFields.UDP_DST); |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 71 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 72 | public final static MatchField<TransportPort> SCTP_SRC = new MatchField<TransportPort>( |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 73 | "sctp_src", MatchFields.SCTP_SRC); |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 74 | public final static MatchField<TransportPort> SCTP_DST = new MatchField<TransportPort>( |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 75 | "sctp_dst", MatchFields.SCTP_DST); |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 76 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 77 | public final static MatchField<ICMPv4Type> ICMPV4_TYPE = new MatchField<ICMPv4Type>( |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 78 | "icmpv4_src", MatchFields.ICMPV4_TYPE); |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 79 | public final static MatchField<ICMPv4Code> ICMPV4_CODE = new MatchField<ICMPv4Code>( |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 80 | "icmpv4_dst", MatchFields.ICMPV4_CODE); |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 81 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame] | 82 | public final static MatchField<ArpOpcode> ARP_OP = new MatchField<ArpOpcode>( |
Yotam Harchol | 5c9d6f4 | 2013-08-01 11:09:20 -0700 | [diff] [blame] | 83 | "arp_op", MatchFields.ARP_OP); |
Yotam Harchol | fb4bfb9 | 2013-08-01 14:02:04 -0700 | [diff] [blame^] | 84 | 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 Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 92 | |
Yotam Harchol | fb4bfb9 | 2013-08-01 14:02:04 -0700 | [diff] [blame^] | 93 | 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 Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 97 | |
Yotam Harchol | fb4bfb9 | 2013-08-01 14:02:04 -0700 | [diff] [blame^] | 98 | public final static MatchField<IPv6FlowLabel> IPV6_FLABEL = |
| 99 | new MatchField<IPv6FlowLabel>("ipv6_flabel", MatchFields.IPV6_FLOWLABEL); |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 100 | |
| 101 | public String getName() { |
| 102 | return name; |
| 103 | } |
| 104 | |
| 105 | } |