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