simnet
Class Ping

java.lang.Object
  extended byjava.lang.Thread
      extended bysimnet.Application
          extended bysimnet.Ping
All Implemented Interfaces:
BPFConsumer, Pluggable, PlugoutListener, java.lang.Runnable, SimnetWindowListener

public class Ping
extends Application
implements BPFConsumer, Pluggable

An application which implements Ping.


Field Summary
(package private)  BPF bpf
           
 
Fields inherited from class simnet.Application
appid, appstart, frame, initialized, node, NODE_ID, pid, random, sim, win
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Ping()
           
 
Method Summary
 void inBPF(int bpf_id, IP_Packet ip_packet)
          So ping can get responses.
 void ping(int dest)
          Pings the specified node.
 void ping(java.lang.Integer dest)
          Pings the specified node.
 void ping(java.lang.String dest)
          Pings the specified node.
 boolean prePlugout(java.lang.Object replacement)
          Ping can be removed by getting rid of the bpf rule, or replaced by transferring the BPF rule.
 
Methods inherited from class simnet.Application
closeWindow, customInit, finalize, getTitleString, initialize, plugoutNotification, printout, printout, processWindowCommand, rawOut, run, window
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bpf

BPF bpf
Constructor Detail

Ping

public Ping()
Method Detail

ping

public void ping(int dest)
Pings the specified node. Note that if a ping is outstanding to a node, and a new ping command is issued, the old echo reply will not be printed

Parameters:
dest - the ID of destination node

ping

public void ping(java.lang.String dest)
Pings the specified node. Called direcly from the UserInterface to provide a version of the ping command that takes Node names as arguments.

Parameters:
dest - the ID of destination node

ping

public void ping(java.lang.Integer dest)
Pings the specified node. Called direcly from the UserInterface to provide an rsynflood command.

Parameters:
dest - the ID of destination node

inBPF

public void inBPF(int bpf_id,
                  IP_Packet ip_packet)
So ping can get responses. Note that when an ICMP echo reply is received, the BPF rule is removed. As a result, pings can only be done one at a time.

Specified by:
inBPF in interface BPFConsumer
Parameters:
bpf_id - the ID of the BPF rule that the ip_packet matched
ip_packet - incoming ip_packet from BPF

prePlugout

public boolean prePlugout(java.lang.Object replacement)
Ping can be removed by getting rid of the bpf rule, or replaced by transferring the BPF rule.

Specified by:
prePlugout in interface Pluggable
Returns:
if this object can now be removed (was the operation sucessful)