Phaneendra Manda
Committed by Thomas Vachuska

[ONOS-3833] Five tuple interface added

Change-Id: I6ba334a8a88591833c2fd404c3f4e9620f199338
1 +/*
2 + * Copyright 2016 Open Networking Laboratory
3 + *
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 + */
16 +package org.onosproject.vtnrsc;
17 +
18 +import org.onlab.packet.IpAddress;
19 +import org.onosproject.net.PortNumber;
20 +
21 +/**
22 + * Abstraction of an entity to provide five tuple information from packet.
23 + * Five tuple means source ip address, destination ip address, source port number,
24 + * destination port number and protocol of the packet.
25 + */
26 +public interface FiveTuple {
27 +
28 + /**
29 + * Returns the protocol value.
30 + *
31 + * @return protocol value IPv4.PROTOCOL_TCP(0x06), IPv4.PROTOCOL_UDP(0x11), IPv4.PROTOCOL_ICMP(0x01)
32 + */
33 + byte protocol();
34 +
35 + /**
36 + * Returns source ip address.
37 + *
38 + * @return ipSrc
39 + */
40 + IpAddress ipSrc();
41 +
42 + /**
43 + * Returns destination ip address.
44 + *
45 + * @return ipDst
46 + */
47 + IpAddress ipDst();
48 +
49 + /**
50 + * Returns source port.
51 + *
52 + * @return portSrc
53 + */
54 + PortNumber portSrc();
55 +
56 + /**
57 + * Returns destination port.
58 + *
59 + * @return portDst
60 + */
61 + PortNumber portDst();
62 +
63 + /**
64 + * Returns the tenant id.
65 + *
66 + * @return tenantId
67 + */
68 + TenantId tenantId();
69 +
70 + /**
71 + * Builder class for Five tuple info.
72 + */
73 + interface Builder {
74 +
75 + /**
76 + * Assign the source ip address to this object.
77 + *
78 + * @param ipSrc source ip address
79 + * @return this the builder object
80 + */
81 + Builder setIpSrc(IpAddress ipSrc);
82 +
83 + /**
84 + * Assign the destination ip address to this object.
85 + *
86 + * @param ipDst destination ip address
87 + * @return this the builder object
88 + */
89 + Builder setIpDst(IpAddress ipDst);
90 +
91 + /**
92 + * Assign the source port to this object.
93 + *
94 + * @param portSrc source port
95 + * @return this the builder object
96 + */
97 + Builder setPortSrc(PortNumber portSrc);
98 +
99 + /**
100 + * Assign the destination port to this object.
101 + *
102 + * @param portDst destination port
103 + * @return this the builder object
104 + */
105 + Builder setPortDst(PortNumber portDst);
106 +
107 + /**
108 + * Assign the protocol to this object.
109 + *
110 + * @param protocol packet protocol
111 + * @return this the builder object
112 + */
113 + Builder setProtocol(byte protocol);
114 +
115 + /**
116 + * Assign the tenant id to this object.
117 + *
118 + * @param tenantId tenant id
119 + * @return this the builder object
120 + */
121 + Builder setTenantId(TenantId tenantId);
122 +
123 + /**
124 + * Builds a FiveTuple object.
125 + *
126 + * @return instance of FiveTuple
127 + */
128 + FiveTuple build();
129 + }
130 +}