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.

Constructor Index

 o AddrList()
Initialize an empty address list

Method Index

 o addAddress(AddrObj)
Add a new address to the address list.
 o addAddress(byte[], byte[])
Add a new address to the address list.
 o addAddress(String)
Add a new address to the address list.
 o deleteAddress(byte[])
Delete an address from the address list.
 o editPanel()
Create a graphical panel to edit the address list.
 o empty()
Check if the address list is empty
 o getAddresses()
Get all addresses contained in the address list.
 o getFirstAddress()
Get the first address of the address list.
 o printAddresses()
Format all addresses contained in the list.
The format of the strings is "aaa.aaa.aaa.aaa/mmm.mmm.mmm.mmm"
 o printAddressesFormatted(PrintStream, int, int, int)
Format all addresses and write them to the specified print stream.
 o read(PersistentInputStream)
Read object data from a persistent input stream
 o union(AddrList)
This method adds all addresses from the parameter address list, that are not yet stored in the list.
 o write(PersistentOutputStream)
Write object data to a persistent output stream

Constructors

 o AddrList
  public AddrList()
Initialize an empty address list

Methods

 o 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
 o 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
 o 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.
 o 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.
 o 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
 o 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
 o 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
 o getAddresses
  protected Vector getAddresses()
Get all addresses contained in the address list.
Returns:
Vector containing the address objects
 o empty
  public boolean empty()
Check if the address list is empty
Returns:
true, if the list is empty, false otherwise
 o 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
 o 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
 o write
  public void write(PersistentOutputStream ps)
Write object data to a persistent output stream
Parameters:
ps - Stream
See Also:
PersistentOutputStream
 o 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