Main Page | Namespace List | Alphabetical List | Class List | File List | Class Members | File Members

RadiusAttribute Class Reference

#include <RadiusAttribute.h>

List of all members.

Public Member Functions

 RadiusAttribute ()
 RadiusAttribute (Octet)
 RadiusAttribute (Octet, char *)
 RadiusAttribute (Octet, string)
 RadiusAttribute (Octet, int)
 ~RadiusAttribute (void)
RadiusAttributeoperator= (const RadiusAttribute &)
 RadiusAttribute (const RadiusAttribute &)
int getLength (void)
void setLength (Octet)
int getType (void)
void setType (Octet)
OctetgetValue (void)
int setValue (char *)
int setValue (string)
int setValue (int)
int setRecvValue (char *value)
int intFromBuf (void)
string ipFromBuf (void)
void dumpRadiusAttrib (void)
char * makePasswordHash (const char *password, char *hpassword, const char *sharedSecret, const char *authenticator)

Private Attributes

Octet type
Octet length
Octetvalue


Detailed Description

This class represents a radius attribute


Constructor & Destructor Documentation

RadiusAttribute::RadiusAttribute void   ) 
 

The constructor sets the type to 0 and the value to NULL.

RadiusAttribute::RadiusAttribute Octet  typ  ) 
 

The construcotr sets the type. The value is set to NULL.

Parameters:
Octet typ : The type of the attribute.

RadiusAttribute::RadiusAttribute Octet  ty,
char *  value
 

The constructor creates an attribute. The type and the value can be set.

Parameters:
Octet type : The type of the attribute.
char *value : A pointer to a value for the attribut.

RadiusAttribute::RadiusAttribute Octet  typ,
string  str
 

The constructor sets the type and the value.

Parameters:
Octet typ : The type of the attribute.
string str : The value as a string.

RadiusAttribute::RadiusAttribute Octet  typ,
int  value
 

The constructor sets the type and the value. The type must have the datatype integer as it is defined in the RFC of the radius protocol.

Parameters:
Octet type : The type of the packet.
int value : The value as an integer.

RadiusAttribute::~RadiusAttribute void   ) 
 

The destructor of the class. It frees the allocated memory for the value, if the pointer is not NULL.

RadiusAttribute::RadiusAttribute const RadiusAttribute ra  ) 
 

The copy constructor.


Member Function Documentation

void RadiusAttribute::dumpRadiusAttrib void   ) 
 

Creates a dump of an attribute.

int RadiusAttribute::getLength void   ) 
 

The getter method for the length of the attribute

Returns:
The length as an integer.

int RadiusAttribute::getType void   ) 
 

The getter method for the type of the attribute.

Returns:
An integer with the type.

Octet * RadiusAttribute::getValue void   ) 
 

The getter method for the value.

Returns:
The value as an Octet.

int RadiusAttribute::intFromBuf void   ) 
 

Transform a attribute value to an integer, this makes only sense if the datatype is an integer. This dependents on the definition in the radius RFC or can be locked up in the file radius.h of this source code.

Returns:
The transformed integer.

string RadiusAttribute::ipFromBuf void   ) 
 

The method converts the value into an ip. The attribute must have the right datatype IPADDRESS.

Returns:
The ip address as a string.

char * RadiusAttribute::makePasswordHash const char *  password,
char *  hpassword,
const char *  sharedSecret,
const char *  authenticator
 

Creates a password buffer with MD5/xOR hashing for the ATTRIB_User_Password. The password filed must be have a length of 16 Octets or a multiple of 16 Octets. If the password is longer than 16 characters, the XOR-hash is build of the first 16 chars, than a new XOR-hash is build over the first XOR-hash and the shared secret and so on. It if defined in the radius RFC.

Parameters:
password The User password.
hpassword A char array for the hashed password. It must have the same length as the password filed (=this->length-2).
sharedSecret The sharedsecret of the server.
authenticator String of the authenticator field.
Returns:
A pointer to the hpassword array, so the function can be used directly in a function/method.

RadiusAttribute & RadiusAttribute::operator= const RadiusAttribute ra  ) 
 

The overloading of the assignment operator.

void RadiusAttribute::setLength Octet  len  ) 
 

The setter method for the length of the attribut. Normally it calculated automatically.

Parameters:
len The length as datatype unsigned char (=Octet).

int RadiusAttribute::setRecvValue char *  value  ) 
 

Extract the value of an received attribute in the buffer to the value field of an attribute. The order is still in network order. If you want to get it maybe as a char or integer you must to know which type it is. So you know the datatype and you can convert it. But this done in another method.

Parameters:
value A pointer to the value which is copied to the value of the attribute.
Returns:
An integer which indicates errors, 0 if everthing is ok, else a number defined in the error.h.

void RadiusAttribute::setType Octet  type  ) 
 

The setter method for the type of the attribute.

Parameters:
type The type as Octet.

int RadiusAttribute::setValue int  value  ) 
 

The method sets the value for an integer. The method writes the integer in a string and calls the method setValue(char *).

Parameters:
value The value as an integer.
Returns:
An integer, 0 if everything is ok, else !=0.

int RadiusAttribute::setValue string  s  ) 
 

The method sets the value. Internal it converts the string into a char array and calls setValue(char *).

Parameters:
s The value as a string.
Returns:
An integer. 0 if everything is ok, else !=0.

int RadiusAttribute::setValue char *  value  ) 
 

Set the value of the attribute. The representation of the value is changed, so it is ready to send over the network. The changes depend on the datatype IPADRESS, INTEGER, String. The datatype enum can be treated as an integer. A special attribut is the User password, the length must be 16 octets or a multipe of 16 Octets. Here it is only copied to the value. The datatypes ipv6addr,ifid, ipv6prefix, ipv6addr are treated as strings.

Parameters:
value : A pointer to the value.
Returns:
An integer which indicates errors, 0 if everthing is ok, else a number defined in the error.h


Member Data Documentation

Octet RadiusAttribute::length [private]
 

The attribute length, of the value

Octet RadiusAttribute::type [private]
 

The attibute type, see in radius.h

Octet* RadiusAttribute::value [private]
 

A pointer to the value


The documentation for this class was generated from the following files:
Generated on Sun Nov 27 20:19:13 2005 for RadiusClass by  doxygen 1.4.2