#include <RadiusPacket.h>
Public Member Functions | |
RadiusPacket (void) | |
~RadiusPacket (void) | |
RadiusPacket (Octet code) | |
int | addRadiusAttribute (RadiusAttribute *) |
void | dumpRadiusPacket (void) |
void | dumpShapedRadiusPacket (void) |
int | radiusSend (list< RadiusServer >::iterator) |
int | radiusReceive (list< RadiusServer > *) |
int | getRadiusAttribNumber (void) |
char * | getAuthenticator (void) |
int | getCode (void) |
pair< multimap< Octet, RadiusAttribute >::iterator, multimap< Octet, RadiusAttribute >::iterator > | findAttributes (int type) |
Private Member Functions | |
void | calcacctdigest (const char *secret) |
void | getRandom (int len, Octet *num) |
int | shapeRadiusPacket (const char *) |
int | unShapeRadiusPacket (void) |
Private Attributes | |
multimap< Octet, RadiusAttribute > | attribs |
int | sock |
Octet | code |
Octet | identifier |
unsigned short int | length |
Octet | authenticator [RADIUS_PACKET_AUTHENTICATOR_LEN] |
Octet * | sendbuffer |
int | sendbufferlen |
Octet * | recvbuffer |
int | recvbufferlen |
|
The constructur generates random numbers for the identifier. The socket, the code and the buffer length are set to 0, the pointer to the buffers is set to NULL. The length is set to 20 Bytes, this is the length without attributes. |
|
The destructur frees the dynamic allocated memory of the buffers, closes the socket and clears the attribute multimap. |
|
The constructur sets the code and generate random numbers for the identifier. The socket and the buffer length are set to 0, the pointer to the buffers is set to NULL. The length is set to 20 Bytes, this is the length without attributes.
|
|
Links a radiusAttrib structure to a radiusPacket.
|
|
Sets the authenticator field if the packet is a accounting request. It is a MD5 hash over the whole packet (the authenticator field itself is set to 0) and the shared secret.
|
|
Create a dump of the radius packet |
|
Dumps a shaped RADIUS packet previously created with shapeRadiusPacket. |
|
The method finds attributes with the given type in the packet and returns iterator pair. This can be looped for the attributes.
|
|
Returns a pointer to the authenticator field.
|
|
The getter method of the packet code.
|
|
Returns the number of attributes in the given radiusPacket.
|
|
Method to generate the hash for the authenticator in Accounting-Requests. |
|
Receives a packet from a radius server, and copies it into recvbuffer. If there is no response the packet is send again if the server->retry is bigger than 0. 1 means the packet is send one more time. If a packet is received the received data is write to the recvbuffer and the length is written to recvbufferlen. The attributes are cleared if a packet is received.
|
|
The method sends the packet to a radius server.
|
|
Formats a radiusPacket structure into a buffer that can be sent to a radius server via UDP. The destination buffer is put into sendbuffer while its length is put into sendbufferlen.
|
|
Formats a UDP-received buffer radiusPacket structure
|
|
|
|
Authenticator. In ACCEPT-Request packets it is a random number, in Accounting-Request it is a hash over whole packet and shared secret. The send-method generates it, when the code is an Accounting-Request |
|
The code of the packet, see the Radius RFC or radius.h |
|
The identifier of the packet, it is generated randomly. |
|
The length of the packet on the network in bytes. |
|
Buffer for recveing the packet over the network. |
|
Length of the buffer. |
|
Buffer for sending the packet over the network. |
|
Length of the buffer. |
|
The multimap for the radius attributes.The socket which is used. |