2 * © 2008 INA Service GmbH
4 package net.pterodactylus.util.fcp;
9 * The “AddPeer” request adds a peer to the node.
11 * @author <a href="mailto:dr@ina-germany.de">David Roden</a>
14 public class AddPeer extends FcpMessage {
17 * Creates a new “AddPeer” request.
24 * Creates a new “AddPeer” request that reads the noderef of the peer from
28 * The file to read the noderef from
30 public AddPeer(String file) {
32 setField("File", file);
36 * Creates a new “AddPeer” request that reads the noderef of the peer from
40 * The URL to read the noderef from
42 public AddPeer(URL url) {
44 setField("URL", String.valueOf(url));
48 * Creates a new “AddPeer” request that adds the peer given by the noderef.
51 * The noderef of the peer
53 public AddPeer(NodeRef nodeRef) {
63 * Sets the noderef of the peer to add.
66 * The noderef of the peer
68 private void setNodeRef(NodeRef nodeRef) {
69 setField("lastGoodVersion", nodeRef.getLastGoodVersion().toString());
70 setField("opennet", String.valueOf(nodeRef.isOpennet()));
71 setField("identity", nodeRef.getIdentity());
72 setField("myName", nodeRef.getMyName());
73 setField("location", String.valueOf(nodeRef.getLocation()));
74 setField("testnet", String.valueOf(nodeRef.isTestnet()));
75 setField("version", String.valueOf(nodeRef.getVersion()));
76 setField("physical.udp", nodeRef.getPhysicalUDP());
77 setField("ark.pubURI", nodeRef.getARK().getPublicURI());
78 setField("ark.number", String.valueOf(nodeRef.getARK().getNumber()));
79 setField("dsaPubKey.y", nodeRef.getDSAPublicKey());
80 setField("dsaGroup.g", nodeRef.getDSAGroup().getBase());
81 setField("dsaGroup.p", nodeRef.getDSAGroup().getPrime());
82 setField("dsaGroup.q", nodeRef.getDSAGroup().getSubprime());
83 setField("auth.negTypes", FcpUtils.encodeMultiIntegerField(nodeRef.getNegotiationTypes()));
84 setField("sig", nodeRef.getSignature());