| version 1.2, 2002/09/04 17:09:28 |
version 1.3, 2002/09/19 12:04:43 |
|
|
| // +----------------------------------------------------------------------+ |
// +----------------------------------------------------------------------+ |
| // |
// |
| // $Id$ |
// $Id$ |
| |
// |
| |
// Identification Protocol implementation |
| |
// |
| |
|
| require_once 'PEAR.php'; |
require_once 'PEAR.php'; |
| |
|
| /** |
/** |
| * Net_Ident default values |
* Net_Ident default values |
| |
* @const NET_IDENT_DEFAULT_TIMEOUT Default ident query network timeout |
| |
* @const NET_IDENT_DEFAULT_PORT Default ident protocol port |
| */ |
*/ |
| define('NET_IDENT_DEFAULT_TIMEOUT', 30); |
define('NET_IDENT_DEFAULT_TIMEOUT', 30); |
| define('NET_IDENT_DEFAULT_PORT', 113); |
define('NET_IDENT_DEFAULT_PORT', 113); |
| |
|
| /** |
/** |
| * Net_Ident object states |
* Net_Ident object states |
| |
* @const NET_IDENT_STATUS_UNDEF Undefined Net_Ident object state |
| |
* @const NET_IDENT_STATUS_OK Net_Ident object did successful query |
| |
* @const NET_IDENT_STATUS_ERROR Net_Ident object query failed |
| */ |
*/ |
| define('NET_IDENT_STATUS_UNDEF', 0); |
define('NET_IDENT_STATUS_UNDEF', 0); |
| define('NET_IDENT_STATUS_OK', 1); |
define('NET_IDENT_STATUS_OK', 1); |
|
|
| */ |
*/ |
| function setRemoteAddr($remote_addr) |
function setRemoteAddr($remote_addr) |
| { |
{ |
| if (strlen($remote_addr) <= 0) { |
strlen($remote_addr) <= 0 && $remote_addr = $_SERVER['REMOTE_ADDR']; |
| global $HTTP_SERVER_VARS; |
|
| $remote_addr = $HTTP_SERVER_VARS['REMOTE_ADDR']; |
|
| } |
|
| $this->_props['remote_addr'] = $remote_addr; |
$this->_props['remote_addr'] = $remote_addr; |
| } |
} |
| |
|
|
|
| */ |
*/ |
| function setRemotePort($remote_port) |
function setRemotePort($remote_port) |
| { |
{ |
| if (intval($remote_port) <= 0) { |
$remote_port = intval($remote_port); |
| global $HTTP_SERVER_VARS; |
$remote_port <= 0 && $remote_port = $_SERVER['REMOTE_PORT']; |
| $remote_port = $HTTP_SERVER_VARS['REMOTE_PORT']; |
|
| } |
|
| $this->_props['remote_port'] = $remote_port; |
$this->_props['remote_port'] = $remote_port; |
| } |
} |
| |
|
|
|
| * @return none |
* @return none |
| * @access public |
* @access public |
| */ |
*/ |
| function setLocalPort($port) |
function setLocalPort($local_port) |
| { |
{ |
| if (intval($port) <= 0) { |
$local_port = intval($local_port); |
| global $HTTP_SERVER_VARS; |
$local_port <= 0 && $local_port = $_SERVER['SERVER_PORT']; |
| $port = $HTTP_SERVER_VARS['SERVER_PORT']; |
$this->_props['local_port'] = $local_port; |
| } |
|
| $this->_props['local_port'] = $port; |
|
| } |
} |
| |
|
| /** |
/** |
|
|
| * @return none |
* @return none |
| * @access public |
* @access public |
| */ |
*/ |
| function setIdentPort($port) |
function setIdentPort($ident_port) |
| { |
{ |
| if (intval($port) <= 0) { |
$ident_port = intval($ident_port); |
| $port = NET_IDENT_DEFAULT_PORT; |
$ident_port <= 0 && $ident_port = NET_IDENT_DEFAULT_PORT; |
| } |
$this->_props['ident_port'] = $ident_port; |
| $this->_props['ident_port'] = $port; |
|
| } |
} |
| |
|
| /** |
/** |
|
|
| */ |
*/ |
| function setTimeout($timeout) |
function setTimeout($timeout) |
| { |
{ |
| if (intval($timeout) <= 0) { |
$timeout = intval($timeout); |
| $port = NET_IDENT_DEFAULT_TIMEOUT; |
$timeout <= 0 && $timeout = NET_IDENT_DEFAULT_TIMEOUT; |
| } |
|
| $this->_props['timeout'] = $timeout; |
$this->_props['timeout'] = $timeout; |
| } |
} |
| |
|