*/
package net.pterodactylus.util.fcp;
-
-
/**
* The “Peer” reply by the node contains information about a peer.
*
- * @author <a href="mailto:dr@ina-germany.de">David Roden</a>
+ * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
* @version $Id$
*/
public class Peer extends BaseMessage {
* @param receivedMessage
* The received message
*/
- public Peer(FcpMessage receivedMessage) {
+ Peer(FcpMessage receivedMessage) {
super(receivedMessage);
}
/**
+ * Returns a collection of fields as a node reference.
+ *
+ * @return The node reference contained within this message
+ */
+ public NodeRef getNodeRef() {
+ NodeRef nodeRef = new NodeRef();
+ nodeRef.setARK(getARK());
+ nodeRef.setDSAGroup(getDSAGroup());
+ nodeRef.setDSAPublicKey(getDSAPublicKey());
+ nodeRef.setIdentity(getIdentity());
+ nodeRef.setLastGoodVersion(getLastGoodVersion());
+ nodeRef.setLocation(getLocation());
+ nodeRef.setName(getMyName());
+ nodeRef.setNegotiationTypes(getNegotiationTypes());
+ nodeRef.setOpennet(isOpennet());
+ nodeRef.setPhysicalUDP(getPhysicalUDP());
+ nodeRef.setVersion(getVersion());
+ return nodeRef;
+ }
+
+ /**
* Returns the “physical.udp” line from the message. It contains all IP
* addresses and port numbers of the peer.
*
* @return The supported negotiation types
*/
public int[] getNegotiationTypes() {
- return FcpUtils.parseMultiIntegerField(getField("auth.negTypes"));
+ return FcpUtils.decodeMultiIntegerField(getField("auth.negTypes"));
}
}