VirtualBox

source: vbox/trunk/src/VBox/Main/include/NATNetworkServiceRunner.h@ 53390

Last change on this file since 53390 was 46970, checked in by vboxsync, 11 years ago

re-added
Main/src-server/NATNetworkServiceRunner.cpp
Main/src-server/DHCPServerRunner.cpp
Main/include/DHCPServerRunner.h
Main/include/NATNetworkServiceRunner.h

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
1/* $Id: NATNetworkServiceRunner.h 46970 2013-07-04 06:43:15Z vboxsync $ */
2/** @file
3 * VirtualBox Main - interface for VBox NAT Network service
4 */
5
6/*
7 * Copyright (C) 2009-2010 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17#include <iprt/err.h>
18#include <iprt/types.h>
19#include <iprt/string.h>
20#include <iprt/mem.h>
21#include <VBox/com/string.h>
22
23typedef enum
24{
25 NATSCCFG_NAME = 1,
26 NATSCCFG_TRUNKTYPE,
27 NATSCCFG_MACADDRESS,
28 NATSCCFG_IPADDRESS,
29 NATSCCFG_NETMASK,
30 NATSCCFG_PORTFORWARD4,
31 NATSCCFG_PORTFORWARD6,
32 NATSCCFG_NOTOPT_MAXVAL
33}NATSCCFG;
34
35#define TRUNKTYPE_WHATEVER "whatever"
36#define TRUNKTYPE_SRVNAT "srvnat"
37
38class NATNetworkServiceRunner
39{
40public:
41 NATNetworkServiceRunner();
42 ~NATNetworkServiceRunner() { stop(); /* don't leave abandoned networks */}
43
44 int setOption(NATSCCFG opt, const char *val, bool enabled)
45 {
46 if (opt == 0 || opt >= NATSCCFG_NOTOPT_MAXVAL)
47 return VERR_INVALID_PARAMETER;
48 if (isRunning())
49 return VERR_INVALID_STATE;
50
51 mOptions[opt] = val;
52 mOptionEnabled[opt] = enabled;
53 return VINF_SUCCESS;
54 }
55
56 int setOption(NATSCCFG opt, const com::Utf8Str &val, bool enabled)
57 {
58 return setOption(opt, val.c_str(), enabled);
59 }
60
61 int start();
62 int stop();
63 bool isRunning();
64
65 void detachFromServer();
66private:
67 com::Utf8Str mOptions[NATSCCFG_NOTOPT_MAXVAL];
68 bool mOptionEnabled[NATSCCFG_NOTOPT_MAXVAL];
69 RTPROCESS mProcess;
70};
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette