On Tue, Sep 02, 2003 at 06:31:33AM +0000, Raphael Manfredi wrote:
> Quoting Craig Barnes <[EMAIL PROTECTED]> from ml.softs.gtk-gnutella.devel:
> :I was looking at both LimeWire's and gtk-gnutella's interpretation of
> :the MinSpeed bits, and they seem to be different:
> :
> : in gtk-gnutella:
> :       
> :   #define QUERY_SPEED_MARK        0x8000 
> :   #define QUERY_SPEED_FIREWALLED  0x4000
> :   #define QUERY_SPEED_NO_XML      0x2000
> :   #define QUERY_SPEED_LEAF_GUIDED 0x1000
> :   #define QUERY_SPEED_GGEP_H      0x0800
> :   #define QUERY_SPEED_OOB_REPLY   0x0400
> :
> : in LimeWire:
> :        
> :    // these specs may seem backwards, but they are not -
> :    // ByteOrder.short2leb puts the low-order byte first, so over the
> :    // network 0x0080 would look like 0x8000
> :    public static final int SPECIAL_MINSPEED_MASK  = 0x0080;
> :    public static final int SPECIAL_FIREWALL_MASK  = 0x0040;
> :    public static final int SPECIAL_XML_MASK       = 0x0020;
> :    public static final int SPECIAL_OUTOFBAND_MASK = 0x0004;
> :        
> 
> I don't see any difference here.  0x8000 in GTKG (big-endian) is precisely
> 0x0080 (little-endian), and LimeWire's comment specifies that they are
> little-endian.

GTKG does not use the field in big-endian order: it uses
READ_GUINT16_LE and WRITE_GUINT16_LE, to read and write the MinSpeed
bytes.  LimeWire calls ByteOrder.short2leb() ["short to little-endian
bytes"] on the MinSpeed field to send it out on the network.  Hence, it
writes 0x0080 as a _little_endian_ 16-bit sequence, { 0x80, 0x00 }, and
this is what the comment refers to as what looks like 0x8000. 

GTKG does _not_ read a MinSpeed of { 0x80, 00 } as a big-endian integer,
but little endian, which goes into memory as 0x0080, not 0x8000 like it
expects.

The { 0x80, 0x00 } also not un-mysteriously looks like the big-endian
arranged bytes in MinSpeed.txt (big-endian bit "15" in previously
little-endian MinSpeed...absolutely horrible mistake), which is the
source of this confusion and the reason for the comment atop LimeWire's
constant-definitions in the code I posted. Why can't people keep to
describing packets on the Gnutella network in _one_ byte order?


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Gtk-gnutella-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/gtk-gnutella-devel

Reply via email to