pax_global_header00006660000000000000000000000064131050106450014505gustar00rootroot0000000000000052 comment=d064a9eb60c628ad85e5d0e53b6d4fd018f0a049 liboping-liboping-1.10.0/000077500000000000000000000000001310501064500151705ustar00rootroot00000000000000liboping-liboping-1.10.0/.gitignore000066400000000000000000000006361310501064500171650ustar00rootroot00000000000000# build system stuff .deps INSTALL Makefile Makefile.in aclocal.m4 autom4te.cache compile config.* configure depcomp install-sh missing stamp-h1 /m4/ # libtool stuff libltdl libtool ltmain.sh # build output .libs/ bindings/perl/Oping.c bindings/perl/blib bindings/perl/pm_to_blib src/mans/*.3 src/mans/*.8 src/oping src/noping src/liboping.pc *.bs *.la *.lo *.loT *.o *.tar.gz *.tar.bz2 bindings/perl/MYMETA.yml liboping-liboping-1.10.0/.travis.yml000066400000000000000000000001721310501064500173010ustar00rootroot00000000000000dist: trusty sudo: false language: c compiler: - clang - gcc script: - autoreconf -fi - ./configure - make all liboping-liboping-1.10.0/AUTHORS000066400000000000000000000007551310501064500162470ustar00rootroot00000000000000liboping has been written by Florian octo Forster The following people have contributed to liboping: * Alex Brooks * Doug MacEachern * Esteban Sanchez * Sebastian Harl * "Wojtek" * Dan Sully * Vladimir Melnikov * Luke Heberling * Hamish Coleman liboping-liboping-1.10.0/COPYING000066400000000000000000000636421310501064500162360ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! liboping-liboping-1.10.0/ChangeLog000066400000000000000000000264131310501064500167500ustar00rootroot000000000000002017-05-11, Version 1.10.0: * Build system: Search the "rt" library for clock_gettime(). This fixes build issues on Mac OS X. Thanks to Yann E. Morni for this fix. #9 * Build system: The "--with[out]-ncurses" option has been added and allows to enforce/disable the building of "noping". Thanks to Thomas Deutschmann for the patch. #15 * Build system: Compatibility code to work with pkg-config < 0.27 has been added. #22 * liboping: Creation of ICMPv4 packets has been fixed: due to an incorrect sizeof() the payload may have been prefixed by 20 zero bytes, resulting in larger packets than desired. Thanks to Kyle Zhou for reporting and fixing this. #10 * liboping: The number of file descriptors used has been reduced to at most two (from one per host). This and a few other optimizations significantly improve performance. Thanks to Luke Heberling for the patch. #11 * oping, noping: Handling of the "-O" command line flag has been fixed. * oping, noping: The "-b" option has been added and enables a bell whenever an echo reply is received. Thanks to Antoine Beaupré for the patch. #6 * noping: The background color has been changed to use the terminal default. Thanks to @middleO. #18 * noping: The ability to add hosts after noping has started (the "a" key) has been added. Thanks to Hamish Coleman for the patch. #20, #23 2016-06-27, Version 1.9.0: * liboping: The new "PING_OPT_MARK" option allows to mark packets, which can be used for filtering and routing such packets on Linux. * oping, noping: The new "-m" command line option allows to set a mark on packets sent by the tool. * oping, noping: The new "-O" command line option allows to write measurements to an CSV file. * oping, noping: The new "-w" command line option allows to specify the timeout after which a packet/reply is considered "dropped". 2014-11-20, Version 1.8.0: * oping, noping: Average and standard deviation have been removed from the status output, which show median and 95th percentile instead. The percentile can be chosen with the "-P" option. * noping: The additional graph types "histogram" and "boxplot" have been added, which can be selected with the "-g" option. 2014-09-25, Version 1.7.0: * oping, noping: The new -Z option allows the exit status to indicate the number of failing hosts. Thanks to Barak Pearlmutter for the patch. * noping: The ability to print a "prettyping" style graph has been added. Thanks to Antoine Beaupré for his work! * src/liboping.c: Build issues on Solaris have been fixed. Thanks Scott Severtson for the fix! * Build system: Creation and installation of a pkg-config file has been added. Thanks to Barak Pearlmutter for the patch. 2012-01-31, Version 1.6.2: * Build system: Setting capabilities and the set-UID bit has been made more fault-tolerant, so that it will work with Debian's fakeroot(1) utility. * src/liboping.c: Fixed a compiler warning about an non-static format string. Thanks to Brian Edwards for pointing this out. * src/liboping.c: Fixed compilation under Mac OS X and Solaris. Thanks to Clayton O'Neill for his patch. 2011-03-06, Version 1.6.1: * Build system: If "make install" is executed as root, the CAP_NET_RAW capability is added to the binary (on Linux) or the set-UID bit is set (other Unixes). * src/oping.c: Fix compiler warnings which may abort the build. Thanks to James Bromberger for reporting the problem. * noping: Compatibility with ncurses 5.8 has been fixed. Thanks to Gaetan Bisson for his patch. 2011-01-26, Version 1.6.0: * liboping: Improve timing of received network packets using SO_TIMESTAMP if available. Thanks to Bruno Prémont for his patch. 2010-11-17, Version 1.5.1: * oping, noping: Alias for the “Voice Admit” DSCP has been added. * src/oping.c, src/liboping.c: Compiler warnings / errors have been fixed. Thanks to James Bromberger for reporting one of them. 2010-10-27, Version 1.5.0: * src/liboping.c: The possibility to set the QoS byte of outgoing IPv4 and IPv6 packets and read the byte from incoming packets has been added. Thanks to Vladimir Melnikov for his patch. * oping, noping: Add the ability to configure the QoS field on the command line. If either the QoS field of outgoing or incoming packets is non-standard, the QoS byte of incoming packets will be printed. * liboping: The library has been relicensed under the LGPL 2.1. 2010-06-13, Version 1.4.0: * noping: A new front-end to liboping, using the ncurses library, has been added. The new command line application displays ping statistics online and highlights aberrant round-trip times. 2009-12-20, Version 1.3.4: * src/liboping.c: When one file descriptor was in an error state, the select(2) loop would run indefinitely. Error handling has been improved so the loop ends gracefully now in this case. * src/liboping.c: Drop privileges before reading files if supported by the system. This way files are opened using the user's original privileges when using the “-f” option. * Net::Oping: An off-by-one error has been fixed in the Perl bindings. Thanks to Fredrik Soderblom for his patch. 2009-09-29, Version 1.3.3: * oping: Disable the “-f” option if the real and effective user IDs don't match. If that is the case the program is probably running SetUID and should not read foreign files. Unfortunately, dropping privileges before reading the file is not possible, because they are required for opening raw sockets. Reading from STDIN using “-f -” is still possible. Thanks to Steve Kemp for reporting this issue as Debian bug #548684. 2009-07-27, Version 1.3.2: * src/oping.h: Remove `HAVE_*_H' macros for system headers. Those macros should not be used in system wide installed header files. Thanks to Sebastian for fixing this. 2009-07-20, Version 1.3.1 * src/liboping.c: Fix too eager argument validation that prevented the library to work as documented. Thanks to Sebastian for catching this bug. 2009-07-18, Version 1.3.0 * oping: Documentation and messages have been improved. * oping: Support for the `-D' command line option has been added. Using this new option, the outgoing network device can be set. Thanks to Sebastian Harl for the patch. * src/liboping.c: The value of the `received TTL' information after missing packets has been corrected. * src/liboping.c: A bug when matching received packets to configured hosts has been fixed. This regression was introduced after 1.0, we believe. Thanks to Sebastian Harl for noticing and fixing this bug. * src/liboping.c: Support for the `PING_OPT_DEVICE' option has been added. This option can be used to set the outgoing network device. Thanks to Sebastian for his patch. 2009-07-15, Version 1.2.0 * `oping': Implement the `-f' command line option to read hostnames from a file (or STDIN). * src/liboping.c: No longer export `sstrerror'. 2009-04-05, Version 1.1.2 * liboping.c: A NULL-pointer dereference has been fixed in the IPv4 code. This led to a segmentation fault when an ICMPv4 paket could not be associated with any host. This usually happened when one or more hosts were unreachable for some time. Thanks to Tomasz Pala for discovering the problem and finding a way to reproduce it. 2009-03-23, Version 1.1.1 * liboping.c: Use libxnet when available. The `normal' version of `recvmsg' does not provide the `auxiliary data' on some or all versions of Solaris. 2009-03-15, Version 1.1.0 * liboping.c: Eliminate the use of `strerror' and use `strerror_r' instead, removing the (hopefully) last thread-unsafe function. * liboping.c: Provide the TTL of received IP packets. * oping.c: Allow setting of the TTL using the `-t' command line option. 2009-02-17, Version 1.0.0 * oping.h: Provide the OPING_VERSION to easily determine the library's version at compile time. * liboping.c: Fixed an off-by-one error in `ping_iterator_get_info': When determining the buffer size to hold the hostname, the function would return one byte too little. * liboping.c: Fix an incorrect assertion in `ping_timeval_add'. Thanks to Alex Brooks for reporting the issue. * liboping.c: Make sure `EAI_SYSTEM' is defined at compile time. Although specified by POSIX, Cygwin apparently doesn't have it. * liboping.c: Add compatibility code for AIX. Thanks to Doug MacEachern for the patch. * liboping.c: Store and possibly return the host name as provided by the user. * liboping.c: The number of timed out packets is now counted and can be retrieved with `ping_iterator_get_info'. * Perl bindings: The Net::Oping Perl package has been added to bindings/ and is built along with liboping. 2007-03-27, Version 0.3.5 * liboping.c: Close the filedescriptor in `ping_free', not `ping_host_remove'. Thanks to Esteban Sanchez for submitting this patch. * oping.h: Include so that `size_t' is defined. Thanks to Alex Brooks for pointing this out. * oping.h: Use `extern "C"' when being used with C++. Thanks to Alex Brooks for pointing this out. 2006-12-01, Version 0.3.4 * Fixes a bug in `ping_host_remove': Due to an incorrect hostname checking the wrong host would be removed. 2006-07-16, Version 0.3.3 * `sendto(2)' now catches `EHOSTUNREACH' and `ENETUNREACH' if they're defined. 2006-07-13, Version 0.3.2 * `oping' now drops root privileges as soon as possible. * `liboping' now contains an `soname' and a version. 2006-07-09, Version 0.3.1 * Removed `libltdl' from the distribution since it's not used. * More nonsense has been removed from the build system. Thanks to Sebastian Harl for pointing it out :) 2006-07-09, Version 0.3.0 * The ability to set the source address from which the packets originate has been added to the library and the oping application. 2006-07-16, Version 0.2.3 * `sendto(2)' now catches `EHOSTUNREACH' and `ENETUNREACH' if they're defined. 2006-06-05, Version 0.2.2 * The `oping' application didn't exit if no hosts could be resolved. This release fixes it's behavior. 2006-06-01, Version 0.2.1 * Fix the behavior for non GNU-Linux systems. liboping tried to `bind(2)' to the raw-socket it uses to send ICMP packets. Apparently (decided by majority vote ;) this is not the right thing to do. GNU/Linux never complained about it, but works find without the bind. Other operating systems don't work at all with the bind. * Build fixes for non-GNU/Linux platforms: Mac OS X doesn't define `size_t' as `unsigned int' and therefore needs casting and FreeBSD needs to have `sys/types.h' included before `netinet/*.h' 2006-05-29, Version 0.2.0 * It's now possible to set the data to be send to the remote host and to get the data received from the host. * The `oping' binary now calculates the standard deviation. Also, it displays the number of byes that were received and other output changes. * Hosts are now returned in the same order as they were added by `ping_host_add'. This is not guaranteed, but makes `oping' prettier. 2006-05-12, Version 0.1.1 * A bug in the library has been fixed: When the sequence got higher than 2^16 the counter in the packets wrapped around, but the internal counter didn't, causing the library to ignore all further ICMP packets. This affected both, ICMPv4 and ICMPv6. 2006-05-08, Version 0.1.0 * Initial release. liboping-liboping-1.10.0/Makefile.am000066400000000000000000000000601310501064500172200ustar00rootroot00000000000000SUBDIRS = src bindings ACLOCAL_AMFLAGS = -I m4 liboping-liboping-1.10.0/NEWS000066400000000000000000000000001310501064500156550ustar00rootroot00000000000000liboping-liboping-1.10.0/README000066400000000000000000000074431310501064500160600ustar00rootroot00000000000000 liboping – Library to ping IPv4 and IPv6 hosts in parallel ════════════════════════════════════════════════════════════ http://noping.cc/ About ━━━━━ liboping was inspired by ping, libping and fping: It differs from these existing solutions in that it can “ping” multiple hosts in parallel using IPv4 or IPv6 transparently. Other design principles were an object oriented interface, simplicity and extensibility. On top of liboping two command line applications have been built. “oping” is a drop-in replacement for ping(1) with very similar output. “noping” is an ncurses-based application which displays statistics while pinging and highlights aberrant round-trip times. Features ━━━━━━━━ • Support for multiple hosts. • Support for IPv4 and IPv6. • Object oriented interface. Perl bindings ━━━━━━━━━━━━━ Included in the source package of liboping are bindings for Perl. The code resides in the bindings/ subdirectory and is compiled and installed by default. To disable building the Perl bindings, call “configure” with “--without-perl-bindings”. Permissions ━━━━━━━━━━━━━ On UNIX, special permissions are required to open raw sockets (raw(7)). If you compile and install the “oping” and “noping” binaries as normal user (which is strongly suggested), you won't be able to use the binaries as a normal user, because you won't have the permission to open raw sockets. The “install” target will automatically try fix this, if it is run with UID~0 (as user root). When on Linux, the capabilities described below will be added. On other UNIXes the traditional Set-UID method (also described below) is used instead. The build system will not abort if this fails, because there are file systems which do not support either method. Also, the Debian packaging system and possibly other scenarios only act as if they were running as root. Linux ━━━━━ On Linux, the preferred method is to assign the required “capability” to the binaries. This will allow the binary to open raw sockets, but doesn't give any other permissions such as reading other users' files or shutting down the system. The downside is that this mechanism is comparatively new: Assigning capabilities to files is available since Linux 2.6.24. To set the required capabilities, run (as user root): # setcap cap_net_raw=ep /opt/oping/bin/oping # setcap cap_net_raw=ep /opt/oping/bin/noping Other UNIX ━━━━━━━━━━ Capabilities are a nice but Linux-specific solution. To make “oping” and “noping” available to unprivileged users on other UNIX systems, use the traditional set-UID root solution. If your system supports “saved set-UIDs” (basically all systems do), the applications will drop the privileges during initialization and only regain them when actually opening the socket(s). To set the set-UID bit, run (as user root): # chown root: /opt/oping/bin/{,n}oping # chmod u+s /opt/oping/bin/{,n}oping Licensing terms ━━━━━━━━━━━━━━━ liboping is licensed under the “GNU Lesser General Public License” (LGPL), version 2.1 or later. The exact licensing terms can be found in the file “COPYING” included in the source distribution of liboping. The “oping” and “noping” utilities included in this package are licensed under the “GNU General Public License” (GPL), version 2. The full licensing terms can be found online at . Author ━━━━━━ Florian “octo” Forster liboping-liboping-1.10.0/autogen.sh000077500000000000000000000001631310501064500171710ustar00rootroot00000000000000#!/bin/sh set -e autoreconf --warnings=all --install echo "autoconfiguration done, to build: ./configure ; make" liboping-liboping-1.10.0/bindings/000077500000000000000000000000001310501064500167655ustar00rootroot00000000000000liboping-liboping-1.10.0/bindings/Makefile.am000066400000000000000000000017611310501064500210260ustar00rootroot00000000000000EXTRA_DIST = perl/Changes perl/MANIFEST perl/META.yml perl/Makefile.PL \ perl/Oping.xs perl/README perl/lib/Net/Oping.pm perl/t/Oping.t \ perl/typemap all-local: @BINDINGS@ [ ! -f perl/Makefile ] || ( cd perl && $(MAKE) all ) install-exec-local: [ ! -f perl/Makefile ] || ( cd perl && $(MAKE) install ) clean-local: [ ! -f perl/Makefile ] || ( cd perl && $(MAKE) realclean ) test: [ ! -f perl/Makefile ] || ( cd perl && $(MAKE) test ) perl: perl-bindings perl-bindings: perl/Makefile cd perl && $(MAKE) # Check if the `perl' directory exists in the _build_ directory. If not, copy # the files from the _source_ directory. perl/Makefile: perl/Makefile.PL $(top_builddir)/config.status if test ! -d perl; then \ for file in $(EXTRA_DIST); do \ mkdir -p `dirname $$file`; \ cp $(srcdir)/$$file `dirname $$file`; \ done \ fi cd perl && @PERL@ Makefile.PL PREFIX="$(prefix)" TOP_BUILDDIR="$(top_builddir)" TARGET_LIBDIR="$(libdir)" @PERL_BINDINGS_OPTIONS@ .PHONY: perl perl-bindings liboping-liboping-1.10.0/bindings/perl/000077500000000000000000000000001310501064500177275ustar00rootroot00000000000000liboping-liboping-1.10.0/bindings/perl/Changes000066400000000000000000000026121310501064500212230ustar00rootroot00000000000000Revision history for Perl extension Net::Oping. 1.21 Thu Oct 1 14:28:25 2009 - Fix an off-by-one error in `_ping_iterator_get_hostname' which caused the trailing null-byte to be included in the strings that are the keys of the hash returned by Net::Oping::ping. Thanks to Fredrik Soderblom for reporting this issue and providing the patch. 1.20 Sat Jul 18 14:57:32 2009 - The `device' method has been added. 1.10 Sun Mar 15 13:49:56 2009 - The build system has been improved. - The `ttl', `get_recv_ttl', and `get_dropped' methods have been added to support new features in liboping 1.0.0 and 1.1.0. 1.02 Tue Feb 17 08:52:25 2009 - Fix a memory leak in _ping_iterator_get_hostname() [fixes RT#37066] Thanks to "Iceberg" for reporting this issue and providing the patch. 1.01 Sun Jan 27 16:08:03 2008 - Have `Makefile.PL' exit if the header file cannot be found _before_ a Makefile is generated. This is done because `ExtUtils::MakeMaker' doesn't check whether libraries exist and this seems to be the standard way of dealing with this. A (hopefully) informative message is written to STDERR in this case. 1.00 Sat Jan 26 13:52:11 2008 - The module has been renamed from `Oping' to `Net::Oping'. - The XS code has been simplified and a high-level interface has been created in Perl. 0.01 Wed Oct 24 01:32:19 2007 - original version; created by h2xs 1.23. liboping-liboping-1.10.0/bindings/perl/MANIFEST000066400000000000000000000001311310501064500210530ustar00rootroot00000000000000Changes lib/Net/Oping.pm Makefile.PL MANIFEST META.yml Oping.xs README t/Oping.t typemap liboping-liboping-1.10.0/bindings/perl/META.yml000066400000000000000000000004611310501064500212010ustar00rootroot00000000000000# http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Net-Oping version: 1.21 version_from: lib/Net/Oping.pm installdirs: site requires: distribution_type: module generated_by: ExtUtils::MakeMaker version 6.30_01 liboping-liboping-1.10.0/bindings/perl/Makefile.PL000066400000000000000000000074321310501064500217070ustar00rootroot00000000000000use 5.006; use ExtUtils::MakeMaker; use Config (%Config); my @OPING_PREFIX = (qw(/opt/oping /usr /usr/local)); my $OPING_PREFIX; my $OPING_CPPFLAGS; my $OPING_LDDLFLAGS; my $OPING_LIBS; my $OPING_DEPEND; # TOP_BUILDDIR is set by liboping's build system, so Net::Oping can link with # the yet uninstalled library. my $TOP_BUILDDIR; my $TARGET_LIBDIR; # Parse custom command line arguments. for (my $i = 0; $i < @ARGV; $i++) { if ($ARGV[$i] =~ m#^OPING_PREFIX=(.*[^/])#) { unshift (@OPING_PREFIX, $1); splice (@ARGV, $i, 1); $i--; } elsif ($ARGV[$i] =~ m#^TOP_BUILDDIR=(.*[^/])#) { $TOP_BUILDDIR = $1; # TOP_BUILDDIR is passed from bindings/, but we're currently in # bindings/perl/. If it is a relative path, we need to add an # extra `../' in order to compensate for this. if ($TOP_BUILDDIR !~ m#^/#) { $TOP_BUILDDIR = "../$TOP_BUILDDIR"; } splice (@ARGV, $i, 1); $i--; } elsif ($ARGV[$i] =~ m#^TARGET_LIBDIR=(.*[^/])#) { # Only save TARGET_LIBDIR if it's not a standard system library # directory, such as /usr/lib. if (!is_system_libdir ($1)) { $TARGET_LIBDIR = $1; } splice (@ARGV, $i, 1); $i--; } } if (!$TOP_BUILDDIR) { for (my $i = 0; $i < @OPING_PREFIX; $i++) { if (!-e $OPING_PREFIX[$i] . '/include/oping.h') { next; } $OPING_PREFIX = $OPING_PREFIX[$i]; print "Found in $OPING_PREFIX/include\n"; last; } } if ($TOP_BUILDDIR) { # Use LDDLFLAGS here instead of LIBS, because: # 1) We need to make sure our library path comes first (and no locally # installed version is used). # 2) Prevent MakeMaker from stipping the -rpath option when the # library is to be installed in a non-standard path. Standard-paths # are read from $Config{'libsdirs'} above. $OPING_CPPFLAGS = "-I$TOP_BUILDDIR/src"; $OPING_LDDLFLAGS = "-L$TOP_BUILDDIR/src/.libs " . $Config{'lddlflags'}; $OPING_LIBS = "-L$TOP_BUILDDIR/src/.libs -loping"; if ($TARGET_LIBDIR) { $OPING_LDDLFLAGS .= qq( -Wl,-rpath -Wl,"$TARGET_LIBDIR"); } $OPING_DEPEND = { 'Oping.o' => "$TOP_BUILDDIR/src/liboping.la" }; } elsif ($OPING_PREFIX) { # -rpath is automagically set in this case. $OPING_CPPFLAGS = "-I$OPING_PREFIX/include"; $OPING_LIBS = "-L$OPING_PREFIX/lib -loping"; } if (!$OPING_CPPFLAGS) { my $search_path = join (', ', @OPING_PREFIX); print STDERR <! * ****************************************************************************** The header file could not be found in the usual places. The prefix paths searched right now are: $search_path Please rerun Makefile.PL giving the prefix to the oping library using the `OPING_PREFIX' argument. If you, for example, had installed the oping library to /tmp/oping, the header file would be at /tmp/oping/include/oping.h; you'd then need to run the Makefile.PL as follows: perl Makefile.PL OPING_PREFIX=/tmp/oping As you can see, the argument passed via `OPING_PREFIX' must be the same directory you passed to the liboping configure script using the `--prefix' argument. No Makefile has been created. EOF exit (0); } WriteMakefile( NAME => 'Net::Oping', VERSION_FROM => 'lib/Net/Oping.pm', PREREQ_PM => {}, ($] >= 5.005 ? (ABSTRACT_FROM => 'lib/Net/Oping.pm', AUTHOR => 'Florian Forster ') : ()), ($OPING_DEPEND ? (depend => $OPING_DEPEND) : ()), LIBS => [$OPING_LIBS], ($OPING_LDDLFLAGS ? (LDDLFLAGS => "$OPING_LDDLFLAGS") : ()), DEFINE => '', INC => "$OPING_CPPFLAGS" ); sub is_system_libdir { my $path = shift; for (split (' ', $Config{'libsdirs'})) { if ($path eq $_) { return (1); } } return; } liboping-liboping-1.10.0/bindings/perl/Oping.xs000066400000000000000000000110641310501064500213610ustar00rootroot00000000000000/** * Net-Oping - Oping.xs * Copyright (C) 2007 Olivier Fredj * Copyright (C) 2008,2009 Florian octo Forster * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; only version 2 of the License is * applicable. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * Authors: * Olivier Fredj * Florian octo Forster */ #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include #include #include #include #include #include #include #include /* NI_MAXHOST */ #include MODULE = Net::Oping PACKAGE = Net::Oping PROTOTYPES: DISABLE pingobj_t * _ping_construct () CODE: RETVAL = ping_construct (); OUTPUT: RETVAL void _ping_destroy (obj); pingobj_t *obj CODE: ping_destroy(obj); int _ping_setopt_timeout (obj, timeout) pingobj_t *obj double timeout CODE: RETVAL = ping_setopt (obj, PING_OPT_TIMEOUT, &timeout); OUTPUT: RETVAL int _ping_setopt_ttl (obj, ttl) pingobj_t *obj int ttl CODE: RETVAL = ping_setopt (obj, PING_OPT_TTL, &ttl); OUTPUT: RETVAL int _ping_setopt_source (obj, addr) pingobj_t *obj char *addr CODE: RETVAL = ping_setopt (obj, PING_OPT_SOURCE, addr); OUTPUT: RETVAL int _ping_setopt_device (obj, dev) pingobj_t *obj char *dev CODE: #if OPING_VERSION >= 1003000 RETVAL = ping_setopt (obj, PING_OPT_DEVICE, dev); #else RETVAL = -95; #endif OUTPUT: RETVAL int _ping_host_add (obj, host); pingobj_t *obj const char *host CODE: RETVAL = ping_host_add (obj, host); OUTPUT: RETVAL int _ping_host_remove (obj, host) pingobj_t *obj const char *host CODE: RETVAL = ping_host_remove (obj, host); OUTPUT: RETVAL int _ping_send (obj) pingobj_t *obj CODE: RETVAL=ping_send (obj); OUTPUT: RETVAL pingobj_iter_t * _ping_iterator_get (obj) pingobj_t *obj CODE: RETVAL = ping_iterator_get (obj); OUTPUT: RETVAL pingobj_iter_t * _ping_iterator_next (iter) pingobj_iter_t *iter CODE: RETVAL = ping_iterator_next (iter); OUTPUT: RETVAL int _ping_iterator_count (obj) pingobj_t *obj CODE: RETVAL = ping_iterator_count (obj); OUTPUT: RETVAL double _ping_iterator_get_latency (iter) pingobj_iter_t *iter CODE: double tmp; size_t tmp_size; int status; RETVAL = -1.0; tmp_size = sizeof (tmp); status = ping_iterator_get_info (iter, PING_INFO_LATENCY, (void *) &tmp, &tmp_size); if (status == 0) RETVAL = tmp; OUTPUT: RETVAL void _ping_iterator_get_hostname (iter) pingobj_iter_t *iter PPCODE: char *buffer; size_t buffer_size; int status; do { buffer = NULL; buffer_size = 0; status = ping_iterator_get_info (iter, PING_INFO_HOSTNAME, (void *) buffer, &buffer_size); if (status != ENOMEM) break; #if !defined(OPING_VERSION) || (OPING_VERSION <= 3005) /* This is a workaround for a bug in 0.3.5. */ buffer_size++; #endif buffer = (char *) malloc (buffer_size); if (buffer == NULL) break; status = ping_iterator_get_info (iter, PING_INFO_HOSTNAME, (void *) buffer, &buffer_size); if (status != 0) { free (buffer); break; } buffer[buffer_size - 1] = 0; XPUSHs (sv_2mortal (newSVpvn(buffer, strlen (buffer)))); free(buffer); } while (0); int _ping_iterator_get_dropped (iter) pingobj_iter_t *iter CODE: #if defined(PING_INFO_DROPPED) uint32_t tmp; size_t tmp_size; int status; RETVAL = -1; tmp_size = sizeof (tmp); status = ping_iterator_get_info (iter, PING_INFO_DROPPED, (void *) &tmp, &tmp_size); if (status == 0) RETVAL = (int) tmp; #else RETVAL = -1; #endif OUTPUT: RETVAL int _ping_iterator_get_recv_ttl (iter) pingobj_iter_t *iter CODE: #if defined(PING_INFO_RECV_TTL) int tmp; size_t tmp_size; int status; RETVAL = -1; tmp_size = sizeof (tmp); status = ping_iterator_get_info (iter, PING_INFO_RECV_TTL, (void *) &tmp, &tmp_size); if (status == 0) RETVAL = tmp; #else RETVAL = -1; #endif OUTPUT: RETVAL const char * _ping_get_error (obj) pingobj_t *obj CODE: RETVAL = ping_get_error(obj); OUTPUT: RETVAL liboping-liboping-1.10.0/bindings/perl/README000066400000000000000000000025601310501064500206120ustar00rootroot00000000000000Net::Oping ========== ICMP latency measurement module using the oping library. DESCRIPTION This Perl module is a high-level interface to the oping library. Its purpose it to send "ICMP ECHO_REQUEST" packets (also known as "ping") to a host and measure the time that elapses until the reception of an "ICMP ECHO_REPLY" packet (also known as "pong"). If no such packet is received after a certain timeout the host is considered to be unreachable. The used "oping" library supports "ping"ing multiple hosts in parallel and works with IPv4 and IPv6 transparently. Other advanced features that are provided by the underlying library, such as setting the data sent or configuring the time of live (TTL) are not yet supported by this interface. INSTALLATION This module is compiled and installed in the standard Perl way: perl Makefile.PL make make test make install DEPENDENCIES This module requires the "oping" library to be installed. The library is available at . COPYRIGHT AND LICENSE Copyright (C) 2007 by Olivier Fredj Copyright (C) 2008,2009 by Florian Forster This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available. liboping-liboping-1.10.0/bindings/perl/lib/000077500000000000000000000000001310501064500204755ustar00rootroot00000000000000liboping-liboping-1.10.0/bindings/perl/lib/Net/000077500000000000000000000000001310501064500212235ustar00rootroot00000000000000liboping-liboping-1.10.0/bindings/perl/lib/Net/Oping.pm000066400000000000000000000244521310501064500226440ustar00rootroot00000000000000# # Net-Oping - lib/Net/Oping.pm # Copyright (C) 2007 Olivier Fredj # Copyright (C) 2008,2009 Florian octo Forster # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; only version 2 of the License is # applicable. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Authors: # Olivier Fredj # Florian octo Forster # package Net::Oping; =head1 NAME Net::Oping - ICMP latency measurement module using the oping library. =head1 SYNOPSIS use Net::Oping (); my $obj = Net::Oping->new (); $obj->host_add (qw(one.example.org two.example.org)); my $ret = $obj->ping (); print "Latency to `one' is " . $ret->{'one.example.org'} . "\n"; =head1 DESCRIPTION This Perl module is a high-level interface to the L. Its purpose it to send C packets (also known as "ping") to a host and measure the time that elapses until the reception of an C packet (also known as "pong"). If no such packet is received after a certain timeout the host is considered to be unreachable. The used I library supports "ping"ing multiple hosts in parallel and works with IPv4 and IPv6 transparently. Other advanced features that are provided by the underlying library, such as setting the data sent, are not yet supported by this interface. =cut use 5.006; use strict; use warnings; use Carp (qw(cluck confess)); our $VERSION = '1.21'; require XSLoader; XSLoader::load ('Net::Oping', $VERSION); return (1); =head1 INTERFACE The interface is kept simple and clean. First you need to create an object to which you then add hosts. Using the C method you can request a latency measurement and get the current values returned. If necessary you can remove hosts from the object, too. The constructor and methods are defined as follows: =over 4 =item I<$obj> = Net::Oping-EB (); Creates and returns a new object. =cut sub new { my $pkg = shift; my $ping_obj = _ping_construct (); my $obj = bless ({ c_obj => $ping_obj }, $pkg); return ($obj); } sub DESTROY { my $obj = shift; _ping_destroy ($obj->{'c_obj'}); } =item I<$status> = I<$obj>-EB (I<$timeout>); Sets the timeout before a host is considered unreachable to I<$timeout> seconds, which may be a floating point number to specify fractional seconds. =cut sub timeout { my $obj = shift; my $timeout = shift; my $status; $status = _ping_setopt_timeout ($obj->{'c_obj'}, $timeout); if ($status != 0) { $obj->{'err_msg'} = "" . _ping_get_error ($obj->{'c_obj'}); return; } return (1); } =item I<$status> = I<$obj>-EB (I<$ttl>); Sets the I