00001 /* 00002 * $Id: gnutella.h,v 1.7 2005/07/01 09:35:35 daichik Exp $ 00003 * 00004 * Copyright (c) 2001-2003, Raphael Manfredi 00005 * 00006 *---------------------------------------------------------------------- 00007 * This file is part of gtk-gnutella. 00008 * 00009 * gtk-gnutella is free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * gtk-gnutella is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with gtk-gnutella; if not, write to the Free Software 00021 * Foundation, Inc.: 00022 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 *---------------------------------------------------------------------- 00024 */ 00025 00026 #ifndef _core_gnutella_h_ 00027 #define _core_gnutella_h_ 00028 00029 #include "if/core/gnutella.h" 00030 00031 /* 00032 * Constants 00033 */ 00034 00035 #define GTA_MSGV_QRP_RESET 0x00 00036 #define GTA_MSGV_QRP_PATCH 0x01 00037 00038 /* 00039 * Structures 00040 */ 00041 00042 #if !defined(__GNUC__) && !defined(__attribute__) 00043 #define __attribute__(p) 00044 #endif 00045 00046 /* Messages structures */ 00047 00048 struct gnutella_msg_init { 00049 struct gnutella_header header; 00051 } __attribute__((__packed__)); 00052 00053 struct gnutella_init_response { 00054 guchar host_port[2]; 00055 guchar host_ip[4]; 00056 guchar files_count[4]; 00057 guchar kbytes_count[4]; 00058 } __attribute__((__packed__)); 00059 00060 struct gnutella_msg_init_response { 00061 struct gnutella_header header; 00062 struct gnutella_init_response response; 00064 } __attribute__((__packed__)); 00065 00066 struct gnutella_search { 00067 guchar speed[2]; 00069 } __attribute__((__packed__)); 00070 00071 struct gnutella_search_results { 00072 guchar num_recs; 00073 guchar host_port[2]; 00074 guchar host_ip[4]; 00075 guchar host_speed[4]; 00076 /* record data follows */ 00077 00078 /* Last 16 bytes = client_id */ 00079 } __attribute__((__packed__)); 00080 00081 struct gnutella_msg_search { 00082 struct gnutella_header header; 00083 struct gnutella_search search; 00084 } __attribute__((__packed__)); 00085 00086 struct gnutella_push_request { 00087 guchar guid[16]; 00088 guchar file_id[4]; 00089 guchar host_ip[4]; 00090 guchar host_port[2]; 00091 } __attribute__((__packed__)); 00092 00093 struct gnutella_msg_push_request { 00094 struct gnutella_header header; 00095 struct gnutella_push_request request; 00097 } __attribute__((__packed__)); 00098 00099 struct gnutella_bye { 00100 guchar code[2]; 00102 } __attribute__((__packed__)); 00103 00104 struct gnutella_qrp_reset { 00105 guchar variant; 00106 guchar table_length[4]; 00107 guchar infinity; 00108 } __attribute__((__packed__)); 00109 00110 struct gnutella_msg_qrp_reset { 00111 struct gnutella_header header; 00112 struct gnutella_qrp_reset data; 00113 } __attribute__((__packed__)); 00114 00115 struct gnutella_qrp_patch { 00116 guchar variant; 00117 guchar seq_no; 00118 guchar seq_size; 00119 guchar compressor; 00120 guchar entry_bits; 00121 } __attribute__((__packed__)); 00122 00123 struct gnutella_msg_qrp_patch { 00124 struct gnutella_header header; 00125 struct gnutella_qrp_patch data; 00126 } __attribute__((__packed__)); 00127 00128 struct gnutella_vendor { 00129 guchar vendor[4]; 00130 guchar selector_id[2]; 00131 guchar version[2]; 00132 /* payload follows */ 00133 } __attribute__((__packed__)); 00134 00135 struct gnutella_msg_vendor { 00136 struct gnutella_header header; 00137 struct gnutella_vendor data; 00138 } __attribute__((__packed__)); 00139 00140 struct gnutella_msg_hsep_data { 00141 struct gnutella_header header; 00142 guchar triple[3 * sizeof(guint64)]; 00143 } __attribute__((__packed__)); 00144 00145 #endif /* _core_gnutella_h_ */ 00146 00147 /* vi: set ts=4 sw=4 cindent: */