diff options
-rw-r--r-- | src/arm/gnunet-service-arm.c | 22 | ||||
-rw-r--r-- | src/include/gnunet_scalarproduct_service.h | 38 |
2 files changed, 39 insertions, 21 deletions
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index b30e8542e..704b6f2fc 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c | |||
@@ -488,7 +488,7 @@ start_process (struct ServiceList *sl, | |||
488 | GNUNET_asprintf ("edbinary, | 488 | GNUNET_asprintf ("edbinary, |
489 | "\"%s\"", | 489 | "\"%s\"", |
490 | binary); | 490 | binary); |
491 | 491 | ||
492 | GNUNET_assert (NULL == sl->proc); | 492 | GNUNET_assert (NULL == sl->proc); |
493 | if (GNUNET_YES == use_debug) | 493 | if (GNUNET_YES == use_debug) |
494 | { | 494 | { |
@@ -747,7 +747,7 @@ handle_start (void *cls, struct GNUNET_SERVER_Client *client, | |||
747 | } | 747 | } |
748 | if (GNUNET_YES == in_shutdown) | 748 | if (GNUNET_YES == in_shutdown) |
749 | { | 749 | { |
750 | signal_result (client, servicename, request_id, | 750 | signal_result (client, servicename, request_id, |
751 | GNUNET_ARM_RESULT_IN_SHUTDOWN); | 751 | GNUNET_ARM_RESULT_IN_SHUTDOWN); |
752 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 752 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
753 | return; | 753 | return; |
@@ -755,7 +755,7 @@ handle_start (void *cls, struct GNUNET_SERVER_Client *client, | |||
755 | sl = find_service (servicename); | 755 | sl = find_service (servicename); |
756 | if (NULL == sl) | 756 | if (NULL == sl) |
757 | { | 757 | { |
758 | signal_result (client, servicename, request_id, | 758 | signal_result (client, servicename, request_id, |
759 | GNUNET_ARM_RESULT_IS_NOT_KNOWN); | 759 | GNUNET_ARM_RESULT_IS_NOT_KNOWN); |
760 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 760 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
761 | return; | 761 | return; |
@@ -818,7 +818,7 @@ handle_stop (void *cls, struct GNUNET_SERVER_Client *client, | |||
818 | return; | 818 | return; |
819 | } | 819 | } |
820 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 820 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
821 | _("Preparing to stop `%s'\n"), | 821 | _("Preparing to stop `%s'\n"), |
822 | servicename); | 822 | servicename); |
823 | if (0 == strcasecmp (servicename, "arm")) | 823 | if (0 == strcasecmp (servicename, "arm")) |
824 | { | 824 | { |
@@ -1299,22 +1299,28 @@ setup_service (void *cls, const char *section) | |||
1299 | return; | 1299 | return; |
1300 | if (GNUNET_OK != | 1300 | if (GNUNET_OK != |
1301 | GNUNET_CONFIGURATION_get_value_string (cfg, section, "BINARY", &binary)) | 1301 | GNUNET_CONFIGURATION_get_value_string (cfg, section, "BINARY", &binary)) |
1302 | { | 1302 | { |
1303 | /* not a service section */ | 1303 | /* not a service section */ |
1304 | return; | 1304 | return; |
1305 | } | 1305 | } |
1306 | if ((GNUNET_YES == | 1306 | if ((GNUNET_YES == |
1307 | GNUNET_CONFIGURATION_have_value (cfg, section, "USER_SERVICE")) && | 1307 | GNUNET_CONFIGURATION_have_value (cfg, section, "USER_SERVICE")) && |
1308 | (GNUNET_YES == | 1308 | (GNUNET_YES == |
1309 | GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "USER_SERVICE"))) | 1309 | GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "USER_SERVICE"))) |
1310 | { | 1310 | { |
1311 | if (GNUNET_NO == start_user) | 1311 | if (GNUNET_NO == start_user) |
1312 | { | ||
1313 | GNUNET_free (binary); | ||
1312 | return; /* user service, and we don't deal with those */ | 1314 | return; /* user service, and we don't deal with those */ |
1315 | } | ||
1313 | } | 1316 | } |
1314 | else | 1317 | else |
1315 | { | 1318 | { |
1316 | if (GNUNET_NO == start_system) | 1319 | if (GNUNET_NO == start_system) |
1320 | { | ||
1321 | GNUNET_free (binary); | ||
1317 | return; /* system service, and we don't deal with those */ | 1322 | return; /* system service, and we don't deal with those */ |
1323 | } | ||
1318 | } | 1324 | } |
1319 | sl = find_service (section); | 1325 | sl = find_service (section); |
1320 | if (NULL != sl) | 1326 | if (NULL != sl) |
diff --git a/src/include/gnunet_scalarproduct_service.h b/src/include/gnunet_scalarproduct_service.h index 1146db1e4..b61a4d6f6 100644 --- a/src/include/gnunet_scalarproduct_service.h +++ b/src/include/gnunet_scalarproduct_service.h | |||
@@ -49,11 +49,13 @@ enum GNUNET_SCALARPRODUCT_ResponseStatus | |||
49 | GNUNET_SCALARPRODUCT_Status_ServiceDisconnected | 49 | GNUNET_SCALARPRODUCT_Status_ServiceDisconnected |
50 | }; | 50 | }; |
51 | 51 | ||
52 | |||
52 | /** | 53 | /** |
53 | * Opaque declaration of the SP-Handle | 54 | * Opaque declaration of the SP-Handle |
54 | */ | 55 | */ |
55 | struct GNUNET_SCALARPRODUCT_Handle; | 56 | struct GNUNET_SCALARPRODUCT_Handle; |
56 | 57 | ||
58 | |||
57 | /** | 59 | /** |
58 | * Continuation called to notify client about result of the | 60 | * Continuation called to notify client about result of the |
59 | * operation. | 61 | * operation. |
@@ -63,6 +65,8 @@ struct GNUNET_SCALARPRODUCT_Handle; | |||
63 | */ | 65 | */ |
64 | typedef void (*GNUNET_SCALARPRODUCT_ContinuationWithStatus) (void *cls, | 66 | typedef void (*GNUNET_SCALARPRODUCT_ContinuationWithStatus) (void *cls, |
65 | enum GNUNET_SCALARPRODUCT_ResponseStatus status); | 67 | enum GNUNET_SCALARPRODUCT_ResponseStatus status); |
68 | |||
69 | |||
66 | /** | 70 | /** |
67 | * Process a datum that was stored in the scalarproduct. | 71 | * Process a datum that was stored in the scalarproduct. |
68 | * | 72 | * |
@@ -74,6 +78,7 @@ typedef void (*GNUNET_SCALARPRODUCT_DatumProcessor) (void *cls, | |||
74 | enum GNUNET_SCALARPRODUCT_ResponseStatus status, | 78 | enum GNUNET_SCALARPRODUCT_ResponseStatus status, |
75 | gcry_mpi_t result); | 79 | gcry_mpi_t result); |
76 | 80 | ||
81 | |||
77 | /** | 82 | /** |
78 | * Request by Alice's client for computing a scalar product | 83 | * Request by Alice's client for computing a scalar product |
79 | * | 84 | * |
@@ -85,17 +90,16 @@ typedef void (*GNUNET_SCALARPRODUCT_DatumProcessor) (void *cls, | |||
85 | * @param mask Array of the mask | 90 | * @param mask Array of the mask |
86 | * @param mask_bytes number of bytes in the mask | 91 | * @param mask_bytes number of bytes in the mask |
87 | * @param cont Callback function | 92 | * @param cont Callback function |
88 | * @param cont_cls Closure for the callback function | 93 | * @param cont_cls Closure for @a cont |
89 | * | ||
90 | * @return a new handle for this computation | 94 | * @return a new handle for this computation |
91 | */ | 95 | */ |
92 | struct GNUNET_SCALARPRODUCT_ComputationHandle * | 96 | struct GNUNET_SCALARPRODUCT_ComputationHandle * |
93 | GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle * cfg, | 97 | GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg, |
94 | const struct GNUNET_HashCode * key, | 98 | const struct GNUNET_HashCode *key, |
95 | const struct GNUNET_PeerIdentity *peer, | 99 | const struct GNUNET_PeerIdentity *peer, |
96 | const int32_t * elements, | 100 | const int32_t *elements, |
97 | uint32_t element_count, | 101 | uint32_t element_count, |
98 | const unsigned char * mask, | 102 | const unsigned char *mask, |
99 | uint32_t mask_bytes, | 103 | uint32_t mask_bytes, |
100 | GNUNET_SCALARPRODUCT_DatumProcessor cont, | 104 | GNUNET_SCALARPRODUCT_DatumProcessor cont, |
101 | void * cont_cls); | 105 | void * cont_cls); |
@@ -108,17 +112,18 @@ GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle * cfg, | |||
108 | * @param elements Array of elements of the vector | 112 | * @param elements Array of elements of the vector |
109 | * @param element_count Number of elements in the vector | 113 | * @param element_count Number of elements in the vector |
110 | * @param cont Callback function | 114 | * @param cont Callback function |
111 | * @param cont_cls Closure for the callback function | 115 | * @param cont_cls Closure for @a cont |
112 | * | ||
113 | * @return a new handle for this computation | 116 | * @return a new handle for this computation |
114 | */ | 117 | */ |
115 | struct GNUNET_SCALARPRODUCT_ComputationHandle * | 118 | struct GNUNET_SCALARPRODUCT_ComputationHandle * |
116 | GNUNET_SCALARPRODUCT_response (const struct GNUNET_CONFIGURATION_Handle * cfg, | 119 | GNUNET_SCALARPRODUCT_response (const struct GNUNET_CONFIGURATION_Handle *cfg, |
117 | const struct GNUNET_HashCode * key, | 120 | const struct GNUNET_HashCode *key, |
118 | const int32_t * elements, | 121 | const int32_t *elements, |
119 | uint32_t element_count, | 122 | uint32_t element_count, |
120 | GNUNET_SCALARPRODUCT_ContinuationWithStatus cont, | 123 | GNUNET_SCALARPRODUCT_ContinuationWithStatus cont, |
121 | void * cont_cls); | 124 | void *cont_cls); |
125 | |||
126 | |||
122 | /** | 127 | /** |
123 | * Cancel an ongoing computation or revoke our collaboration offer. | 128 | * Cancel an ongoing computation or revoke our collaboration offer. |
124 | * Closes the connection to the service | 129 | * Closes the connection to the service |
@@ -126,15 +131,22 @@ GNUNET_SCALARPRODUCT_response (const struct GNUNET_CONFIGURATION_Handle * cfg, | |||
126 | * @param h computation handle to terminate | 131 | * @param h computation handle to terminate |
127 | */ | 132 | */ |
128 | void | 133 | void |
129 | GNUNET_SCALARPRODUCT_cancel (struct GNUNET_SCALARPRODUCT_ComputationHandle * h); | 134 | GNUNET_SCALARPRODUCT_cancel (struct GNUNET_SCALARPRODUCT_ComputationHandle *h); |
135 | |||
130 | 136 | ||
131 | /** | 137 | /** |
132 | * Cancel ALL ongoing computation or revoke our collaboration offer. | 138 | * Cancel ALL ongoing computation or revoke our collaboration offer. |
133 | * Closes ALL connections to the service | 139 | * Closes ALL connections to the service |
140 | * | ||
141 | * FIXME: this should take an argument, and we should | ||
142 | * have an explicit 'connect' API which returns an opaque | ||
143 | * connection handle. Avoid (globals) in the library! | ||
144 | * @deprecated in this form | ||
134 | */ | 145 | */ |
135 | void | 146 | void |
136 | GNUNET_SCALARPRODUCT_disconnect (); | 147 | GNUNET_SCALARPRODUCT_disconnect (); |
137 | 148 | ||
149 | |||
138 | #if 0 /* keep Emacsens' auto-indent happy */ | 150 | #if 0 /* keep Emacsens' auto-indent happy */ |
139 | { | 151 | { |
140 | #endif | 152 | #endif |