1ea651ed3a0c8d9a946477a8eeb297c48ff8f119
[jSite2.git] / src / net / pterodactylus / util / fcp / ClientHello.java
1 /**
2  * © 2008 INA Service GmbH
3  */
4 package net.pterodactylus.util.fcp;
5
6
7 /**
8  * A “ClientHello” message that <i>must</i> be sent to the node first thing
9  * after calling {@link FcpConnection#connect()}.
10  * 
11  * @author David ‘Bombe’ Roden &lt;bombe@freenetproject.org&gt;
12  * @version $Id$
13  */
14 public class ClientHello extends FcpMessage {
15
16         /**
17          * Creates a new “ClientHello” message with the given client name. The
18          * client name has to be unique to the node otherwise you will get a
19          * {@link CloseConnectionDuplicateClientName} response from the node!
20          * 
21          * @param clientName
22          *            The unique client name
23          */
24         public ClientHello(String clientName) {
25                 this(clientName, "2.0");
26         }
27
28         /**
29          * Creates a new “ClientHello” message with the given client name. The
30          * client name has to be unique to the node otherwise you will get a
31          * {@link CloseConnectionDuplicateClientName} response from the node!
32          * 
33          * The expected FCP version is currently ignored by the node.
34          * 
35          * @param clientName
36          *            The unique client name
37          * @param expectedVersion
38          *            The FCP version that the node is expected to talk
39          */
40         public ClientHello(String clientName, String expectedVersion) {
41                 super("ClientHello");
42                 setField("Name", clientName);
43                 setField("ExpectedVersion", expectedVersion);
44         }
45
46 }