add AddPeer command
[jSite2.git] / src / net / pterodactylus / util / fcp / NodeRef.java
diff --git a/src/net/pterodactylus/util/fcp/NodeRef.java b/src/net/pterodactylus/util/fcp/NodeRef.java
new file mode 100644 (file)
index 0000000..4eb80eb
--- /dev/null
@@ -0,0 +1,307 @@
+/**
+ * © 2008 INA Service GmbH
+ */
+package net.pterodactylus.util.fcp;
+
+/**
+ * A reference for a node. The noderef contains all data that is necessary to
+ * establish a trusted and secure connection to the node.
+ * 
+ * @author <a href="mailto:dr@ina-germany.de">David Roden</a>
+ * @version $Id$
+ */
+public class NodeRef {
+
+       /** The identity of the node. */
+       private String identity;
+
+       /** Whether the node is an opennet peer. */
+       private boolean opennet;
+
+       /** The name of the node. */
+       private String name;
+
+       /** The location of the node. */
+       private double location;
+
+       /** The IP addresses and ports of the node. */
+       private String physicalUDP;
+
+       /** The ARK of the node. */
+       private ARK ark;
+
+       /** The public DSA key of the node. */
+       private String dsaPublicKey;
+
+       /** The DSA group of the node. */
+       private DSAGroup dsaGroup;
+
+       /** The node’s supported negotiation types. */
+       private int[] negotiationTypes;
+
+       /** The version of the node. */
+       private Version version;
+
+       /** The oldest version the node will connect to. */
+       private Version lastGoodVersion;
+
+       /** Whether the node is a testnet node. */
+       private boolean testnet;
+
+       /** The signature of the reference. */
+       private String signature;
+
+       /**
+        * Returns the identity of the node.
+        * 
+        * @return The identity of the node
+        */
+       public String getIdentity() {
+               return identity;
+       }
+
+       /**
+        * Sets the identity of the node.
+        * 
+        * @param identity
+        *            The identity of the node
+        */
+       public void setIdentity(String identity) {
+               this.identity = identity;
+       }
+
+       /**
+        * Returns whether the node is an opennet peer.
+        * 
+        * @return <code>true</code> if the node is an opennet peer,
+        *         <code>false</code> otherwise
+        */
+       public boolean isOpennet() {
+               return opennet;
+       }
+
+       /**
+        * Sets whether the node is an opennet peer.
+        * 
+        * @param opennet
+        *            <code>true</code> if the node is an opennet peer,
+        *            <code>false</code> otherwise
+        */
+       public void setOpennet(boolean opennet) {
+               this.opennet = opennet;
+       }
+
+       /**
+        * Returns the name of the node. If the node is an opennet peer, it will not
+        * have a name!
+        * 
+        * @return The name of the node, or <code>null</code> if the node is an
+        *         opennet peer
+        */
+       public String getName() {
+               return name;
+       }
+
+       /**
+        * Sets the name of the peer.
+        * 
+        * @param name
+        *            The name of the peer
+        */
+       public void setName(String name) {
+               this.name = name;
+       }
+
+       /**
+        * Returns the location of the node.
+        * 
+        * @return The location of the node
+        */
+       public double getLocation() {
+               return location;
+       }
+
+       /**
+        * Sets the location of the node
+        * 
+        * @param location
+        *            The location of the node
+        */
+       public void setLocation(double location) {
+               this.location = location;
+       }
+
+       /**
+        * Returns the IP addresses and port numbers of the node.
+        * 
+        * @return The IP addresses and port numbers of the node
+        */
+       public String getPhysicalUDP() {
+               return physicalUDP;
+       }
+
+       /**
+        * Sets the IP addresses and port numbers of the node.
+        * 
+        * @param physicalUDP
+        *            The IP addresses and port numbers of the node
+        */
+       public void setPhysicalUDP(String physicalUDP) {
+               this.physicalUDP = physicalUDP;
+       }
+
+       /**
+        * Returns the ARK of the node.
+        * 
+        * @return The ARK of the node
+        */
+       public ARK getArk() {
+               return ark;
+       }
+
+       /**
+        * Sets the ARK of the node.
+        * 
+        * @param ark
+        *            The ARK of the node
+        */
+       public void setArk(ARK ark) {
+               this.ark = ark;
+       }
+
+       /**
+        * Returns the public DSA key of the node.
+        * 
+        * @return The public DSA key of the node
+        */
+       public String getDSAPublicKey() {
+               return dsaPublicKey;
+       }
+
+       /**
+        * Sets the public DSA key of the node.
+        * 
+        * @param dsaPublicKey
+        *            The public DSA key of the node
+        */
+       public void setDSAPublicKey(String dsaPublicKey) {
+               this.dsaPublicKey = dsaPublicKey;
+       }
+
+       /**
+        * Returns the DSA group of the node.
+        * 
+        * @return The DSA group of the node
+        */
+       public DSAGroup getDSAGroup() {
+               return dsaGroup;
+       }
+
+       /**
+        * Sets the DSA group of the node.
+        * 
+        * @param dsaGroup
+        *            The DSA group of the node
+        */
+       public void setDSAGroup(DSAGroup dsaGroup) {
+               this.dsaGroup = dsaGroup;
+       }
+
+       /**
+        * Returns the negotiation types supported by the node.
+        * 
+        * @return The node’s supported negotiation types
+        */
+       public int[] getNegotiationTypes() {
+               return negotiationTypes;
+       }
+
+       /**
+        * Sets the negotiation types supported by the node.
+        * 
+        * @param negotiationTypes
+        *            The node’s supported negotiation types
+        */
+       public void setNegotiationTypes(int[] negotiationTypes) {
+               this.negotiationTypes = negotiationTypes;
+       }
+
+       /**
+        * Returns the version of the node.
+        * 
+        * @return The version of the node
+        */
+       public Version getVersion() {
+               return version;
+       }
+
+       /**
+        * Sets the version of the node.
+        * 
+        * @param version
+        *            The version of the node
+        */
+       public void setVersion(Version version) {
+               this.version = version;
+       }
+
+       /**
+        * Returns the last good version of the node.
+        * 
+        * @return The oldest version the node will connect to
+        */
+       public Version getLastGoodVersion() {
+               return lastGoodVersion;
+       }
+
+       /**
+        * Sets the last good version of the node.
+        * 
+        * @param lastGoodVersion
+        *            The oldest version the node will connect to
+        */
+       public void setLastGoodVersion(Version lastGoodVersion) {
+               this.lastGoodVersion = lastGoodVersion;
+       }
+
+       /**
+        * Returns whether the node is a testnet node.
+        * 
+        * @return <code>true</code> if the node is a testnet node,
+        *         <code>false</code> otherwise
+        */
+       public boolean isTestnet() {
+               return testnet;
+       }
+
+       /**
+        * Sets whether this node is a testnet node.
+        * 
+        * @param testnet
+        *            <code>true</code> if the node is a testnet node,
+        *            <code>false</code> otherwise
+        */
+       public void setTestnet(boolean testnet) {
+               this.testnet = testnet;
+       }
+
+       /**
+        * Returns the signature of the noderef.
+        * 
+        * @return The signature of the noderef
+        */
+       public String getSignature() {
+               return signature;
+       }
+
+       /**
+        * Sets the signature of the noderef.
+        * 
+        * @param signature
+        *            The signature of the noderef
+        */
+       public void setSignature(String signature) {
+               this.signature = signature;
+       }
+
+}