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

gmsg.h

Go to the documentation of this file.
00001 /*
00002  * $Id: gmsg.h,v 1.10 2005/10/20 06:34:39 cbiere 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_gmsg_h_
00037 #define _core_gmsg_h_
00038 
00039 #include "gnutella.h"
00040 #include "pmsg.h"
00041 
00042 #include "if/core/search.h"
00043 
00044 struct gnutella_node;
00045 struct route_dest;
00046 struct mqueue;
00047 
00048 #define gmsg_function(p) (((struct gnutella_header *) p)->function)
00049 #define gmsg_hops(p)     (((struct gnutella_header *) p)->hops)
00050 
00051 /*
00052  * Public interface
00053  */
00054 
00055 void gmsg_init(void);
00056 const gchar *gmsg_name(guint function);
00057 
00058 pmsg_t *gmsg_to_pmsg(gconstpointer msg, guint32 size);
00059 pmsg_t *gmsg_to_ctrl_pmsg(gconstpointer msg, guint32 size);
00060 pmsg_t * gmsg_to_ctrl_pmsg_extend(
00061     gconstpointer msg, guint32 size, pmsg_free_t free_cb, gpointer arg);
00062 pmsg_t *gmsg_split_to_pmsg(gconstpointer head,
00063     gconstpointer data, guint32 size);
00064 pmsg_t * gmsg_split_to_pmsg_extend(gconstpointer head, gconstpointer data,
00065     guint32 size, pmsg_free_t free_cb, gpointer arg);
00066 
00067 void gmsg_mb_sendto_all(const GSList *sl, pmsg_t *mb);
00068 void gmsg_mb_sendto_one(struct gnutella_node *n, pmsg_t *mb);
00069 
00070 void gmsg_sendto_one(struct gnutella_node *n, gconstpointer msg, guint32 size);
00071 void gmsg_ctrl_sendto_one(struct gnutella_node *n,
00072     gconstpointer msg, guint32 size);
00073 void gmsg_split_sendto_one(struct gnutella_node *n,
00074     gconstpointer head, gconstpointer data, guint32 size);
00075 void gmsg_sendto_all(const GSList *l, gconstpointer msg, guint32 size);
00076 void gmsg_split_sendto_all(const GSList *l,
00077     gconstpointer head, gconstpointer data, guint32 size);
00078 void gmsg_split_sendto_all_but_one(const GSList *sl,
00079     const struct gnutella_node *n,
00080     gconstpointer head, gconstpointer data, guint32 size);
00081 void gmsg_sendto_route(struct gnutella_node *n, struct route_dest *rt);
00082 
00083 gboolean gmsg_can_drop(gconstpointer pdu, gint size);
00084 gboolean gmsg_is_oob_query(gconstpointer msg);
00085 gboolean gmsg_split_is_oob_query(gconstpointer head, gconstpointer data);
00086 gint gmsg_cmp(gconstpointer pdu1, gconstpointer pdu2);
00087 gchar *gmsg_infostr(gconstpointer head);
00088 gchar *gmsg_infostr_full(gconstpointer message);
00089 gchar *gmsg_infostr_full_split(gconstpointer head, gconstpointer data);
00090 
00091 void gmsg_install_presend(pmsg_t *mb);
00092 
00093 void gmsg_log_dropped(gconstpointer head,
00094     const gchar *reason, ...) G_GNUC_PRINTF(2, 3);
00095 void gmsg_log_bad(const struct gnutella_node *n,
00096     const gchar *reason, ...) G_GNUC_PRINTF(2, 3);
00097 
00098 void gmsg_sendto_route_ggep(
00099     struct gnutella_node *n, struct route_dest *rt, guint32 regular_size);
00100 void gmsg_sendto_one_ggep(struct gnutella_node *n,
00101     gconstpointer msg, guint32 size, guint32 regular_size);
00102 void gmsg_ctrl_sendto_one_ggep(struct gnutella_node *n,
00103     gconstpointer msg, guint32 size, guint32 regular_size);
00104 void gmsg_sendto_all_ggep(const GSList *sl,
00105     gconstpointer msg, guint32 size, guint32 regular_size);
00106 
00107 void gmsg_search_sendto_one(struct gnutella_node *n, gnet_search_t sh,
00108     gconstpointer msg, guint32 size);
00109 void gmsg_search_sendto_all(const GSList *l, gnet_search_t sh,
00110     gconstpointer msg, guint32 size);
00111 
00112 #endif  /* _core_gmsg_h_ */
00113 
00114 /* vi: set ts=4 sw=4 cindent: */

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