blob: b6e8317bde3fc2394aa90459daab6ab0b16b6051 [file] [log] [blame]
Andreas Wundsam40e14f72013-05-06 14:49:08 -07001package org.openflow.protocol.match;
2
3import org.openflow.types.EthType;
4import org.openflow.types.IPv4;
5import org.openflow.types.IPv4WithMask;
6import org.openflow.types.IPv6;
7import org.openflow.types.IPv6WithMask;
8import org.openflow.types.IpProtocol;
9import org.openflow.types.MacAddress;
10import org.openflow.types.MacAddressWithMask;
11import org.openflow.types.OFPort;
12import org.openflow.types.U16;
13import org.openflow.types.U8;
14import org.openflow.types.VlanPcp;
15import org.openflow.types.VlanVid;
16import org.openflow.types.VlanVidWithMask.VlanVidWithMask;
17
18public class MatchField<F, M> {
19 private final String name;
20 public final int id;
21
22 public MatchField(final String name) {
23 this.name = name;
24 this.id = -1;
25 }
26
27 public MatchField(final String name, final int id) {
28 this.name = name;
29 this.id = id;
30 }
31
32 public final static MatchField<OFPort, NoMatch> IN_PORT =
33 new MatchField<OFPort, NoMatch>("in_port", 0);
34 public final static MatchField<OFPort, NoMatch> IN_PHY_PORT =
35 new MatchField<OFPort, NoMatch>("in_phy_port");
36 public final static MatchField<OFPort, NoMatch> METADATA =
37 new MatchField<OFPort, NoMatch>("metadata");
38
39 public final static MatchField<MacAddress, MacAddressWithMask> ETH_DST =
40 new MatchField<MacAddress, MacAddressWithMask>("eth_dst");
41 public final static MatchField<MacAddress, MacAddressWithMask> ETH_SRC =
42 new MatchField<MacAddress, MacAddressWithMask>("eth_src", 1);
43
44 public final static MatchField<EthType, NoMatch> ETH_TYPE =
45 new MatchField<EthType, NoMatch>("eth_type");
46 public final static MatchField<VlanVid, VlanVidWithMask> VLAN_VID =
47 new MatchField<VlanVid, VlanVidWithMask>("vlan_vid");
48 public final static MatchField<VlanPcp, NoMatch> VLAN_PCP =
49 new MatchField<VlanPcp, NoMatch>("vlan_pcp");
50
51 public final static MatchField<NoMatch, NoMatch> IP_DSCP =
52 new MatchField<NoMatch, NoMatch>("ip_dscp");
53 public final static MatchField<NoMatch, NoMatch> IP_ECN =
54 new MatchField<NoMatch, NoMatch>("ip_dscp");
55 public final static MatchField<IpProtocol, NoMatch> IP_PROTO =
56 new MatchField<IpProtocol, NoMatch>("ip_proto");
57
58 public final static MatchField<IPv4, IPv4WithMask> IPV4_SRC =
59 new MatchField<IPv4, IPv4WithMask>("ipv4_src");
60 public final static MatchField<IPv4, IPv4WithMask> IPV4_DST =
61 new MatchField<IPv4, IPv4WithMask>("ipv4_dst");
62
63 public final static MatchField<U16, NoMatch> TCP_SRC = new MatchField<U16, NoMatch>(
64 "tcp_src");
65 public final static MatchField<U16, NoMatch> TCP_DST = new MatchField<U16, NoMatch>(
66 "tcp_dst");
67
68 public final static MatchField<U16, NoMatch> UDP_SRC = new MatchField<U16, NoMatch>(
69 "udp_src");
70 public final static MatchField<U16, NoMatch> UDP_DST = new MatchField<U16, NoMatch>(
71 "udp_dst");
72
73 public final static MatchField<U16, NoMatch> SCTP_SRC = new MatchField<U16, NoMatch>(
74 "sctp_src");
75 public final static MatchField<U16, NoMatch> SCTP_DST = new MatchField<U16, NoMatch>(
76 "sctp_dst");
77
78 public final static MatchField<U8, NoMatch> ICMPV4_TYPE = new MatchField<U8, NoMatch>(
79 "icmpv4_src");
80 public final static MatchField<U8, NoMatch> ICMPV4_CODE = new MatchField<U8, NoMatch>(
81 "icmpv4_dst");
82
83 public final static MatchField<U16, NoMatch> ARP_OP = new MatchField<U16, NoMatch>(
84 "arp_op");
85 public final static MatchField<IPv4, IPv4WithMask> ARP_SPA =
86 new MatchField<IPv4, IPv4WithMask>("arp_spa");
87 public final static MatchField<IPv4, IPv4WithMask> ARP_TPA =
88 new MatchField<IPv4, IPv4WithMask>("arp_tpa");
89 public final static MatchField<MacAddress, MacAddressWithMask> ARP_SHA =
90 new MatchField<MacAddress, MacAddressWithMask>("arp_sha");
91 public final static MatchField<MacAddress, MacAddressWithMask> ARP_THA =
92 new MatchField<MacAddress, MacAddressWithMask>("arp_tha");
93
94 public final static MatchField<IPv6, IPv6WithMask> IPV6_SRC =
95 new MatchField<IPv6, IPv6WithMask>("ipv6_src");
96 public final static MatchField<IPv6, IPv6WithMask> IPV6_DST =
97 new MatchField<IPv6, IPv6WithMask>("ipv6_dst");
98
99 public final static MatchField<U8, IPv6WithMask> IPV6_FLABEL =
100 new MatchField<U8, IPv6WithMask>("ipv6_flabel");
101
102 public String getName() {
103 return name;
104 }
105
106}