diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/message/msg_handler.h	Sat Feb 20 21:18:28 2010 -0800
     1.3 @@ -0,0 +1,71 @@
     1.4 +/*
     1.5 + * $Id: msg_handler.h,v 1.3 2004/01/07 07:24:43 hipnod Exp $
     1.6 + *
     1.7 + * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net)
     1.8 + *
     1.9 + * This program is free software; you can redistribute it and/or modify it
    1.10 + * under the terms of the GNU General Public License as published by the
    1.11 + * Free Software Foundation; either version 2, or (at your option) any
    1.12 + * later version.
    1.13 + *
    1.14 + * This program is distributed in the hope that it will be useful, but
    1.15 + * WITHOUT ANY WARRANTY; without even the implied warranty of
    1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.17 + * General Public License for more details.
    1.18 + */
    1.19 +
    1.20 +#ifndef GIFT_GT_MSG_HANDLER_H_
    1.21 +#define GIFT_GT_MSG_HANDLER_H_
    1.22 +
    1.23 +/*****************************************************************************/
    1.24 +
    1.25 +#define MSG_DEBUG             gt_config_get_int("message/debug=0")
    1.26 +
    1.27 +/*****************************************************************************/
    1.28 +
    1.29 +/* Erm, ugly node state encoded in a query-hit */
    1.30 +typedef enum gt_eqhd_type1
    1.31 +{
    1.32 +	EQHD1_EMPTY       = 0x00,  /* no flags set */
    1.33 +	EQHD1_PUSH_FLAG   = 0x01,  /* send a push request for this result */
    1.34 +	EQHD1_HAS_BAD     = 0x02,  /* bad flag in qhd[2] is signficant,always 0? */
    1.35 +	EQHD1_HAS_BUSY    = 0x04,  /* busy ... */
    1.36 +	EQHD1_HAS_STABLE  = 0x08,  /* stable ... */
    1.37 +	EQHD1_HAS_SPEED   = 0x10,  /* speed ... */
    1.38 +	EQHD1_HAS_GGEP    = 0x20,  /* query-hit has GGEP encoded block */
    1.39 +} gt_eqhd1_t;
    1.40 +
    1.41 +typedef enum gt_eqhd_type2
    1.42 +{
    1.43 +	EQHD2_EMPTY       = 0x00,  /* no flags set */
    1.44 +	EQHD2_HAS_PUSH    = 0x01,  /* set if push flag is significant */
    1.45 +	EQHD2_BAD_FLAG    = 0x02,  /* always 0? */
    1.46 +	EQHD2_BUSY_FLAG   = 0x04,  /* set if for no availability */
    1.47 +	EQHD2_STABLE_FLAG = 0x08,  /* set if transmitted an upload */
    1.48 +	EQHD2_SPEED_FLAG  = 0x10,  /* if set, speed is max attained upload speed */
    1.49 +	EQHD2_HAS_GGEP    = 0x20,  /* packet has GGEP */
    1.50 +} gt_eqhd2_t;
    1.51 +
    1.52 +/*****************************************************************************/
    1.53 +
    1.54 +#include "gt_node.h"
    1.55 +#include "gt_packet.h"
    1.56 +
    1.57 +#include "message/gt_message.h"
    1.58 +
    1.59 +/*****************************************************************************/
    1.60 +
    1.61 +/*
    1.62 + * A message handler function.
    1.63 + */
    1.64 +typedef void (*GtMessageHandler) (GtNode *node, TCPC *c, GtPacket *packet);
    1.65 +
    1.66 +#define MSG_HANDLER_ARG_NAMES \
    1.67 +	node, c, packet
    1.68 +
    1.69 +#define GT_MSG_HANDLER(func) \
    1.70 +	void func (GtNode *node, TCPC *c, GtPacket *packet)
    1.71 +
    1.72 +/*****************************************************************************/
    1.73 +
    1.74 +#endif /* GIFT_GT_MSG_HANDLER_H_ */