Gnutella Forums  

Go Back   Gnutella Forums > Gnutella News and Gnutelliums Forums > General Gnutella Development Discussion
Register FAQ The Twelve Commandments Members List Calendar Arcade Find the Best VPN Search Today's Posts Mark Forums Read

General Gnutella Development Discussion For general discussion about Gnutella development.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old December 28th, 2001
Connoisseur
 
Join Date: August 9th, 2001
Location: Philadelphia, PA, USA
Posts: 358
cultiv8r is flying high
Default

Quote:
Originally posted by veniamin

Header = Record
ID: TGUID;
Function: Byte;
TTL:byte;
Hops:byte;
Datalength: Integer(???)
end;
Ah! Someone's using Delphi (or Pascal)!

Well, for that, I will give you the records used in my Cultiv8r client

Hopefully you can use them. Keep in mind that the records are packed! I'm using pointers to them, because I can easily reference them from memory that way - I read the entire message before processing.

Code:
Type
  // AKA Descriptor Header
  _PGHeader = ^_TGHeader;
  _TGHeader = packed record
    MsgID   : TGUID;
    Func    : byte;
    TTL     : byte;
    Hops    : byte;
    DataLen : integer;
  end;

  _PPong = ^_TPong;
  _TPong = packed record // 0x01
    Port      : word;
    IP        : integer;
    FileCount : dword;
    TotalSize : dword;
  end;

  // BYE packet - this is a proposal, see the GDF
  _PByeHead = ^_TByeHead;
  _TByeHead = packed record // 0x02
    Code : word;
  end;

  // Query Hit
  _PQueryResultHeader = ^_TQueryResultHeader;
  _TQueryResultHeader = packed record // 0x81
    Results : byte;
    Port    : word;
    IP      : integer;
    Speed   : integer;
  end;

  // Query Hit Result set
  _PQueryResultRecordHeader = ^_TQueryResultRecordHeader;
  _TQueryResultRecordHeader = packed record
    FileIndex : integer;
    FileSize  : integer;
  end;

  // Just the vendor ID m'am!
  _PQueryResultFooterExtensionHeader = ^_TQueryResultFooterExtensionHeader;
  _TQueryResultFooterExtensionHeader = packed record
    VendorID : array[0..3] of char;
  end;

  //  EQHD As used by many clients, ala BearShare
  _PQueryResultFooterExtensionDataOne = ^_TQueryResultFooterExtensionDataOne;
  _TQueryResultFooterExtensionDataOne = packed record
    DataLength : byte;
    Flag1,
    Flag2      : byte;
  end;

  // The GUID at the very end of the Query Hit
  _PQueryResultFooter = ^_TQueryResultFooter;
  _TQueryResultFooter = packed record
    ClientID : TGUID;
  end;

  // Push baby, Push!
  _PPush = ^_TPush;
  _TPush = packed record
    ClientID  : TGUID;
    FileIndex : integer;
    IP        : integer;
    Port      : integer;
  end;
Also, most newer clients use GUID marking. So you could use this snippet for creating your GUIDs:

Code:
function CreateGUID : TGUID;
begin
  CoCreateGUID(Result);

  Result.D4[0] := $FF;
  Result.D4[7] := $0;
end;
-- Mike
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Spin-off of Gnutella Protocol? PhreakerONE General Gnutella Development Discussion 0 June 6th, 2002 02:57 PM
gnutella protocol Unregistered General Gnutella / Gnutella Network Discussion 2 May 19th, 2002 10:23 AM
Gnutella protocol and hostcaches bateman23 General Gnutella Development Discussion 5 January 9th, 2002 03:42 AM
gnutella protocol v0.6? chuckles42 Gnucleus (Windows) 0 September 15th, 2001 08:11 AM
Gnutella protocol to sloppy? Tiago s1x General Gnutella Development Discussion 3 August 6th, 2001 04:20 PM


All times are GMT -7. The time now is 09:21 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright © 2020 Gnutella Forums.
All Rights Reserved.