ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-FastPing/README
(Generate patch)

Comparing AnyEvent-FastPing/README (file contents):
Revision 1.3 by root, Sat May 5 23:20:26 2007 UTC vs.
Revision 1.7 by root, Tue Nov 17 21:38:07 2009 UTC

1NAME 1NAME
2 Net::FPing - quickly ping a large number of hosts 2 AnyEvent::FastPing - quickly ping a large number of hosts
3 3
4SYNOPSIS 4SYNOPSIS
5 use Net::FPing; 5 use AnyEvent::FastPing;
6 6
7DESCRIPTION 7DESCRIPTION
8 This module was written for a single purpose only: sendinf ICMP EHCO 8 This module was written for a single purpose only: sending ICMP ECHO
9 REQUEST packets as quickly as possible to a large number of hosts 9 REQUEST packets as quickly as possible to a large number of hosts
10 (thousands to millions). 10 (thousands to millions).
11 11
12 It employs a sending thread and is fully event-driven (using AnyEvent), 12 It employs a sending thread and is fully event-driven (using AnyEvent),
13 so you have to run an event model supported by AnyEvent to use this 13 so you have to run an event model supported by AnyEvent to use this
14 module. 14 module.
15 15
16FUNCTIONS 16FUNCTIONS
17 Net::FPing::ipv4_supported 17 AnyEvent::FastPing::ipv4_supported
18 Returns true if IPv4 is supported in this module and on this system. 18 Returns true if IPv4 is supported in this module and on this system.
19 19
20 Net::FPing::ipv6_supported 20 AnyEvent::FastPing::ipv6_supported
21 Returns true if IPv6 is supported in this module and on this system. 21 Returns true if IPv6 is supported in this module and on this system.
22 22
23 Net::FPing::icmp4_pktsize 23 AnyEvent::FastPing::icmp4_pktsize
24 Returns the number of bytes each IPv4 ping packet has. 24 Returns the number of bytes each IPv4 ping packet has.
25 25
26 Net::FPing::icmp6_pktsize 26 AnyEvent::FastPing::icmp6_pktsize
27 Returns the number of bytes each IPv4 ping packet has. 27 Returns the number of bytes each IPv4 ping packet has.
28 28
29 Net::FPing::icmp_ping [ranges...], $send_interval, $payload, \&callback 29 AnyEvent::FastPing::icmp_ping [ranges...], $send_interval, $payload,
30 \&callback
30 Ping the given IPv4 address ranges. Each range is an arrayref of the 31 Ping the given IPv4 address ranges. Each range is an arrayref of the
31 form "[lo, hi, interval]", where "lo" and "hi" are octet strings 32 form "[lo, hi, interval]", where "lo" and "hi" are octet strings
32 with either 4 octets (for IPv4 addresses) or 16 octets (for IPV6 33 with either 4 octets (for IPv4 addresses) or 16 octets (for IPV6
33 addresses), representing the lowest and highest address to ping (you 34 addresses), representing the lowest and highest address to ping (you
34 can convert a dotted-quad IPv4 address to this format by using 35 can convert a dotted-quad IPv4 address to this format by using
36 seconds between pings to the given range. If omitted, defaults to 37 seconds between pings to the given range. If omitted, defaults to
37 $send_interval. 38 $send_interval.
38 39
39 The $send_interval is the minimum interval between sending any two 40 The $send_interval is the minimum interval between sending any two
40 packets and is a way to make an overall rate limit. If omitted, 41 packets and is a way to make an overall rate limit. If omitted,
41 pings will be send as fast as possible. 42 pings will be sent as fast as possible.
42 43
43 The $payload is a 32 bit unsigned integer given as the ICMP ECHO 44 The $payload is a 32 bit unsigned integer given as the ICMP ECHO
44 REQUEST ident and sequence numbers (in unspecified order :). 45 REQUEST ident and sequence numbers (in unspecified order :).
45 46
46 The request will be queued and all requests will be served by a 47 The request will be queued and all requests will be served by a
71 11.0.0.1-11.0.255.255 with at most 1000 packets/s. Do not, however, 72 11.0.0.1-11.0.255.255 with at most 1000 packets/s. Do not, however,
72 exceed 1000 packets/s overall: 73 exceed 1000 packets/s overall:
73 74
74 my $done = AnyEvent->condvar; 75 my $done = AnyEvent->condvar;
75 76
76 Net::FPing::icmp_ping 77 AnyEvent::FastPing::icmp_ping
78 [
77 [v10.0.0.1, v10.0.0.15, .01], 79 [v10.0.0.1, v10.0.0.15, .01],
78 [v11.0.0.1, v11.0.255.255, .001], 80 [v11.0.0.1, v11.0.255.255, .001],
81 ],
79 .001, 0x12345678, 82 .001, 0x12345678,
80 sub { 83 sub {
81 warn "all ranges pinged\n"; 84 warn "all ranges pinged\n";
82 $done->broadcast; 85 $done->broadcast;
83 } 86 }
84 ; 87 ;
85 88
86 $done->wait; 89 $done->wait;
87 90
88 Net::FPing::register_cb \&cb 91 AnyEvent::FastPing::register_cb \&cb
89 Register a callback that is called for every received ping reply 92 Register a callback that is called for every received ping reply
90 (regardless of whether a ping is still in process or not and 93 (regardless of whether a ping is still in process or not and
91 regardless of whether the reply is actually a reply ot a ping sent 94 regardless of whether the reply is actually a reply to a ping sent
92 earlier). 95 earlier).
93 96
94 The code reference gets a single parameter - an arrayref with an 97 The code reference gets a single parameter - an arrayref with an
95 entry for each received packet (replies are beign batched for 98 entry for each received packet (replies are being batched for
96 greater efficiency). Each packet is represented by an arrayref with 99 greater efficiency). Each packet is represented by an arrayref with
97 three members: the source address (an octet string of either 4 100 three members: the source address (an octet string of either 4
98 (IPv4) or 16 (IPv6) octets length), the payload as passed to 101 (IPv4) or 16 (IPv6) octets length), the payload as passed to
99 "icmp_ping" and the round trip time in seconds. 102 "icmp_ping" and the round trip time in seconds.
100 103
121 "0.00090184211731", 124 "0.00090184211731",
122 305419896 125 305419896
123 ] 126 ]
124 ] 127 ]
125 128
126 Net::FPing::unregister_cb \&cb 129 AnyEvent::FastPing::unregister_cb \&cb
127 Unregister the callback again (make sure you pass the same 130 Unregister the callback again (make sure you pass the same
128 codereference as to "register_cb"). 131 codereference as to "register_cb").
129 132
130AUTHOR 133AUTHOR
131 Marc Lehmann <schmorp@schmorp.de> 134 Marc Lehmann <schmorp@schmorp.de>
132 http://home.schmorp.de/ 135 http://home.schmorp.de/
133 136
134AUTHOR 137LICENSE
135 This software is distributed under the GENERAL PUBLIC LICENSE, 138 This software is distributed under the GENERAL PUBLIC LICENSE, version 2
136 version 2 or any later. 139 or any later version or, at your option, the Artistic License.
137 140

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines