-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.h
102 lines (77 loc) · 3.25 KB
/
Config.h
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
* radiusplugin -- An OpenVPN plugin for do radius authentication
* and accounting.
*
* Copyright (C) 2005 EWE TEL GmbH/Ralf Luebben <ralfluebben@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _CONFIG_H_
#define _CONFIG_H_
#include <fstream>
#include <iostream>
#include <cstring>
#include "RadiusClass/error.h"
#include <list>
#include <utility>
using namespace std;
/**This class represents the configurations attributes (without radius configuration) which
* can set in the configuration file and methods for the attributes.
*/
class Config
{
private:
string ccdPath; /**<The client config dir, where the plugin writes the config informations (framed routes & ip address of the client)*/
string statusfile; /**< The path and filename of the status file, where openvpn writes the status information.*/
char subnet[16]; /**<The subnet which is assigned to the client in topology option.*/
char p2p[16]; /**<The OpenVPN server address which is assigned to the client in topology p2p.*/
string vsascript; /**<A script whcih handles vendor specific attributes.*/
string vsanamedpipe; /**<The named pipe to the vsascript.*/
bool usernameascommonname; /**<Use the username as commonname in the plugin (for OpenVPN option username-as-common-name (no commonname in the enviroment!)).*/
bool clientcertnotrequired; /**<For OpenVPN option client_cert_not_required, commonname = UNDEF.*/
string openvpnconfig; /**<Path to OpenVPN config.*/
bool overwriteccfiles; /**<If true the plugin overwrites the client config files.*/
bool useauthcontrolfile; /**<If true and the OpenVPN version supports auth control files, the acf is used.*/
void deletechars(string * );
public:
Config(void);
Config(char * configfile);
~Config();
int parseConfigFile(const char * configfile);
void getValue(const char * text, char * value);
string getCcdPath(void);
void setCcdPath(string);
string getStatusFile(void);
void setStatusFile(string);
char * getSubnet(void);
void setSubnet(char * );
char * getP2p(void);
void setP2p(char * );
string getVsaScript(void);
void setVsaScript(string);
string getVsaNamedPipe(void);
void setVsaNamedPipe(string);
bool getUsernameAsCommonname(void);
void setUsernameAsCommonname(bool);
bool getClientCertNotRequired(void);
void setClientCertNotRequired(bool);
bool getOverWriteCCFiles(void);
void setOverWriteCCFiles(bool);
bool getUseAuthControlFile(void);
void setUseAuthControlFile(bool);
string getOpenVPNConfig(void);
void setOpenVPNConfig(string);
};
#endif //_CONFIG_H_