|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread net.clackrouter.router.core.Router
public class Router
Main router class that contains all components representing a given host in a Clack topology and handles all packet receiving and transmission.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static int |
DEFAULT_ROUTE_METRIC
|
static int |
ROUTER_ALERT_TIME
Time between alerts for any host using this router's Alerter . |
static int |
ROUTER_SLEEP_MSEC
Time the router pauses during each iteration of the main processing loop in run(). |
java.lang.String |
setup_routing_key
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
Router(VNSProtocolManager proto_manager,
TopologyModel model,
boolean isGUI)
|
Method Summary | |
---|---|
boolean |
addComponent(ClackComponent comp)
Add a component to this router's list. |
void |
addLocalLinkChangeListener(LocalLinkChangedListener l)
|
void |
addLocalLinkInfo(java.net.InetAddress net,
java.net.InetAddress mask,
java.net.InetAddress nh,
java.lang.String iface,
boolean is_up,
int metric,
boolean is_routing_iface)
|
void |
addNeedToNotify(Alarm a)
|
void |
configureIPInterface(java.lang.String iface_name,
java.net.InetAddress addr,
java.net.InetAddress mask)
Let's external entities set the IP address and subnet of a particular interface on the router This is a bit tricky, because they need to change both the input and output interfaces, and repaint them. |
void |
endTest()
signals the end of the current test |
Alerter |
getAlerter()
Get the router's Alerter for registering a one-time callback. |
ClackComponent[] |
getAllComponents()
Get all components contained within the router. |
ClackComponent |
getComponent(java.lang.String component_name)
Retrieve a component by name |
java.net.InetAddress |
getDefaultNextHop()
|
java.lang.String |
getDefaultRouteIface()
|
ClackDocument |
getDocument()
Access the document this router is associated with |
java.lang.String |
getHost()
Get this router's name within the topology |
InterfaceIn[] |
getInputInterfaces()
Get an array of all Input Interfaces. |
Interface |
getInterfaceByName(java.lang.String devicename)
Returns the input interface associated with the specified device. |
java.util.Hashtable |
getLocalLinkInfo()
|
InterfaceOut[] |
getOutputInterfaces()
Get an array of all output interfaces. |
boolean |
getPendingError()
|
int |
getPort()
Get the port this router is using to connect to the VNS server |
VNSProtocolManager |
getProtocolManager()
|
RoutingTable |
getRoutingTable()
Returns the routing table of the IPRouteLookup component in this router |
java.lang.String |
getServer()
Get the VNS server name that this router is connected to |
TCP |
getTCPStack()
Access the TCPStack of this router (may be null) |
TimeManager |
getTimeManager()
|
int |
getTopology()
Get the topology number for this router |
UDP |
getUDPStack()
Access the UDPStack of this router (may be null) |
void |
handlePacket(VNSPacket packet)
Handles packets that arrive at one of the router's input interfaces. |
boolean |
initializeNonVNSRouter(TopologyModel.Host host)
|
boolean |
initializeVNSConnectedRouter()
Reads interface hardware information from the ProtocolManager (must be called before Router is started). |
boolean |
isGUI()
indicates whether this router is visible as a full router in the Clack Application |
boolean |
isLocalRouter()
Find out if this router is local (ie: not connected to VNS) This must be tested before any checking any of getTopology(), getHost(), getPort() or getServer(). |
void |
registerForPoll(ClackComponent comp)
Used by components to register for a callback once per router processing loop. |
void |
removeComponent(ClackComponent comp)
Removes the specified component from the router's list. |
void |
removeComponent(java.lang.String comp_name)
Removes the named component from the Router's list. |
void |
removeFromPoll(ClackComponent comp)
Unregisters a component from being polled. |
void |
removeLocalLinkChangeListener(LocalLinkChangedListener l)
|
void |
run()
Main processing loop for a Clack Router. |
void |
runTest(ClackRouterTest test,
boolean disconnect)
Run the specified test on this router. |
void |
sendOutgoingPacket(VNSEthernetPacket packet)
Method used by InterfaceOut components to send packets to VNS . |
void |
setDefaultRouting(java.net.InetAddress next_hop,
java.lang.String iface)
|
void |
setDocument(ClackDocument doc)
Set the document this router is associated with |
void |
setIfaceStatus(java.lang.String iface_name,
boolean is_up)
|
void |
setIPRouteLookup(IPRouteLookup iprl)
|
void |
setPendingError(boolean e)
|
void |
setRoutingTable(RoutingTable table)
Sets the routing table for this router, overwriting all previous entries. |
void |
setTCPStack(TCP t)
|
void |
setUDPStack(UDP u)
|
void |
startEthereal()
|
void |
stopEthereal()
|
void |
stopRouterAndDisconnect()
Signals the Router to end processing and disconnect from VNS. |
void |
updateLinkMetric(java.lang.String iface_str,
int metric)
|
void |
updateRouteTableStateInGUI()
|
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static int ROUTER_ALERT_TIME
Alerter
.
public static int ROUTER_SLEEP_MSEC
Time the router pauses during each iteration of the main processing loop in run().
Used so that the router does not eat up a majority of the CPU cycles on a computer by just spining in the processing loop
public static final int DEFAULT_ROUTE_METRIC
public java.lang.String setup_routing_key
Constructor Detail |
---|
public Router(VNSProtocolManager proto_manager, TopologyModel model, boolean isGUI)
Method Detail |
---|
public boolean initializeVNSConnectedRouter() throws java.lang.Exception
java.lang.Exception
public boolean initializeNonVNSRouter(TopologyModel.Host host) throws java.lang.Exception
java.lang.Exception
public void run()
Main processing loop for a Clack Router.
In each loop, we check if we need to exit, sleep, poll() each registered component, and then process a single piece of data from the protocol manager.
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void handlePacket(VNSPacket packet)
Handles packets that arrive at one of the router's input interfaces.
The router checks that the packet info is valid and then hands it off to the correct InterfaceIn component. We also notify the topology link to let it know that a packet has arrived
public void sendOutgoingPacket(VNSEthernetPacket packet)
packet
- the Ethernet frame to be sentpublic void stopRouterAndDisconnect()
public void registerForPoll(ClackComponent comp)
comp
- component to be polledpublic void removeFromPoll(ClackComponent comp)
comp
- public ClackComponent getComponent(java.lang.String component_name)
public boolean addComponent(ClackComponent comp)
comp
- component to be added
public void removeComponent(java.lang.String comp_name)
public void removeComponent(ClackComponent comp)
public ClackComponent[] getAllComponents()
public void setRoutingTable(RoutingTable table) throws java.lang.Exception
java.lang.Exception
public RoutingTable getRoutingTable()
public void setIPRouteLookup(IPRouteLookup iprl)
public InterfaceIn[] getInputInterfaces()
public InterfaceOut[] getOutputInterfaces()
public Interface getInterfaceByName(java.lang.String devicename)
public Alerter getAlerter()
Get the router's Alerter for registering a one-time callback.
The alerter is used any time a callback is needed. For example, we use this to implement flashing links. This is more light-weight than having each flash spawn its own thread
public VNSProtocolManager getProtocolManager()
public void setTCPStack(TCP t)
public TCP getTCPStack()
public void setUDPStack(UDP u)
public UDP getUDPStack()
public boolean isGUI()
public void setDocument(ClackDocument doc)
public ClackDocument getDocument()
public boolean isLocalRouter()
public int getTopology()
public java.lang.String getHost()
public int getPort()
public java.lang.String getServer()
public TimeManager getTimeManager()
public void runTest(ClackRouterTest test, boolean disconnect)
test
- test to rundisconnect
- flag indicated if router should disconnect from other routers and VNS for the testpublic void endTest()
public void addLocalLinkInfo(java.net.InetAddress net, java.net.InetAddress mask, java.net.InetAddress nh, java.lang.String iface, boolean is_up, int metric, boolean is_routing_iface)
public java.util.Hashtable getLocalLinkInfo()
public void addLocalLinkChangeListener(LocalLinkChangedListener l)
public void removeLocalLinkChangeListener(LocalLinkChangedListener l)
public java.net.InetAddress getDefaultNextHop()
public java.lang.String getDefaultRouteIface()
public void setDefaultRouting(java.net.InetAddress next_hop, java.lang.String iface)
public void updateRouteTableStateInGUI()
public void startEthereal()
public void stopEthereal()
public void addNeedToNotify(Alarm a)
public void setPendingError(boolean e)
public boolean getPendingError()
public void configureIPInterface(java.lang.String iface_name, java.net.InetAddress addr, java.net.InetAddress mask) throws java.lang.Exception
java.lang.Exception
public void setIfaceStatus(java.lang.String iface_name, boolean is_up)
public void updateLinkMetric(java.lang.String iface_str, int metric)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |