Phaneendra Manda
Committed by Thomas Vachuska

[ONOS-3833] Five tuple interface added

Change-Id: I6ba334a8a88591833c2fd404c3f4e9620f199338
/*
* Copyright 2016 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import org.onlab.packet.IpAddress;
import org.onosproject.net.PortNumber;
/**
* Abstraction of an entity to provide five tuple information from packet.
* Five tuple means source ip address, destination ip address, source port number,
* destination port number and protocol of the packet.
*/
public interface FiveTuple {
/**
* Returns the protocol value.
*
* @return protocol value IPv4.PROTOCOL_TCP(0x06), IPv4.PROTOCOL_UDP(0x11), IPv4.PROTOCOL_ICMP(0x01)
*/
byte protocol();
/**
* Returns source ip address.
*
* @return ipSrc
*/
IpAddress ipSrc();
/**
* Returns destination ip address.
*
* @return ipDst
*/
IpAddress ipDst();
/**
* Returns source port.
*
* @return portSrc
*/
PortNumber portSrc();
/**
* Returns destination port.
*
* @return portDst
*/
PortNumber portDst();
/**
* Returns the tenant id.
*
* @return tenantId
*/
TenantId tenantId();
/**
* Builder class for Five tuple info.
*/
interface Builder {
/**
* Assign the source ip address to this object.
*
* @param ipSrc source ip address
* @return this the builder object
*/
Builder setIpSrc(IpAddress ipSrc);
/**
* Assign the destination ip address to this object.
*
* @param ipDst destination ip address
* @return this the builder object
*/
Builder setIpDst(IpAddress ipDst);
/**
* Assign the source port to this object.
*
* @param portSrc source port
* @return this the builder object
*/
Builder setPortSrc(PortNumber portSrc);
/**
* Assign the destination port to this object.
*
* @param portDst destination port
* @return this the builder object
*/
Builder setPortDst(PortNumber portDst);
/**
* Assign the protocol to this object.
*
* @param protocol packet protocol
* @return this the builder object
*/
Builder setProtocol(byte protocol);
/**
* Assign the tenant id to this object.
*
* @param tenantId tenant id
* @return this the builder object
*/
Builder setTenantId(TenantId tenantId);
/**
* Builds a FiveTuple object.
*
* @return instance of FiveTuple
*/
FiveTuple build();
}
}