Class sfclasses.AddrList
All Packages Class Hierarchy This Package Previous Next Index
Class sfclasses.AddrList
java.lang.Object
|
+----sfclasses.AddrList
- public class AddrList
- extends Object
- implements Persistent
List of IP addresses
This class implements a list of IP addresses. The addresses are stored
in a vector of AddrObj objects. AddrObj is a private class declared in
this file. Each IP address consists of a four byte address and a four
byte netmask. This file also declares the private class AddrPanel which
is used to edit an address list.
-
AddrList()
- Initialize an empty address list
-
addAddress(AddrObj)
- Add a new address to the address list.
-
addAddress(byte[], byte[])
- Add a new address to the address list.
-
addAddress(String)
- Add a new address to the address list.
-
deleteAddress(byte[])
-
Delete an address from the address list.
-
editPanel()
- Create a graphical panel to edit the address list.
-
empty()
- Check if the address list is empty
-
getAddresses()
- Get all addresses contained in the address list.
-
getFirstAddress()
- Get the first address of the address list.
-
printAddresses()
- Format all addresses contained in the list.
The format of the strings is "aaa.aaa.aaa.aaa/mmm.mmm.mmm.mmm"
-
printAddressesFormatted(PrintStream, int, int, int)
- Format all addresses and write them to the specified print stream.
-
read(PersistentInputStream)
- Read object data from a persistent input stream
-
union(AddrList)
- This method adds all addresses from the parameter address list,
that are not yet stored in the list.
-
write(PersistentOutputStream)
- Write object data to a persistent output stream
AddrList
public AddrList()
- Initialize an empty address list
addAddress
protected void addAddress(AddrObj adr)
- Add a new address to the address list. If the address already exists,
it is removed from the list before adding the new one. Two addresses
with equal address parts are equal regardless of their netmasks.
- Parameters:
- adr - Address object to add
addAddress
public void addAddress(byte addr[],
byte mask[])
- Add a new address to the address list. If the address already exists,
it is removed from the list before adding the new one. Two addresses
with equal address parts are equal regardless of their netmasks. The
given address and netmask are converted to an address object before
adding.
- Parameters:
- addr - Byte array containing the IP address
- mask - Byte array containing the netmask
addAddress
public void addAddress(String str)
- Add a new address to the address list. If the address already exists,
it is removed from the list before adding the new one. Two addresses
with equal address parts are equal regardless of their netmasks. The
given string is converted to an address object before adding. The string
must be of the format "aaa.aaa.aaa.aaa[/mmm.mmm.mmm.mmm]".
- Parameters:
- str - string containing the IP address and optionally the netmask.
deleteAddress
public boolean deleteAddress(byte addr[])
- Delete an address from the address list.
- Parameters:
- addr - Byte array containing the address to delete.
- Returns:
- true if successful, false if the parameter isn't a valid IP
address or if the address is not in the list.
editPanel
public Panel editPanel()
- Create a graphical panel to edit the address list. The panel can
be included in frames or dialog boxes.
- Returns:
- Panel containing the address list editor
getFirstAddress
public byte[] getFirstAddress()
- Get the first address of the address list. This method is called whenever
the software needs to know the address of a firewall it should use to
connect to.
- Returns:
- IP address in byte array format or null if the list is empty
union
public void union(AddrList al)
- This method adds all addresses from the parameter address list,
that are not yet stored in the list. If both the list and the paramter
contain an address, the address with the shorter netmask is used.
This method is used by the autoconfiguration algorithms.
- Parameters:
- al - List containing the new addresses
getAddresses
protected Vector getAddresses()
- Get all addresses contained in the address list.
- Returns:
- Vector containing the address objects
empty
public boolean empty()
- Check if the address list is empty
- Returns:
- true, if the list is empty, false otherwise
printAddresses
public String[] printAddresses()
- Format all addresses contained in the list.
The format of the strings is "aaa.aaa.aaa.aaa/mmm.mmm.mmm.mmm"
- Returns:
- Array of strings containing the formatted addresses
printAddressesFormatted
public void printAddressesFormatted(PrintStream ps,
int indent,
int port,
int prend)
- Format all addresses and write them to the specified print stream.
The output format is conforming to the firewall configuration file syntax.
- Parameters:
- ps - PrintStream to write the output to
write
public void write(PersistentOutputStream ps)
- Write object data to a persistent output stream
- Parameters:
- ps - Stream
- See Also:
- PersistentOutputStream
read
public void read(PersistentInputStream ps) throws IOException
- Read object data from a persistent input stream
- Parameters:
- ps - Stream
- See Also:
- PersistentInputStream
All Packages Class Hierarchy This Package Previous Next Index