concast.merged
Class Merged

java.lang.Object
  |
  +--concast.merged.Merged
All Implemented Interfaces:
UserAPI

public final class Merged
extends java.lang.Object
implements UserAPI

Main executable module, also exports user API for applications. Merged is launched from the CSPd. Separate document describes Merged arguments.
User API calls are implemented in this class. All public methods are implementation of UserAPI.


Field Summary
static int FAIL
           
static int FAIL_NOT_ENOUGH_ARGUMENTS
           
static boolean LOG_OUT
          defines allow or not to use System.out to print internal log messages
static boolean LOG_UDP
           
static int LOG_UDP_PORT
           
static int MAX_ACTIVE_DECS
          Upper bound on number of entries in the mergeStateTable, as described in the spec
 java.lang.Class[] Merged_Class
           
static int MODE
           
protected  java.security.SecureRandom random
           
protected  byte[] secretEncKey
           
protected  byte[] secretKey
           
protected  boolean secretKeyUpdated
           
protected  byte[] secretMacKey
           
static boolean UNL_ON
          true, is communication with CSPd is ON
static int VERSION
          version of merged
 
Method Summary
 boolean cancelTimer()
          Remove timer for current tag, if any returns true if was removed false, if it was not found in any case, after calling this method there no more timers are pending for current tag
 void debug(java.lang.String s)
          Print debugging message, for user only
 void debugOFF()
          Turn debugging of current merged off.
 void debugON()
          Turn debug option on.
 void enableUNL(boolean update)
          Disable/Enable UNL updates.
 byte[] getByteArray(java.lang.String name)
           
 javax.crypto.Cipher getCipherDec()
          Retrieve (decryption) cipher from the flow state
 javax.crypto.Cipher getCipherEnc()
          Retrieves (encryption) cipher from the flow state
 javax.crypto.Mac getCipherMac()
          Retrieve mac cipher from the flow state
 long getCurrentTag()
          Returns current value of tag
 long getDEClimit()
          Returns MAX_ACTIVE_DECS as described in the draft Maximum amount of per-flow state kept at a node
 int getInt(java.lang.String name)
           
 long getLong(java.lang.String name)
           
 int getMyID()
          Returns ID to identify current node (currently it is based on the IP address
 byte[] getSecretEncKey()
          Returns secret key for data encryption/decryption.
 byte[] getSecretKey()
          Returns secret key material used to generate secret keys.
 boolean getSecretKeyUpdated()
          Returns true, if the secret key has been updated and sets this flag to false.
 byte[] getSecretMacKey()
          Returns secret key for secure-hash mac.
 long getSenderID()
          Returns upstream neighbor ID of the current incoming packet.
 long getTimer()
          Returns absolute number of milliseconds - time on which second part of the packet processing (buildAndFwdIfDone) has been scheduled, or 0 if it was not scheduled
 UNL getUNL()
          Returns Upstream Neighbor List
protected  void logDebug(java.lang.String s)
          Logging to stderr only
 void logUdp(java.lang.String s)
          Print the message to the UDP socket.
static void main(java.lang.String[] argv)
          Parameters:
0 classPath (file or url) 1 SpecBase ...
 boolean putByteArray(java.lang.String name, byte[] value)
           
 boolean putCipherDec(javax.crypto.Cipher c)
          Store decryption cipher in the flow state.
 boolean putCipherEnc(javax.crypto.Cipher c)
          Allows to store initialized (encryption) cipher in the flow state.
 boolean putCipherMac(javax.crypto.Mac m)
          Store mac cipher in the flow state.
 boolean putInt(java.lang.String name, int value)
          The following 6 method are used to store and retrieve data in the flow state.
 boolean putLong(java.lang.String name, long value)
           
 boolean setTimer(long time)
          This method can only be called from user done() method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNL_ON

public static boolean UNL_ON
true, is communication with CSPd is ON

VERSION

public static final int VERSION
version of merged

MAX_ACTIVE_DECS

public static final int MAX_ACTIVE_DECS
Upper bound on number of entries in the mergeStateTable, as described in the spec

LOG_OUT

public static final boolean LOG_OUT
defines allow or not to use System.out to print internal log messages

Merged_Class

public java.lang.Class[] Merged_Class

MODE

public static int MODE

secretKey

protected byte[] secretKey

secretKeyUpdated

protected boolean secretKeyUpdated

secretEncKey

protected byte[] secretEncKey

secretMacKey

protected byte[] secretMacKey

random

protected java.security.SecureRandom random

FAIL

public static final int FAIL

FAIL_NOT_ENOUGH_ARGUMENTS

public static final int FAIL_NOT_ENOUGH_ARGUMENTS

LOG_UDP

public static boolean LOG_UDP

LOG_UDP_PORT

public static final int LOG_UDP_PORT
Method Detail

getTimer

public long getTimer()
Returns absolute number of milliseconds - time on which second part of the packet processing (buildAndFwdIfDone) has been scheduled, or 0 if it was not scheduled
Specified by:
getTimer in interface UserAPI

setTimer

public boolean setTimer(long time)
This method can only be called from user done() method. Calling the methods tells merged : "I'm not ready to build a message right now. I want to try again at time (absolute in milliseconds)" returns true, if time was setup return false, otherwise
Specified by:
setTimer in interface UserAPI

cancelTimer

public boolean cancelTimer()
Remove timer for current tag, if any returns true if was removed false, if it was not found in any case, after calling this method there no more timers are pending for current tag
Specified by:
cancelTimer in interface UserAPI

getDEClimit

public long getDEClimit()
Returns MAX_ACTIVE_DECS as described in the draft Maximum amount of per-flow state kept at a node
Specified by:
getDEClimit in interface UserAPI

getUNL

public UNL getUNL()
           throws java.io.IOException
Returns Upstream Neighbor List
Specified by:
getUNL in interface UserAPI

enableUNL

public void enableUNL(boolean update)
Description copied from interface: UserAPI
Disable/Enable UNL updates.
Specified by:
enableUNL in interface UserAPI

getCurrentTag

public long getCurrentTag()
Returns current value of tag
Specified by:
getCurrentTag in interface UserAPI

getMyID

public int getMyID()
Returns ID to identify current node (currently it is based on the IP address
Specified by:
getMyID in interface UserAPI

putInt

public boolean putInt(java.lang.String name,
                      int value)
The following 6 method are used to store and retrieve data in the flow state. This data can be shared between multiple DECs. put*() method returns true, if value has been stored in the flow state and false if it has not been stored, in the case of exceeding memory for the flow state
Specified by:
putInt in interface UserAPI

putLong

public boolean putLong(java.lang.String name,
                       long value)
Specified by:
putLong in interface UserAPI

putByteArray

public boolean putByteArray(java.lang.String name,
                            byte[] value)
Specified by:
putByteArray in interface UserAPI

getInt

public int getInt(java.lang.String name)
Specified by:
getInt in interface UserAPI

getLong

public long getLong(java.lang.String name)
Specified by:
getLong in interface UserAPI

getByteArray

public byte[] getByteArray(java.lang.String name)
Specified by:
getByteArray in interface UserAPI

getSenderID

public long getSenderID()
Returns upstream neighbor ID of the current incoming packet. This method is only available from gettag() and merge() methods, and only in first time calls of done(), buildmsg() methods, that are executed when the packet first arrives. Call of this method from any other done() or buildmsg() methods returns 0 (because merged does not store this id). This ID is one of ID's in the UNL list.
Specified by:
getSenderID in interface UserAPI

getSecretKey

public byte[] getSecretKey()
Returns secret key material used to generate secret keys. This key is supplied by the receiver and is passed by the CSPD
Specified by:
getSecretKey in interface UserAPI

getSecretEncKey

public byte[] getSecretEncKey()
Returns secret key for data encryption/decryption. This key is supplied by the receiver and is passed by the CSPD
Specified by:
getSecretEncKey in interface UserAPI

getSecretMacKey

public byte[] getSecretMacKey()
Returns secret key for secure-hash mac. This key is supplied by the receiver and is passed by the CSPD
Specified by:
getSecretMacKey in interface UserAPI

getSecretKeyUpdated

public boolean getSecretKeyUpdated()
Returns true, if the secret key has been updated and sets this flag to false. Otherwise, returns false.
Specified by:
getSecretKeyUpdated in interface UserAPI

putCipherEnc

public boolean putCipherEnc(javax.crypto.Cipher c)
Allows to store initialized (encryption) cipher in the flow state. This is used for optimization (to initialize cipher only once).
Specified by:
putCipherEnc in interface UserAPI

getCipherEnc

public javax.crypto.Cipher getCipherEnc()
Retrieves (encryption) cipher from the flow state
Specified by:
getCipherEnc in interface UserAPI

putCipherDec

public boolean putCipherDec(javax.crypto.Cipher c)
Store decryption cipher in the flow state.
Specified by:
putCipherDec in interface UserAPI

getCipherDec

public javax.crypto.Cipher getCipherDec()
Retrieve (decryption) cipher from the flow state
Specified by:
getCipherDec in interface UserAPI

putCipherMac

public boolean putCipherMac(javax.crypto.Mac m)
Store mac cipher in the flow state.
Specified by:
putCipherMac in interface UserAPI

getCipherMac

public javax.crypto.Mac getCipherMac()
Retrieve mac cipher from the flow state
Specified by:
getCipherMac in interface UserAPI

debugON

public void debugON()
Turn debug option on. Will create a log file and print log messages of the current merged, when rcsp is in debugging mode
Specified by:
debugON in interface UserAPI

debugOFF

public void debugOFF()
Turn debugging of current merged off.
Specified by:
debugOFF in interface UserAPI

debug

public void debug(java.lang.String s)
Print debugging message, for user only
Specified by:
debug in interface UserAPI

logDebug

protected void logDebug(java.lang.String s)
Logging to stderr only

logUdp

public void logUdp(java.lang.String s)
Print the message to the UDP socket. Added for the Darpa demo in Jan$
Specified by:
logUdp in interface UserAPI

main

public static void main(java.lang.String[] argv)
Parameters:
0 classPath (file or url) 1 SpecBase ... c MergeState //c - the number of classes included in the mergespec, c >= 2, // usually c = 2 //NEW : on the sender, when Merge Spec is not available, CSPD should //supply c = 2, // arg[1] = "null", // arg[2] = "null" //OLD options c+1 Encryption class name, or "null" if not available c+2 receiver IP address (since there is a single flow per merged) c+3 ENC_ON or ENC_OFF c+4 DEC_ON or DEC_OFF //NEW options, replace c+3 and c+4 with c+3 S, M, or R (for Sender, Middle, or Receiver) More info in MERGEd/Java/docs/concast-secure-data-int.txt