Author: zothar
Date: 2007-07-13 20:25:28 +0000 (Fri, 13 Jul 2007)
New Revision: 14093
Modified:
trunk/freenet/src/freenet/node/Node.java
trunk/freenet/src/freenet/node/fcp/GetNode.java
trunk/freenet/src/freenet/node/fcp/NodeData.java
Log:
FCP: Add support for fetching the opennet node ref rather than the darknet node
ref to GetNode
Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java 2007-07-13 19:36:59 UTC (rev
14092)
+++ trunk/freenet/src/freenet/node/Node.java 2007-07-13 20:25:28 UTC (rev
14093)
@@ -2600,6 +2600,10 @@
return darknetCrypto.exportPrivateFieldSet();
}
+ public SimpleFieldSet exportOpennetPrivateFieldSet() {
+ return opennet.crypto.exportPrivateFieldSet();
+ }
+
/**
* Should the IP detection code only use the IP address override and
the bindTo information,
* rather than doing a full detection?
Modified: trunk/freenet/src/freenet/node/fcp/GetNode.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/GetNode.java 2007-07-13 19:36:59 UTC
(rev 14092)
+++ trunk/freenet/src/freenet/node/fcp/GetNode.java 2007-07-13 20:25:28 UTC
(rev 14093)
@@ -9,11 +9,13 @@
public class GetNode extends FCPMessage {
+ final boolean giveOpennetRef;
final boolean withPrivate;
final boolean withVolatile;
static final String NAME = "GetNode";
public GetNode(SimpleFieldSet fs) {
+ giveOpennetRef = Fields.stringToBool(fs.get("GiveOpennetRef"),
false);
withPrivate = Fields.stringToBool(fs.get("WithPrivate"), false);
withVolatile = Fields.stringToBool(fs.get("WithVolatile"),
false);
}
@@ -31,7 +33,7 @@
if(!handler.hasFullAccess()) {
throw new
MessageInvalidException(ProtocolErrorMessage.ACCESS_DENIED, "GetNode requires
full access", null, false);
}
- handler.outputHandler.queue(new NodeData(node, withPrivate,
withVolatile));
+ handler.outputHandler.queue(new NodeData(node, giveOpennetRef,
withPrivate, withVolatile));
}
}
Modified: trunk/freenet/src/freenet/node/fcp/NodeData.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/NodeData.java 2007-07-13 19:36:59 UTC
(rev 14092)
+++ trunk/freenet/src/freenet/node/fcp/NodeData.java 2007-07-13 20:25:28 UTC
(rev 14093)
@@ -10,21 +10,31 @@
static final String name = "NodeData";
final Node node;
+ final boolean giveOpennetRef;
final boolean withPrivate;
final boolean withVolatile;
- public NodeData(Node node, boolean withPrivate, boolean withVolatile) {
+ public NodeData(Node node, boolean giveOpennetRef, boolean withPrivate,
boolean withVolatile) {
this.node = node;
+ this.giveOpennetRef = giveOpennetRef;
this.withPrivate = withPrivate;
this.withVolatile = withVolatile;
}
public SimpleFieldSet getFieldSet() {
SimpleFieldSet fs;
- if(withPrivate) {
- fs = node.exportDarknetPrivateFieldSet();
+ if(giveOpennetRef) {
+ if(withPrivate) {
+ fs = node.exportOpennetPrivateFieldSet();
+ } else {
+ fs = node.exportOpennetPublicFieldSet();
+ }
} else {
- fs = node.exportDarknetPublicFieldSet();
+ if(withPrivate) {
+ fs = node.exportDarknetPrivateFieldSet();
+ } else {
+ fs = node.exportDarknetPublicFieldSet();
+ }
}
if(withVolatile) {
SimpleFieldSet vol = node.exportVolatileFieldSet();