edu.harvard.deas.hyperenc
Class VSatRandomSource

java.lang.Object
  extended by edu.harvard.deas.hyperenc.VSatRandomSource
All Implemented Interfaces:
RandomSource, Serializable

public class VSatRandomSource
extends Object
implements RandomSource

The VSatRandomSource, given two 32-bit integers, the PSN selection key and the page request key, obtains a page of random data from a PSN. It selects the PSN from a PSN list specified at construction, and then sends the page request key to the PSN, which replies by sending a page.

See Also:
Serialized Form

Field Summary
static int DEFAULT_PSN_PORT
          The port on which PSNs listen by default; connections to PSNs will attempt to connect to this port.
 
Constructor Summary
VSatRandomSource(NNLookup<String> psnList)
          Constructs a new VSatRandomSource.
 
Method Summary
 void getPage(byte[] block, byte[] page)
          Gets a page of random bits.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PSN_PORT

public static final int DEFAULT_PSN_PORT
The port on which PSNs listen by default; connections to PSNs will attempt to connect to this port.

See Also:
Constant Field Values
Constructor Detail

VSatRandomSource

public VSatRandomSource(NNLookup<String> psnList)
Constructs a new VSatRandomSource.

Parameters:
psnList - a list of PSN hostnames/IPs with associated integer keys. This list will be used to choose PSNs; the PSN with the numerically closest key, per the NNLookup.get(int) method, is used.
Method Detail

getPage

public void getPage(byte[] block,
                    byte[] page)
             throws PageCreationException
Gets a page of random bits.

Specified by:
getPage in interface RandomSource
Parameters:
block - A buffer of random bytes used used to get the PSN info/id from the central server (must be exactly 8 bytes long)
page - An empty array to hold the returned random data
Throws:
PageCreationException