package org.kne.cloud.network.ipv6;

import java.io.Serializable;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.util.Objects;

public class FlowSession implements Serializable{
	private IPv6Address srcAddr;
	private IPv6Address dstAddr;
	private int flowLabel;
	public FlowSession(IPv6Address srcAddr, IPv6Address dstAddr, int flowLabel) {
		super();
		this.srcAddr = srcAddr;
		this.dstAddr = dstAddr;
		this.flowLabel = flowLabel;
	}
	public IPv6Address getSrcAddr() {
		return srcAddr;
	}
	public IPv6Address getDstAddr() {
		return dstAddr;
	}
	public int getFlowLabel() {
		return flowLabel;
	}
	@Override
	public String toString() {
		return "FlowSession [srcAddr=" + srcAddr + ", dstAddr=" + dstAddr + ", flowLabel=" + flowLabel + "]";
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((dstAddr == null) ? 0 : dstAddr.hashCode());
		result = prime * result + flowLabel;
		result = prime * result + ((srcAddr == null) ? 0 : srcAddr.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		FlowSession other = (FlowSession) obj;
		if (dstAddr == null) {
			if (other.dstAddr != null)
				return false;
		} else if (!dstAddr.equals(other.dstAddr))
			return false;
		if (flowLabel != other.flowLabel)
			return false;
		if (srcAddr == null) {
			if (other.srcAddr != null)
				return false;
		} else if (!srcAddr.equals(other.srcAddr))
			return false;
		return true;
	}
	
}

