blob: 10d47fac40188d80cdeb80e22ea15b33a77233cf [file] [log] [blame]
Phaneendra Mandaeed93192016-02-05 20:30:17 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Phaneendra Mandaeed93192016-02-05 20:30:17 +05303 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.vtnrsc;
17
18import org.onlab.packet.IpAddress;
Phaneendra Mandab212bc92016-07-08 16:50:11 +053019import org.onlab.packet.MacAddress;
Phaneendra Mandaeed93192016-02-05 20:30:17 +053020import org.onosproject.net.PortNumber;
21
22/**
23 * Abstraction of an entity to provide five tuple information from packet.
24 * Five tuple means source ip address, destination ip address, source port number,
25 * destination port number and protocol of the packet.
26 */
27public interface FiveTuple {
28
29 /**
30 * Returns the protocol value.
31 *
32 * @return protocol value IPv4.PROTOCOL_TCP(0x06), IPv4.PROTOCOL_UDP(0x11), IPv4.PROTOCOL_ICMP(0x01)
33 */
34 byte protocol();
35
36 /**
37 * Returns source ip address.
38 *
39 * @return ipSrc
40 */
41 IpAddress ipSrc();
42
43 /**
44 * Returns destination ip address.
45 *
46 * @return ipDst
47 */
48 IpAddress ipDst();
49
50 /**
51 * Returns source port.
52 *
53 * @return portSrc
54 */
55 PortNumber portSrc();
56
57 /**
58 * Returns destination port.
59 *
60 * @return portDst
61 */
62 PortNumber portDst();
63
64 /**
Phaneendra Mandab212bc92016-07-08 16:50:11 +053065 * Returns source mac.
66 *
67 * @return srcMac
68 */
69 MacAddress macSrc();
70
71 /**
72 * Returns destination mac.
73 *
74 * @return dstMac
75 */
76 MacAddress macDst();
77
78 /**
Phaneendra Mandaeed93192016-02-05 20:30:17 +053079 * Returns the tenant id.
80 *
81 * @return tenantId
82 */
83 TenantId tenantId();
84
85 /**
86 * Builder class for Five tuple info.
87 */
88 interface Builder {
89
90 /**
91 * Assign the source ip address to this object.
92 *
93 * @param ipSrc source ip address
94 * @return this the builder object
95 */
96 Builder setIpSrc(IpAddress ipSrc);
97
98 /**
99 * Assign the destination ip address to this object.
100 *
101 * @param ipDst destination ip address
102 * @return this the builder object
103 */
104 Builder setIpDst(IpAddress ipDst);
105
106 /**
107 * Assign the source port to this object.
108 *
109 * @param portSrc source port
110 * @return this the builder object
111 */
112 Builder setPortSrc(PortNumber portSrc);
113
114 /**
115 * Assign the destination port to this object.
116 *
117 * @param portDst destination port
118 * @return this the builder object
119 */
120 Builder setPortDst(PortNumber portDst);
121
122 /**
Phaneendra Mandab212bc92016-07-08 16:50:11 +0530123 * Assign the source mac address to this object.
124 *
125 * @param macSrc source mac address
126 * @return this the builder object
127 */
128 Builder setMacSrc(MacAddress macSrc);
129
130 /**
131 * Assign the destination mac address to this object.
132 *
133 * @param macDst destination mac address
134 * @return this the builder object
135 */
136 Builder setMacDst(MacAddress macDst);
137
138 /**
Phaneendra Mandaeed93192016-02-05 20:30:17 +0530139 * Assign the protocol to this object.
140 *
141 * @param protocol packet protocol
142 * @return this the builder object
143 */
144 Builder setProtocol(byte protocol);
145
146 /**
147 * Assign the tenant id to this object.
148 *
149 * @param tenantId tenant id
150 * @return this the builder object
151 */
152 Builder setTenantId(TenantId tenantId);
153
154 /**
155 * Builds a FiveTuple object.
156 *
157 * @return instance of FiveTuple
158 */
159 FiveTuple build();
160 }
161}