|
IP*Works! V8 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--ipworks.Syslog
The Syslog bean is used to send and receive network system log packets.
The Syslog bean implements a lightweight BSD syslog client as specified in RFC 3164. The bean is used to send and receive BSD system network logging packets.
The first step in using the Syslog bean is to set LocalHost and LocalPort to the interface and port
on which the host will be receiving syslog packets, then
set Active to True. For each packet, the bean
will parse the headers and message and fire a PacketIn event.
| Constructor Summary | |
Syslog()
|
|
| Method Summary | |
void |
addSyslogEventListener(ipworks.SyslogEventListener l)
|
java.lang.String |
config(java.lang.String configurationString)
Sets or retrieves a beanconfiguration setting. |
void |
doEvents()
Processes events from the internal message queue. |
java.lang.String |
getLocalHost()
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
int |
getLocalPort()
The port in the local host where Syslog binds. |
java.lang.String |
getRemoteHost()
Sets a specific host for outgoing log packets. |
int |
getRemotePort()
Sets a specific port for outgoing log packets. |
boolean |
isActive()
Enables or disables sending and receiving of data. |
void |
removeSyslogEventListener(ipworks.SyslogEventListener l)
|
void |
sendPacket(int facility,
int severity,
java.lang.String message)
Send a log packet to RemoteHost . |
void |
setActive(boolean active)
Enables or disables sending and receiving of data. |
void |
setLocalHost(java.lang.String localHost)
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
void |
setLocalPort(int localPort)
The port in the local host where Syslog binds. |
void |
setRemoteHost(java.lang.String remoteHost)
Sets a specific host for outgoing log packets. |
void |
setRemotePort(int remotePort)
Sets a specific port for outgoing log packets. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Syslog()
| Method Detail |
public boolean isActive()
Setting the Active property to True makes the bean create a
communication endpoint (socket) which can be used for sending
and receiving UDP datagrams. Setting it to False destroys
the socket and disables data communications.
public void setActive(boolean active)
throws IPWorksException
Setting the Active property to True makes the bean create a
communication endpoint (socket) which can be used for sending
and receiving UDP datagrams. Setting it to False destroys
the socket and disables data communications.
IPWorksExceptionpublic java.lang.String getLocalHost()
The LocalHost property contains the name of the local host
as obtained by the gethostname() system call, or if the
user has assigned an IP address, the value of that address.
In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.
If the bean is connected, the LocalHost property shows
the IP address of the interface through which the connection
is made in internet dotted format (aaa.bbb.ccc.ddd). In most
cases, this is the address of the local host, except for multihomed
hosts (machines with more than one IP interface).
NOTE: LocalHost is not persistent. You must always set it in
code, and never in the property window.
public void setLocalHost(java.lang.String localHost)
throws IPWorksException
The LocalHost property contains the name of the local host
as obtained by the gethostname() system call, or if the
user has assigned an IP address, the value of that address.
In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.
If the bean is connected, the LocalHost property shows
the IP address of the interface through which the connection
is made in internet dotted format (aaa.bbb.ccc.ddd). In most
cases, this is the address of the local host, except for multihomed
hosts (machines with more than one IP interface).
NOTE: LocalHost is not persistent. You must always set it in
code, and never in the property window.
IPWorksExceptionpublic int getLocalPort()
The LocalPort property must be set before Syslog is
activated ( Active is set to True). It instructs the
bean to bind to a specific port (or communication
endpoint) in the local machine.
Setting it to 0 (default) enables the TCP/IP stack to choose a port
at random. The chosen port will be shown by the LocalPort property after the connection is established.
LocalPort cannot be changed once the bean is Active .
Any attempt to set the LocalPort property when the bean
is Active will generate an error.
The LocalPort property is useful when trying to connect
to services that require a trusted port in the client side.
public void setLocalPort(int localPort)
throws IPWorksException
The LocalPort property must be set before Syslog is
activated ( Active is set to True). It instructs the
bean to bind to a specific port (or communication
endpoint) in the local machine.
Setting it to 0 (default) enables the TCP/IP stack to choose a port
at random. The chosen port will be shown by the LocalPort property after the connection is established.
LocalPort cannot be changed once the bean is Active .
Any attempt to set the LocalPort property when the bean
is Active will generate an error.
The LocalPort property is useful when trying to connect
to services that require a trusted port in the client side.
IPWorksExceptionpublic java.lang.String getRemoteHost()
When a call is made to the SendPacket method, the bean will send
it to whatever value is in RemoteHost . The default value is the
broadcast address, "255.255.255.255".
public void setRemoteHost(java.lang.String remoteHost)
throws IPWorksException
When a call is made to the SendPacket method, the bean will send
it to whatever value is in RemoteHost . The default value is the
broadcast address, "255.255.255.255".
IPWorksExceptionpublic int getRemotePort()
When a call is made to the SendPacket method, the bean will
send to RemoteHost on RemotePort . The default value is 514,
the standard port as defined in the BSD syslog RFC 3164.
public void setRemotePort(int remotePort)
throws IPWorksException
When a call is made to the SendPacket method, the bean will
send to RemoteHost on RemotePort . The default value is 514,
the standard port as defined in the BSD syslog RFC 3164.
IPWorksException
public java.lang.String config(java.lang.String configurationString)
throws IPWorksException
Config is a generic method available in every bean.
It is used to set and retrieveconfiguration settingsfor the
bean.
Configuration settings are similar in functionality to properties,
but they are rarely used. In order to avoid "polluting" the property
namespace of the bean, access to these internal properties is provided through the Config method.
To set a configuration setting named PROPERTY , you must call Config("PROPERTY=VALUE") , where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).
To read (query) the value of a configuration setting, you must call Config("PROPERTY") . The value will be returned as a string.
IPWorksException
public void doEvents()
throws IPWorksException
When DoEvents is called, the bean processes any
available events. If no events are available, it waits for a
preset period of time, and then returns.
IPWorksException
public void sendPacket(int facility,
int severity,
java.lang.String message)
throws IPWorksException
RemoteHost .
System log packets are composed of three main sections, each of which can be broken down into two smaller pieces.
The first section is the PRI, which contains the originating Facility and Severity of the Message . Facility is a value from 0 to 23, with each value being a different part of the system:
Severity is a value from 0 to 7 using the following convention:
The section sections contains a timestamp and hostname, both of which are automatically generated by the bean. The third section is the Message itself.
IPWorksException
public void addSyslogEventListener(ipworks.SyslogEventListener l)
throws java.util.TooManyListenersException
java.util.TooManyListenersExceptionpublic void removeSyslogEventListener(ipworks.SyslogEventListener l)
|
IP*Works! V8 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||