The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

P2P::pDonkey::Met - Perl extension for handling *.met files of eDonkey peer2peer protocol.

SYNOPSIS

    use P2P::pDonkey::Met ':server';
    my $servers;
    my $p = readServerMet($ARGV[0]);
    if ($p) {
        printServerMet($p);
    } else {
        print "$ARGV[0] is not in server.met format\n";
    }

    ...

    use P2P::pDonkey::Met ':part';
    foreach my $f (@ARGV) {
        my $p = readPartMet($f);
        if ($p) {
            printPartMet($p);
        } else {
            print "$f is not in part.met format\n";
        }
    }

    ...

    use P2P::pDonkey::Met ':known';
    my $p = readKnownMet($ARGV[0]);
    if ($p) {
        printKnownMet($p);
    } else {
        print "$ARGV[0] is not in known.met format\n";
    }

    ...

    use P2P::pDonkey::Met ':pref';
    my $p = readPrefMet($ARGV[0]);
    if ($p) {
        printPrefMet($p);
    } else {
        print "$ARGV[0] is not in pref.met format\n";
    }

DESCRIPTION

The module provides functions for reading, printing and writing *.met files of eDonkey peer2peer protocol.

P2P::pDonkey::Met provides the subroutines for four types of met files: server.met, ...part.met, known.met, pref.met.

server.met

Functions are tagged with ':server'.

unpackServerDesc($buffer, $offset)
    Returns reference to unpacked server description structure.
packServerDesc($p)
    Returns packed string for description $$p.
printServerDesc($p)
    Prints server description to STDOUT.
makeServerDesc($ip, $port, $name, $desc, $nusers, $nfiles, $preference)
    Returns reference to new server description structure. 
unpackServerDescList($buffer, $offset)
    Returns reference to list of server descriptions.
packServerDescList($l)
    Returns packed string for list of descriptions @$l.
printServerDescList($l)
    Prints items of list @$l to STDOUT.
unpackServerDescListU($buffer, $offset)
    Returns reference to hash of server descriptions. Keys are idAddr($ip, $port).
packServerDescListU($h)
    Returns packed string for hash of descriptions %$h.
printServerDescListU($h)
    Prints values of hash %$h to STDOUT.
unpackServerMet($buffer, $offset)
    Returns reference to hash of server descriptions.
packServerMet($h)
    Returns packed string in server.met file format.
printServerMet($buffer, $offset)
    Alias to printServerDescListU($buffer, $offset).
readServerMet($filename)
    Reads file and unpacks data with unpackServerMet() function.
writeServerMet($filename, $h)
    Packs %$h with packServerMet() function and writes to file.

...part.met

Functions are tagged with ':part'.

unpackPartMet($buffer, $offset)
    Returns reference to file information structure.
    
packPartMet($p)
    Returns packed string in part.met format.
printPartMet($p)
    Prints file information to STDOUT.
    
readPartMet($filename)
    Reads file and unpacks data with unpackPartMet() function.
writePartMet($filename, $p)
    Packs $$p with packPartMet() function and writes to file.

known.met

Functions are tagged with ':known'.

unpackKnownMet($buffer, $offset)
    Returns reference to list of file information structures.
    
packKnownMet($l)
    Returns packed string in known.met format.
printKnownMet($l)
    Prints elements of list @$l to STDOUT.
    
readKnownMet($filename)
    Reads file and unpacks data with unpackKnownMet() function.
writeKnownMet($filename, $l)
    Packs @$p with packKnownMet() function and writes to file.

pref.met

Functions are tagged with ':pref'.

unpackPrefMet($buffer, $offset)
    Returns reference to hash:

        IP => $ip 
        Port => $port 
        Hash => $hash 
        Meta => $meta 
        Pref => $pref
    
packPrefMet($p)
    Returns packed string in pref.met format.
printPrefMet($p)
    Print file information to STDOUT.
    
readPrefMet($filename)
    Reads file and unpacks data with unpackPrefMet() function.
writePrefMet($filename, $p)
    Packs $$p with packPrefMet() function and writes to file.

EXPORT

None by default.

AUTHOR

Alexey Klimkin, <klimkin@mail.ru>

SEE ALSO

perl, P2P::pDonkey::Meta.

eDonkey home:

        <http://www.edonkey2000.com/>

Basic protocol information:

        <http://hitech.dk/donkeyprotocol.html>
    
        <http://www.schrevel.com/edonkey/>

Client stuff:

        <http://www.emule-project.net/>
    
        <http://www.nongnu.org/mldonkey/>

Server stuff:

        <http://www.thedonkeynetwork.com/>