package org.kne.cloud.network.klalb;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class RSTPacket extends KLALBPacket implements PortPacket{
	private int sport,dport;
	public RSTPacket(int sport,int dport) {
		super(RST);
		this.sport=sport;
		this.dport=dport;
	}

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

	public RSTPacket() {
		super(RST);
	}

	public int getSport() {
		return sport;
	}

	public int getDport() {
		return dport;
	}

	@Override
	public String toString() {
		return "RST "+sport+"->"+dport;
	}

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

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

}
