diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-12-18 16:22:14 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-12-18 16:22:14 +0000 |
commit | fb12af8319a84389a536ab2f3735daf3b24f11bd (patch) | |
tree | 53e1424149fe8e7d5673e783868fcaa8a6bdbb55 | |
parent | d19064a18f3fcf35c94d7f56485e41fb3425d066 (diff) | |
download | gnunet-fb12af8319a84389a536ab2f3735daf3b24f11bd.tar.gz gnunet-fb12af8319a84389a536ab2f3735daf3b24f11bd.zip |
-use const in peerstore callback
-rw-r--r-- | src/ats/ats.conf.in | 4 | ||||
-rw-r--r-- | src/cadet/test_cadet.c | 2 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_cp.c | 4 | ||||
-rw-r--r-- | src/hostlist/gnunet-daemon-hostlist_client.c | 9 | ||||
-rw-r--r-- | src/include/gnunet_peerstore_service.h | 53 | ||||
-rw-r--r-- | src/peerstore/gnunet-service-peerstore.c | 6 | ||||
-rw-r--r-- | src/peerstore/peerstore.h | 27 | ||||
-rw-r--r-- | src/peerstore/peerstore_api.c | 58 | ||||
-rw-r--r-- | src/peerstore/perf_peerstore_store.c | 10 | ||||
-rw-r--r-- | src/peerstore/test_peerstore_api_iterate.c | 13 | ||||
-rw-r--r-- | src/peerstore/test_peerstore_api_store.c | 23 | ||||
-rw-r--r-- | src/peerstore/test_peerstore_api_sync.c | 10 | ||||
-rw-r--r-- | src/sensor/gnunet-sensor-profiler.c | 5 | ||||
-rw-r--r-- | src/sensor/gnunet-service-sensor_analysis.c | 4 | ||||
-rw-r--r-- | src/sensor/gnunet-service-sensor_reporting.c | 6 | ||||
-rw-r--r-- | src/transport/plugin_transport_http_common.c | 4 |
16 files changed, 133 insertions, 105 deletions
diff --git a/src/ats/ats.conf.in b/src/ats/ats.conf.in index f8e323037..8765de434 100644 --- a/src/ats/ats.conf.in +++ b/src/ats/ats.conf.in | |||
@@ -35,7 +35,7 @@ BLUETOOTH_QUOTA_OUT = 128 KiB | |||
35 | # Proportional specific settings | 35 | # Proportional specific settings |
36 | # How proportional to preferences is bandwidth distribution in a network | 36 | # How proportional to preferences is bandwidth distribution in a network |
37 | # 1.0: Fair with respect to addresses without preferences | 37 | # 1.0: Fair with respect to addresses without preferences |
38 | # > 1.0: The bigger, the more respect is payed to preferences | 38 | # > 1.0: The bigger, the more respect is payed to preferences |
39 | PROP_PROPORTIONALITY_FACTOR = 2.00 | 39 | PROP_PROPORTIONALITY_FACTOR = 2.00 |
40 | # Should we stick to existing connections are prefer to switch? | 40 | # Should we stick to existing connections are prefer to switch? |
41 | # [1.0...2.0], lower value prefers to switch, bigger value is more tolerant | 41 | # [1.0...2.0], lower value prefers to switch, bigger value is more tolerant |
@@ -47,7 +47,7 @@ PROP_STABILITY_FACTOR = 1.25 | |||
47 | # Maximum duration for a solution process (both LP and MILP) | 47 | # Maximum duration for a solution process (both LP and MILP) |
48 | # MLP_MAX_DURATION = 3 s | 48 | # MLP_MAX_DURATION = 3 s |
49 | # Maximum numbero of iterations for a solution process (only LP) | 49 | # Maximum numbero of iterations for a solution process (only LP) |
50 | # MLP_MAX_ITERATIONS = | 50 | # MLP_MAX_ITERATIONS = |
51 | # Tolerated MIP Gap [0.0 .. 1.0], default 0.025 | 51 | # Tolerated MIP Gap [0.0 .. 1.0], default 0.025 |
52 | MLP_MAX_MIP_GAP = 0.025 | 52 | MLP_MAX_MIP_GAP = 0.025 |
53 | # Tolerated LP/MIP Gap [0.0 .. 1.0], default 0.025 | 53 | # Tolerated LP/MIP Gap [0.0 .. 1.0], default 0.025 |
diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c index fb17c053a..b9661a9b7 100644 --- a/src/cadet/test_cadet.c +++ b/src/cadet/test_cadet.c | |||
@@ -33,7 +33,7 @@ | |||
33 | /** | 33 | /** |
34 | * How namy messages to send | 34 | * How namy messages to send |
35 | */ | 35 | */ |
36 | #define TOTAL_PACKETS 20000 | 36 | #define TOTAL_PACKETS 40000 |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * How long until we give up on connecting the peers? | 39 | * How long until we give up on connecting the peers? |
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index d6ffa491d..e901af25e 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c | |||
@@ -579,8 +579,8 @@ ats_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
579 | */ | 579 | */ |
580 | static int | 580 | static int |
581 | peer_respect_cb (void *cls, | 581 | peer_respect_cb (void *cls, |
582 | struct GNUNET_PEERSTORE_Record *record, | 582 | const struct GNUNET_PEERSTORE_Record *record, |
583 | char *emsg) | 583 | const char *emsg) |
584 | { | 584 | { |
585 | struct GSF_ConnectedPeer *cp = cls; | 585 | struct GSF_ConnectedPeer *cp = cls; |
586 | 586 | ||
diff --git a/src/hostlist/gnunet-daemon-hostlist_client.c b/src/hostlist/gnunet-daemon-hostlist_client.c index d59407af8..4d31ab692 100644 --- a/src/hostlist/gnunet-daemon-hostlist_client.c +++ b/src/hostlist/gnunet-daemon-hostlist_client.c | |||
@@ -1574,12 +1574,13 @@ GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c, | |||
1574 | else if (0 == strcmp(proxytype_str, "SOCKS4A")) | 1574 | else if (0 == strcmp(proxytype_str, "SOCKS4A")) |
1575 | proxy_type = CURLPROXY_SOCKS4A; | 1575 | proxy_type = CURLPROXY_SOCKS4A; |
1576 | else if (0 == strcmp(proxytype_str, "SOCKS5_HOSTNAME")) | 1576 | else if (0 == strcmp(proxytype_str, "SOCKS5_HOSTNAME")) |
1577 | proxy_type = CURLPROXY_SOCKS5_HOSTNAME ; | 1577 | proxy_type = CURLPROXY_SOCKS5_HOSTNAME; |
1578 | else | 1578 | else |
1579 | { | 1579 | { |
1580 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1580 | if (0 != strcasecmp (proxytype_str, "NONE")) |
1581 | _("Invalid proxy type: `%s', disabling proxy! Check configuration!\n"), | 1581 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1582 | proxytype_str); | 1582 | _("Invalid proxy type: `%s', disabling proxy! Check configuration!\n"), |
1583 | proxytype_str); | ||
1583 | GNUNET_free (proxytype_str); | 1584 | GNUNET_free (proxytype_str); |
1584 | 1585 | ||
1585 | GNUNET_free (proxy); | 1586 | GNUNET_free (proxy); |
diff --git a/src/include/gnunet_peerstore_service.h b/src/include/gnunet_peerstore_service.h index a3fed7065..49166659b 100644 --- a/src/include/gnunet_peerstore_service.h +++ b/src/include/gnunet_peerstore_service.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) | 3 | (C) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU General Public License as published |
@@ -52,7 +52,7 @@ enum GNUNET_PEERSTORE_StoreOption | |||
52 | * Delete any previous values for the given key before | 52 | * Delete any previous values for the given key before |
53 | * storing the given value. | 53 | * storing the given value. |
54 | */ | 54 | */ |
55 | GNUNET_PEERSTORE_STOREOPTION_REPLACE = 1, | 55 | GNUNET_PEERSTORE_STOREOPTION_REPLACE = 1 |
56 | 56 | ||
57 | }; | 57 | }; |
58 | 58 | ||
@@ -93,7 +93,7 @@ struct GNUNET_PEERSTORE_Record | |||
93 | void *value; | 93 | void *value; |
94 | 94 | ||
95 | /** | 95 | /** |
96 | * Size of 'value' BLOB | 96 | * Size of @e value BLOB |
97 | */ | 97 | */ |
98 | size_t value_size; | 98 | size_t value_size; |
99 | 99 | ||
@@ -108,13 +108,15 @@ struct GNUNET_PEERSTORE_Record | |||
108 | struct GNUNET_SERVER_Client *client; | 108 | struct GNUNET_SERVER_Client *client; |
109 | }; | 109 | }; |
110 | 110 | ||
111 | |||
111 | /** | 112 | /** |
112 | * Continuation called with a status result. | 113 | * Continuation called with a status result. |
113 | * | 114 | * |
114 | * @param cls closure | 115 | * @param cls closure |
115 | * @param success #GNUNET_OK or #GNUNET_SYSERR | 116 | * @param success #GNUNET_OK or #GNUNET_SYSERR |
116 | */ | 117 | */ |
117 | typedef void (*GNUNET_PEERSTORE_Continuation)(void *cls, int success); | 118 | typedef void |
119 | (*GNUNET_PEERSTORE_Continuation)(void *cls, int success); | ||
118 | 120 | ||
119 | /** | 121 | /** |
120 | * Function called by PEERSTORE for each matching record. | 122 | * Function called by PEERSTORE for each matching record. |
@@ -124,9 +126,10 @@ typedef void (*GNUNET_PEERSTORE_Continuation)(void *cls, int success); | |||
124 | * @param emsg error message, or NULL if no errors | 126 | * @param emsg error message, or NULL if no errors |
125 | * @return #GNUNET_YES to continue iterating, #GNUNET_NO to stop | 127 | * @return #GNUNET_YES to continue iterating, #GNUNET_NO to stop |
126 | */ | 128 | */ |
127 | typedef int (*GNUNET_PEERSTORE_Processor) (void *cls, | 129 | typedef int |
128 | struct GNUNET_PEERSTORE_Record *record, | 130 | (*GNUNET_PEERSTORE_Processor) (void *cls, |
129 | char *emsg); | 131 | const struct GNUNET_PEERSTORE_Record *record, |
132 | const char *emsg); | ||
130 | 133 | ||
131 | /** | 134 | /** |
132 | * Connect to the PEERSTORE service. | 135 | * Connect to the PEERSTORE service. |
@@ -136,6 +139,7 @@ typedef int (*GNUNET_PEERSTORE_Processor) (void *cls, | |||
136 | struct GNUNET_PEERSTORE_Handle * | 139 | struct GNUNET_PEERSTORE_Handle * |
137 | GNUNET_PEERSTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); | 140 | GNUNET_PEERSTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); |
138 | 141 | ||
142 | |||
139 | /** | 143 | /** |
140 | * Disconnect from the PEERSTORE service. Any pending ITERATE and WATCH requests | 144 | * Disconnect from the PEERSTORE service. Any pending ITERATE and WATCH requests |
141 | * will be canceled. | 145 | * will be canceled. |
@@ -145,7 +149,9 @@ GNUNET_PEERSTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); | |||
145 | * @param sync_first send any pending STORE requests before disconnecting | 149 | * @param sync_first send any pending STORE requests before disconnecting |
146 | */ | 150 | */ |
147 | void | 151 | void |
148 | GNUNET_PEERSTORE_disconnect (struct GNUNET_PEERSTORE_Handle *h, int sync_first); | 152 | GNUNET_PEERSTORE_disconnect (struct GNUNET_PEERSTORE_Handle *h, |
153 | int sync_first); | ||
154 | |||
149 | 155 | ||
150 | /** | 156 | /** |
151 | * Store a new entry in the PEERSTORE. | 157 | * Store a new entry in the PEERSTORE. |
@@ -161,7 +167,7 @@ GNUNET_PEERSTORE_disconnect (struct GNUNET_PEERSTORE_Handle *h, int sync_first); | |||
161 | * @param expiry absolute time after which the entry is (possibly) deleted | 167 | * @param expiry absolute time after which the entry is (possibly) deleted |
162 | * @param options options specific to the storage operation | 168 | * @param options options specific to the storage operation |
163 | * @param cont Continuation function after the store request is sent | 169 | * @param cont Continuation function after the store request is sent |
164 | * @param cont_cls Closure for 'cont' | 170 | * @param cont_cls Closure for @a cont |
165 | */ | 171 | */ |
166 | struct GNUNET_PEERSTORE_StoreContext * | 172 | struct GNUNET_PEERSTORE_StoreContext * |
167 | GNUNET_PEERSTORE_store (struct GNUNET_PEERSTORE_Handle *h, | 173 | GNUNET_PEERSTORE_store (struct GNUNET_PEERSTORE_Handle *h, |
@@ -175,6 +181,7 @@ GNUNET_PEERSTORE_store (struct GNUNET_PEERSTORE_Handle *h, | |||
175 | GNUNET_PEERSTORE_Continuation cont, | 181 | GNUNET_PEERSTORE_Continuation cont, |
176 | void *cont_cls); | 182 | void *cont_cls); |
177 | 183 | ||
184 | |||
178 | /** | 185 | /** |
179 | * Cancel a store request | 186 | * Cancel a store request |
180 | * | 187 | * |
@@ -183,6 +190,7 @@ GNUNET_PEERSTORE_store (struct GNUNET_PEERSTORE_Handle *h, | |||
183 | void | 190 | void |
184 | GNUNET_PEERSTORE_store_cancel (struct GNUNET_PEERSTORE_StoreContext *sc); | 191 | GNUNET_PEERSTORE_store_cancel (struct GNUNET_PEERSTORE_StoreContext *sc); |
185 | 192 | ||
193 | |||
186 | /** | 194 | /** |
187 | * Iterate over records matching supplied key information | 195 | * Iterate over records matching supplied key information |
188 | * | 196 | * |
@@ -196,11 +204,13 @@ GNUNET_PEERSTORE_store_cancel (struct GNUNET_PEERSTORE_StoreContext *sc); | |||
196 | */ | 204 | */ |
197 | struct GNUNET_PEERSTORE_IterateContext * | 205 | struct GNUNET_PEERSTORE_IterateContext * |
198 | GNUNET_PEERSTORE_iterate (struct GNUNET_PEERSTORE_Handle *h, | 206 | GNUNET_PEERSTORE_iterate (struct GNUNET_PEERSTORE_Handle *h, |
199 | const char *sub_system, | 207 | const char *sub_system, |
200 | const struct GNUNET_PeerIdentity *peer, | 208 | const struct GNUNET_PeerIdentity *peer, |
201 | const char *key, | 209 | const char *key, |
202 | struct GNUNET_TIME_Relative timeout, | 210 | struct GNUNET_TIME_Relative timeout, |
203 | GNUNET_PEERSTORE_Processor callback, void *callback_cls); | 211 | GNUNET_PEERSTORE_Processor callback, |
212 | void *callback_cls); | ||
213 | |||
204 | 214 | ||
205 | /** | 215 | /** |
206 | * Cancel an iterate request | 216 | * Cancel an iterate request |
@@ -211,9 +221,10 @@ GNUNET_PEERSTORE_iterate (struct GNUNET_PEERSTORE_Handle *h, | |||
211 | void | 221 | void |
212 | GNUNET_PEERSTORE_iterate_cancel (struct GNUNET_PEERSTORE_IterateContext *ic); | 222 | GNUNET_PEERSTORE_iterate_cancel (struct GNUNET_PEERSTORE_IterateContext *ic); |
213 | 223 | ||
224 | |||
214 | /** | 225 | /** |
215 | * Request watching a given key | 226 | * Request watching a given key |
216 | * User will be notified with any new values added to key | 227 | * User will be notified with any new values added to key. |
217 | * | 228 | * |
218 | * @param h handle to the PEERSTORE service | 229 | * @param h handle to the PEERSTORE service |
219 | * @param sub_system name of sub system | 230 | * @param sub_system name of sub system |
@@ -225,10 +236,12 @@ GNUNET_PEERSTORE_iterate_cancel (struct GNUNET_PEERSTORE_IterateContext *ic); | |||
225 | */ | 236 | */ |
226 | struct GNUNET_PEERSTORE_WatchContext * | 237 | struct GNUNET_PEERSTORE_WatchContext * |
227 | GNUNET_PEERSTORE_watch (struct GNUNET_PEERSTORE_Handle *h, | 238 | GNUNET_PEERSTORE_watch (struct GNUNET_PEERSTORE_Handle *h, |
228 | const char *sub_system, | 239 | const char *sub_system, |
229 | const struct GNUNET_PeerIdentity *peer, | 240 | const struct GNUNET_PeerIdentity *peer, |
230 | const char *key, | 241 | const char *key, |
231 | GNUNET_PEERSTORE_Processor callback, void *callback_cls); | 242 | GNUNET_PEERSTORE_Processor callback, |
243 | void *callback_cls); | ||
244 | |||
232 | 245 | ||
233 | /** | 246 | /** |
234 | * Cancel a watch request | 247 | * Cancel a watch request |
@@ -236,7 +249,7 @@ GNUNET_PEERSTORE_watch (struct GNUNET_PEERSTORE_Handle *h, | |||
236 | * @param wc handle to the watch request | 249 | * @param wc handle to the watch request |
237 | */ | 250 | */ |
238 | void | 251 | void |
239 | GNUNET_PEERSTORE_watch_cancel(struct GNUNET_PEERSTORE_WatchContext *wc); | 252 | GNUNET_PEERSTORE_watch_cancel (struct GNUNET_PEERSTORE_WatchContext *wc); |
240 | 253 | ||
241 | #if 0 /* keep Emacsens' auto-indent happy */ | 254 | #if 0 /* keep Emacsens' auto-indent happy */ |
242 | { | 255 | { |
diff --git a/src/peerstore/gnunet-service-peerstore.c b/src/peerstore/gnunet-service-peerstore.c index f8ec631b9..bdd93e63a 100644 --- a/src/peerstore/gnunet-service-peerstore.c +++ b/src/peerstore/gnunet-service-peerstore.c | |||
@@ -239,7 +239,9 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) | |||
239 | * @return #GNUNET_YES to continue iteration | 239 | * @return #GNUNET_YES to continue iteration |
240 | */ | 240 | */ |
241 | static int | 241 | static int |
242 | record_iterator (void *cls, struct GNUNET_PEERSTORE_Record *record, char *emsg) | 242 | record_iterator (void *cls, |
243 | const struct GNUNET_PEERSTORE_Record *record, | ||
244 | const char *emsg) | ||
243 | { | 245 | { |
244 | struct GNUNET_PEERSTORE_Record *cls_record = cls; | 246 | struct GNUNET_PEERSTORE_Record *cls_record = cls; |
245 | struct StoreRecordMessage *srm; | 247 | struct StoreRecordMessage *srm; |
@@ -410,7 +412,7 @@ handle_iterate (void *cls, struct GNUNET_SERVER_Client *client, | |||
410 | 412 | ||
411 | 413 | ||
412 | /** | 414 | /** |
413 | * Continuation of store_record called by the peerstore plugin | 415 | * Continuation of store_record called by the peerstore plugin |
414 | * | 416 | * |
415 | * @param cls closure | 417 | * @param cls closure |
416 | * @param success result | 418 | * @param success result |
diff --git a/src/peerstore/peerstore.h b/src/peerstore/peerstore.h index ef134feef..6644464ec 100644 --- a/src/peerstore/peerstore.h +++ b/src/peerstore/peerstore.h | |||
@@ -30,10 +30,11 @@ | |||
30 | 30 | ||
31 | 31 | ||
32 | GNUNET_NETWORK_STRUCT_BEGIN | 32 | GNUNET_NETWORK_STRUCT_BEGIN |
33 | |||
33 | /** | 34 | /** |
34 | * Message carrying a PEERSTORE record message | 35 | * Message carrying a PEERSTORE record message |
35 | */ | 36 | */ |
36 | struct StoreRecordMessage | 37 | struct StoreRecordMessage |
37 | { | 38 | { |
38 | 39 | ||
39 | /** | 40 | /** |
@@ -47,15 +48,20 @@ GNUNET_NETWORK_STRUCT_BEGIN | |||
47 | uint16_t peer_set GNUNET_PACKED; | 48 | uint16_t peer_set GNUNET_PACKED; |
48 | 49 | ||
49 | /** | 50 | /** |
51 | * Size of the sub_system string | ||
52 | * Allocated at position 0 after this struct | ||
53 | */ | ||
54 | uint16_t sub_system_size GNUNET_PACKED; | ||
55 | |||
56 | /** | ||
50 | * Peer Identity | 57 | * Peer Identity |
51 | */ | 58 | */ |
52 | struct GNUNET_PeerIdentity peer; | 59 | struct GNUNET_PeerIdentity peer; |
53 | 60 | ||
54 | /** | 61 | /** |
55 | * Size of the sub_system string | 62 | * Expiry time of entry |
56 | * Allocated at position 0 after this struct | ||
57 | */ | 63 | */ |
58 | uint16_t sub_system_size GNUNET_PACKED; | 64 | struct GNUNET_TIME_Absolute expiry GNUNET_PACKED; |
59 | 65 | ||
60 | /** | 66 | /** |
61 | * Size of the key string | 67 | * Size of the key string |
@@ -70,18 +76,14 @@ GNUNET_NETWORK_STRUCT_BEGIN | |||
70 | uint16_t value_size GNUNET_PACKED; | 76 | uint16_t value_size GNUNET_PACKED; |
71 | 77 | ||
72 | /** | 78 | /** |
73 | * Expiry time of entry | ||
74 | */ | ||
75 | struct GNUNET_TIME_Absolute expiry GNUNET_PACKED; | ||
76 | |||
77 | /** | ||
78 | * Options, needed only in case of a | 79 | * Options, needed only in case of a |
79 | * store operation | 80 | * store operation |
80 | */ | 81 | */ |
81 | enum GNUNET_PEERSTORE_StoreOption options GNUNET_PACKED; | 82 | uint32_t /* enum GNUNET_PEERSTORE_StoreOption */ options GNUNET_PACKED; |
82 | 83 | ||
83 | }; | 84 | }; |
84 | 85 | ||
86 | |||
85 | /** | 87 | /** |
86 | * Message carrying record key hash | 88 | * Message carrying record key hash |
87 | */ | 89 | */ |
@@ -94,6 +96,11 @@ struct StoreKeyHashMessage | |||
94 | struct GNUNET_MessageHeader header; | 96 | struct GNUNET_MessageHeader header; |
95 | 97 | ||
96 | /** | 98 | /** |
99 | * Always 0, for alignment. | ||
100 | */ | ||
101 | uint32_t reserved GNUNET_PACKED; | ||
102 | |||
103 | /** | ||
97 | * Hash of a record key | 104 | * Hash of a record key |
98 | */ | 105 | */ |
99 | struct GNUNET_HashCode keyhash; | 106 | struct GNUNET_HashCode keyhash; |
diff --git a/src/peerstore/peerstore_api.c b/src/peerstore/peerstore_api.c index 90594f73a..46f170a23 100644 --- a/src/peerstore/peerstore_api.c +++ b/src/peerstore/peerstore_api.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) | 3 | (C) 2013-2014 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU General Public License as published |
@@ -17,11 +17,11 @@ | |||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | |||
21 | /** | 20 | /** |
22 | * @file peerstore/peerstore_api.c | 21 | * @file peerstore/peerstore_api.c |
23 | * @brief API for peerstore | 22 | * @brief API for peerstore |
24 | * @author Omar Tarabai | 23 | * @author Omar Tarabai |
24 | * @author Christian Grothoff | ||
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
@@ -292,15 +292,30 @@ reconnect (struct GNUNET_PEERSTORE_Handle *h); | |||
292 | * @param cls a 'struct GNUNET_PEERSTORE_WatchContext *' | 292 | * @param cls a 'struct GNUNET_PEERSTORE_WatchContext *' |
293 | */ | 293 | */ |
294 | static void | 294 | static void |
295 | watch_request_sent (void *cls); | 295 | watch_request_sent (void *cls) |
296 | { | ||
297 | struct GNUNET_PEERSTORE_WatchContext *wc = cls; | ||
298 | |||
299 | wc->request_sent = GNUNET_YES; | ||
300 | wc->ev = NULL; | ||
301 | } | ||
302 | |||
296 | 303 | ||
297 | /** | 304 | /** |
298 | * Callback after MQ envelope is sent | 305 | * Callback after MQ envelope is sent |
299 | * | 306 | * |
300 | * @param cls a 'struct GNUNET_PEERSTORE_IterateContext *' | 307 | * @param cls a `struct GNUNET_PEERSTORE_IterateContext *` |
301 | */ | 308 | */ |
302 | static void | 309 | static void |
303 | iterate_request_sent (void *cls); | 310 | iterate_request_sent (void *cls) |
311 | { | ||
312 | struct GNUNET_PEERSTORE_IterateContext *ic = cls; | ||
313 | |||
314 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
315 | "Iterate request sent to service.\n"); | ||
316 | ic->iterating = GNUNET_YES; | ||
317 | ic->ev = NULL; | ||
318 | } | ||
304 | 319 | ||
305 | 320 | ||
306 | /** | 321 | /** |
@@ -724,7 +739,6 @@ handle_iterate_result (void *cls, | |||
724 | callback_cls = ic->callback_cls; | 739 | callback_cls = ic->callback_cls; |
725 | if (NULL == msg) /* Connection error */ | 740 | if (NULL == msg) /* Connection error */ |
726 | { | 741 | { |
727 | |||
728 | if (NULL != callback) | 742 | if (NULL != callback) |
729 | callback (callback_cls, NULL, | 743 | callback (callback_cls, NULL, |
730 | _("Error communicating with `PEERSTORE' service.")); | 744 | _("Error communicating with `PEERSTORE' service.")); |
@@ -759,23 +773,6 @@ handle_iterate_result (void *cls, | |||
759 | 773 | ||
760 | 774 | ||
761 | /** | 775 | /** |
762 | * Callback after MQ envelope is sent | ||
763 | * | ||
764 | * @param cls a `struct GNUNET_PEERSTORE_IterateContext *` | ||
765 | */ | ||
766 | static void | ||
767 | iterate_request_sent (void *cls) | ||
768 | { | ||
769 | struct GNUNET_PEERSTORE_IterateContext *ic = cls; | ||
770 | |||
771 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
772 | "Iterate request sent to service.\n"); | ||
773 | ic->iterating = GNUNET_YES; | ||
774 | ic->ev = NULL; | ||
775 | } | ||
776 | |||
777 | |||
778 | /** | ||
779 | * Called when the iterate request is timedout | 776 | * Called when the iterate request is timedout |
780 | * | 777 | * |
781 | * @param cls a `struct GNUNET_PEERSTORE_IterateContext *` | 778 | * @param cls a `struct GNUNET_PEERSTORE_IterateContext *` |
@@ -923,21 +920,6 @@ handle_watch_result (void *cls, const struct GNUNET_MessageHeader *msg) | |||
923 | 920 | ||
924 | 921 | ||
925 | /** | 922 | /** |
926 | * Callback after MQ envelope is sent | ||
927 | * | ||
928 | * @param cls a `struct GNUNET_PEERSTORE_WatchContext *` | ||
929 | */ | ||
930 | static void | ||
931 | watch_request_sent (void *cls) | ||
932 | { | ||
933 | struct GNUNET_PEERSTORE_WatchContext *wc = cls; | ||
934 | |||
935 | wc->request_sent = GNUNET_YES; | ||
936 | wc->ev = NULL; | ||
937 | } | ||
938 | |||
939 | |||
940 | /** | ||
941 | * Cancel a watch request | 923 | * Cancel a watch request |
942 | * | 924 | * |
943 | * @param wc handle to the watch request | 925 | * @param wc handle to the watch request |
diff --git a/src/peerstore/perf_peerstore_store.c b/src/peerstore/perf_peerstore_store.c index e97699fe2..ad7c70195 100644 --- a/src/peerstore/perf_peerstore_store.c +++ b/src/peerstore/perf_peerstore_store.c | |||
@@ -37,9 +37,9 @@ static struct GNUNET_PeerIdentity p; | |||
37 | static char *k = "test_peerstore_stress_key"; | 37 | static char *k = "test_peerstore_stress_key"; |
38 | static char *v = "test_peerstore_stress_val"; | 38 | static char *v = "test_peerstore_stress_val"; |
39 | 39 | ||
40 | int count = 0; | 40 | static int count = 0; |
41 | 41 | ||
42 | void | 42 | static void |
43 | disconnect () | 43 | disconnect () |
44 | { | 44 | { |
45 | if (NULL != h) | 45 | if (NULL != h) |
@@ -48,7 +48,7 @@ disconnect () | |||
48 | } | 48 | } |
49 | 49 | ||
50 | 50 | ||
51 | void | 51 | static void |
52 | store () | 52 | store () |
53 | { | 53 | { |
54 | GNUNET_PEERSTORE_store (h, ss, &p, k, v, strlen (v) + 1, | 54 | GNUNET_PEERSTORE_store (h, ss, &p, k, v, strlen (v) + 1, |
@@ -61,7 +61,9 @@ store () | |||
61 | 61 | ||
62 | 62 | ||
63 | static int | 63 | static int |
64 | watch_cb (void *cls, struct GNUNET_PEERSTORE_Record *record, char *emsg) | 64 | watch_cb (void *cls, |
65 | const struct GNUNET_PEERSTORE_Record *record, | ||
66 | const char *emsg) | ||
65 | { | 67 | { |
66 | GNUNET_assert (NULL == emsg); | 68 | GNUNET_assert (NULL == emsg); |
67 | if (STORES == count) | 69 | if (STORES == count) |
diff --git a/src/peerstore/test_peerstore_api_iterate.c b/src/peerstore/test_peerstore_api_iterate.c index 626a020de..5952d45d1 100644 --- a/src/peerstore/test_peerstore_api_iterate.c +++ b/src/peerstore/test_peerstore_api_iterate.c | |||
@@ -39,8 +39,11 @@ static char *k3 = "test_peerstore_api_iterate_key3"; | |||
39 | static char *val = "test_peerstore_api_iterate_val"; | 39 | static char *val = "test_peerstore_api_iterate_val"; |
40 | static int count = 0; | 40 | static int count = 0; |
41 | 41 | ||
42 | |||
42 | static int | 43 | static int |
43 | iter3_cb (void *cls, struct GNUNET_PEERSTORE_Record *record, char *emsg) | 44 | iter3_cb (void *cls, |
45 | const struct GNUNET_PEERSTORE_Record *record, | ||
46 | const char *emsg) | ||
44 | { | 47 | { |
45 | if (NULL != emsg) | 48 | if (NULL != emsg) |
46 | return GNUNET_NO; | 49 | return GNUNET_NO; |
@@ -58,7 +61,9 @@ iter3_cb (void *cls, struct GNUNET_PEERSTORE_Record *record, char *emsg) | |||
58 | 61 | ||
59 | 62 | ||
60 | static int | 63 | static int |
61 | iter2_cb (void *cls, struct GNUNET_PEERSTORE_Record *record, char *emsg) | 64 | iter2_cb (void *cls, |
65 | const struct GNUNET_PEERSTORE_Record *record, | ||
66 | const char *emsg) | ||
62 | { | 67 | { |
63 | if (NULL != emsg) | 68 | if (NULL != emsg) |
64 | return GNUNET_NO; | 69 | return GNUNET_NO; |
@@ -76,7 +81,9 @@ iter2_cb (void *cls, struct GNUNET_PEERSTORE_Record *record, char *emsg) | |||
76 | 81 | ||
77 | 82 | ||
78 | static int | 83 | static int |
79 | iter1_cb (void *cls, struct GNUNET_PEERSTORE_Record *record, char *emsg) | 84 | iter1_cb (void *cls, |
85 | const struct GNUNET_PEERSTORE_Record *record, | ||
86 | const char *emsg) | ||
80 | { | 87 | { |
81 | if (NULL != emsg) | 88 | if (NULL != emsg) |
82 | return GNUNET_NO; | 89 | return GNUNET_NO; |
diff --git a/src/peerstore/test_peerstore_api_store.c b/src/peerstore/test_peerstore_api_store.c index 06ad34756..794a2b048 100644 --- a/src/peerstore/test_peerstore_api_store.c +++ b/src/peerstore/test_peerstore_api_store.c | |||
@@ -37,10 +37,12 @@ static char *val1 = "test_peerstore_api_store_val1"; | |||
37 | static char *val2 = "test_peerstore_api_store_val2-"; | 37 | static char *val2 = "test_peerstore_api_store_val2-"; |
38 | static char *val3 = "test_peerstore_api_store_val3--"; | 38 | static char *val3 = "test_peerstore_api_store_val3--"; |
39 | 39 | ||
40 | int count = 0; | 40 | static int count = 0; |
41 | 41 | ||
42 | int | 42 | static int |
43 | test3_cont2 (void *cls, struct GNUNET_PEERSTORE_Record *record, char *emsg) | 43 | test3_cont2 (void *cls, |
44 | const struct GNUNET_PEERSTORE_Record *record, | ||
45 | const char *emsg) | ||
44 | { | 46 | { |
45 | if (NULL != emsg) | 47 | if (NULL != emsg) |
46 | return GNUNET_NO; | 48 | return GNUNET_NO; |
@@ -83,8 +85,10 @@ test3 () | |||
83 | } | 85 | } |
84 | 86 | ||
85 | 87 | ||
86 | int | 88 | static int |
87 | test2_cont2 (void *cls, struct GNUNET_PEERSTORE_Record *record, char *emsg) | 89 | test2_cont2 (void *cls, |
90 | const struct GNUNET_PEERSTORE_Record *record, | ||
91 | const char *emsg) | ||
88 | { | 92 | { |
89 | if (NULL != emsg) | 93 | if (NULL != emsg) |
90 | return GNUNET_NO; | 94 | return GNUNET_NO; |
@@ -128,8 +132,10 @@ test2 () | |||
128 | } | 132 | } |
129 | 133 | ||
130 | 134 | ||
131 | int | 135 | static int |
132 | test1_cont2 (void *cls, struct GNUNET_PEERSTORE_Record *record, char *emsg) | 136 | test1_cont2 (void *cls, |
137 | const struct GNUNET_PEERSTORE_Record *record, | ||
138 | const char *emsg) | ||
133 | { | 139 | { |
134 | if (NULL != emsg) | 140 | if (NULL != emsg) |
135 | return GNUNET_NO; | 141 | return GNUNET_NO; |
@@ -172,7 +178,8 @@ test1 () | |||
172 | 178 | ||
173 | 179 | ||
174 | static void | 180 | static void |
175 | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, | 181 | run (void *cls, |
182 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
176 | struct GNUNET_TESTING_Peer *peer) | 183 | struct GNUNET_TESTING_Peer *peer) |
177 | { | 184 | { |
178 | h = GNUNET_PEERSTORE_connect (cfg); | 185 | h = GNUNET_PEERSTORE_connect (cfg); |
diff --git a/src/peerstore/test_peerstore_api_sync.c b/src/peerstore/test_peerstore_api_sync.c index 3803d72c1..8bd8328f8 100644 --- a/src/peerstore/test_peerstore_api_sync.c +++ b/src/peerstore/test_peerstore_api_sync.c | |||
@@ -26,9 +26,9 @@ | |||
26 | #include "gnunet_testing_lib.h" | 26 | #include "gnunet_testing_lib.h" |
27 | #include "gnunet_peerstore_service.h" | 27 | #include "gnunet_peerstore_service.h" |
28 | 28 | ||
29 | int ok = 1; | 29 | static int ok = 1; |
30 | 30 | ||
31 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 31 | static const struct GNUNET_CONFIGURATION_Handle *cfg; |
32 | 32 | ||
33 | static struct GNUNET_PEERSTORE_Handle *h; | 33 | static struct GNUNET_PEERSTORE_Handle *h; |
34 | 34 | ||
@@ -37,8 +37,10 @@ static struct GNUNET_PeerIdentity pid; | |||
37 | static char *key = "test_peerstore_api_store_key"; | 37 | static char *key = "test_peerstore_api_store_key"; |
38 | static char *val = "test_peerstore_api_store_val"; | 38 | static char *val = "test_peerstore_api_store_val"; |
39 | 39 | ||
40 | int | 40 | static int |
41 | iterate_cb (void *cls, struct GNUNET_PEERSTORE_Record *record, char *emsg) | 41 | iterate_cb (void *cls, |
42 | const struct GNUNET_PEERSTORE_Record *record, | ||
43 | const char *emsg) | ||
42 | { | 44 | { |
43 | const char *rec_val; | 45 | const char *rec_val; |
44 | 46 | ||
diff --git a/src/sensor/gnunet-sensor-profiler.c b/src/sensor/gnunet-sensor-profiler.c index cb0b80044..21574774d 100644 --- a/src/sensor/gnunet-sensor-profiler.c +++ b/src/sensor/gnunet-sensor-profiler.c | |||
@@ -365,8 +365,9 @@ dashboard_started (void *cls, struct GNUNET_TESTBED_Operation *op, | |||
365 | * @return #GNUNET_YES to continue iterating, #GNUNET_NO to stop | 365 | * @return #GNUNET_YES to continue iterating, #GNUNET_NO to stop |
366 | */ | 366 | */ |
367 | static int | 367 | static int |
368 | peerstore_watch_cb (void *cls, struct GNUNET_PEERSTORE_Record *record, | 368 | peerstore_watch_cb (void *cls, |
369 | char *emsg) | 369 | const struct GNUNET_PEERSTORE_Record *record, |
370 | const char *emsg) | ||
370 | { | 371 | { |
371 | struct PeerInfo *peer = cls; | 372 | struct PeerInfo *peer = cls; |
372 | struct GNUNET_SENSOR_DashboardAnomalyEntry *anomaly; | 373 | struct GNUNET_SENSOR_DashboardAnomalyEntry *anomaly; |
diff --git a/src/sensor/gnunet-service-sensor_analysis.c b/src/sensor/gnunet-service-sensor_analysis.c index b82db4b8e..45eaaa8c1 100644 --- a/src/sensor/gnunet-service-sensor_analysis.c +++ b/src/sensor/gnunet-service-sensor_analysis.c | |||
@@ -189,7 +189,9 @@ SENSOR_analysis_stop () | |||
189 | * @return #GNUNET_YES | 189 | * @return #GNUNET_YES |
190 | */ | 190 | */ |
191 | static int | 191 | static int |
192 | sensor_watcher (void *cls, struct GNUNET_PEERSTORE_Record *record, char *emsg) | 192 | sensor_watcher (void *cls, |
193 | const struct GNUNET_PEERSTORE_Record *record, | ||
194 | const char *emsg) | ||
193 | { | 195 | { |
194 | struct SensorModel *model = cls; | 196 | struct SensorModel *model = cls; |
195 | double *val; | 197 | double *val; |
diff --git a/src/sensor/gnunet-service-sensor_reporting.c b/src/sensor/gnunet-service-sensor_reporting.c index 1c19b38f9..8d69836a0 100644 --- a/src/sensor/gnunet-service-sensor_reporting.c +++ b/src/sensor/gnunet-service-sensor_reporting.c | |||
@@ -1032,10 +1032,12 @@ handle_anomaly_report (void *cls, const struct GNUNET_PeerIdentity *other, | |||
1032 | * @param cls Closure, ValueInfo struct related to the sensor we are watching | 1032 | * @param cls Closure, ValueInfo struct related to the sensor we are watching |
1033 | * @param record PEERSTORE new record, NULL if error | 1033 | * @param record PEERSTORE new record, NULL if error |
1034 | * @param emsg Error message, NULL if no error | 1034 | * @param emsg Error message, NULL if no error |
1035 | * @return GNUNET_YES to continue watching | 1035 | * @return #GNUNET_YES to continue watching |
1036 | */ | 1036 | */ |
1037 | static int | 1037 | static int |
1038 | value_watch_cb (void *cls, struct GNUNET_PEERSTORE_Record *record, char *emsg) | 1038 | value_watch_cb (void *cls, |
1039 | const struct GNUNET_PEERSTORE_Record *record, | ||
1040 | const char *emsg) | ||
1039 | { | 1041 | { |
1040 | struct ValueInfo *vi = cls; | 1042 | struct ValueInfo *vi = cls; |
1041 | 1043 | ||
diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c index 947b64bef..acccf39f8 100644 --- a/src/transport/plugin_transport_http_common.c +++ b/src/transport/plugin_transport_http_common.c | |||
@@ -432,8 +432,8 @@ http_common_plugin_address_pretty_printer (void *cls, const char *type, | |||
432 | 432 | ||
433 | saddr = NULL; | 433 | saddr = NULL; |
434 | sock_addr = NULL; | 434 | sock_addr = NULL; |
435 | if ((addrlen < sizeof(struct HttpAddress)) | 435 | if ( (addrlen < sizeof(struct HttpAddress)) || |
436 | || (addrlen != http_common_address_get_size (address))) | 436 | (addrlen != http_common_address_get_size (address)) ) |
437 | { | 437 | { |
438 | GNUNET_break(0); | 438 | GNUNET_break(0); |
439 | goto handle_error; | 439 | goto handle_error; |