IC::Radius - ICRADIUS Interface Module use IC::Radius; my $radius = new IC::Radius; $radius->init('username', 'password'); The IC::Radius module provides functions for interfacing with ICRADIUS

init($username, $password, [$hostname , $database, $option, $option...]);
$username - database username $password - database password $hostname - database hostname (default is localhost) $database - radius database (default is radius) $option - Init option(s) $OPT_DEBUG - Turn on debugging

initialize_errors();
initializes the internal error hashes none $self->initialize_errors(); $self->{success} DATABASE - Internal Database/SQL Syntax Error

();
$ - DATABASE - Internal Database/SQL Syntax Error

insert_user($username, $password, $encrypted);
insert a new user $username - username $password - password $encrypted - password will be encrypted if true $radius->insert_user('barney', 'rubble'); id of the newly created user DATABASE - Internal Database/SQL Syntax Error

insert_user_attribute($username, $type, $attribute, $value);
Adds a new attribute to the specified username $username - username to add attribute to $type - reply or check $attribute - attribute to add to $username $value - value of the added attribute $radius->insert_user_attribute('barney', 'reply', 'Filter-Id', 'rubble'); id of the newly added attribute. DATABASE - Internal Database/SQL Syntax Error

insert_group_attribute($groupname, $type, $attribute, $value);
Add a new attribute to the specified group $groupname - groupname to add attribute to $type - check or reply $attribute - attribute to add to $groupname $value - value of added attribute $radius->insert_group_attribute('PPP', 'reply', 'Session-Timeout', '21600'); id of the newly added attribute. DATABASE - Internal Database/SQL Syntax Error

insert_user_group($username, $groupname);
Add a user to the specified group $username - user to be added to $groupname $groupname - group to add $username to $radius->insert_user_group('barney', 'PPP'); id of the row containing the new group membership DATABASE - Internal Database/SQL Syntax Error

insert_realm($realmname, $nas, $authport [, $option, $option...]);
Add a new realm $realmname - realms realname $nas - nas name $authport - auth port $options - reference to array of options for realm $radius->insert_realm('flintstones.com', 'bedrock', '1812', 'nostrip'); id of the newly created realm DATABASE - Internal Database/SQL Syntax Error

insert_nas($nasname, $shortname, $ipaddr, $type, $ports, $secret, $community, $snmp);
Add a new nas $nasname - name of nas to add $shortname - shortname of nas $ipaddr - ip address of nas $type - type of nas $ports - number of ports on nas $secret - nas's secret $community - snmp community name $snmp - snmp status of 'on' or 'off' $radius->insert_nas('pm1.flintstones.com', 'pm1', '123.199.199.199', 'livingston', '46', 'Dino', 'flintsnmp', 'on'); id of the newly created nas DATABASE - Internal Database/SQL Syntax Error

delete_user($username);
deletes all entries in radgroup, radreply, and usergroup for the specified user $username - user to delete $radius->delete_user('fred'); `$self-'{success}> if the operation is successful DATABASE - Internal Database/SQL Syntax Error

delete_user_attribute($username, $type, $attribute[, $value]);
Deletes the specified attribute from the specified user $username - user on which the attribute is to be deleted $type - check or reply $attribute - attribute to be deleted from $username $value - value of attribute to be deleted $radius->delete_user_attribute('barney', 'reply', 'Filter-Id', 'rubble'); `$self-'{success}> if the operation is successful DATABASE - Internal Database/SQL Syntax Error ITEM_NOT_FOUND - the specified user/attribute/value was not found

delete_group($groupname);
delete a specified group $groupname - group to be deleted $radius->delete_group('PPP'); `$self-'{success}> if the operation is successful DATABASE - Internal Database/SQL Syntax Error

delete_group_attribute($groupname, $type, $attribute, $value);
Deletes the specified attribute from the specified group $groupname - group on which the attribute is to be deleted $type - reply or check $attribute - attribute to be deleted from $groupname $value - value of attribute to be deleted $radius->delete_group_attribute('PPP', 'reply', 'Filter-Id', '21600'); `$self-'{success}> if the operation is successful DATABASE - Internal Database/SQL Syntax Error ITEM_NOT_FOUND - the specified group/attribute/value was not found

delete_user_group($username, $groupname);
Remove a user from the specified group $username - user to remove from $groupname $groupname - group to remove $username $radius->delete_user_group('barney', 'PPP'); `$self-'{success}> if the operation is successful DATABASE - Internal Database/SQL Syntax Error ITEM_NOT_FOUND - the specified user was not found in the specified group

delete_realm($realmname);
delete a realm $realmname - realm to delete $radius->delete_realm('flintstone.com'); `$self-'{success}> if the operation is successful DATABASE - Internal Database/SQL Syntax Error

delete_nas($nasname);
delete a nas $nasname - nas to delete $radius->delete_nas('flintstone.com'); `$self-'{success}> if the operation is successful DATABASE - Internal Database/SQL Syntax Error

delete_acct_sessions($radacctids);
delete sessions from the radacct table $radacctids - reference to an array of radacctids $radius->delete_acct_sessions(['44440']); `$self-'{success}> if the operation is successful DATABASE - Internal Database/SQL Syntax Error

update_user_attribute($username, $type, $attribute, $ovalue, $nvalue);
updates the specified user attribute to $value $username - user to update attribute of $type - check or reply $attribute - attribute to update value of $ovalue - old value of attribute $nvalue - new value of attribute $radius->update_user_attribute('fred', 'check', 'Filter-Id', 'rubble', 'bedrock'); `$self-'{success}> if the operation is successful DATABASE - Internal Database/SQL Syntax Error

update_group_attribute($groupname, $type, $attributeid, $ovalue, $nvalue);
updates the sepcified group attribute to $value $groupname - group to update attribute of $type - check or reply $attribute - attribute to update value of $ovalue - old value of attribute $nvalue - new value of attribute $radius->update_group_attribute('PPP', 'reply', 'Idle-Timeout', '1000', '43200'); `$self-'{success}> if the operation is successful DATABASE - Internal Database/SQL Syntax Error

replace_user_groups($username, $groups);
removes all groups for $username and replaces them with groups in $groups $username - username to replace groups for $groups - group or array ref of groups place user in $radius->replace_user_groups('barney', 'PPP'); # one way $radius->replace_user_groups('barney', ['PPP', 'Metered']); # another way `$self-'{success}> if the operation is successful DATABASE - Internal Database/SQL Syntax Error

update_realm($orealmname, $realmname, $nas, $authport [, $option, $option...]);
update an existing realm $orealmname - realms current name $realmname - realms new name $nas - nas name $authport - auth port $options - reference to array of options for realm $radius->update_realm('flintstones.com', 'bedrock.com', 'bedrock', '1812', 'nostrip'); `$self-'{success}> if the operation is successful DATABASE - Internal Database/SQL Syntax Error

update_nas($onasname, $nasname, $shortname, $ipaddr, $type, $ports, $secret, $community, $snmp);
update an existing realm $onasname - nas' current name $nasname - nas' new name $shortname - short name $ipaddr - ip address $type - type $ports - ports $secret - secret $community - snmp community $snmp - snmp port limit checking (on or off) $radius->update_nas('pm1.flintstones.com', 'pm1', '123.199.199.199', 'livingston', '46', 'Dino', 'flintsnmp', 'on'); `$self-'{success}> if the operation is successful DATABASE - Internal Database/SQL Syntax Error

fetch_user_list();
fetch a list of known users none $radius->fetch_user_list; array or reference to an array of usernames DATABASE - Internal Database/SQL Syntax Error

fetch_group_list();
retrieve a list of groups none $radius->fetch_group_list; array or reference to array of group names DATABASE - Internal Database/SQL Syntax Error

fetch_user_reply_items($username);
fetch all reply items on a user $username - user to fetch reply items for $radius->fetch_user_reply_items('fred'); hashref of reply items and their values DATABASE - Internal Database/SQL Syntax Error

fetch_user_check_items($username);
fetch all check items on a user $username - user to fetch check items for $radius->fetch_user_check_items('fred'); hashref of check items and their values DATABASE - Internal Database/SQL Syntax Error

fetch_user_groups($username);
get a list of all groups the specified user belongs to $username - user to fetch groups of $radius->fetch_users_groups('fred'); array or arrayref containing group names of which the specified user belongs to DATABASE - Internal Database/SQL Syntax Error

fetch_group_reply_items($groupname);
fetch all reply items on a group $groupname - group to fetch reply items for $radius->fetch_group_reply_items('fred'); hashref of reply items and their values DATABASE - Internal Database/SQL Syntax Error

fetch_group_check_items($groupname);
fetch all check items on a group $groupname - group to fetch check items for $radius->fetch_group_check_items('fred'); hashref of check items and their values DATABASE - Internal Database/SQL Syntax Error

fetch_attribute_list();
retrieve a list of avaialable attributes none my $attributes = $radius->fetch_attribute_list(); array or array ref of hashref's containing attribute information from the dictionary table DATABASE - Internal Database/SQL Syntax Error

fetch_attribute_info($attribute);
fetch information on a specified attribute $attribute - attribute to fetch info for $radius->fetch_attribute_info('Password'); hashref of attribute information from the dictionary table DATABASE - Internal Database/SQL Syntax Error

fetch_attribute_values($attribute);
retrieve a list of values possible for a specified attribute $attribute - attribute to retrieve the possible values of my $values = $radius->fetch_attribute_values('Filter-Id'); array or arrayref of hashref's of attribute values DATABASE - Internal Database/SQL Syntax Error ITEM_NOT_FOUND - There were no values associated with the attribute

fetch_realm_list();
retrieve a list of realms none my $realms = $radius->fetch_realms_list; array or reference to an array of hash references containing realm information DATABASE - Internal Database/SQL Syntax Error

fetch_realm_options();
retrieve a list of available options for realms none my $realms = $radius->fetch_realms_options; array or reference to an array of options DATABASE - Internal Database/SQL Syntax Error

fetch_realm_info($realmname);
fetch information on a specified realm $realmname - realm to fetch info for $radius->fetch_realm_info('LOCAL'); hashref of information on the specified realm DATABASE - Internal Database/SQL Syntax Error

fetch_nas_list();
retrieve a list of nas' none my $nas = $radius->fetch_nas_list; array or reference to an array of hash references containing nas information DATABASE - Internal Database/SQL Syntax Error

fetch_nas_info($nasname);
fetch information on a specified nas $nasname - nas to fetch info for $radius->fetch_nas_info('pm.flintstones.com'); hashref of information on the specified nas DATABASE - Internal Database/SQL Syntax Error

fetch_session_info($radacctid);
fetch information on a specified session $radacctid - session to fetch info for $radius->fetch_session_info('44440'); hashref of attribute information about the session from the radacct table DATABASE - Internal Database/SQL Syntax Error

fetch_last_insert_id();
retrieves the id of the row most recently inserted into a mysql table none my $id = $self->fetch_last_insert_id(); id of the most recently inserted row DATABASE - Internal Database/SQL Syntax Error

insert_row($table, $fields);
$table - table to insert row into $fields - hashref containing keys that match up to the database to be updated with corresponding values. DATABASE - Internal Database/SQL Syntax Error

delete_row($table, $criteria);
$table - table to delete row from $criteria - arrayref of arrayrefs of hashref's containing criteria for where clause. keys should be the left side of the equals and values the right. DATABASE - Internal Database/SQL Syntax Error

update_fields($table, $fields, $criteria);
Update fields in $table with the specified criteria $table - table to update fields for $fields - hashref containing keys that match up to the database to be updated with corresponding values. $criteria - arrayref of arrayrefs of hashref's containing criteria for where clause. keys should be the left side of the equals and values the right. DATABASE - Internal Database/SQL Syntax Error

select_count();
$ - DATABASE - Internal Database/SQL Syntax Error

print_debug($string, $type);
used to print debug code to STDERR. The format is "LINE: PACKAGE::method: $type: $string". $type is an optional argument and is ommited if left blank. While this method was originally designed to be used within the module, it could be used from the code using the module as well. $string - the debug message $type - the optional argument that is the type of debug message such as 'SQL'. $sql = 'SELECT * FROM table'; $self->print_debug($sql, 'SQL'); # SQL execute code `$self-'{success}> none

print_error($string, $type);
used to print error to STDERR. The format is "LINE: PACKAGE::method: $type: $string". $type is an optional argument and is ommited if left blank. While this method was originally designed to be used within the module, it could be used from the code using the module as well. $string - the error message $type - the optional argument that is the type of error message such as 'SQL'. $radius->print_error("Unable to find user $user") unless (user_exists($user)); `$self-'{success}> none

set_error($error);
sets the current error to the specified error $error - error number or error label to set error to return $self->set_error('ITEM_NOT_FOUND') unless $found; $self->{failure} DATABASE - Internal Database/SQL Syntax Error