aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/testbed_api_services.c
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-08-25 11:50:39 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-08-25 11:50:39 +0000
commit5bec5a8d66565e3f42aa5b4fc98ab0d87c47e528 (patch)
tree831cf55cd54f2adc78fc87ac9114de4748f1bdb1 /src/testbed/testbed_api_services.c
parent9233abe82cdf18d40932d590f1c411dff47488e7 (diff)
downloadgnunet-5bec5a8d66565e3f42aa5b4fc98ab0d87c47e528.tar.gz
gnunet-5bec5a8d66565e3f42aa5b4fc98ab0d87c47e528.zip
towards implementing service_connect
Diffstat (limited to 'src/testbed/testbed_api_services.c')
-rw-r--r--src/testbed/testbed_api_services.c88
1 files changed, 86 insertions, 2 deletions
diff --git a/src/testbed/testbed_api_services.c b/src/testbed/testbed_api_services.c
index 34de0fd84..9fbb92797 100644
--- a/src/testbed/testbed_api_services.c
+++ b/src/testbed/testbed_api_services.c
@@ -24,7 +24,73 @@
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "testbed_api.h"
27#include "testbed_api_peers.h" 28#include "testbed_api_peers.h"
29#include "testbed_api_operations.h"
30
31struct ServiceConnectData
32{
33 /**
34 * helper function callback to establish the connection
35 */
36 GNUNET_TESTBED_ConnectAdapter ca;
37
38 /**
39 * helper function callback to close the connection
40 */
41 GNUNET_TESTBED_DisconnectAdapter da;
42
43 /**
44 * Closure to the above callbacks
45 */
46 void *cada_cls;
47
48 /**
49 * Service name
50 */
51 char *service_name;
52
53 /**
54 * Closure for operation event
55 */
56 void *op_cls;
57
58};
59
60
61/**
62 * Context information for forwarded operation used in service connect
63 */
64struct SCFOContext
65{
66
67};
68
69
70
71/**
72 * Function called when a service connect operation is ready
73 *
74 * @param cls the closure from GNUNET_TESTBED_operation_create_()
75 */
76static void
77opstart_service_connect (void *cls)
78{
79 GNUNET_break (0);
80}
81
82
83/**
84 * Callback which will be called when service connect type operation is
85 * released
86 *
87 * @param cls the closure from GNUNET_TESTBED_operation_create_()
88 */
89static void
90oprelease_service_connect (void *cls)
91{
92 GNUNET_break (0);
93}
28 94
29 95
30/** 96/**
@@ -54,8 +120,26 @@ GNUNET_TESTBED_service_connect (void *op_cls,
54 GNUNET_TESTBED_DisconnectAdapter da, 120 GNUNET_TESTBED_DisconnectAdapter da,
55 void *cada_cls) 121 void *cada_cls)
56{ 122{
57 GNUNET_break (0); 123 struct OperationContext *opc;
58 return NULL; 124 struct ServiceConnectData *data;
125
126 data = GNUNET_malloc (sizeof (struct ServiceConnectData));
127 data->ca = ca;
128 data->da = da;
129 data->cada_cls = cada_cls;
130 data->op_cls = op_cls;
131 opc = GNUNET_malloc (sizeof (struct OperationContext));
132 opc->data = data;
133 opc->c = peer->controller;
134 opc->id = peer->controller->operation_counter++;
135 opc->type = OP_SERVICE_CONNECT;
136 opc->op = GNUNET_TESTBED_operation_create_ (opc, &opstart_service_connect,
137 &oprelease_service_connect);
138 GNUNET_TESTBED_operation_queue_insert_
139 (opc->c->opq_parallel_service_connections, opc->op);
140 GNUNET_TESTBED_operation_queue_insert_ (opc->c->opq_parallel_operations,
141 opc->op);
142 return opc->op;
59} 143}
60 144
61/* end of testbed_api_services.c */ 145/* end of testbed_api_services.c */