2 * © 2008 INA Service GmbH
4 package net.pterodactylus.util.fcp;
7 * Some convenience methods for parsing a “NodeHello” message from the node.
9 * @author <a href="mailto:dr@ina-germany.de">David Roden</a>
12 public class NodeHello extends BaseMessage {
15 * Createa a new “NodeHello” message that wraps the received message.
17 * @param receivedMessage
18 * The received FCP message
20 NodeHello(FcpMessage receivedMessage) {
21 super(receivedMessage);
25 * Returns the build of the node. This may not be a number but also a string
26 * like “@custom@” in case you built the node yourself.
28 * @return The build of the node
30 public String getBuild() {
31 return getField("Build");
35 * Returns the build number of the node. This may not be a number but also a
36 * string like “@custom@” in case you built the node yourself.
38 * @return The build number of the node, or <code>-1</code> if the build
39 * number could not be determined
41 public int getBuildNumber() {
42 return FcpUtils.safeParseInt(getBuild());
46 * Returns the number of compression codecs.
48 * @return The number of compression codecs
50 public String getCompressionCodecs() {
51 return getField("CompressionCodecs");
55 * Returns the number of compression codecs.
57 * @return The number of compression codecs, or <code>-1</code> if the
58 * number of compression codecs could not be determined
60 public int getCompressionCodecsNumber() {
61 return FcpUtils.safeParseInt(getCompressionCodecs());
65 * Returns the unique connection identifier.
67 * @return The connection identifier
69 public String getConnectionIdentifier() {
70 return getField("ConnectionIdentifier");
74 * Returns the build of the external library file.
76 * @return The build of the external library file
78 public String getExtBuild() {
79 return getField("ExtBuild");
83 * Returns the build number of the external library file.
85 * @return The build number of the external library file, or <code>-1</code>
86 * if the build number could not be determined
88 public int getExtBuildNumber() {
89 return FcpUtils.safeParseInt(getExtBuild());
93 * Returns the revision of the external library file.
95 * @return The revision of the external library file
97 public String getExtRevision() {
98 return getField("ExtRevision");
102 * Returns the revision number of the external library file.
104 * @return The revision number of the external library file, or
105 * <code>-1</code> if the revision number could not be determined
107 public int getExtRevisionNumber() {
108 return FcpUtils.safeParseInt(getExtRevision());
112 * Returns the FCP version the node speaks.
114 * @return The FCP version the node speaks
116 public String getFCPVersion() {
117 return getField("FCPVersion");
121 * Returns the make of the node, e.g. “Fred” (freenet reference
124 * @return The make of the node
126 public String getNode() {
127 return getField("Node");
131 * Returns the language of the node as 2-letter code, e.g. “en” or “de”.
133 * @return The language of the node
135 public String getNodeLanguage() {
136 return getField("NodeLanguage");
140 * Returns the revision of the node.
142 * @return The revision of the node
144 public String getRevision() {
145 return getField("Revision");
149 * Returns the revision number of the node.
151 * @return The revision number of the node, or <code>-1</code> if the
152 * revision number coult not be determined
154 public int getRevisionNumber() {
155 return FcpUtils.safeParseInt(getRevision());
159 * Returns whether the node is currently is testnet mode.
161 * @return <code>true</code> if the node is currently in testnet mode,
162 * <code>false</code> otherwise
164 public boolean getTestnet() {
165 return Boolean.valueOf(getField("Testnet"));
169 * Returns the version of the node.
171 * @return The version of the node
173 public String getVersion() {
174 return getField("Version");