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; |
| 7 | import org.openflow.types.IPv4WithMask; |
| 8 | import org.openflow.types.IPv6FlowLabel; |
| 9 | import org.openflow.types.IPv6WithMask; |
| 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; |
Yotam Harchol | 161a5d5 | 2013-07-25 17:17:48 -0700 | [diff] [blame] | 14 | import org.openflow.types.Masked; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 15 | import org.openflow.types.OFPort; |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 16 | import org.openflow.types.OFValueType; |
| 17 | import org.openflow.types.TransportPort; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 18 | import org.openflow.types.VlanPcp; |
| 19 | import org.openflow.types.VlanVid; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 20 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 21 | public class MatchField<F extends OFValueType> { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 22 | 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 Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 35 | 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 Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 41 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 42 | 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 Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 46 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 47 | public final static MatchField<EthType> ETH_TYPE = |
| 48 | new MatchField<EthType>("eth_type"); |
Yotam Harchol | 161a5d5 | 2013-07-25 17:17:48 -0700 | [diff] [blame] | 49 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 50 | 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 Harchol | 161a5d5 | 2013-07-25 17:17:48 -0700 | [diff] [blame] | 54 | |
| 55 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 56 | 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 Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 62 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 63 | 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 Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 67 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 68 | public final static MatchField<TransportPort> TCP_SRC = new MatchField<TransportPort>( |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 69 | "tcp_src"); |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 70 | public final static MatchField<TransportPort> TCP_DST = new MatchField<TransportPort>( |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 71 | "tcp_dst"); |
| 72 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 73 | public final static MatchField<TransportPort> UDP_SRC = new MatchField<TransportPort>( |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 74 | "udp_src"); |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 75 | public final static MatchField<TransportPort> UDP_DST = new MatchField<TransportPort>( |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 76 | "udp_dst"); |
| 77 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 78 | public final static MatchField<TransportPort> SCTP_SRC = new MatchField<TransportPort>( |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 79 | "sctp_src"); |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 80 | public final static MatchField<TransportPort> SCTP_DST = new MatchField<TransportPort>( |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 81 | "sctp_dst"); |
| 82 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 83 | public final static MatchField<ICMPv4Type> ICMPV4_TYPE = new MatchField<ICMPv4Type>( |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 84 | "icmpv4_src"); |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 85 | public final static MatchField<ICMPv4Code> ICMPV4_CODE = new MatchField<ICMPv4Code>( |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 86 | "icmpv4_dst"); |
| 87 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 88 | public final static MatchField<ArpOpcode> ARP_OP = new MatchField<ArpOpcode>( |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 89 | "arp_op"); |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 90 | 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 Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 98 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 99 | 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 Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 103 | |
Yotam Harchol | d7b8420 | 2013-07-26 16:08:10 -0700 | [diff] [blame^] | 104 | public final static MatchField<Masked<IPv6FlowLabel>> IPV6_FLABEL = |
| 105 | new MatchField<Masked<IPv6FlowLabel>>("ipv6_flabel"); |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 106 | |
| 107 | public String getName() { |
| 108 | return name; |
| 109 | } |
| 110 | |
| 111 | } |