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 _RADIUSATTRIB_H_ 00023 #define _RADIUSATTRIB_H_ 00024 #include <string> 00025 #include "radius.h" 00026 #include <iostream> 00027 using namespace std; 00028 00031 class RadiusAttribute 00032 { 00033 private: 00034 Octet type; 00035 Octet length; 00036 Octet *value; 00039 public: 00040 00041 RadiusAttribute(); 00042 RadiusAttribute(Octet); 00043 RadiusAttribute(Octet, char * ); 00044 RadiusAttribute(Octet, string); 00045 RadiusAttribute(Octet, int); 00046 ~RadiusAttribute(void); 00047 00048 RadiusAttribute & operator=(const RadiusAttribute &); 00049 00050 RadiusAttribute(const RadiusAttribute &); 00051 00052 int getLength(void); 00053 void setLength(Octet); 00054 00055 int getType(void); 00056 void setType(Octet); 00057 00058 Octet * getValue(void); 00059 int setValue(char *); 00060 int setValue(string); 00061 int setValue(int); 00062 00063 int setRecvValue(char *value); 00064 00065 int intFromBuf(void); 00066 00067 string ipFromBuf(void); 00068 00069 void dumpRadiusAttrib(void); 00070 00071 char * makePasswordHash(const char *password,char * hpassword, const char *sharedSecret, const char *authenticator); 00072 00073 }; 00074 00075 00076 00077 00078 #endif //_RADIUSATTRIB_H_