blob: 73729863d313aeb6e3248e9c25c8400d9cbbaa39 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
package org.gnunet.testbed;
import org.gnunet.util.Client;
import org.gnunet.util.Configuration;
/**
* Handle to interact with a GNUnet testbed controller. Each
* controller has at least one master handle which is created when the
* controller is created; this master handle interacts with the
* controller process, destroying it destroys the controller (by
* closing stdin of the controller process). Additionally,
* controllers can interact with each other (in a P2P fashion); those
* links are established via TCP/IP on the controller's service port.
*/
public class Controller {
/**
* Client connecting to the testbed service.
*/
Client client;
/**
* Connect to a controller process. The configuration to use for the connection
* is retreived from the given host where a controller is started using
* GNUNET_TESTBED_controller_start().
*
* @param host host to run the controller on; This should be the same host if
* the controller was previously started with
* GNUNET_TESTBED_controller_start()
* @param event_mask bit mask with set of events to call 'cc' for;
* or-ed values of "1LL" shifted by the
* respective 'enum GNUNET_TESTBED_EventType'
* (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) | ...")
* @param cb controller callback to invoke on events
*/
public Controller(Host host, long event_mask, ControllerEventCallback cb) {
client = new Client("testbed", host.cfg);
}
/**
* Create the given peer at the specified host using the given
* controller. If the given controller is not running on the target
* host, it should find or create a controller at the target host and
* delegate creating the peer. Explicit delegation paths can be setup
* using 'GNUNET_TESTBED_controller_link'. If no explicit delegation
* path exists, a direct link with a subordinate controller is setup
* for the first delegated peer to a particular host; the subordinate
* controller is then destroyed once the last peer that was delegated
* to the remote host is stopped.
*
* Creating the peer only creates the handle to manipulate and further
* configure the peer; use "GNUNET_TESTBED_peer_start" and
* "GNUNET_TESTBED_peer_stop" to actually start/stop the peer's
* processes.
*
* Note that the given configuration will be adjusted by the
* controller to avoid port/path conflicts with other peers.
* The "final" configuration can be obtained using
* 'GNUNET_TESTBED_peer_get_information'.
*
* @param host host to run the peer on; cannot be NULL
* @param cfg Template configuration to use for the peer. Should exist until
* operation is cancelled or GNUNET_TESTBED_operation_done() is called
* @param cb the callback to call when the peer has been created
* @return the operation handle
*/
public Operation createPeer(Host host, Configuration cfg, PeerCreateCallback cb) {
return null;
}
/**
* Stop the given controller (also will terminate all peers and
* controllers dependent on this controller). This function
* blocks until the testbed has been fully terminated (!).
*/
public void disconnect () {
}
}
|