view src/message/msg_handler.h @ 0:d39e1d0d75b6

initial add
author paulo@hit-nxdomain.opendns.com
date Sat, 20 Feb 2010 21:18:28 -0800
parents
children
line source
1 /*
2 * $Id: msg_handler.h,v 1.3 2004/01/07 07:24:43 hipnod Exp $
3 *
4 * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net)
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 */
17 #ifndef GIFT_GT_MSG_HANDLER_H_
18 #define GIFT_GT_MSG_HANDLER_H_
20 /*****************************************************************************/
22 #define MSG_DEBUG gt_config_get_int("message/debug=0")
24 /*****************************************************************************/
26 /* Erm, ugly node state encoded in a query-hit */
27 typedef enum gt_eqhd_type1
28 {
29 EQHD1_EMPTY = 0x00, /* no flags set */
30 EQHD1_PUSH_FLAG = 0x01, /* send a push request for this result */
31 EQHD1_HAS_BAD = 0x02, /* bad flag in qhd[2] is signficant,always 0? */
32 EQHD1_HAS_BUSY = 0x04, /* busy ... */
33 EQHD1_HAS_STABLE = 0x08, /* stable ... */
34 EQHD1_HAS_SPEED = 0x10, /* speed ... */
35 EQHD1_HAS_GGEP = 0x20, /* query-hit has GGEP encoded block */
36 } gt_eqhd1_t;
38 typedef enum gt_eqhd_type2
39 {
40 EQHD2_EMPTY = 0x00, /* no flags set */
41 EQHD2_HAS_PUSH = 0x01, /* set if push flag is significant */
42 EQHD2_BAD_FLAG = 0x02, /* always 0? */
43 EQHD2_BUSY_FLAG = 0x04, /* set if for no availability */
44 EQHD2_STABLE_FLAG = 0x08, /* set if transmitted an upload */
45 EQHD2_SPEED_FLAG = 0x10, /* if set, speed is max attained upload speed */
46 EQHD2_HAS_GGEP = 0x20, /* packet has GGEP */
47 } gt_eqhd2_t;
49 /*****************************************************************************/
51 #include "gt_node.h"
52 #include "gt_packet.h"
54 #include "message/gt_message.h"
56 /*****************************************************************************/
58 /*
59 * A message handler function.
60 */
61 typedef void (*GtMessageHandler) (GtNode *node, TCPC *c, GtPacket *packet);
63 #define MSG_HANDLER_ARG_NAMES \
64 node, c, packet
66 #define GT_MSG_HANDLER(func) \
67 void func (GtNode *node, TCPC *c, GtPacket *packet)
69 /*****************************************************************************/
71 #endif /* GIFT_GT_MSG_HANDLER_H_ */