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 it
6 under the terms of the GNU General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your 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 Affero General Public License for more details.
17 * @file testbed/gnunet-service-testbed_links.h
18 * @brief TESTBED service components that deals with starting slave controllers
19 * and establishing lateral links between controllers
20 * @author Sree Harsha Totakura
25 * A connected controller which is not our child
31 * Structure representing a connected(directly-linked) controller
36 * The controller process handle if we had started the controller
38 struct GNUNET_TESTBED_ControllerProc *controller_proc;
41 * The controller handle
43 struct GNUNET_TESTBED_Controller *controller;
46 * handle to lcc which is associated with this slave startup. Should be set to
47 * NULL when the slave has successfully started up
49 struct LinkControllersContext *lcc;
52 * Head of the host registration DLL
54 struct HostRegistration *hr_dll_head;
57 * Tail of the host registration DLL
59 struct HostRegistration *hr_dll_tail;
62 * The current host registration handle
64 struct GNUNET_TESTBED_HostRegistrationHandle *rhandle;
67 * Hashmap to hold Registered host contexts
69 struct GNUNET_CONTAINER_MultiHashMap *reghost_map;
72 * The id of the host this controller is running on
78 * A list of directly linked neighbours
80 extern struct Slave **GST_slave_list;
83 * The size of directly linked neighbours list
85 extern unsigned int GST_slave_list_size;
89 * Cleans up the neighbour list
92 GST_neighbour_list_clean (void);
96 * Get a neighbour from the neighbour list
98 * @param id the index of the neighbour in the neighbour list
99 * @return the Neighbour; NULL if the given index in invalid (index greater than
100 * the list size or neighbour at that index is NULL)
103 GST_get_neighbour (uint32_t id);
107 * Function to cleanup the neighbour connect contexts
110 GST_free_nccq (void);
114 * Notification context to be used to notify when connection to the neighbour's
115 * controller is opened
117 struct NeighbourConnectNotification;
121 * The notification callback to call when we are connect to neighbour
123 * @param cls the closure given to GST_neighbour_get_connection()
124 * @param controller the controller handle to the neighbour
127 (*GST_NeigbourConnectNotifyCallback) (void *cls,
128 struct GNUNET_TESTBED_Controller *controller);
132 * Try to open a connection to the given neigbour. If the connection is open
133 * already, then it is re-used. If not, the request is queued in the operation
134 * queues responsible for bounding the total number of file descriptors. The
135 * actual connection will happen when the operation queue marks the
136 * corresponding operation as active.
138 * @param n the neighbour to open a connection to
139 * @param cb the notification callback to call when the connection is opened
140 * @param cb_cls the closure for the above callback
142 struct NeighbourConnectNotification *
143 GST_neighbour_get_connection (struct Neighbour *n,
144 GST_NeigbourConnectNotifyCallback cb,
149 * Cancel the request for opening a connection to the neighbour
151 * @param h the notification handle
154 GST_neighbour_get_connection_cancel (struct NeighbourConnectNotification *h);
158 * Release the connection to the neighbour. The actual connection will be
159 * closed if connections to other neighbour are waiting (to maintain a bound on
160 * the total number of connections that are open).
162 * @param n the neighbour whose connection can be closed
165 GST_neighbour_release_connection (struct Neighbour *n);
169 * Function to create a neigbour and add it into the neighbour list
171 * @param host the host of the neighbour
174 GST_create_neighbour (struct GNUNET_TESTBED_Host *host);
178 * Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_LCONTROLLERS message
180 * @param cls identification of the client
181 * @param msg the actual message
184 handle_link_controllers (void *cls,
185 const struct GNUNET_TESTBED_ControllerLinkRequest *msg);
189 * Clean up @a client handle if we stored any via #handle_link_controllers(),
190 * the given client disconnected.
192 * @param client the client that is history
195 GST_link_notify_disconnect (struct GNUNET_SERVICE_Client *client);
199 * Cleans up the slave list
202 GST_slave_list_clear (void);