File: RadiusConfig.h

package info (click to toggle)
openvpn-auth-radius 2.1-12
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,824 kB
  • sloc: cpp: 9,043; perl: 323; makefile: 46
file content (91 lines) | stat: -rwxr-xr-x 2,620 bytes parent folder | download | duplicates (7)
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
/*
 *  RadiusClass -- An C++-Library for 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 _CONFIGPARSER_H_

#define _CONFIGPARSER_H_
#include <fstream>
#include <iostream>
#include <cstring>
#include <cstdlib>

#include "RadiusServer.h"
#include"RadiusServer.h"
#include "error.h"

#include <list>
#include <utility> 

using std::list;
using namespace std;

/**This class represents the configurations attributes which 
 * can set in the configuration file and methods for the attributes.
 */
class RadiusConfig
{
private:
	list<RadiusServer> server; 		/**<An list with radius server, it is created dynamically by parsing the configuration file.*/
	char serviceType[2]; 			/**<The service type which is set in the radius packet.*/
    char framedProtocol[2]; 		/**<The framed protocol which is set in the radius packet as an attribute.*/
    char nasPortType[2]; 			/**<The nas port type which is set in radius packet.*/
    char nasIdentifier[128]; 		/**<The nas identifier which is set in the radius packet.*/
    char nasIpAddress[16]; 			/**<The nas ipaddress which is set in the radius packet.*/
    
	void deletechars(string *);
	
	
public:
	RadiusConfig(void);
	RadiusConfig(string configfile);
	~RadiusConfig();
	
	int parseConfigFile(const char * configfile);
	
		
	
	void getValue(const char * text, char * value);
	
	list<RadiusServer>* getRadiusServer(void);
	
	
	void setServiceType(char *);
	char * getServiceType(void);
	
	void setFramedProtocol(char *);
	char * getFramedProtocol(void);
	
    
    void setNASPortType(char *);
    char * getNASPortType(void);
    
    void setNASIdentifier(char *);
    char * getNASIdentifier(void);
    
    char * getNASIpAddress(void);
	void setNASIpAddress(char * );
	
	
	
	friend ostream& operator << (ostream& os, RadiusConfig& config);
};

#endif //_CONFIGPARSER_H_