Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

extensions.h

Go to the documentation of this file.
00001 /*
00002  * $Id: extensions.h,v 1.16 2005/09/10 08:17:28 daichik Exp $
00003  *
00004  * Copyright (c) 2002-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 
00036 #ifndef _core_extensions_h_
00037 #define _core_extensions_h_
00038 
00039 #include <glib.h>
00040 
00045 typedef enum ext_type {
00046     EXT_UNKNOWN = 0,    
00047     EXT_XML,            
00048     EXT_HUGE,           
00049     EXT_GGEP,           
00050     EXT_NONE,           
00052     EXT_TYPE_COUNT
00053 } ext_type_t;
00054 
00059 typedef enum ext_token {
00060     EXT_T_UNKNOWN = 0,      
00061     EXT_T_URN_BITPRINT,     
00062     EXT_T_URN_SHA1,         
00063     EXT_T_URN_EMPTY,        
00064     EXT_T_XML,              
00065     EXT_T_UNKNOWN_GGEP,     
00066     EXT_T_OVERHEAD,         
00067     EXT_T_GGEP_LIME_XML,    
00068     EXT_T_GGEP_ALT,         
00069     EXT_T_GGEP_BH,          
00070     EXT_T_GGEP_CT,          
00071     EXT_T_GGEP_DU,          
00072     EXT_T_GGEP_GTKG_IPV6,   
00073     EXT_T_GGEP_GTKG_TLS,    
00074     EXT_T_GGEP_GTKGV1,      
00075     EXT_T_GGEP_GUE,         
00076     EXT_T_GGEP_H,           
00077     EXT_T_GGEP_HNAME,       
00078     EXT_T_GGEP_IP,          
00079     EXT_T_GGEP_IPP,         
00080     EXT_T_GGEP_LF,          
00081     EXT_T_GGEP_LOC,         
00082     EXT_T_GGEP_PATH,        
00083     EXT_T_GGEP_PHC,         
00084     EXT_T_GGEP_PUSH,        
00085     EXT_T_GGEP_SCP,         
00086     EXT_T_GGEP_T,           
00087     EXT_T_GGEP_UDPHC,       
00088     EXT_T_GGEP_UP,          
00089     EXT_T_GGEP_VC,          
00090     EXT_T_GGEP_u,           
00092     EXT_T_TOKEN_COUNT
00093 } ext_token_t;
00094 
00095 #define GGEP_NAME(x) ext_ggep_name(CAT2(EXT_T_GGEP_,x))
00096 #define GGEP_GTKG_NAME(x) ext_ggep_name(CAT2(EXT_T_GGEP_GTKG_,x))
00097 
00120 typedef struct extvec {
00121     const gchar *ext_name;  
00122     ext_token_t ext_token;  
00123     ext_type_t ext_type;    
00124     gpointer opaque;        
00125 } extvec_t;
00126 
00127 #define MAX_EXTVEC      32  
00129 /*
00130  * Public interface.
00131  */
00132 
00133 void ext_init(void);
00134 void ext_close(void);
00135 
00136 void ext_prepare(extvec_t *exv, gint exvcnt);
00137 gint ext_parse(gchar *buf, gint len, extvec_t *exv, gint exvcnt);
00138 void ext_reset(extvec_t *exv, gint exvcnt);
00139 
00140 gboolean ext_is_printable(const extvec_t *e);
00141 gboolean ext_is_ascii(const extvec_t *e);
00142 gboolean ext_has_ascii_word(const extvec_t *e);
00143 
00144 void ext_dump(FILE *fd, const extvec_t *extvec, gint extcnt,
00145     const gchar *prefix, const gchar *postfix, gboolean payload);
00146 
00147 const gchar *ext_payload(const extvec_t *e);
00148 guint16 ext_paylen(const extvec_t *e);
00149 const gchar *ext_base(const extvec_t *e);
00150 guint16 ext_headlen(const extvec_t *e);
00151 guint16 ext_len(const extvec_t *e);
00152 const gchar *ext_ggep_id_str(const extvec_t *e);
00153 const gchar *ext_ggep_name(ext_token_t id);
00154 
00155 void ext_prepare(extvec_t *exv, gint exvcnt);
00156 void ext_reset(extvec_t *exv, gint exvcnt);
00157 
00158 #endif  /* _core_extensions_h_ */
00159 
00160 /* vi: set ts=4 sw=4 cindent: */
00161 

Generated on Sun Feb 12 10:49:56 2006 for Gtk-Gnutella by doxygen 1.3.6