Added tables of the syslog constants defined in the ext/standard/syslog.c

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@31925 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Jesus M. Castagnetto 2000-09-04 06:52:39 +00:00
parent 2c2fe99c9e
commit 5965008df0

View file

@ -63,6 +63,11 @@
write to the system logger. The use of
<function>closelog</function> is optional.
</para>
<para>
See also <function>define_syslog_variables</function>,
<function>syslog</function> and
<function>closelog</function>.
</para>
</refsect1>
</refentry>
@ -107,6 +112,31 @@
</refsect1>
</refentry>
<refentry id="function.define-syslog-variables">
<refnamediv>
<refname>define_syslog_variables</refname>
<refpurpose>Initializes all syslog related constants</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>void <function>define_syslog_varaibles</function></funcdef>
<paramdef>void</paramdef>
</funcprototype>
</funcsynopsis>
<para>
Initializes all constants used in the syslog functions.
</para>
<para>
See also <function>openlog</function>,
<function>syslog</function> and
<function>closelog</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.fsockopen">
<refnamediv>
<refname>fsockopen</refname>
@ -120,8 +150,8 @@
<funcprototype>
<funcdef>int <function>fsockopen</function></funcdef>
<paramdef>
string <parameter><optional>udp://</optional>hostname</parameter>
</paramdef>
string <parameter><optional>udp://</optional>hostname</parameter>
</paramdef>
<paramdef>int <parameter>port</parameter></paramdef>
<paramdef>int
<parameter><optional>errno</optional></parameter>
@ -135,18 +165,18 @@
</funcprototype>
</funcsynopsis>
<para>
Initiates a stream connection in the Internet (AF_INET, using TCP
or UDP) or Unix (AF_UNIX) domain. For the Internet domain, it
will open a TCP socket connection to
<parameter>hostname</parameter> on port
<parameter>port</parameter>. <parameter>hostname</parameter> may
in this case be either a fully qualified domain name or an IP
address. For UDP connections, you need to explicitly specify the
protocol: <parameter>udp://hostname</parameter>. For the Unix
domain, <parameter>hostname</parameter> will be used as the path
to the socket, <parameter>port</parameter> must be set to 0 in
this case. The optional <parameter>timeout</parameter> can be
used to set a timeout in seconds for the connect system call.
Initiates a stream connection in the Internet (AF_INET, using TCP
or UDP) or Unix (AF_UNIX) domain. For the Internet domain, it
will open a TCP socket connection to
<parameter>hostname</parameter> on port
<parameter>port</parameter>. <parameter>hostname</parameter> may
in this case be either a fully qualified domain name or an IP
address. For UDP connections, you need to explicitly specify the
protocol: <parameter>udp://hostname</parameter>. For the Unix
domain, <parameter>hostname</parameter> will be used as the path
to the socket, <parameter>port</parameter> must be set to 0 in
this case. The optional <parameter>timeout</parameter> can be
used to set a timeout in seconds for the connect system call.
</para>
<para>
<function>Fsockopen</function> returns a file pointer which may
@ -191,11 +221,11 @@ if (!$fp) {
}
</programlisting>
</example>
The example below shows how to retrieve the day and time
from the UDP service "daytime" (port 13) in your own machine.
<example>
<title>Using UDP connection</title>
<programlisting role="php">
The example below shows how to retrieve the day and time
from the UDP service "daytime" (port 13) in your own machine.
<example>
<title>Using UDP connection</title>
<programlisting role="php">
&lt;?php
$fp = fsockopen("udp://127.0.0.1", 13, &amp;$errno, &amp;$errstr);
if (!$fp) {
@ -206,8 +236,8 @@ if (!$fp) {
fclose($fp);
}
?&gt;
</programlisting>
</example>
</programlisting>
</example>
See also: <function>pfsockopen</function>,
<function>socket_set_blocking</function>,
<function>socket_set_timeout</function>, <function>fgets</function>,
@ -453,9 +483,9 @@ if (!$fp) {
<refnamediv>
<refname>ip2long</refname>
<refpurpose>
Converts a string containing an (IPv4) Internet Protocol dotted address
into a proper address.
</refpurpose>
Converts a string containing an (IPv4) Internet Protocol dotted address
into a proper address.
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
@ -466,23 +496,23 @@ if (!$fp) {
</funcprototype>
</funcsynopsis>
<para>
The function <function>ip2long</function> generates an IPv4 Internet
network address from its Internet standard format (dotted string)
representation.
<example>
<title><function>Ip2long</function> Example</title>
<programlisting role="php">
The function <function>ip2long</function> generates an IPv4 Internet
network address from its Internet standard format (dotted string)
representation.
<example>
<title><function>Ip2long</function> Example</title>
<programlisting role="php">
&lt;?
$ip = gethostbyname("www.php.net");
$out = "The following URLs are equivalent:&lt;br&gt;\n";
$out .= "http://www.php.net/, http://".$ip."/, and http://".ip2long($ip)."/&lt;br&gt;\n";
echo $out;
?&gt;
</programlisting>
</example>
</programlisting>
</example>
</para>
<para>
See also: <function>long2ip</function>
See also: <function>long2ip</function>
</para>
</refsect1>
</refentry>
@ -491,9 +521,9 @@ echo $out;
<refnamediv>
<refname>long2ip</refname>
<refpurpose>
Converts an (IPv4) Internet network address into a string in Internet
standard dotted format
</refpurpose>
Converts an (IPv4) Internet network address into a string in Internet
standard dotted format
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
@ -504,12 +534,12 @@ echo $out;
</funcprototype>
</funcsynopsis>
<para>
The function <function>long2ip</function> generates an Internet address
in dotted format (i.e.: aaa.bbb.ccc.ddd) from the proper address
representation.
The function <function>long2ip</function> generates an Internet address
in dotted format (i.e.: aaa.bbb.ccc.ddd) from the proper address
representation.
</para>
<para>
See also: <function>ip2long</function>
See also: <function>ip2long</function>
</para>
</refsect1>
</refentry>
@ -533,14 +563,134 @@ echo $out;
<function>Openlog</function> opens a connection to the system
logger for a program. The string <parameter>ident</parameter> is
added to each message. Values for <parameter>option</parameter>
and <parameter>facility</parameter> are given in the next
section. The use of <function>openlog</function> is optional; It
and <parameter>facility</parameter> are given below.
The <parameter>option</parameter> argument is used to indicate
what loggin options will be used when generating a log message.
The <parameter>facility</parameter> argument is used to specify what
type of program is logging the message. This allows you to specify
(in your machine's syslog configuration) how messages coming from
different facilities will be handled.
The use of <function>openlog</function> is optional. It
will automatically be called by <function>syslog</function> if
necessary, in which case <parameter>ident</parameter> will default
to false.
</para>
<para>
See also <function>syslog</function> and
<table>
<title><function>Openlog</function> Options</title>
<tgroup cols="2">
<thead>
<row>
<entry>Constant</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>LOG_CONS</entry>
<entry>
if there is an error while sending data to the system logger,
write directly to the system console
</entry>
</row>
<row>
<entry>LOG_NDELAY</entry>
<entry>
open the connection to the logger immediately
</entry>
</row>
<row>
<entry>LOG_ODELAY</entry>
<entry>
(default) delay openning the connection until the first
message is logged
</entry>
</row>
<row>
<entry>LOG_PERROR</entry>
<entry>print log message also to standard error</entry>
</row>
<row>
<entry>LOG_PID</entry>
<entry>include PID with each message</entry>
</row>
</tbody>
</tgroup>
</table>
You can use one or more of this options. When using multiple options
you need to <literal>OR</literal> them, i.e. to open the connection
immediately, write to the consoloe and include the PID in each message,
you will use: <literal>LOG_CONS | LOG_NDELAY | LOG_PID</literal>
</para>
<para>
<table>
<title><function>Openlog</function> Facilities</title>
<tgroup cols="2">
<thead>
<row>
<entry>Constant</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>LOG_AUTH</entry>
<entry>
security/authorization messages (use LOG_AUTHPRIV instead
in systems where that constant is defined)
</entry>
</row>
<row>
<entry>LOG_AUTHPRIV</entry>
<entry>security/authorization messages (private)</entry>
</row>
<row>
<entry>LOG_CRON</entry>
<entry>clock daemon (cron and at)</entry>
</row>
<row>
<entry>LOG_DAEMON</entry>
<entry>other system daemons</entry>
</row>
<row>
<entry>LOG_KERN</entry>
<entry>kernel messages</entry>
</row>
<row>
<entry>LOG_LOCAL0 ... LOG_LOCAL7</entry>
<entry>reserved for local use</entry>
</row>
<row>
<entry>LOG_LPR</entry>
<entry>line printer subsystem</entry>
</row>
<row>
<entry>LOG_MAIL</entry>
<entry>mail subsystem</entry>
</row>
<row>
<entry>LOG_NEWS</entry>
<entry>USENET news subsystem</entry>
</row>
<row>
<entry>LOG_SYSLOG</entry>
<entry>messages generated internally by syslogd</entry>
</row>
<row>
<entry>LOG_USER</entry>
<entry>generic user-level messages</entry>
</row>
<row>
<entry>LOG_UUCP</entry>
<entry>UUCP subsystem</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
See also <function>define_syslog_variables</function>,
<function>syslog</function> and
<function>closelog</function>.
</para>
</refsect1>
@ -629,7 +779,7 @@ echo $out;
Sets the timeout value on <parameter>socket descriptor</parameter>,
expressed in the sum of <parameter>seconds</parameter> and
<parameter>microseconds</parameter>.
<example>
<example>
<title><function>socket_set_timeout</function> Example</title>
<programlisting role="php">
&lt;?php
@ -683,6 +833,53 @@ if(!$fp) {
error message string (strerror) corresponding to the present
value of <errortype>errno</errortype>.
</para>
<para>
<table>
<title><function>Syslog</function> Priorities (in descending order)</title>
<tgroup cols="2">
<thead>
<row>
<entry>Constant</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>LOG_EMERG</entry>
<entry>system is unusable</entry>
</row>
<row>
<entry>LOG_ALERT</entry>
<entry>action must be taken immediately</entry>
</row>
<row>
<entry>LOG_CRIT</entry>
<entry>critical conditions</entry>
</row>
<row>
<entry>LOG_ERR</entry>
<entry>error conditions</entry>
</row>
<row>
<entry>LOG_WARNING</entry>
<entry>warning conditions</entry>
</row>
<row>
<entry>LOG_NOTICE</entry>
<entry>normal, but significant, condition</entry>
</row>
<row>
<entry>LOG_INFO</entry>
<entry>informational message</entry>
</row>
<row>
<entry>LOG_DEBUG</entry>
<entry>debug-level message</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
More information on the syslog facilities can be found in the man
pages for syslog on Unix machines.