edu.harvard.deas.hyperenc.vsat
Class PageServerNode

java.lang.Object
  extended by java.lang.Thread
      extended by edu.harvard.deas.hyperenc.vsat.PageServerNode
All Implemented Interfaces:
Runnable

public class PageServerNode
extends Thread

The PageServerNode represents a Page Server Node in the hyper-encryption system. It listens for page requests and responds to them. Each request consists of a 32-bit integer, the page request key. The PSN responds to a page request by sending back a 4096-byte page of random data; each page is served at most twice.

A PageServerNode is backed by a PageDatabase, which handles the details of page management. The PageServerNode itself receives requests and uses the contained request key to retrieve a page from the PageDatabase. It then sends this page back to the requester.

The request key is interpreted as a big-endian integer: the high byte comes first.

See Also:
PageDatabase

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static int DEFAULT_PSN_PORT
          The port on which the PSN listens for connections/requests.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
PageServerNode()
          Creates a new Page Server Node using the default port.
PageServerNode(int psn_port)
          Creates a new Virtual Satellite node that listens for connections on psn_port.
 
Method Summary
 boolean isShutdown()
          Whether or not to shut down.
static void main(String[] args)
          Creates a PSN and runs it until the process is killed.
 void run()
          The main thread of execution for the PSN.
 void shutdownNow()
          Shut down the server now.
 
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

DEFAULT_PSN_PORT

public static final int DEFAULT_PSN_PORT
The port on which the PSN listens for connections/requests.

See Also:
Constant Field Values
Constructor Detail

PageServerNode

public PageServerNode()
Creates a new Page Server Node using the default port. Equivalent to PageServerNode(DEFAULT_PSN_PORT).


PageServerNode

public PageServerNode(int psn_port)
Creates a new Virtual Satellite node that listens for connections on psn_port. This does all of the network setup as well

Parameters:
psn_port - The port on which to listen for connections.
Method Detail

main

public static void main(String[] args)
Creates a PSN and runs it until the process is killed.


isShutdown

public boolean isShutdown()
Whether or not to shut down.

Returns:
Whether we have been told to shut down.

shutdownNow

public void shutdownNow()
Shut down the server now.


run

public void run()
The main thread of execution for the PSN. It listens for connections and processes any received requests. Loops until killed, for example by SIGTERM.

Specified by:
run in interface Runnable
Overrides:
run in class Thread