ANTS v2.0 API

ants.dante
Class DanteServer

java.lang.Object
  |
  +--ants.core.Entity
        |
        +--ants.core.Application
              |
              +--ants.dante.DanteServer

public final class DanteServer
extends Application
implements java.lang.Runnable, DanteConstants

This class dynamically distributes addresses for a core server.

DanteServer accepts the following arguments:

  • -port int: override the default port value (14)
  • -start X.Y.Z.W: the first address available for distribution
  • -end A.B.C.D: the last address available for distribution
  • Author:
    Andrew Whitaker

    Fields inherited from class ants.core.Application
    defaults
     
    Fields inherited from interface ants.dante.DanteConstants
    DANTE_CLIENT_PORT, DANTE_SERVER_PORT, DANTE_VERSION, ERROR, INIT, JOIN, KEEP_ALIVE_FREQUENCY, LEAVE, MAX_FAILURES, REFRESH, RESPONSE, TIMEOUT, UNDEFINED
     
    Constructor Summary
    DanteServer()
               
     
    Method Summary
     int allocateAddress(edu.utah.janos.nodeos.Address link)
              Allocate a new (unused) address, and a build a provisional gateway
     void markAddress(int address, edu.utah.janos.nodeos.Address link)
              Called on receiving a keep-alive update to reset the timeout field.
     void receive(Capsule c)
              Callback for packets that are delivered to this application.
     void returnAddress(int address)
              Return a timed-out address to the pool.
     void run()
              Clear the use bits after each timeout period.
     void setArgs(KeyArgs k)
              Parse command line arguments for this application.
     void start()
              Start this Application rolling.
     
    Methods inherited from class ants.core.Application
    getDefaultResources, getDefaultTTL, getNode, getNodeAddress, getPort, getPrincipal, send, send, setDefaultResources, setDefaultTTL, thisNode, toString
     
    Methods inherited from class java.lang.Object
    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Constructor Detail

    DanteServer

    public DanteServer()
    Method Detail

    start

    public void start()
               throws java.lang.Exception
    Description copied from class: Application
    Start this Application rolling. This is invoked once by the Node after it has been initialized.

    Note that implementations of start should just set things up. If the application wants to do things like send packets, this function should start a new thread to do that. Creating a GUI and associating callbacks is a good thing to do here.

    XXX mostly stuff that could just be done in the no-arg constructor, no?

    Overrides:
    start in class Application

    setArgs

    public void setArgs(KeyArgs k)
                 throws InvalidKeyArgsException
    Description copied from class: Application
    Parse command line arguments for this application. Understands the -port option and the -principal option.

    It is guaranteed that this method will be invoked before the application starts running (i.e. shortly after the constructor is invoked).

    XXX A security issue related to this method is that a mallicious application could change its parameters by invoking this method after startup. For example, the application could change its principal to "Administrator". To avoid any pitfalls, the local copies of the argument variables should be ignored once control is given over to the application's start method

    Overrides:
    setArgs in class Application
    Tags copied from class: Application
    See Also:
    #port, KeyArgs

    receive

    public void receive(Capsule c)
    Description copied from class: Application
    Callback for packets that are delivered to this application. This does nothing, so the default behavior for the application is to drop delivered packets on the floor.
    Overrides:
    receive in class Application
    Tags copied from class: Application
    Parameters:
    cap - the Capsule that got delivered. XXX state of Xdr?

    allocateAddress

    public int allocateAddress(edu.utah.janos.nodeos.Address link)
                        throws AddressExhaustionException
    Allocate a new (unused) address, and a build a provisional gateway

    markAddress

    public void markAddress(int address,
                            edu.utah.janos.nodeos.Address link)
    Called on receiving a keep-alive update to reset the timeout field. This prevents the address from being garbage collected. Also, add the address to the list of gateways if it isn't already there.

    returnAddress

    public void returnAddress(int address)
    Return a timed-out address to the pool.

    run

    public void run()
    Clear the use bits after each timeout period. Discard old address mappings.
    Specified by:
    run in interface java.lang.Runnable

    ANTS v2.0 API

    This documentation is Copyright (C) 1998-2001 The University of Utah and the University of Washington. All Rights Reserved. See the individual source files for distribution terms.
    Documentation, software, and mailing lists for ANTS v2.0 can be found at the Janos Project: http://www.cs.utah.edu/flux/janos/