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