summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2003-10-15 15:21:43 +0000
committerPeter Palfrader <peter@palfrader.org>2003-10-15 15:21:43 +0000
commiteae058561c5ff1e818a1778782858753b214f3a1 (patch)
tree313e96cf35328a135d5a6eb4ef6ecd8186fc4dea
parentf2a19242299e39a63970818e81cba56d8e9f6258 (diff)
move keyid into RoutingForward
-rw-r--r--src/org/noreply/fancydress/type3/routing/RoutingForward.java17
-rw-r--r--src/org/noreply/fancydress/type3/routing/RoutingHOST.java7
-rw-r--r--src/org/noreply/fancydress/type3/routing/RoutingIP4.java7
3 files changed, 18 insertions, 13 deletions
diff --git a/src/org/noreply/fancydress/type3/routing/RoutingForward.java b/src/org/noreply/fancydress/type3/routing/RoutingForward.java
index 28ac75d..183696a 100644
--- a/src/org/noreply/fancydress/type3/routing/RoutingForward.java
+++ b/src/org/noreply/fancydress/type3/routing/RoutingForward.java
@@ -9,12 +9,18 @@ package org.noreply.fancydress.type3.routing;
*/
public abstract class RoutingForward extends Routing {
/**
+ * Keyid of the next hop's Identity Key
+ */
+ protected byte[] keyid;
+
+ /**
* Default constructor.
*
* @param type The routing type as integer.
*/
- protected RoutingForward(int type) {
+ protected RoutingForward(int type, byte[] keyid) {
super (type);
+ this.keyid = keyid;
}
/**
@@ -23,5 +29,14 @@ public abstract class RoutingForward extends Routing {
* @return A routing class with the same information, but with a SWAP routing type.
*/
public abstract RoutingForward asSwap();
+
+ /**
+ * Return the Identity Key of the next node
+ *
+ * @returns next node's identity key.
+ */
+ public byte[] getKeyID() {
+ return keyid;
+ }
}
diff --git a/src/org/noreply/fancydress/type3/routing/RoutingHOST.java b/src/org/noreply/fancydress/type3/routing/RoutingHOST.java
index 933bfec..6138c2e 100644
--- a/src/org/noreply/fancydress/type3/routing/RoutingHOST.java
+++ b/src/org/noreply/fancydress/type3/routing/RoutingHOST.java
@@ -21,10 +21,6 @@ public class RoutingHOST extends RoutingForward {
* Port at which the Type III server is listening
*/
private int port;
- /**
- * Keyid of the Packet Key
- */
- private byte[] keyid;
/**
* Constructor that creates the routing as either FWD/HOST or SWAP-FWD/HOST
@@ -35,14 +31,13 @@ public class RoutingHOST extends RoutingForward {
* @param boolean if true, have a SWAP-FWD/HOST routing type, FWD/HOST otherwhise
*/
private RoutingHOST(String hostname, int port, byte[] keyid, boolean asSwap) {
- super (asSwap ? RoutingType.SWAP_FWD_HOST : RoutingType.FWD_HOST);
+ super (asSwap ? RoutingType.SWAP_FWD_HOST : RoutingType.FWD_HOST, keyid);
if (keyid.length != CryptoPrimitives.HASH_LEN)
throw new Error("keyid must be HASH_LEN bytes long.");
this.hostname = hostname;
this.port = port;
- this.keyid = keyid;
}
/**
diff --git a/src/org/noreply/fancydress/type3/routing/RoutingIP4.java b/src/org/noreply/fancydress/type3/routing/RoutingIP4.java
index 08e1ce1..e0527a0 100644
--- a/src/org/noreply/fancydress/type3/routing/RoutingIP4.java
+++ b/src/org/noreply/fancydress/type3/routing/RoutingIP4.java
@@ -23,10 +23,6 @@ public class RoutingIP4 extends RoutingForward {
* Port at which the Type III server is listening
*/
private int port;
- /**
- * Keyid of the next hop's Packet Key
- */
- private byte[] keyid;
/**
* Constructor that creates the routing as either FWD/IP4 or SWAP-FWD/IP4
@@ -37,7 +33,7 @@ public class RoutingIP4 extends RoutingForward {
* @param boolean if true, have a SWAP-FWD/IP4 routing type, FWD/IP4 otherwhise
*/
private RoutingIP4(InetAddress ip, int port, byte[] keyid, boolean asSwap) {
- super (asSwap ? RoutingType.SWAP_FWD_IP4 : RoutingType.FWD_IP4);
+ super (asSwap ? RoutingType.SWAP_FWD_IP4 : RoutingType.FWD_IP4, keyid);
if (keyid.length != CryptoPrimitives.HASH_LEN)
throw new Error("keyid must be HASH_LEN bytes long.");
@@ -46,7 +42,6 @@ public class RoutingIP4 extends RoutingForward {
this.ip = ip;
this.port = port;
- this.keyid = keyid;
}
/**