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.util.fcp;
23 * The “NodeData” contains the noderef of the node, along with additional data.
25 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
28 public class NodeData extends BaseMessage {
30 /** The noderef of the node. */
31 private final NodeRef nodeRef;
34 * Creates a new “NodeData” message that wraps the received message.
36 * @param receivedMessage
37 * The received message
39 NodeData(FcpMessage receivedMessage) {
40 super(receivedMessage);
41 nodeRef = new NodeRef(receivedMessage);
45 * Returns the noderef of the node.
47 * @return The noderef of the node
49 public NodeRef getNodeRef() {
54 * Returns the last good version, i.e. the oldest version the node will
57 * @return The last good version
59 public Version getLastGoodVersion() {
60 return nodeRef.getLastGoodVersion();
64 * Returns the signature of the noderef.
66 * @return The signature of the noderef
68 public String getSignature() {
69 return nodeRef.getSignature();
73 * Returns whether the noderef is the opennet noderef of the node
75 * @return <code>true</code> if the noderef is the opennet noderef of the
76 * node, <code>false</code> otherwise
78 public boolean isOpennet() {
79 return nodeRef.isOpennet();
83 * Returns the identity of the node
85 * @return The identity of the node
87 public String getIdentity() {
88 return nodeRef.getIdentity();
92 * Returns the name of the node.
94 * @return The name of the node
96 public String getMyName() {
97 return nodeRef.getMyName();
101 * Returns the version of the node.
103 * @return The version of the node
105 public Version getVersion() {
106 return nodeRef.getVersion();
110 * Returns IP addresses and port number of the node.
112 * @return The IP addresses and port numbers of the node
114 public String getPhysicalUDP() {
115 return nodeRef.getPhysicalUDP();
119 * Returns the ARK of the node.
121 * @return The ARK of the node
123 public ARK getARK() {
124 return nodeRef.getARK();
128 * Returns the public key of the node.
130 * @return The public key of the node
132 public String getDSAPublicKey() {
133 return nodeRef.getDSAPublicKey();
137 * Returns the private key of the node.
139 * @return The private key of the node
141 public String getDSKPrivateKey() {
142 return getField("dsaPrivKey.x");
146 * Returns the DSA group of the node.
148 * @return The DSA group of the node
150 public DSAGroup getDSAGroup() {
151 return nodeRef.getDSAGroup();
155 * Returns the negotiation types supported by the node.
157 * @return The node’s supported negotiation types
159 public int[] getNegotiationTypes() {
160 return nodeRef.getNegotiationTypes();
164 * Returns one of the volatile fields from the message. The given field name
165 * is prepended with “volatile.” so if you want to get the value of the
166 * field with the name “volatile.freeJavaMemory” you only need to specify
170 * The name of the field
171 * @return The value of the field, or <code>null</code> if there is no
174 public String getVolatile(String field) {
175 return getField("volatile." + field);