diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-06-26 19:07:46 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-06-26 19:07:46 +0000 |
commit | 5c9fac9cafe7d0911b80cc1aeab52b2e0d0cff9b (patch) | |
tree | 83d36490d61f8bb6d74bd21818aa47b2f7c37e95 /src/testbed/testbed_api_hosts.c | |
parent | 7eb788695c1411f6fbeb05d4fbef302d2a4dd7ee (diff) | |
download | gnunet-5c9fac9cafe7d0911b80cc1aeab52b2e0d0cff9b.tar.gz gnunet-5c9fac9cafe7d0911b80cc1aeab52b2e0d0cff9b.zip |
testbed host registration
Diffstat (limited to 'src/testbed/testbed_api_hosts.c')
-rw-r--r-- | src/testbed/testbed_api_hosts.c | 72 |
1 files changed, 71 insertions, 1 deletions
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c index ca3afb29a..766a87ad2 100644 --- a/src/testbed/testbed_api_hosts.c +++ b/src/testbed/testbed_api_hosts.c | |||
@@ -72,6 +72,11 @@ struct GNUNET_TESTBED_Host | |||
72 | * The port which is to be used for SSH | 72 | * The port which is to be used for SSH |
73 | */ | 73 | */ |
74 | uint16_t port; | 74 | uint16_t port; |
75 | |||
76 | /** | ||
77 | * Set this flag to 1 if host is registered with a controller; 0 if not | ||
78 | */ | ||
79 | uint8_t is_registered; | ||
75 | }; | 80 | }; |
76 | 81 | ||
77 | 82 | ||
@@ -126,7 +131,7 @@ GNUNET_TESTBED_host_create_by_id_ (uint32_t id) | |||
126 | 131 | ||
127 | 132 | ||
128 | /** | 133 | /** |
129 | * Obtain a host's unique global ID. | 134 | * Obtain the host's unique global ID. |
130 | * | 135 | * |
131 | * @param host handle to the host, NULL means 'localhost' | 136 | * @param host handle to the host, NULL means 'localhost' |
132 | * @return id global host ID assigned to the host (0 is | 137 | * @return id global host ID assigned to the host (0 is |
@@ -140,6 +145,45 @@ GNUNET_TESTBED_host_get_id_ (const struct GNUNET_TESTBED_Host *host) | |||
140 | 145 | ||
141 | 146 | ||
142 | /** | 147 | /** |
148 | * Obtain the host's hostname. | ||
149 | * | ||
150 | * @param host handle to the host, NULL means 'localhost' | ||
151 | * @return hostname of the host | ||
152 | */ | ||
153 | const char * | ||
154 | GNUNET_TESTBED_host_get_hostname_ (const struct GNUNET_TESTBED_Host *host) | ||
155 | { | ||
156 | return host->hostname; | ||
157 | } | ||
158 | |||
159 | |||
160 | /** | ||
161 | * Obtain the host's username | ||
162 | * | ||
163 | * @param host handle to the host, NULL means 'localhost' | ||
164 | * @return username to login to the host | ||
165 | */ | ||
166 | const char * | ||
167 | GNUNET_TESTBED_host_get_username_ (const struct GNUNET_TESTBED_Host *host) | ||
168 | { | ||
169 | return host->username; | ||
170 | } | ||
171 | |||
172 | |||
173 | /** | ||
174 | * Obtain the host's ssh port | ||
175 | * | ||
176 | * @param host handle to the host, NULL means 'localhost' | ||
177 | * @return username to login to the host | ||
178 | */ | ||
179 | uint16_t | ||
180 | GNUNET_TESTBED_host_get_ssh_port_ (const struct GNUNET_TESTBED_Host *host) | ||
181 | { | ||
182 | return host->port; | ||
183 | } | ||
184 | |||
185 | |||
186 | /** | ||
143 | * Create a host to run peers and controllers on. | 187 | * Create a host to run peers and controllers on. |
144 | * | 188 | * |
145 | * @param id global host ID assigned to the host; 0 is | 189 | * @param id global host ID assigned to the host; 0 is |
@@ -336,4 +380,30 @@ GNUNET_TESTBED_host_stop_ (struct GNUNET_TESTBED_HelperHandle *handle) | |||
336 | GNUNET_free (handle); | 380 | GNUNET_free (handle); |
337 | } | 381 | } |
338 | 382 | ||
383 | |||
384 | /** | ||
385 | * Marks a host as registered with a controller | ||
386 | * | ||
387 | * @param host the host to mark | ||
388 | */ | ||
389 | void | ||
390 | GNUNET_TESTBED_mark_host_as_registered_ (struct GNUNET_TESTBED_Host *host) | ||
391 | { | ||
392 | host->is_registered = 1; | ||
393 | } | ||
394 | |||
395 | |||
396 | /** | ||
397 | * Checks whether a host has been registered | ||
398 | * | ||
399 | * @param host the host to check | ||
400 | * @return GNUNET_YES if registered; GNUNET_NO if not | ||
401 | */ | ||
402 | int | ||
403 | GNUNET_TESTBED_is_host_registered_ (const struct GNUNET_TESTBED_Host *host) | ||
404 | { | ||
405 | return (1 == host->is_registered) ? GNUNET_YES : GNUNET_NO; | ||
406 | } | ||
407 | |||
408 | |||
339 | /* end of testbed_api_hosts.c */ | 409 | /* end of testbed_api_hosts.c */ |