package org.kne.cloud.network.klalb;

import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;

public class PONGPacket extends KLALBPacket {
	
	private static final int HEADER_LENGTH=41;
	
	public long getTimepingsnd() {
		return klalbHeader.getLong(17);
	}

	public long getTimepingrcv() {
		return klalbHeader.getLong(25);
	}

	public long getTimepongsnd() {
		return klalbHeader.getLong(33);
	}

	public long getUpSpeed() {
		return klalbHeader.getLong(1);
	}

	public long getDownSpeed() {
		return klalbHeader.getLong(9);
	}


	@Override
	public long getTotalLength() {
		return HEADER_LENGTH;
	}
	
	public PONGPacket( long timepingsnd,long timepingrcv, long timepongsnd,long upSpeed,long downSpeed) {
		super(PONG,HEADER_LENGTH);
		klalbHeader.putLong(upSpeed);
		klalbHeader.putLong(downSpeed);
		klalbHeader.putLong(timepingsnd);
		klalbHeader.putLong(timepingrcv);
		klalbHeader.putLong(timepongsnd);
	}

	public PONGPacket(ByteBuffer bb) {
		super(bb,HEADER_LENGTH);
	}


	@Override
	public String toString() {
		return "PONG";
	}
}
