edu.uiuc.cs.net.DPRPManager
Class SimpleDPRPServer
java.lang.Object
|
+--edu.uiuc.cs.net.DPRPManager.SimpleDPRPServer
- public class SimpleDPRPServer
- extends java.lang.Object
The main server class, that starts the entire process. This class
started out as a really simple server, that just received a packet, and
sent it back out again. However through refactoring, this code
became something much more complex. It probably should be renamed,
but it's kindof a nice reminder of where this code came
from. :)
- Version:
- 1.3 - October 27th, 2001
- Author:
- Andy Reitz (areitz@cs.uiuc.edu)
Field Summary |
static boolean |
DEBUG
Controls the printing of debug output to stdout. |
static ServerPortMgr |
PortManager
The ServerPortMgr instance for this server. |
static java.util.HashMap |
sessionMap
Maps "clientIP:port" strings to
DPRPServerSession instances. |
static java.lang.String |
VERSION
The version string, for the "-v" parameter. |
Method Summary |
static void |
main(java.lang.String[] args)
The start of control for this allegedly-simple DPRP server. |
private static void |
printCommandUsage()
Simply dumps a message to stderr about how to start this utility. |
static void |
removeSession(java.lang.String sourceKey)
Removes a "session" from the sessionMap. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
DEBUG
public static boolean DEBUG
- Controls the printing of debug output to stdout.
VERSION
public static final java.lang.String VERSION
- The version string, for the "-v" parameter.
PortManager
public static ServerPortMgr PortManager
- The ServerPortMgr instance for this server.
sessionMap
public static java.util.HashMap sessionMap
- Maps "clientIP:port" strings to
DPRPServerSession instances.
SimpleDPRPServer
public SimpleDPRPServer()
main
public static void main(java.lang.String[] args)
- The start of control for this allegedly-simple DPRP server. This
method is not a mere skeleton -- it actually has a lot of functionality.
It first instantiates the ServerPortMgr singleton,
and then it parses its command-line parameters. It guarantees that
both the internal and external IP addresses are supplied, and if
a host configuration file is specified, it reads that in, and builds
the DPRPRestriction map. Addionally, if it finds a
stored lease file, this will also be sucked in, and on disk leases
restored.
Moving into the main server loop, we block on the internal socket,
waiting for a client request. When such a request is received, it
is matched against a map of open requests. If a previous request
is found, this new packet is routed to the appropriate handling
thread. Otherwise, after some error-checks succeed, a new thread
is spawned in order to handle this packet (as it represents a new
session).
- Parameters:
args
- The command line parameters.
removeSession
public static void removeSession(java.lang.String sourceKey)
- Removes a "session" from the sessionMap. When a
session finishes, the last thing it does is to remove it's
identifier from the map, affecting a full cleanup.
- Parameters:
sourceKey
- The source identifier, serves as the key in
the map.
printCommandUsage
private static void printCommandUsage()
- Simply dumps a message to stderr about how to start this utility.