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
24#include <openvpn/win/call.hpp>
25
26namespace openvpn {
27
28class WinCmd : public Action
29{
30 public:
32
33 WinCmd(const std::string &command)
34 : cmd(command)
35 {
36 }
37
38 virtual void execute(std::ostream &os) override
39 {
40 os << cmd << std::endl;
41 std::string out = Win::call(cmd);
42 os << out;
43 }
44
45 virtual 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
The smart pointer class.
Definition rc.hpp:119
RCPtr< WinCmd > Ptr
Definition cmd.hpp:31
virtual void execute(std::ostream &os) override
Definition cmd.hpp:38
virtual std::string to_string() const override
Definition cmd.hpp:45
std::string cmd
Definition cmd.hpp:51
WinCmd(const std::string &command)
Definition cmd.hpp:33
std::string call(const std::string &cmd)
Definition call.hpp:31
std::ostringstream os
static std::stringstream out
Definition test_path.cpp:10