OpenVPN 3 Core Library
Loading...
Searching...
No Matches
cmd.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_CMD_H
13
#define OPENVPN_WIN_CMD_H
14
15
#include <windows.h>
16
17
#include <string>
18
#include <regex>
19
20
#include <
openvpn/common/exception.hpp
>
21
#include <
openvpn/common/string.hpp
>
22
#include <
openvpn/common/action.hpp
>
23
#include <
openvpn/common/unicode.hpp
>
24
#include <
openvpn/win/call.hpp
>
25
26
namespace
openvpn
{
27
28
class
WinCmd
:
public
Action
29
{
30
public
:
31
typedef
RCPtr<WinCmd>
Ptr
;
32
33
WinCmd
(
const
std::string &command)
34
:
cmd
(command)
35
{
36
}
37
38
void
execute
(std::ostream &
os
)
override
39
{
40
os
<<
cmd
<<
"\n"
;
41
std::string
out
=
Win::call
(
cmd
);
42
os
<<
out
;
43
}
44
45
std::string
to_string
()
const override
46
{
47
return
cmd
;
48
}
49
50
private
:
51
std::string
cmd
;
52
};
53
54
}
// namespace openvpn
55
#endif
action.hpp
call.hpp
openvpn::RCPtr
The smart pointer class.
Definition
rc.hpp:119
openvpn::WinCmd
Definition
cmd.hpp:29
openvpn::WinCmd::Ptr
RCPtr< WinCmd > Ptr
Definition
cmd.hpp:31
openvpn::WinCmd::cmd
std::string cmd
Definition
cmd.hpp:51
openvpn::WinCmd::WinCmd
WinCmd(const std::string &command)
Definition
cmd.hpp:33
openvpn::WinCmd::to_string
std::string to_string() const override
Definition
cmd.hpp:45
openvpn::WinCmd::execute
void execute(std::ostream &os) override
Definition
cmd.hpp:38
unicode.hpp
exception.hpp
openvpn::Win::call
std::string call(const std::string &cmd)
Definition
call.hpp:31
openvpn
Definition
ovpncli.cpp:97
string.hpp
openvpn::Action
Definition
action.hpp:31
os
std::ostringstream os
Definition
test_capture.cpp:1099
out
static std::stringstream out
Definition
test_path.cpp:10
openvpn
win
cmd.hpp
Generated by
1.9.8