cfd5168d9993e9e713917ff4946c6cca0ae6808f
[pingcheck] / src / dns / timetolive.h
1 /*
2 The software in this package is distributed under the GNU General
3 Public License version 2 (with a special exception described below).
4
5 A copy of GNU General Public License (GPL) is included in this distribution,
6 in the file COPYING.GPL.
7
8 As a special exception, if other files instantiate templates or use macros
9 or inline functions from this file, or you compile this file and link it
10 with other works to produce a work based on this file, this file
11 does not by itself cause the resulting work to be covered
12 by the GNU General Public License.
13
14 However the source code for this file must still be made available
15 in accordance with section (3) of the GNU General Public License.
16
17 This exception does not invalidate any other reasons why a work based
18 on this file might be covered by the GNU General Public License.
19 */
20 #ifndef TIME_TO_LIVE_H
21 #define TIME_TO_LIVE_H
22
23 #include <stdint.h>
24
25 #include <boost/asio.hpp>
26
27 //-----------------------------------------------------------------------------
28 // TimeToLive
29 //-----------------------------------------------------------------------------
30
31 class TimeToLive
32 {
33 public:
34     TimeToLive( uint32_t ttl = 0 );
35     ~TimeToLive();
36
37     uint32_t get_value() const;
38     void set_value( const uint32_t ttl );
39
40     uint32_t get_updated_value() const;
41
42 private:
43     /// the numeric time-to-live
44     uint32_t Ttl;
45     /// the time when the time-to-live was set, so it is possible to know the
46     /// elapsed time
47     boost::posix_time::ptime TtlSetTime;
48 };
49
50 #endif // TIME_TO_LIVE_H