OpenVPN 3 Core Library
Loading...
Searching...
No Matches
sleep.hpp
Go to the documentation of this file.
1
// OpenVPN -- An application to securely tunnel IP networks
2
// over a single port, with support for SSL/TLS-based
3
// session authentication and key exchange,
4
// packet encryption, packet authentication, and
5
// packet compression.
6
//
7
// Copyright (C) 2012- OpenVPN Inc.
8
//
9
// SPDX-License-Identifier: MPL-2.0 OR AGPL-3.0-only WITH openvpn3-openssl-exception
10
//
11
12
#ifndef OPENVPN_WIN_SLEEP_H
13
#define OPENVPN_WIN_SLEEP_H
14
15
#include <windows.h>
16
17
#include <string>
18
19
#include <
openvpn/common/action.hpp
>
20
#include <
openvpn/common/to_string.hpp
>
21
22
namespace
openvpn
{
23
24
class
WinSleep
:
public
Action
25
{
26
public
:
27
typedef
RCPtr<WinSleep>
Ptr
;
28
29
WinSleep
(DWORD dwMilliseconds_arg)
30
:
dwMilliseconds
(dwMilliseconds_arg)
31
{
32
}
33
34
void
execute
(std::ostream &
os
)
override
35
{
36
os
<<
to_string
() <<
"\n"
;
37
::Sleep(
dwMilliseconds
);
38
}
39
40
std::string
to_string
()
const override
41
{
42
return
"Sleeping for "
+
openvpn::to_string
(
dwMilliseconds
) +
" milliseconds..."
;
43
}
44
45
private
:
46
DWORD
dwMilliseconds
;
47
};
48
49
}
// namespace openvpn
50
#endif
action.hpp
openvpn::RCPtr
The smart pointer class.
Definition
rc.hpp:119
openvpn::WinSleep
Definition
sleep.hpp:25
openvpn::WinSleep::dwMilliseconds
DWORD dwMilliseconds
Definition
sleep.hpp:46
openvpn::WinSleep::execute
void execute(std::ostream &os) override
Definition
sleep.hpp:34
openvpn::WinSleep::to_string
std::string to_string() const override
Definition
sleep.hpp:40
openvpn::WinSleep::Ptr
RCPtr< WinSleep > Ptr
Definition
sleep.hpp:27
openvpn::WinSleep::WinSleep
WinSleep(DWORD dwMilliseconds_arg)
Definition
sleep.hpp:29
openvpn
Definition
ovpncli.cpp:97
openvpn::to_string
std::string to_string(const T &t)
Convert a value to a string.
Definition
to_string.hpp:45
openvpn::Action
Definition
action.hpp:31
os
std::ostringstream os
Definition
test_capture.cpp:1099
to_string.hpp
openvpn
win
sleep.hpp
Generated by
1.9.8