add AddPeer command
[jSite2.git] / src / net / pterodactylus / util / fcp / NodeRef.java
1 /**
2  * © 2008 INA Service GmbH
3  */
4 package net.pterodactylus.util.fcp;
5
6 /**
7  * A reference for a node. The noderef contains all data that is necessary to
8  * establish a trusted and secure connection to the node.
9  * 
10  * @author <a href="mailto:dr@ina-germany.de">David Roden</a>
11  * @version $Id$
12  */
13 public class NodeRef {
14
15         /** The identity of the node. */
16         private String identity;
17
18         /** Whether the node is an opennet peer. */
19         private boolean opennet;
20
21         /** The name of the node. */
22         private String name;
23
24         /** The location of the node. */
25         private double location;
26
27         /** The IP addresses and ports of the node. */
28         private String physicalUDP;
29
30         /** The ARK of the node. */
31         private ARK ark;
32
33         /** The public DSA key of the node. */
34         private String dsaPublicKey;
35
36         /** The DSA group of the node. */
37         private DSAGroup dsaGroup;
38
39         /** The node’s supported negotiation types. */
40         private int[] negotiationTypes;
41
42         /** The version of the node. */
43         private Version version;
44
45         /** The oldest version the node will connect to. */
46         private Version lastGoodVersion;
47
48         /** Whether the node is a testnet node. */
49         private boolean testnet;
50
51         /** The signature of the reference. */
52         private String signature;
53
54         /**
55          * Returns the identity of the node.
56          * 
57          * @return The identity of the node
58          */
59         public String getIdentity() {
60                 return identity;
61         }
62
63         /**
64          * Sets the identity of the node.
65          * 
66          * @param identity
67          *            The identity of the node
68          */
69         public void setIdentity(String identity) {
70                 this.identity = identity;
71         }
72
73         /**
74          * Returns whether the node is an opennet peer.
75          * 
76          * @return <code>true</code> if the node is an opennet peer,
77          *         <code>false</code> otherwise
78          */
79         public boolean isOpennet() {
80                 return opennet;
81         }
82
83         /**
84          * Sets whether the node is an opennet peer.
85          * 
86          * @param opennet
87          *            <code>true</code> if the node is an opennet peer,
88          *            <code>false</code> otherwise
89          */
90         public void setOpennet(boolean opennet) {
91                 this.opennet = opennet;
92         }
93
94         /**
95          * Returns the name of the node. If the node is an opennet peer, it will not
96          * have a name!
97          * 
98          * @return The name of the node, or <code>null</code> if the node is an
99          *         opennet peer
100          */
101         public String getName() {
102                 return name;
103         }
104
105         /**
106          * Sets the name of the peer.
107          * 
108          * @param name
109          *            The name of the peer
110          */
111         public void setName(String name) {
112                 this.name = name;
113         }
114
115         /**
116          * Returns the location of the node.
117          * 
118          * @return The location of the node
119          */
120         public double getLocation() {
121                 return location;
122         }
123
124         /**
125          * Sets the location of the node
126          * 
127          * @param location
128          *            The location of the node
129          */
130         public void setLocation(double location) {
131                 this.location = location;
132         }
133
134         /**
135          * Returns the IP addresses and port numbers of the node.
136          * 
137          * @return The IP addresses and port numbers of the node
138          */
139         public String getPhysicalUDP() {
140                 return physicalUDP;
141         }
142
143         /**
144          * Sets the IP addresses and port numbers of the node.
145          * 
146          * @param physicalUDP
147          *            The IP addresses and port numbers of the node
148          */
149         public void setPhysicalUDP(String physicalUDP) {
150                 this.physicalUDP = physicalUDP;
151         }
152
153         /**
154          * Returns the ARK of the node.
155          * 
156          * @return The ARK of the node
157          */
158         public ARK getArk() {
159                 return ark;
160         }
161
162         /**
163          * Sets the ARK of the node.
164          * 
165          * @param ark
166          *            The ARK of the node
167          */
168         public void setArk(ARK ark) {
169                 this.ark = ark;
170         }
171
172         /**
173          * Returns the public DSA key of the node.
174          * 
175          * @return The public DSA key of the node
176          */
177         public String getDSAPublicKey() {
178                 return dsaPublicKey;
179         }
180
181         /**
182          * Sets the public DSA key of the node.
183          * 
184          * @param dsaPublicKey
185          *            The public DSA key of the node
186          */
187         public void setDSAPublicKey(String dsaPublicKey) {
188                 this.dsaPublicKey = dsaPublicKey;
189         }
190
191         /**
192          * Returns the DSA group of the node.
193          * 
194          * @return The DSA group of the node
195          */
196         public DSAGroup getDSAGroup() {
197                 return dsaGroup;
198         }
199
200         /**
201          * Sets the DSA group of the node.
202          * 
203          * @param dsaGroup
204          *            The DSA group of the node
205          */
206         public void setDSAGroup(DSAGroup dsaGroup) {
207                 this.dsaGroup = dsaGroup;
208         }
209
210         /**
211          * Returns the negotiation types supported by the node.
212          * 
213          * @return The node’s supported negotiation types
214          */
215         public int[] getNegotiationTypes() {
216                 return negotiationTypes;
217         }
218
219         /**
220          * Sets the negotiation types supported by the node.
221          * 
222          * @param negotiationTypes
223          *            The node’s supported negotiation types
224          */
225         public void setNegotiationTypes(int[] negotiationTypes) {
226                 this.negotiationTypes = negotiationTypes;
227         }
228
229         /**
230          * Returns the version of the node.
231          * 
232          * @return The version of the node
233          */
234         public Version getVersion() {
235                 return version;
236         }
237
238         /**
239          * Sets the version of the node.
240          * 
241          * @param version
242          *            The version of the node
243          */
244         public void setVersion(Version version) {
245                 this.version = version;
246         }
247
248         /**
249          * Returns the last good version of the node.
250          * 
251          * @return The oldest version the node will connect to
252          */
253         public Version getLastGoodVersion() {
254                 return lastGoodVersion;
255         }
256
257         /**
258          * Sets the last good version of the node.
259          * 
260          * @param lastGoodVersion
261          *            The oldest version the node will connect to
262          */
263         public void setLastGoodVersion(Version lastGoodVersion) {
264                 this.lastGoodVersion = lastGoodVersion;
265         }
266
267         /**
268          * Returns whether the node is a testnet node.
269          * 
270          * @return <code>true</code> if the node is a testnet node,
271          *         <code>false</code> otherwise
272          */
273         public boolean isTestnet() {
274                 return testnet;
275         }
276
277         /**
278          * Sets whether this node is a testnet node.
279          * 
280          * @param testnet
281          *            <code>true</code> if the node is a testnet node,
282          *            <code>false</code> otherwise
283          */
284         public void setTestnet(boolean testnet) {
285                 this.testnet = testnet;
286         }
287
288         /**
289          * Returns the signature of the noderef.
290          * 
291          * @return The signature of the noderef
292          */
293         public String getSignature() {
294                 return signature;
295         }
296
297         /**
298          * Sets the signature of the noderef.
299          * 
300          * @param signature
301          *            The signature of the noderef
302          */
303         public void setSignature(String signature) {
304                 this.signature = signature;
305         }
306
307 }