00001 /* 00002 * RadiusClass -- An C++-Library for radius authentication 00003 * and accounting. 00004 * 00005 * Copyright (C) 2005 EWE TEL GmbH/Ralf Luebben <ralfluebben@gmx.de> 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License version 2 00009 * as published by the Free Software Foundation. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program (see the file COPYING included with this 00018 * distribution); if not, write to the Free Software Foundation, Inc., 00019 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 */ 00021 00022 #ifndef _CONFIGPARSER_H_ 00023 00024 #define _CONFIGPARSER_H_ 00025 #include <fstream> 00026 #include <iostream> 00027 00028 #include "RadiusServer.h" 00029 #include"RadiusServer.h" 00030 #include "error.h" 00031 00032 #include <list> 00033 #include <utility> 00034 00035 using std::list; 00036 using namespace std; 00037 00041 class RadiusConfig 00042 { 00043 private: 00044 list<RadiusServer> server; 00045 char serviceType[2]; 00046 char framedProtocol[2]; 00047 char nasPortType[2]; 00048 char nasIdentifier[128]; 00049 char nasIpAddress[16]; 00051 void deletechars(char * ); 00052 00053 00054 public: 00055 RadiusConfig(void); 00056 RadiusConfig(char * configfile); 00057 ~RadiusConfig(); 00058 00059 int parseConfigFile(const char * configfile); 00060 00061 00062 00063 void getValue(char * text, char * value); 00064 00065 list<RadiusServer>* getRadiusServer(void); 00066 00067 00068 void setServiceType(char *); 00069 char * getServiceType(void); 00070 00071 void setFramedProtocol(char *); 00072 char * getFramedProtocol(void); 00073 00074 00075 void setNASPortType(char *); 00076 char * getNASPortType(void); 00077 00078 void setNASIdentifier(char *); 00079 char * getNASIdentifier(void); 00080 00081 char * getNASIpAddress(void); 00082 void setNASIpAddress(char * ); 00083 00084 friend ostream& operator << (ostream& os, RadiusConfig& config); 00085 }; 00086 00087 #endif //_CONFIGPARSER_H_