javadoc, final, private, volatile

This commit is contained in:
zzz
2012-10-31 15:52:12 +00:00
parent 2c3edc0503
commit 96ed7abdc5
5 changed files with 43 additions and 35 deletions

View File

@@ -21,6 +21,9 @@ import net.i2p.data.Destination;
/** /**
* Define the standard means of interacting with the I2P system * Define the standard means of interacting with the I2P system
* *
* An I2PClient contains no state, it is just a facility for creating private key files
* and generating sesssions from existing private key files.
*
* @author jrandom * @author jrandom
*/ */
public interface I2PClient { public interface I2PClient {

View File

@@ -25,14 +25,18 @@ import net.i2p.data.SigningPrivateKey;
import net.i2p.data.SigningPublicKey; import net.i2p.data.SigningPublicKey;
/** /**
* Base client implementation * Base client implementation.
* An I2PClient contains no state, it is just a facility for creating private key files
* and generating sesssions from existing private key files.
* *
* @author jrandom * @author jrandom
*/ */
class I2PClientImpl implements I2PClient { class I2PClientImpl implements I2PClient {
/** /**
* Create the destination with a null payload * Create the destination with a null payload.
* This is not bound to the I2PClient, you must supply the data back again
* in createSession().
* *
* @param destKeyStream location to write out the destination, PrivateKey, and SigningPrivateKey, * @param destKeyStream location to write out the destination, PrivateKey, and SigningPrivateKey,
* format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile} * format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}

View File

@@ -515,9 +515,9 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
* Needs work. * Needs work.
*/ */
protected class AvailabilityNotifier implements Runnable { protected class AvailabilityNotifier implements Runnable {
private List _pendingIds; private final List _pendingIds;
private List _pendingSizes; private final List _pendingSizes;
private boolean _alive; private volatile boolean _alive;
public AvailabilityNotifier() { public AvailabilityNotifier() {
_pendingIds = new ArrayList(2); _pendingIds = new ArrayList(2);

View File

@@ -61,6 +61,7 @@ public class CryptixAESEngine extends AESEngine {
} }
****/ ****/
/** */
public CryptixAESEngine(I2PAppContext context) { public CryptixAESEngine(I2PAppContext context) {
super(context); super(context);
//_cache = new CryptixAESKeyCache(); //_cache = new CryptixAESKeyCache();

View File

@@ -32,53 +32,53 @@ public final class CryptixRijndael_Algorithm // implicit no-argument constructor
// Debugging methods and variables // Debugging methods and variables
//........................................................................... //...........................................................................
static final String _NAME = "Rijndael_Algorithm"; private static final String _NAME = "Rijndael_Algorithm";
static final boolean _IN = true, _OUT = false; private static final boolean _IN = true, _OUT = false;
static final boolean _RDEBUG = false; private static final boolean _RDEBUG = false;
static final int _debuglevel = 0; // RDEBUG ? Rijndael_Properties.getLevel(NAME): 0; private static final int _debuglevel = 0; // RDEBUG ? Rijndael_Properties.getLevel(NAME): 0;
// static final PrintWriter err = RDEBUG ? Rijndael_Properties.getOutput() : null; // static final PrintWriter err = RDEBUG ? Rijndael_Properties.getOutput() : null;
static final PrintWriter _err = new PrintWriter(new java.io.OutputStreamWriter(System.err)); private static final PrintWriter _err = new PrintWriter(new java.io.OutputStreamWriter(System.err));
static final boolean _TRACE = false; // Rijndael_Properties.isTraceable(NAME); private static final boolean _TRACE = false; // Rijndael_Properties.isTraceable(NAME);
static void debug(String s) { private static void debug(String s) {
_err.println(">>> " + _NAME + ": " + s); _err.println(">>> " + _NAME + ": " + s);
} }
static void trace(boolean in, String s) { private static void trace(boolean in, String s) {
if (_TRACE) _err.println((in ? "==> " : "<== ") + _NAME + "." + s); if (_TRACE) _err.println((in ? "==> " : "<== ") + _NAME + "." + s);
} }
static void trace(String s) { private static void trace(String s) {
if (_TRACE) _err.println("<=> " + _NAME + "." + s); if (_TRACE) _err.println("<=> " + _NAME + "." + s);
} }
// Constants and variables // Constants and variables
//........................................................................... //...........................................................................
static final int _BLOCK_SIZE = 16; // default block size in bytes private static final int _BLOCK_SIZE = 16; // default block size in bytes
static final int[] _alog = new int[256]; private static final int[] _alog = new int[256];
static final int[] _log = new int[256]; private static final int[] _log = new int[256];
static final byte[] _S = new byte[256]; private static final byte[] _S = new byte[256];
static final byte[] _Si = new byte[256]; private static final byte[] _Si = new byte[256];
static final int[] _T1 = new int[256]; private static final int[] _T1 = new int[256];
static final int[] _T2 = new int[256]; private static final int[] _T2 = new int[256];
static final int[] _T3 = new int[256]; private static final int[] _T3 = new int[256];
static final int[] _T4 = new int[256]; private static final int[] _T4 = new int[256];
static final int[] _T5 = new int[256]; private static final int[] _T5 = new int[256];
static final int[] _T6 = new int[256]; private static final int[] _T6 = new int[256];
static final int[] _T7 = new int[256]; private static final int[] _T7 = new int[256];
static final int[] _T8 = new int[256]; private static final int[] _T8 = new int[256];
static final int[] _U1 = new int[256]; private static final int[] _U1 = new int[256];
static final int[] _U2 = new int[256]; private static final int[] _U2 = new int[256];
static final int[] _U3 = new int[256]; private static final int[] _U3 = new int[256];
static final int[] _U4 = new int[256]; private static final int[] _U4 = new int[256];
static final byte[] _rcon = new byte[30]; private static final byte[] _rcon = new byte[30];
static final int[][][] _shifts = new int[][][] { { { 0, 0}, { 1, 3}, { 2, 2}, { 3, 1}}, private static final int[][][] _shifts = new int[][][] { { { 0, 0}, { 1, 3}, { 2, 2}, { 3, 1}},
{ { 0, 0}, { 1, 5}, { 2, 4}, { 3, 3}}, { { 0, 0}, { 1, 5}, { 2, 4}, { 3, 3}},
{ { 0, 0}, { 1, 7}, { 3, 5}, { 4, 4}}}; { { 0, 0}, { 1, 7}, { 3, 5}, { 4, 4}}};
@@ -344,12 +344,12 @@ public final class CryptixRijndael_Algorithm // implicit no-argument constructor
} }
// multiply two elements of GF(2^m) // multiply two elements of GF(2^m)
static final int mul(int a, int b) { private static final int mul(int a, int b) {
return (a != 0 && b != 0) ? _alog[(_log[a & 0xFF] + _log[b & 0xFF]) % 255] : 0; return (a != 0 && b != 0) ? _alog[(_log[a & 0xFF] + _log[b & 0xFF]) % 255] : 0;
} }
// convenience method used in generating Transposition boxes // convenience method used in generating Transposition boxes
static final int mul4(int a, byte[] b) { private static final int mul4(int a, byte[] b) {
if (a == 0) return 0; if (a == 0) return 0;
a = _log[a & 0xFF]; a = _log[a & 0xFF];
int a0 = (b[0] != 0) ? _alog[(a + _log[b[0] & 0xFF]) % 255] & 0xFF : 0; int a0 = (b[0] != 0) ? _alog[(a + _log[b[0] & 0xFF]) % 255] & 0xFF : 0;