2 * jFCPlib - NodeData.java - Copyright © 2008 David Roden
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 package net.pterodactylus.fcp;
22 * The “NodeData” contains the noderef of the node, along with additional data.
24 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
26 public class NodeData extends BaseMessage {
28 /** The noderef of the node. */
29 private final NodeRef nodeRef;
32 * Creates a new “NodeData” message that wraps the received message.
34 * @param receivedMessage
35 * The received message
37 NodeData(FcpMessage receivedMessage) {
38 super(receivedMessage);
39 nodeRef = new NodeRef(receivedMessage);
43 * Returns the noderef of the node.
45 * @return The noderef of the node
47 public NodeRef getNodeRef() {
52 * Returns the last good version, i.e. the oldest version the node will
55 * @return The last good version
57 public Version getLastGoodVersion() {
58 return nodeRef.getLastGoodVersion();
62 * Returns the signature of the noderef.
64 * @return The signature of the noderef
66 public String getSignature() {
67 return nodeRef.getSignature();
71 * Returns whether the noderef is the opennet noderef of the node
73 * @return <code>true</code> if the noderef is the opennet noderef of the
74 * node, <code>false</code> otherwise
76 public boolean isOpennet() {
77 return nodeRef.isOpennet();
81 * Returns the identity of the node
83 * @return The identity of the node
85 public String getIdentity() {
86 return nodeRef.getIdentity();
90 * Returns the name of the node.
92 * @return The name of the node
94 public String getMyName() {
95 return nodeRef.getMyName();
99 * Returns the version of the node.
101 * @return The version of the node
103 public Version getVersion() {
104 return nodeRef.getVersion();
108 * Returns IP addresses and port number of the node.
110 * @return The IP addresses and port numbers of the node
112 public String getPhysicalUDP() {
113 return nodeRef.getPhysicalUDP();
117 * Returns the ARK of the node.
119 * @return The ARK of the node
121 public ARK getARK() {
122 return nodeRef.getARK();
126 * Returns the public key of the node.
128 * @return The public key of the node
130 public String getDSAPublicKey() {
131 return nodeRef.getDSAPublicKey();
135 * Returns the private key of the node.
137 * @return The private key of the node
139 public String getDSKPrivateKey() {
140 return getField("dsaPrivKey.x");
144 * Returns the DSA group of the node.
146 * @return The DSA group of the node
148 public DSAGroup getDSAGroup() {
149 return nodeRef.getDSAGroup();
153 * Returns the negotiation types supported by the node.
155 * @return The node’s supported negotiation types
157 public int[] getNegotiationTypes() {
158 return nodeRef.getNegotiationTypes();
162 * Returns one of the volatile fields from the message. The given field name
163 * is prepended with “volatile.” so if you want to get the value of the
164 * field with the name “volatile.freeJavaMemory” you only need to specify
168 * The name of the field
169 * @return The value of the field, or <code>null</code> if there is no such
172 public String getVolatile(String field) {
173 return getField("volatile." + field);