2 This file is part of GNUnet.
3 Copyright (C) 2008--2013 GNUnet e.V.
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.
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.
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., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 * @file testbed/gnunet-service-testbed_links.h
23 * @brief TESTBED service components that deals with starting slave controllers
24 * and establishing lateral links between controllers
25 * @author Sree Harsha Totakura
30 * A connected controller which is not our child
36 * Structure representing a connected(directly-linked) controller
41 * The controller process handle if we had started the controller
43 struct GNUNET_TESTBED_ControllerProc *controller_proc;
46 * The controller handle
48 struct GNUNET_TESTBED_Controller *controller;
51 * handle to lcc which is associated with this slave startup. Should be set to
52 * NULL when the slave has successfully started up
54 struct LinkControllersContext *lcc;
57 * Head of the host registration DLL
59 struct HostRegistration *hr_dll_head;
62 * Tail of the host registration DLL
64 struct HostRegistration *hr_dll_tail;
67 * The current host registration handle
69 struct GNUNET_TESTBED_HostRegistrationHandle *rhandle;
72 * Hashmap to hold Registered host contexts
74 struct GNUNET_CONTAINER_MultiHashMap *reghost_map;
77 * The id of the host this controller is running on
83 * A list of directly linked neighbours
85 extern struct Slave **GST_slave_list;
88 * The size of directly linked neighbours list
90 extern unsigned int GST_slave_list_size;
94 * Cleans up the neighbour list
97 GST_neighbour_list_clean();
101 * Get a neighbour from the neighbour list
103 * @param id the index of the neighbour in the neighbour list
104 * @return the Neighbour; NULL if the given index in invalid (index greater than
105 * the list size or neighbour at that index is NULL)
108 GST_get_neighbour (uint32_t id);
112 * Function to cleanup the neighbour connect contexts
119 * Notification context to be used to notify when connection to the neighbour's
120 * controller is opened
122 struct NeighbourConnectNotification;
126 * The notification callback to call when we are connect to neighbour
128 * @param cls the closure given to GST_neighbour_get_connection()
129 * @param controller the controller handle to the neighbour
131 typedef void (*GST_NeigbourConnectNotifyCallback) (void *cls,
133 GNUNET_TESTBED_Controller
138 * Try to open a connection to the given neigbour. If the connection is open
139 * already, then it is re-used. If not, the request is queued in the operation
140 * queues responsible for bounding the total number of file descriptors. The
141 * actual connection will happen when the operation queue marks the
142 * corresponding operation as active.
144 * @param n the neighbour to open a connection to
145 * @param cb the notification callback to call when the connection is opened
146 * @param cb_cls the closure for the above callback
148 struct NeighbourConnectNotification *
149 GST_neighbour_get_connection (struct Neighbour *n,
150 GST_NeigbourConnectNotifyCallback cb,
155 * Cancel the request for opening a connection to the neighbour
157 * @param h the notification handle
160 GST_neighbour_get_connection_cancel (struct NeighbourConnectNotification *h);
164 * Release the connection to the neighbour. The actual connection will be
165 * closed if connections to other neighbour are waiting (to maintain a bound on
166 * the total number of connections that are open).
168 * @param n the neighbour whose connection can be closed
171 GST_neighbour_release_connection (struct Neighbour *n);
175 * Function to create a neigbour and add it into the neighbour list
177 * @param host the host of the neighbour
180 GST_create_neighbour (struct GNUNET_TESTBED_Host *host);
184 * Message handler for GNUNET_MESSAGE_TYPE_TESTBED_LCONTROLLERS message
187 * @param client identification of the client
188 * @param message the actual message
191 GST_handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
192 const struct GNUNET_MessageHeader *message);
196 * Cleans up the slave list
199 GST_slave_list_clear ();