uTools-Manuals/docs/php/radius_add_server.html
2019-04-28 19:00:34 +08:00

165 lines
6.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Adds a server</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.radius-add-server" class="refentry">
<div class="refnamediv">
<h1 class="refname">radius_add_server</h1>
<p class="verinfo">(PECL radius &gt;= 1.1.0)</p><p class="refpurpose"><span class="refname">radius_add_server</span> &mdash; <span class="dc-title">Adds a server</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.radius-add-server-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>radius_add_server</strong></span>
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$radius_handle</code></span>
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$hostname</code></span>
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$port</code></span>
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$secret</code></span>
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$timeout</code></span>
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$max_tries</code></span>
) : <span class="type">bool</span></div>
<p class="para rdfs-comment">
<span class="function"><strong>radius_add_server()</strong></span> may be called multiple times, and it
may be used together with <span class="function"><a href="radius_config.html" class="function">radius_config()</a></span>. At most 10
servers may be specified. When multiple servers are given, they are tried
in round-robin fashion until a valid response is received, or until each
server&#039;s <code class="parameter">max_tries</code> limit has been reached.
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.radius-add-server-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">radius_handle</code></dt>
<dd>
<p class="para">
</p>
</dd>
<dt>
<code class="parameter">hostname</code></dt>
<dd>
<p class="para">
The <code class="parameter">hostname</code> parameter specifies the server host,
either as a fully qualified domain name or as a dotted-quad IP address
in text form.
</p>
</dd>
<dt>
<code class="parameter">port</code></dt>
<dd>
<p class="para">
The <code class="parameter">port</code> specifies the UDP port to contact on
the server. If port is given as 0, the library looks up the
<code class="systemitem systemitem">radius/udp</code> or
<code class="systemitem systemitem">radacct/udp</code> service in the
network services database, and uses the port found there. If no entry
is found, the library uses the standard Radius ports, 1812 for
authentication and 1813 for accounting.
</p>
</dd>
<dt>
<code class="parameter">secret</code></dt>
<dd>
<p class="para">
The shared secret for the server host is passed to the
<code class="parameter">secret</code> parameter. The Radius protocol ignores
all but the leading 128 bytes of the shared secret.
</p>
</dd>
<dt>
<code class="parameter">timeout</code></dt>
<dd>
<p class="para">
The timeout for receiving replies from the server is passed to the
<code class="parameter">timeout</code> parameter, in units of seconds.
</p>
</dd>
<dt>
<code class="parameter">max_tries</code></dt>
<dd>
<p class="para">
The maximum number of repeated requests to make before giving up is
passed into the <code class="parameter">max_tries</code>.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.radius-add-server-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
成功时返回 <strong><code>TRUE</code></strong> 或者在失败时返回 <strong><code>FALSE</code></strong>
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.radius-add-server-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-665">
<p><strong>Example #1 <span class="function"><strong>radius_add_server()</strong></span> example</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">if&nbsp;(!</span><span style="color: #0000BB">radius_add_server</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'radius.example.com'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1812</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'testing123'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'RadiusError:'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">radius_strerror</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">).&nbsp;</span><span style="color: #DD0000">"\n&lt;br&gt;"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;exit;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.radius-add-server-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="radius_config.html" class="function" rel="rdfs-seeAlso">radius_config()</a> - Causes the library to read the given configuration file</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>