com.caucho.quercus.lib
Class NetworkModule

java.lang.Object
  extended by com.caucho.quercus.module.AbstractQuercusModule
      extended by com.caucho.quercus.lib.NetworkModule
All Implemented Interfaces:
QuercusModule

public class NetworkModule
extends AbstractQuercusModule

Information about PHP network


Field Summary
static int DNS_A
           
static int DNS_A6
           
static int DNS_AAAA
           
static int DNS_ALL
           
static int DNS_ANY
           
static int DNS_CNAME
           
static int DNS_HINFO
           
static int DNS_MX
           
static int DNS_NAPTR
           
static int DNS_NS
           
static int DNS_PTR
           
static int DNS_SOA
           
static int DNS_SRV
           
static int DNS_TXT
           
static int LOG_ALERT
           
static int LOG_AUTH
           
static int LOG_AUTHPRIV
           
static int LOG_CONS
           
static int LOG_CRIT
           
static int LOG_CRON
           
static int LOG_DAEMON
           
static int LOG_DEBUG
           
static int LOG_EMERG
           
static int LOG_ERR
           
static int LOG_INFO
           
static int LOG_KERN
           
static int LOG_LOCAL0
           
static int LOG_LOCAL1
           
static int LOG_LOCAL2
           
static int LOG_LOCAL3
           
static int LOG_LOCAL4
           
static int LOG_LOCAL5
           
static int LOG_LOCAL6
           
static int LOG_LOCAL7
           
static int LOG_LPR
           
static int LOG_MAIL
           
static int LOG_NDELAY
           
static int LOG_NEWS
           
static int LOG_NOTICE
           
static int LOG_NOWAIT
           
static int LOG_ODELAY
           
static int LOG_PERROR
           
static int LOG_PID
           
static int LOG_SYSLOG
           
static int LOG_USER
           
static int LOG_UUCP
           
static int LOG_WARNING
           
 
Fields inherited from class com.caucho.quercus.module.AbstractQuercusModule
PHP_INI_ALL, PHP_INI_PERDIR, PHP_INI_SYSTEM, PHP_INI_USER
 
Constructor Summary
NetworkModule()
           
 
Method Summary
static boolean checkdnsrr(Env env, java.lang.String hostname, java.lang.String type)
           
static boolean closelog()
          Closes syslog.
static Value define_syslog_variables(Env env)
          Initialization of syslog.
static boolean dns_check_record(Env env, java.lang.String hostname, java.lang.String type)
          Finds the mx hosts for the given hostname, placing them in mxhosts and their corresponding weights in weight, if provided.
static boolean dns_get_mx(Env env, java.lang.String hostname, Value mxhosts, Value weight)
          Finds the mx hosts for the given hostname, placing them in mxhosts and their corresponding weights in weight, if provided.
 ArrayValue dns_get_record(Env env, java.lang.String hostname, int type, Value authnsRef, Value addtlRef)
           
static SocketInputOutput fsockopen(Env env, java.lang.String host, int port, Value errno, Value errstr, double timeout)
          Opens a socket
static java.lang.String gethostbyaddr(Env env, java.lang.String ip)
          Returns the IP address of the given host name.
static java.lang.String gethostbyname(java.lang.String hostname)
          Returns the IP address of the given host name.
static Value gethostbynamel(Env env, java.lang.String hostname)
          Returns the IP addresses of the given host name.
static boolean getmxrr(Env env, java.lang.String hostname, Value mxhosts, Value weight)
           
static Value getprotobyname(java.lang.String protoName)
          Returns the protocol number associated with the given protocol name.
static java.lang.String getprotobynumber(int protoNumber)
          Returns the protocol name associated with the given protocol number.
static Value getservbyname(java.lang.String service, java.lang.String protocol)
          Returns the port number associated with the given protocol and service name.
static java.lang.String getservbyport(int port, java.lang.String protocol)
          Returns the service name associated it the given protocol name and service port.
static Value ip2long(java.lang.String ip)
          Converts string to long
static StringValue long2ip(Env env, long address)
           
static boolean openlog(Env env, java.lang.String ident, int option, int facility)
          Opens syslog.
static boolean syslog(Env env, int priority, java.lang.String message)
          syslog
 
Methods inherited from class com.caucho.quercus.module.AbstractQuercusModule
addConstant, addConstant, addConstant, getConstMap, getIniDefinitions, getLoadedExtensions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_EMERG

public static final int LOG_EMERG
See Also:
Constant Field Values

LOG_ALERT

public static final int LOG_ALERT
See Also:
Constant Field Values

LOG_CRIT

public static final int LOG_CRIT
See Also:
Constant Field Values

LOG_ERR

public static final int LOG_ERR
See Also:
Constant Field Values

LOG_WARNING

public static final int LOG_WARNING
See Also:
Constant Field Values

LOG_NOTICE

public static final int LOG_NOTICE
See Also:
Constant Field Values

LOG_INFO

public static final int LOG_INFO
See Also:
Constant Field Values

LOG_DEBUG

public static final int LOG_DEBUG
See Also:
Constant Field Values

LOG_PID

public static final int LOG_PID
See Also:
Constant Field Values

LOG_CONS

public static final int LOG_CONS
See Also:
Constant Field Values

LOG_NDELAY

public static final int LOG_NDELAY
See Also:
Constant Field Values

LOG_NOWAIT

public static final int LOG_NOWAIT
See Also:
Constant Field Values

LOG_ODELAY

public static final int LOG_ODELAY
See Also:
Constant Field Values

LOG_PERROR

public static final int LOG_PERROR
See Also:
Constant Field Values

LOG_AUTH

public static final int LOG_AUTH
See Also:
Constant Field Values

LOG_AUTHPRIV

public static final int LOG_AUTHPRIV
See Also:
Constant Field Values

LOG_CRON

public static final int LOG_CRON
See Also:
Constant Field Values

LOG_DAEMON

public static final int LOG_DAEMON
See Also:
Constant Field Values

LOG_KERN

public static final int LOG_KERN
See Also:
Constant Field Values

LOG_LOCAL0

public static final int LOG_LOCAL0
See Also:
Constant Field Values

LOG_LOCAL1

public static final int LOG_LOCAL1
See Also:
Constant Field Values

LOG_LOCAL2

public static final int LOG_LOCAL2
See Also:
Constant Field Values

LOG_LOCAL3

public static final int LOG_LOCAL3
See Also:
Constant Field Values

LOG_LOCAL4

public static final int LOG_LOCAL4
See Also:
Constant Field Values

LOG_LOCAL5

public static final int LOG_LOCAL5
See Also:
Constant Field Values

LOG_LOCAL6

public static final int LOG_LOCAL6
See Also:
Constant Field Values

LOG_LOCAL7

public static final int LOG_LOCAL7
See Also:
Constant Field Values

LOG_LPR

public static final int LOG_LPR
See Also:
Constant Field Values

LOG_MAIL

public static final int LOG_MAIL
See Also:
Constant Field Values

LOG_NEWS

public static final int LOG_NEWS
See Also:
Constant Field Values

LOG_SYSLOG

public static final int LOG_SYSLOG
See Also:
Constant Field Values

LOG_USER

public static final int LOG_USER
See Also:
Constant Field Values

LOG_UUCP

public static final int LOG_UUCP
See Also:
Constant Field Values

DNS_A

public static final int DNS_A
See Also:
Constant Field Values

DNS_CNAME

public static final int DNS_CNAME
See Also:
Constant Field Values

DNS_HINFO

public static final int DNS_HINFO
See Also:
Constant Field Values

DNS_MX

public static final int DNS_MX
See Also:
Constant Field Values

DNS_NS

public static final int DNS_NS
See Also:
Constant Field Values

DNS_PTR

public static final int DNS_PTR
See Also:
Constant Field Values

DNS_SOA

public static final int DNS_SOA
See Also:
Constant Field Values

DNS_TXT

public static final int DNS_TXT
See Also:
Constant Field Values

DNS_AAAA

public static final int DNS_AAAA
See Also:
Constant Field Values

DNS_SRV

public static final int DNS_SRV
See Also:
Constant Field Values

DNS_NAPTR

public static final int DNS_NAPTR
See Also:
Constant Field Values

DNS_A6

public static final int DNS_A6
See Also:
Constant Field Values

DNS_ALL

public static final int DNS_ALL
See Also:
Constant Field Values

DNS_ANY

public static final int DNS_ANY
See Also:
Constant Field Values
Constructor Detail

NetworkModule

public NetworkModule()
Method Detail

fsockopen

public static SocketInputOutput fsockopen(Env env,
                                          java.lang.String host,
                                          int port,
                                          Value errno,
                                          Value errstr,
                                          double timeout)
Opens a socket


ip2long

public static Value ip2long(java.lang.String ip)
Converts string to long


long2ip

public static StringValue long2ip(Env env,
                                  long address)

gethostbyname

public static java.lang.String gethostbyname(java.lang.String hostname)
Returns the IP address of the given host name. If the IP address cannot be obtained, then the provided host name is returned instead.

Parameters:
hostname - the host name who's IP to search for
Returns:
the IP for the given host name or, if the IP cannot be obtained, the provided host name

gethostbynamel

public static Value gethostbynamel(Env env,
                                   java.lang.String hostname)
Returns the IP addresses of the given host name. If the IP addresses cannot be obtained, then the provided host name is returned instead.

Parameters:
hostname - the host name who's IP to search for
Returns:
the IPs for the given host name or, if the IPs cannot be obtained, the provided host name

gethostbyaddr

public static java.lang.String gethostbyaddr(Env env,
                                             java.lang.String ip)
Returns the IP address of the given host name. If the IP address cannot be obtained, then the provided host name is returned instead.

Returns:
the IP for the given host name or, if the IP cannot be obtained, the provided host name

getprotobyname

public static Value getprotobyname(java.lang.String protoName)
Returns the protocol number associated with the given protocol name.

Parameters:
protoName - the name of the protocol
Returns:
the number associated with the given protocol name

getprotobynumber

public static java.lang.String getprotobynumber(int protoNumber)
Returns the protocol name associated with the given protocol number.


getservbyname

public static Value getservbyname(java.lang.String service,
                                  java.lang.String protocol)
Returns the port number associated with the given protocol and service name.

Parameters:
service - the service name
protocol - the protocol, either udp or tcp
Returns:
the number associated with the given protocol and service name

getservbyport

public static java.lang.String getservbyport(int port,
                                             java.lang.String protocol)
Returns the service name associated it the given protocol name and service port.

Parameters:
port - the service port number
protocol - the protocol, either udp or tcp
Returns:
the service name

getmxrr

public static boolean getmxrr(Env env,
                              java.lang.String hostname,
                              Value mxhosts,
                              Value weight)

dns_get_mx

public static boolean dns_get_mx(Env env,
                                 java.lang.String hostname,
                                 Value mxhosts,
                                 Value weight)
Finds the mx hosts for the given hostname, placing them in mxhosts and their corresponding weights in weight, if provided. Returns true if any hosts were found. False otherwise.

Parameters:
hostname - the hostname to find records for
mxhosts - an array to add the mx hosts to
weight - an array to add the weights to
Returns:
true if records are found, false otherwise

checkdnsrr

public static boolean checkdnsrr(Env env,
                                 java.lang.String hostname,
                                 java.lang.String type)

dns_check_record

public static boolean dns_check_record(Env env,
                                       java.lang.String hostname,
                                       java.lang.String type)
Finds the mx hosts for the given hostname, placing them in mxhosts and their corresponding weights in weight, if provided. Returns true if any hosts were found. False otherwise.

Parameters:
hostname - the hostname to find records for
Returns:
true if records are found, false otherwise

dns_get_record

public ArrayValue dns_get_record(Env env,
                                 java.lang.String hostname,
                                 int type,
                                 Value authnsRef,
                                 Value addtlRef)

define_syslog_variables

public static Value define_syslog_variables(Env env)
Initialization of syslog.


openlog

public static boolean openlog(Env env,
                              java.lang.String ident,
                              int option,
                              int facility)
Opens syslog. XXX: stubbed for now


closelog

public static boolean closelog()
Closes syslog.


syslog

public static boolean syslog(Env env,
                             int priority,
                             java.lang.String message)
syslog