ANTS v2.0 API

apps.mobile
Class MobileApplication

java.lang.Object
  |
  +--ants.core.Entity
        |
        +--ants.core.Application
              |
              +--apps.mobile.MobileApplication

public class MobileApplication
extends Application
implements java.lang.Runnable

primitive Mobile test application

Author:
David Wetherall

Field Summary
static java.lang.String[] defaults
           
 
Fields inherited from class ants.core.Application
defaults
 
Constructor Summary
MobileApplication()
           
 
Method Summary
 void receive(Capsule cap)
          Callback for packets that are delivered to this application.
 void run()
          Send packets to the mobile host, hopefully they get routed correctly
 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
 

Field Detail

defaults

public static final java.lang.String[] defaults
Constructor Detail

MobileApplication

public MobileApplication()
Method Detail

receive

public void receive(Capsule cap)
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?

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

run

public void run()
Send packets to the mobile host, hopefully they get routed correctly
Specified by:
run in interface java.lang.Runnable

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

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/