aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/gnunet-service-testbed_links.h
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-05-06 16:06:08 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-05-06 16:06:08 +0000
commitad25eef39dc8c15b85bd70c6585af95d7e687fd5 (patch)
tree152df39da268b913fd5a93467556ca9249e20416 /src/testbed/gnunet-service-testbed_links.h
parente2bb863887e78b5847fd86ef5a399a5d13d856d3 (diff)
downloadgnunet-ad25eef39dc8c15b85bd70c6585af95d7e687fd5.tar.gz
gnunet-ad25eef39dc8c15b85bd70c6585af95d7e687fd5.zip
- doc
Diffstat (limited to 'src/testbed/gnunet-service-testbed_links.h')
-rw-r--r--src/testbed/gnunet-service-testbed_links.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/testbed/gnunet-service-testbed_links.h b/src/testbed/gnunet-service-testbed_links.h
index 65741c21c..9134ab545 100644
--- a/src/testbed/gnunet-service-testbed_links.h
+++ b/src/testbed/gnunet-service-testbed_links.h
@@ -25,6 +25,10 @@
25 * @author Sree Harsha Totakura 25 * @author Sree Harsha Totakura
26 */ 26 */
27 27
28
29/**
30 * A connected controller which is not our child
31 */
28struct Neighbour; 32struct Neighbour;
29 33
30 34
@@ -92,36 +96,97 @@ extern struct Slave **GST_slave_list;
92 */ 96 */
93extern unsigned int GST_slave_list_size; 97extern unsigned int GST_slave_list_size;
94 98
99
100/**
101 * Cleans up the neighbour list
102 */
95void 103void
96GST_neighbour_list_clean(); 104GST_neighbour_list_clean();
97 105
106
107/**
108 * Get a neighbour from the neighbour list
109 *
110 * @param id the index of the neighbour in the neighbour list
111 * @return the Neighbour; NULL if the given index in invalid (index greater than
112 * the list size or neighbour at that index is NULL)
113 */
98struct Neighbour * 114struct Neighbour *
99GST_get_neighbour (uint32_t id); 115GST_get_neighbour (uint32_t id);
100 116
117
118/**
119 * Function to cleanup the neighbour connect contexts
120 */
101void 121void
102GST_free_nccq (); 122GST_free_nccq ();
103 123
124
125/**
126 * Notification context to be used to notify when connection to the neighbour's
127 * controller is opened
128 */
104struct NeighbourConnectNotification; 129struct NeighbourConnectNotification;
105 130
131
132/**
133 * The notification callback to call when we are connect to neighbour
134 *
135 * @param cls the closure given to GST_neighbour_get_connection()
136 * @param controller the controller handle to the neighbour
137 */
106typedef void (*GST_NeigbourConnectNotifyCallback) (void *cls, 138typedef void (*GST_NeigbourConnectNotifyCallback) (void *cls,
107 struct 139 struct
108 GNUNET_TESTBED_Controller 140 GNUNET_TESTBED_Controller
109 *controller); 141 *controller);
110 142
143
144/**
145 * Try to open a connection to the given neigbour. If the connection is open
146 * already, then it is re-used. If not, the request is queued in the operation
147 * queues responsible for bounding the total number of file descriptors. The
148 * actual connection will happen when the operation queue marks the
149 * corresponding operation as active.
150 *
151 * @param n the neighbour to open a connection to
152 * @param cb the notification callback to call when the connection is opened
153 * @param cb_cls the closure for the above callback
154 */
111struct NeighbourConnectNotification * 155struct NeighbourConnectNotification *
112GST_neighbour_get_connection (struct Neighbour *n, 156GST_neighbour_get_connection (struct Neighbour *n,
113 GST_NeigbourConnectNotifyCallback cb, 157 GST_NeigbourConnectNotifyCallback cb,
114 void *cb_cls); 158 void *cb_cls);
115 159
160
161/**
162 * Cancel the request for opening a connection to the neighbour
163 *
164 * @param h the notification handle
165 */
116void 166void
117GST_neighbour_get_connection_cancel (struct NeighbourConnectNotification *h); 167GST_neighbour_get_connection_cancel (struct NeighbourConnectNotification *h);
118 168
169
170/**
171 * Release the connection to the neighbour. The actual connection will be
172 * closed if connections to other neighbour are waiting (to maintain a bound on
173 * the total number of connections that are open).
174 *
175 * @param n the neighbour whose connection can be closed
176 */
119void 177void
120GST_neighbour_release_connection (struct Neighbour *n); 178GST_neighbour_release_connection (struct Neighbour *n);
121 179
180
181/**
182 * Function to create a neigbour and add it into the neighbour list
183 *
184 * @param host the host of the neighbour
185 */
122struct Neighbour * 186struct Neighbour *
123GST_create_neighbour (struct GNUNET_TESTBED_Host *host); 187GST_create_neighbour (struct GNUNET_TESTBED_Host *host);
124 188
189
125/** 190/**
126 * Message handler for GNUNET_MESSAGE_TYPE_TESTBED_LCONTROLLERS message 191 * Message handler for GNUNET_MESSAGE_TYPE_TESTBED_LCONTROLLERS message
127 * 192 *