2
* $Id: ggep.h,v 1.12 2003/07/19 22:08:59 rmanfredi Exp $
4
* Copyright (c) 2002-2003, Raphael Manfredi
6
* Gnutella Generic Extension Protocol (GGEP).
8
*----------------------------------------------------------------------
9
* This file is part of gtk-gnutella.
11
* gtk-gnutella is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 2 of the License, or
14
* (at your option) any later version.
16
* gtk-gnutella is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
21
* You should have received a copy of the GNU General Public License
22
* along with gtk-gnutella; if not, write to the Free Software
24
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
*----------------------------------------------------------------------
31
#include "extensions.h"
35
#define GGEP_MAGIC '\xc3' /* GGEP extension prefix */
38
* GGEP Extension Header Flags.
41
#define GGEP_F_LAST '\x80' /* Last extension in GGEP block */
42
#define GGEP_F_COBS '\x40' /* Whether COBS was used on payload */
43
#define GGEP_F_DEFLATE '\x20' /* Whether payload was deflated */
44
#define GGEP_F_MBZ '\x10' /* Bits that Must Be Zero */
45
#define GGEP_F_IDLEN '\x0f' /* Where ID length is stored */
48
* GGEP Length Encoding.
51
#define GGEP_L_CONT '\x80' /* Continuation present */
52
#define GGEP_L_LAST '\x40' /* Last byte */
53
#define GGEP_L_VALUE '\x3f' /* Value */
54
#define GGEP_L_VSHIFT 6
56
#define GGEP_L_XFLAGS (GGEP_L_CONT | GGEP_L_LAST)
62
#define GGEP_H_SHA1 0x01 /* Binary SHA1 */
63
#define GGEP_H_BITPRINT 0x02 /* Bitprint (SHA1 + Tiger tree root) */
64
#define GGEP_H_MD5 0x03 /* Binary MD5 */
65
#define GGEP_H_UUID 0x04 /* Binary UUID (GUID-like) */
66
#define GGEP_H_MD4 0x05 /* Binary MD4 */
69
* Flags for ggep_ext_write() and friends.
72
#define GGEP_W_LAST 0x00000001 /* This is the last extension */
73
#define GGEP_W_COBS 0x00000002 /* Attempt COBS encoding, if needed */
74
#define GGEP_W_DEFLATE 0x00000004 /* Attempt payload compression */
75
#define GGEP_W_FIRST 0x00000008 /* First extension, write GGEP_MAGIC */
83
gint ggep_decode_into(extvec_t *exv, gchar *buf, gint len);
87
gchar *id, gchar *payload, gint plen,
92
gchar *id, struct iovec *iov, gint iovcnt,
95
void ggep_ext_mark_last(guchar *start);