Freeside:3:Documentation:Developer/FS/port

From Freeside
Jump to: navigation, search

NAME

FS::port - Object methods for port records

SYNOPSIS

 use FS::port;

 $record = new FS::port \%hash;
 $record = new FS::port { 'column' => 'value' };

 $error = $record->insert;

 $error = $new_record->replace($old_record);

 $error = $record->delete;

 $error = $record->check;

 $session = $port->session;

DESCRIPTION

An FS::port object represents an individual port on a NAS. FS::port inherits from FS::Record. The following fields are currently supported:

portnum - primary key; ip - IP address of this port; nasport - port number on the NAS; nasnum - NAS this port is on - see FS::nas

METHODS

new HASHREF
Creates a new port. To add the port to the database, see "insert".
Note that this stores the hash reference, not a distinct copy of the hash it points to. You can ask the object for a copy with the hash method.
insert
Adds this record to the database. If there is an error, returns the error, otherwise returns false.
delete
Delete this record from the database.
replace OLD_RECORD
Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
check
Checks all fields to make sure this is a valid port. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
session
Returns the currently open session on this port, or if no session is currently open, the most recent session. See FS::session.

BUGS

The session method won't deal well if you have multiple open sessions on a port, for example if your RADIUS server drops stop records. Suggestions for how to deal with this sort of lossage welcome; should we close the session when we get a new session on that port? Tag it as invalid somehow? Close it one second after it was opened? *sigh* Maybe FS::session shouldn't let you create overlapping sessions, at least folks will find out their logging is dropping records.

If you think the above refers multiple user logins you need to read the manpages again.

SEE ALSO

FS::Record, schema.html from the base documentation.