2 * jSite2 - NodeData.java -
3 * Copyright © 2008 David Roden
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 package net.pterodactylus.fcp;
23 * The “NodeData” contains the noderef of the node, along with additional data.
25 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
27 public class NodeData extends BaseMessage {
29 /** The noderef of the node. */
30 private final NodeRef nodeRef;
33 * Creates a new “NodeData” message that wraps the received message.
35 * @param receivedMessage
36 * The received message
38 NodeData(FcpMessage receivedMessage) {
39 super(receivedMessage);
40 nodeRef = new NodeRef(receivedMessage);
44 * Returns the noderef of the node.
46 * @return The noderef of the node
48 public NodeRef getNodeRef() {
53 * Returns the last good version, i.e. the oldest version the node will
56 * @return The last good version
58 public Version getLastGoodVersion() {
59 return nodeRef.getLastGoodVersion();
63 * Returns the signature of the noderef.
65 * @return The signature of the noderef
67 public String getSignature() {
68 return nodeRef.getSignature();
72 * Returns whether the noderef is the opennet noderef of the node
74 * @return <code>true</code> if the noderef is the opennet noderef of the
75 * node, <code>false</code> otherwise
77 public boolean isOpennet() {
78 return nodeRef.isOpennet();
82 * Returns the identity of the node
84 * @return The identity of the node
86 public String getIdentity() {
87 return nodeRef.getIdentity();
91 * Returns the name of the node.
93 * @return The name of the node
95 public String getMyName() {
96 return nodeRef.getMyName();
100 * Returns the version of the node.
102 * @return The version of the node
104 public Version getVersion() {
105 return nodeRef.getVersion();
109 * Returns IP addresses and port number of the node.
111 * @return The IP addresses and port numbers of the node
113 public String getPhysicalUDP() {
114 return nodeRef.getPhysicalUDP();
118 * Returns the ARK of the node.
120 * @return The ARK of the node
122 public ARK getARK() {
123 return nodeRef.getARK();
127 * Returns the public key of the node.
129 * @return The public key of the node
131 public String getDSAPublicKey() {
132 return nodeRef.getDSAPublicKey();
136 * Returns the private key of the node.
138 * @return The private key of the node
140 public String getDSKPrivateKey() {
141 return getField("dsaPrivKey.x");
145 * Returns the DSA group of the node.
147 * @return The DSA group of the node
149 public DSAGroup getDSAGroup() {
150 return nodeRef.getDSAGroup();
154 * Returns the negotiation types supported by the node.
156 * @return The node’s supported negotiation types
158 public int[] getNegotiationTypes() {
159 return nodeRef.getNegotiationTypes();
163 * Returns one of the volatile fields from the message. The given field name
164 * is prepended with “volatile.” so if you want to get the value of the
165 * field with the name “volatile.freeJavaMemory” you only need to specify
169 * The name of the field
170 * @return The value of the field, or <code>null</code> if there is no
173 public String getVolatile(String field) {
174 return getField("volatile." + field);