next up previous contents index
Next: P-Grid Up: Gnutella Previous: Transferring files   Contents   Index

Metadata and rich queries

To make it possible to perform detailed searches metadata that classifies the shared files are necessary. For example, a book has an author, a publisher, an edition number, a publishing year and an ISBN number. A music file is made by some artist, has a title, resides on some album, was recorded in a certain studio, released a certain year on some record label and so on.

Metadata is sometimes available within the file itself. For example, MP3 music files often contain an ID3 tag at the end. This tag provides metadata for that file, such as title, artist, album, year and genre. Since all file types do not have this ability an external metadata scheme has been proposed, and implemented in modern Gnutella clients.

The proposed scheme uses XML to encode a rich query, but is still able to maintain compatibility with older clients. A Query message containing a rich query contains an XML block after the null terminated query string. This block is also null terminated, and will be discarded by older clients. The format of a rich Query message is outlined in table tbl:gnutellametaquery.


Table 3.11: Rich XML metadata Query message
Bytes Description
0-1 Minimum speed, kb/s
2- Null terminated search criteria
11#11- Null terminated rich XML metadata search criteria
Rest Optional extensions



A rich QueryHit message contains embedded XML in the EQHD block and private vendor data fields of the QueryHit message. The EQHD block and private vendor data has the format shown in table tbl:gnutellametareply for rich replies. See also table tbl:gnutellaqueryhit for a description of the QueryHit message and table tbl:gnutellaqueryhiteqhdblock for a description of the original EQHD block.


Table 3.12: Contents of EQHD block in rich QueryReply messages
Bytes Description
0-3 Vendor code
4 Public area size (set to 4)
5-6 Public area
7-8 Size of XML payload + 1, 16#16
9- Private area
11#11- Null terminated XML payload, 16#16 bytes



The size of the private area is calculated by subtracting the size of the XML payload from the total size of the EQHD block.


next up previous contents index
Next: P-Grid Up: Gnutella Previous: Transferring files   Contents   Index
Marcus Bergner 2003-06-10