From: Guilherme Maciel Ferreira Date: Tue, 8 Mar 2011 17:51:37 +0000 (+0100) Subject: Included a section explaining the basics of the code X-Git-Tag: v1.0~155 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=f9c5fff0efca359776548728b240af57721a9d7b;p=pingcheck Included a section explaining the basics of the code --- diff --git a/Readme b/Readme index 72000fb..17add93 100644 --- a/Readme +++ b/Readme @@ -1,3 +1,13 @@ + Table of Contents +======================================= +1. Introduction +2. Code Conventions +3. Source Code +4. Configuration File +5. References + + + 1. Introduction ======================================= This application provides means to check the availability of remote hosts @@ -17,16 +27,18 @@ The host's address can be an IP or a DNS. There are many ways to invoke the application, the simplest is just type: ./libpingcheck which uses the configuration values from the configuration file (describled in -section 4.Configuration file). +the Configuration File section). 1.3. Resources --------------------------------------- -Further information about the problem domain can be found in the following -resources: -- http://tools.ietf.org/html/rfc792 -- http://en.wikipedia.org/wiki/Ping -- http://en.wikipedia.org/wiki/Internet_Control_Message_Protocol +Further information about the problem domain can be found in the References +section. + + +1.4. Legal Issues +--------------------------------------- +All rights reserved to Intra2net AG. @@ -91,8 +103,46 @@ The sources are spread over these distincts directories: - conf: keeps default and example configuration files. +3.2. Main concept of application operation +--------------------------------------- +This application makes extensive use of asynchronous timers-handlers from +Boost ASIO. So this section describes briefly how ASIO works. More information +can be found in the References section. + +The basic idea is to have a handler which will be called when a timer expires. +After the timer expires, you have to schedule the timer again to call your +handler once more. Given the declaration of the timer: + + boost::asio::deadline_timer my_timer( my_io_service ); + +you must specify when it will expire: + + my_timer.expires_at( some_time_in_seconds + seconds( interval_in_seconds ) ); + +and which method will handle when the timer expires. + + my_timer.async_wait( boost::bind( &MyClass::my_handle_method, this ) ); + +Then, the my_io_service service can be called to perform a loop: + + my_io_service.run(); + + 4. Configuration file ======================================= +In this section are describled the configuration items, along with they +possible values and meanings. +- limit-to-notify: range from 0 to the number of hosts available. This value + represents minimum number of hosts that have to fail (i.e. do not reply the + ping) in order to alert any external system. + +5. References +======================================= +[1] http://tools.ietf.org/html/rfc792 +[2] http://en.wikipedia.org/wiki/Ping +[3] http://en.wikipedia.org/wiki/Internet_Control_Message_Protocol +[4] http://www.boost.org/doc/libs/1_45_0/doc/html/boost_asio.html +[5] http://www.boost.org/doc/libs/1_45_0/doc/html/program_options.html