/*
* bitlet - Simple bittorrent library
* Copyright (C) 2008 Alessandro Bahgat Shehata, Daniele Castagna
*
* 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.bitlet.wetorrent.peer.message;
public class Message {
public static final byte KEEP_ALIVE = -1;
public static final byte CHOKE = 0;
public static final byte UNCHOKE = 1;
public static final byte INTERESTED = 2;
public static final byte NOT_INTERESTED = 3;
public static final byte HAVE = 4;
public static final byte BITFIELD = 5;
public static final byte REQUEST = 6;
public static final byte PIECE = 7;
public static final byte CANCEL = 8;
private byte type;
private byte[] payload;
public Message(byte type, byte[] payload) {
this.type = type;
}
public byte[] getPayload() {
return payload;
}
public byte getType() {
return type;
}
public void setPayload(byte[] payload) {
this.payload = payload;
}
}