forked from pocoproject/poco
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNTPEventArgs.h
More file actions
86 lines (62 loc) · 1.6 KB
/
NTPEventArgs.h
File metadata and controls
86 lines (62 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//
// NTPEventArgs.h
//
// $Id: //poco/1.4/Net/include/Poco/Net/NTPEventArgs.h#1 $
//
// Library: Net
// Package: NTP
// Module: NTPEventArgs
//
// Definition of NTPEventArgs.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Net_NTPEventArgs_INCLUDED
#define Net_NTPEventArgs_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/SocketAddress.h"
#include "Poco/Net/NTPPacket.h"
namespace Poco {
namespace Net {
class Net_API NTPEventArgs
/// The purpose of the NTPEventArgs class is to be used as template parameter
/// to instantiate event members in NTPClient class.
/// When clients register for an event notification, the reference to the class is
/// passed to the handler function to provide information about the event.
{
public:
NTPEventArgs(const SocketAddress& address);
/// Creates NTPEventArgs.
virtual ~NTPEventArgs();
/// Destroys NTPEventArgs.
std::string hostName() const;
/// Tries to resolve the target IP address into host name.
/// If unsuccessful, all exceptions are silently ignored and
/// the IP address is returned.
std::string hostAddress() const;
/// Returns the target IP address.
const NTPPacket &packet();
/// Returns the NTP packet.
private:
NTPEventArgs();
void setPacket(NTPPacket &packet);
SocketAddress _address;
NTPPacket _packet;
friend class NTPClient;
};
//
// inlines
//
inline const NTPPacket &NTPEventArgs::packet()
{
return _packet;
}
inline void NTPEventArgs::setPacket(NTPPacket &packet)
{
_packet = packet;
}
} } // namespace Poco::Net
#endif