package org.kne.cloud.network.klalb;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;

public class NACKTPacket extends KLALBPacket implements PortPacket{
	private int sport,dport;
	private long number;


	public NACKTPacket(int sport,int dport,long number) {
		super(NACKT);
		this.sport=sport;
		this.dport=dport;
		this.number=number;
	}

	public NACKTPacket() {
		super(NACKT);
	}

	@Override
	public String toString() {
		return "NACKT "+sport+"->"+dport+" "+number+"[]";
	}

	public int getSport() {
		return sport;
	}

	@Override
	public long getLength() {
		return super.getLength()+17;
	}

	public int getDport() {
		return dport;
	}

	public long getNumber() {
		return number;
	}


	@Override
	protected void writeToStream(DataOutput dto) throws IOException {
		super.writeToStream(dto);
		dto.writeInt(sport);
		dto.writeInt(dport);
		dto.writeLong(number);
	}

	@Override
	protected void readFromStream(DataInput din) throws IOException {
		super.readFromStream(din);
		sport=din.readInt();
		dport=din.readInt();
		number=din.readLong();
	}

}
