blob: 0a6caff53d06e539c160218ccc145577b0244550 [file] [log] [blame]
Toshio Koidea03915e2014-07-01 18:39:52 -07001package net.onrc.onos.core.matchaction.match;
2
3import net.floodlightcontroller.util.MACAddress;
4import net.onrc.onos.core.util.IPv4;
5
6/**
7 * A match object (traffic specifier) for packet nodes, flow-paths and intents.
8 * <p>
9 * This class does not have a switch ID and a port number. They are handled by
10 * MatchAction, IFlow or Intent class.
11 */
12public class PacketMatch implements IMatch {
13
14 // Match fields
15 protected MACAddress srcMacAddress;
16 protected MACAddress dstMacAddress;
17 protected IPv4 srcIpAddress;
18 protected IPv4 dstIpAddress;
19
20 /**
21 * Constructor.
22 */
23 public PacketMatch() {
24 this(null, null, null, null);
25 }
26
27 /**
28 * Constructor.
29 *
30 * @param srcMac Source Host MAC Address
31 * @param dstMac Destination Host MAC Address
32 * @param srcIp Source IP Address
33 * @param dstIp Destination IP Address
34 */
35 public PacketMatch(MACAddress srcMac, MACAddress dstMac,
36 IPv4 srcIp, IPv4 dstIp) {
37 this.srcMacAddress = srcMac;
38 this.dstMacAddress = dstMac;
39 this.srcIpAddress = srcIp;
40 this.dstIpAddress = dstIp;
41 }
42
43 /**
44 * Gets the source host MAC address.
45 *
46 * @return The source host MAC address.
47 */
48 public MACAddress getSrcMacAddress() {
49 return srcMacAddress;
50 }
51
52 /**
53 * Gets the destination host MAC address.
54 *
55 * @return The destination host MAC address.
56 */
57 public MACAddress getDstMacAddress() {
58 return dstMacAddress;
59 }
60
61 /**
62 * Gets the source host IP address.
63 *
64 * @return The source host IP address.
65 */
66 public IPv4 getSrcIpAddress() {
67 return srcIpAddress;
68 }
69
70 /**
71 * Gets the destination host IP address.
72 *
73 * @return The destination host IP address.
74 */
75 public IPv4 getDstIpAddress() {
76 return dstIpAddress;
77 }
78}