1 /* 2 * XNap - A P2P framework and client. 3 * 4 * See the file AUTHORS for copyright information. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 */ 19 20 package org.xnap.plugin.overnet.net.msg.client; 21 22 import org.apache.log4j.Logger; 23 import org.xnap.plugin.overnet.net.msg.core.Tags; 24 25 public class DownloadLinkMessage extends OvernetClientMessage 26 { 27 //--- Constant(s) --- 28 29 public static final byte TYPE = (byte)226; 30 31 32 //--- Data field(s) --- 33 34 private static Logger logger = Logger.getLogger(DownloadLinkMessage.class); 35 36 //--- Constructor(s) --- 37 38 public DownloadLinkMessage(byte[] hash, int filesize, String filename) 39 { 40 super(TYPE); 41 put(hash); 42 // not existing ip 43 putInt(0); 44 putShort((short)0); 45 // two tags 46 putInt(2); 47 // first tag filesize 48 put(Tags.TAGTYPE_INT); 49 putShort((short)1); // Tag name len = 1 => special tag (abbreviation) 50 put(Tags.TAGNAME_FILESIZE_SHORT.getBytes()[0]); 51 putInt(filesize); // filesize integer value 52 // second tag filename 53 put (Tags.TAGTYPE_STRING); 54 putShort((short)1); // Tag name len = 1 => special tag (abbreviation) 55 put(Tags.TAGNAME_FILENAME_SHORT.getBytes()[0]); 56 putString(filename); 57 } 58 59 //--- Method(s) --- 60 61 62 }