- remove duplicate functions
[oweals/gnunet.git] / src / testbed / testbed_api_hosts.h
1 /*
2       This file is part of GNUnet
3       (C) 2008--2012 Christian Grothoff (and other contributing authors)
4
5       GNUnet is free software; you can redistribute it and/or modify
6       it under the terms of the GNU General Public License as published
7       by the Free Software Foundation; either version 3, or (at your
8       option) any later version.
9
10       GNUnet is distributed in the hope that it will be useful, but
11       WITHOUT ANY WARRANTY; without even the implied warranty of
12       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13       General Public License for more details.
14
15       You should have received a copy of the GNU General Public License
16       along with GNUnet; see the file COPYING.  If not, write to the
17       Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18       Boston, MA 02111-1307, USA.
19  */
20
21 /**
22  * @file testbed/testbed_api_hosts.h
23  * @brief internal API to access the 'hosts' subsystem
24  * @author Christian Grothoff
25  */
26
27 #ifndef NEW_TESTING_API_HOSTS_H
28 #define NEW_TESTING_API_HOSTS_H
29
30 #include "gnunet_testbed_service.h"
31 #include "testbed_helper.h"
32
33
34 /**
35  * Lookup a host by ID.
36  *
37  * @param id global host ID assigned to the host; 0 is
38  *        reserved to always mean 'localhost'
39  * @return handle to the host, NULL on error
40  */
41 struct GNUNET_TESTBED_Host *
42 GNUNET_TESTBED_host_lookup_by_id_ (uint32_t id);
43
44
45 /**
46  * Create a host by ID; given this host handle, we could not
47  * run peers at the host, but we can talk about the host
48  * internally.
49  *
50  * @param id global host ID assigned to the host; 0 is
51  *        reserved to always mean 'localhost'
52  * @return handle to the host, NULL on error
53  */
54 struct GNUNET_TESTBED_Host *
55 GNUNET_TESTBED_host_create_by_id_ (uint32_t id);
56
57
58 /**
59  * Obtain a host's unique global ID.
60  *
61  * @param host handle to the host, NULL means 'localhost'
62  * @return id global host ID assigned to the host (0 is
63  *         'localhost', but then obviously not globally unique)
64  */
65 uint32_t
66 GNUNET_TESTBED_host_get_id_ (const struct GNUNET_TESTBED_Host *host);
67
68
69 /**
70  * Obtain the host's username
71  *
72  * @param host handle to the host, NULL means 'localhost'
73  * @return username to login to the host
74  */
75 const char *
76 GNUNET_TESTBED_host_get_username_ (const struct GNUNET_TESTBED_Host *host);
77
78
79 /**
80  * Obtain the host's ssh port
81  *
82  * @param host handle to the host, NULL means 'localhost'
83  * @return username to login to the host
84  */
85 uint16_t
86 GNUNET_TESTBED_host_get_ssh_port_ (const struct GNUNET_TESTBED_Host *host);
87
88
89 /**
90  * Opaque wrapper around GNUNET_HELPER_Handle
91  */
92 struct GNUNET_TESTBED_HelperHandle;
93
94
95 /* /\** */
96 /*  * Run a given helper process at the given host.  Communication */
97 /*  * with the helper will be via GNUnet messages on stdin/stdout. */
98 /*  * Runs the process via 'ssh' at the specified host, or locally. */
99 /*  * Essentially an SSH-wrapper around the 'gnunet_helper_lib.h' API. */
100 /*  *  */
101 /*  * @param controller_ip the ip address of the controller. Will be set as TRUSTED */
102 /*  *          host when starting testbed controller at host */
103 /*  * @param host host to use, use "NULL" for localhost */
104 /*  * @param binary_argv binary name and command-line arguments to give to the */
105 /*  *          binary */
106 /*  * @param cfg template configuration to use for the remote controller; the */
107 /*  *          remote controller will be started with a slightly modified */
108 /*  *          configuration (port numbers, unix domain sockets and service home */
109 /*  *          values are changed as per TESTING library on the remote host) */
110 /*  * @param cb the callback to run when helper process dies; cannot be NULL */
111 /*  * @param cb_cls the closure for the above callback */
112 /*  * @return handle to terminate the command, NULL on error */
113 /*  *\/ */
114 /* struct GNUNET_TESTBED_HelperHandle * */
115 /* GNUNET_TESTBED_host_run_ (const char *controller_ip, */
116 /*                        const struct GNUNET_TESTBED_Host *host, */
117 /*                        const struct GNUNET_CONFIGURATION_Handle *cfg, */
118 /*                        GNUNET_HELPER_ExceptionCallback cb, */
119 /*                        void *cb_cls); */
120
121
122
123 /* /\** */
124 /*  * Stops a helper in the HelperHandle using GNUNET_HELPER_stop */
125 /*  * */
126 /*  * @param handle the handle returned from GNUNET_TESTBED_host_start_ */
127 /*  *\/ */
128 /* void */
129 /* GNUNET_TESTBED_host_stop_ (struct GNUNET_TESTBED_HelperHandle *handle); */
130
131
132 /**
133  * Marks a host as registered with a controller
134  *
135  * @param host the host to mark
136  * @param controller the controller at which this host is registered
137  */
138 void
139 GNUNET_TESTBED_mark_host_registered_at_ (struct GNUNET_TESTBED_Host *host,
140                                          const struct GNUNET_TESTBED_Controller
141                                          *controller);
142
143
144 /**
145  * Checks whether a host has been registered with the given controller
146  *
147  * @param host the host to check
148  * @param controller the controller at which host's registration is checked
149  * @return GNUNET_YES if registered; GNUNET_NO if not
150  */
151 int
152 GNUNET_TESTBED_is_host_registered_ (const struct GNUNET_TESTBED_Host *host,
153                                     const struct GNUNET_TESTBED_Controller
154                                     *controller);
155
156
157
158 #endif
159 /* end of testbed_api_hosts.h */