Author: toad
Date: 2007-07-12 17:43:30 +0000 (Thu, 12 Jul 2007)
New Revision: 14046
Modified:
trunk/freenet/src/freenet/io/comm/DMT.java
trunk/freenet/src/freenet/node/NodeCrypto.java
Log:
Add path folding messages
Modified: trunk/freenet/src/freenet/io/comm/DMT.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/DMT.java 2007-07-12 15:53:45 UTC (rev
14045)
+++ trunk/freenet/src/freenet/io/comm/DMT.java 2007-07-12 17:43:30 UTC (rev
14046)
@@ -115,6 +115,7 @@
public static final String FORK_COUNT = "forkCount";
public static final String TIME_LEFT = "timeLeft";
public static final String PREV_UID = "prevUID";
+ public static final String OPENNET_NODEREF = "opennetNoderef";
//Diagnostic
public static final MessageType ping = new MessageType("ping") {{
@@ -716,6 +717,59 @@
return msg;
}
+ // Opennet completions (not sent to darknet nodes)
+
+ /** Sent when a request to an opennet node is completed, but the data
source does not want to
+ * path fold */
+ public static MessageType FNPOpennetCompletedAck = new
MessageType("FNPOpennetCompletedAck") {{
+ addField(UID, Long.class);
+ }};
+
+ public static Message createFNPOpennetCompletedAck(long uid) {
+ Message msg = new Message(FNPOpennetCompletedAck);
+ msg.set(UID, uid);
+ return msg;
+ }
+
+ /** Sent when a request completes and the data source does want to path
fold */
+ public static MessageType FNPOpennetConnectDestination = new
MessageType("FNPOpennetConnectDestination") {{
+ addField(UID, Long.class);
+ addField(OPENNET_NODEREF, ShortBuffer.class);
+ }};
+
+ public static Message createFNPOpennetConnectDestination(long uid,
ShortBuffer buf) {
+ Message msg = new Message(FNPOpennetConnectDestination);
+ msg.set(UID, uid);
+ msg.set(OPENNET_NODEREF, buf);
+ return msg;
+ }
+
+ /** Path folding response */
+ public static MessageType FNPOpennetConnectReply = new
MessageType("FNPOpennetConnectReply") {{
+ addField(UID, Long.class);
+ addField(OPENNET_NODEREF, ShortBuffer.class);
+ }};
+
+ public static Message createFNPOpennetConnectReply(long uid,
ShortBuffer buf) {
+ Message msg = new Message(FNPOpennetConnectReply);
+ msg.set(UID, uid);
+ msg.set(OPENNET_NODEREF, buf);
+ return msg;
+ }
+
+ /** Path folding rejected by request sender */
+ public static MessageType FNPOpennetConnectRejected = new
MessageType("FNPOpennetConnectRejected") {{
+ addField(UID, Long.class);
+ }};
+
+ public static Message createFNPOpennetConnectRejected(long uid) {
+ Message msg = new Message(FNPOpennetConnectRejected);
+ msg.set(UID, uid);
+ return msg;
+ }
+
+ // Key offers (ULPRs)
+
public static MessageType FNPOfferKey = new MessageType("FNPOfferKey")
{{
addField(KEY, Key.class);
}};
Modified: trunk/freenet/src/freenet/node/NodeCrypto.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeCrypto.java 2007-07-12 15:53:45 UTC
(rev 14045)
+++ trunk/freenet/src/freenet/node/NodeCrypto.java 2007-07-12 17:43:30 UTC
(rev 14046)
@@ -267,10 +267,11 @@
// Negotiation types
fs.put("location", node.lm.getLocation().getValue()); // FIXME
maybe !forSetup; see #943
fs.putSingle("version", Version.getVersionString()); // Keep,
vital that peer know our version. For example, some types may be sent in
different formats to different node versions (e.g. Peer).
- fs.put("testnet", node.testnetEnabled); // Vital that peer know
this!
fs.putSingle("lastGoodVersion",
Version.getLastGoodVersionString()); // Also vital
- if(node.testnetEnabled)
+ if(node.testnetEnabled) {
+ fs.put("testnet", node.testnetEnabled); // Vital that
peer know this!
fs.put("testnetPort", node.testnetHandler.getPort());
// Useful, saves a lot of complexity
+ }
if(!isOpennet)
fs.putSingle("myName", node.getMyName()); // FIXME see
#942
fs.put("opennet", isOpennet);