| 1 |
NAME |
| 2 |
Net::FCP - http://freenet.sf.net client protocol |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
use Net::FCP; |
| 6 |
|
| 7 |
my $fcp = new Net::FCP; |
| 8 |
|
| 9 |
my $ni = $fcp->txn_node_info->result; |
| 10 |
my $ni = $fcp->node_info; |
| 11 |
|
| 12 |
DESCRIPTION |
| 13 |
See <http://freenet.sourceforge.net/index.php?page=fcp> for a |
| 14 |
description of what the messages do. I am too lazy to document all this |
| 15 |
here. |
| 16 |
|
| 17 |
WARNING |
| 18 |
This module is alpha. While it probably won't destroy (much :) of your |
| 19 |
data, it currently works only with the Event module (alkthough the event |
| 20 |
mechanism is fully pluggable). |
| 21 |
|
| 22 |
THE Net::FCP CLASS |
| 23 |
$fcp = new Net::FCP [host => $host][, port => $port] |
| 24 |
Create a new virtual FCP connection to the given host and port |
| 25 |
(default 127.0.0.1:8481). |
| 26 |
|
| 27 |
Connections are virtual because no persistent physical connection is |
| 28 |
established. However, the existance of the node is checked by |
| 29 |
executing a "ClientHello" transaction. |
| 30 |
|
| 31 |
$txn = $fcp->txn(type => attr => val,...) |
| 32 |
The low-level interface to transactions. Don't use it. |
| 33 |
|
| 34 |
$txn = $fcp->txn_client_hello |
| 35 |
$nodehello = $fcp->client_hello |
| 36 |
Executes a ClientHello request and returns it's results. |
| 37 |
|
| 38 |
{ |
| 39 |
max_file_size => "5f5e100", |
| 40 |
protocol => "1.2", |
| 41 |
node => "Fred,0.6,1.46,7050" |
| 42 |
} |
| 43 |
|
| 44 |
$txn = $fcp->txn_client_info |
| 45 |
$nodeinfo = $fcp->client_info |
| 46 |
Executes a ClientInfo request and returns it's results. |
| 47 |
|
| 48 |
{ |
| 49 |
max_file_size => "5f5e100", |
| 50 |
datastore_max => "2540be400", |
| 51 |
node_port => 369, |
| 52 |
java_name => "Java HotSpot(_T_M) Server VM", |
| 53 |
operating_system_version => "2.4.20", |
| 54 |
estimated_load => 52, |
| 55 |
free_memory => "5cc0148", |
| 56 |
datastore_free => "5ce03400", |
| 57 |
node_address => "1.2.3.4", |
| 58 |
active_jobs => "1f", |
| 59 |
allocated_memory => "bde0000", |
| 60 |
architecture => "i386", |
| 61 |
routing_time => "a5", |
| 62 |
least_recent_timestamp => "f41538b878", |
| 63 |
available_threads => 17, |
| 64 |
datastore_used => "1f72bb000", |
| 65 |
java_version => "Blackdown-1.4.1-01", |
| 66 |
is_transient => "false", |
| 67 |
operating_system => "Linux", |
| 68 |
java_vendor => "http://www.blackdown.org/", |
| 69 |
most_recent_timestamp => "f77e2cc520" |
| 70 |
} |
| 71 |
|
| 72 |
$txn = $fcp->txn_generate_chk ($metadata, $data) |
| 73 |
$uri = $fcp->generate_chk ($metadata, $data) |
| 74 |
Creates a new CHK, given the metadata and data. UNTESTED. |
| 75 |
|
| 76 |
$txn = $fcp->txn_generate_svk_pair |
| 77 |
($public, $private) = @{ $fcp->generate_svk_pair } |
| 78 |
Creates a new SVK pair. Returns an arrayref. |
| 79 |
|
| 80 |
[ |
| 81 |
"hKs0-WDQA4pVZyMPKNFsK1zapWY", |
| 82 |
"ZnmvMITaTXBMFGl4~jrjuyWxOWg" |
| 83 |
] |
| 84 |
|
| 85 |
$txn = $fcp->txn_insert_private_key ($private) |
| 86 |
$uri = $fcp->insert_private_key ($private) |
| 87 |
Inserts a private key. $private can be either an insert URI (must |
| 88 |
start with freenet:SSK@) or a raw private key (i.e. the private |
| 89 |
value you get back from "generate_svk_pair"). |
| 90 |
|
| 91 |
Returns the public key. |
| 92 |
|
| 93 |
UNTESTED. |
| 94 |
|
| 95 |
$txn = $fcp->txn_get_size ($uri) |
| 96 |
$length = $fcp->get_size ($uri) |
| 97 |
Finds and returns the size (rounded up to the nearest power of two) |
| 98 |
of the given document. |
| 99 |
|
| 100 |
UNTESTED. |
| 101 |
|
| 102 |
MISSING: ClientGet, ClientPut |
| 103 |
|
| 104 |
THE Net::FCP::Txn CLASS |
| 105 |
All requests (or transactions) are executed in a asynchroneous way (LIE: |
| 106 |
uploads are blocking). For each request, a "Net::FCP::Txn" object is |
| 107 |
created (worse: a tcp connection is created, too). |
| 108 |
|
| 109 |
For each request there is actually a different subclass (and it's |
| 110 |
possible to subclass these, although of course not documented). |
| 111 |
|
| 112 |
The most interesting method is "result". |
| 113 |
|
| 114 |
new arg => val,... |
| 115 |
Creates a new "Net::FCP::Txn" object. Not normally used. |
| 116 |
|
| 117 |
$result = $txn->result |
| 118 |
Waits until a result is available and then returns it. |
| 119 |
|
| 120 |
This waiting is (depending on your event modul) not very efficient, |
| 121 |
as it is done outside the "mainloop". |
| 122 |
|
| 123 |
SEE ALSO |
| 124 |
<http://freenet.sf.net>. |
| 125 |
|
| 126 |
BUGS |
| 127 |
AUTHOR |
| 128 |
Marc Lehmann <pcg@goof.com> |
| 129 |
http://www.goof.com/pcg/marc/ |
| 130 |
|