diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:46:35 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:46:35 +0000 |
commit | 502af2167f7c218366666ca4944bd7cc54b5b19a (patch) | |
tree | a91fec5cc9769d260640bd91c6633cb9cf395524 /src/include | |
parent | 03af5a603b7cc53432249d5854cd412aa90dde0d (diff) | |
download | gnunet-502af2167f7c218366666ca4944bd7cc54b5b19a.tar.gz gnunet-502af2167f7c218366666ca4944bd7cc54b5b19a.zip |
indentation
Diffstat (limited to 'src/include')
49 files changed, 3147 insertions, 2785 deletions
diff --git a/src/include/gettext.h b/src/include/gettext.h index c89197cfc..0295ac2f5 100644 --- a/src/include/gettext.h +++ b/src/include/gettext.h | |||
@@ -23,7 +23,7 @@ | |||
23 | #if ENABLE_NLS | 23 | #if ENABLE_NLS |
24 | 24 | ||
25 | /* Get declarations of GNU message catalog functions. */ | 25 | /* Get declarations of GNU message catalog functions. */ |
26 | # include <libintl.h> | 26 | #include <libintl.h> |
27 | 27 | ||
28 | #else | 28 | #else |
29 | 29 | ||
@@ -34,7 +34,7 @@ | |||
34 | and also including <libintl.h> would fail on SunOS 4, whereas <locale.h> | 34 | and also including <libintl.h> would fail on SunOS 4, whereas <locale.h> |
35 | is GNUNET_OK. */ | 35 | is GNUNET_OK. */ |
36 | #if defined(__sun) | 36 | #if defined(__sun) |
37 | # include <locale.h> | 37 | #include <locale.h> |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | /* Disabled NLS. | 40 | /* Disabled NLS. |
@@ -42,20 +42,20 @@ | |||
42 | for invalid uses of the value returned from these functions. | 42 | for invalid uses of the value returned from these functions. |
43 | On pre-ANSI systems without 'const', the config.h file is supposed to | 43 | On pre-ANSI systems without 'const', the config.h file is supposed to |
44 | contain "#define const". */ | 44 | contain "#define const". */ |
45 | # define gettext(Msgid) ((const char *) (Msgid)) | 45 | #define gettext(Msgid) ((const char *) (Msgid)) |
46 | # define dgettext(Domainname, Msgid) ((const char *) (Msgid)) | 46 | #define dgettext(Domainname, Msgid) ((const char *) (Msgid)) |
47 | # define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) | 47 | #define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) |
48 | # define ngettext(Msgid1, Msgid2, N) \ | 48 | #define ngettext(Msgid1, Msgid2, N) \ |
49 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) | 49 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) |
50 | # define dngettext(Domainname, Msgid1, Msgid2, N) \ | 50 | #define dngettext(Domainname, Msgid1, Msgid2, N) \ |
51 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) | 51 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) |
52 | # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ | 52 | #define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ |
53 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) | 53 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) |
54 | /* slight modification here to avoid warnings: generate GNUNET_NO code, | 54 | /* slight modification here to avoid warnings: generate GNUNET_NO code, |
55 | not even the cast... */ | 55 | not even the cast... */ |
56 | # define textdomain(Domainname) | 56 | #define textdomain(Domainname) |
57 | # define bindtextdomain(Domainname, Dirname) | 57 | #define bindtextdomain(Domainname, Dirname) |
58 | # define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) | 58 | #define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) |
59 | 59 | ||
60 | #endif | 60 | #endif |
61 | 61 | ||
diff --git a/src/include/gnunet_arm_service.h b/src/include/gnunet_arm_service.h index 317105520..e0a0b83ad 100644 --- a/src/include/gnunet_arm_service.h +++ b/src/include/gnunet_arm_service.h | |||
@@ -59,7 +59,7 @@ typedef void (*GNUNET_ARM_Callback) (void *cls, int success); | |||
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Handle for interacting with ARM. | 61 | * Handle for interacting with ARM. |
62 | */ | 62 | */ |
63 | struct GNUNET_ARM_Handle; | 63 | struct GNUNET_ARM_Handle; |
64 | 64 | ||
65 | 65 | ||
@@ -73,9 +73,9 @@ struct GNUNET_ARM_Handle; | |||
73 | * @param service service that *this* process is implementing/providing, can be NULL | 73 | * @param service service that *this* process is implementing/providing, can be NULL |
74 | * @return context to use for further ARM operations, NULL on error | 74 | * @return context to use for further ARM operations, NULL on error |
75 | */ | 75 | */ |
76 | struct GNUNET_ARM_Handle * | 76 | struct GNUNET_ARM_Handle *GNUNET_ARM_connect (const struct |
77 | GNUNET_ARM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 77 | GNUNET_CONFIGURATION_Handle *cfg, |
78 | const char *service); | 78 | const char *service); |
79 | 79 | ||
80 | 80 | ||
81 | /** | 81 | /** |
@@ -83,8 +83,7 @@ GNUNET_ARM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
83 | * | 83 | * |
84 | * @param h the handle that was being used | 84 | * @param h the handle that was being used |
85 | */ | 85 | */ |
86 | void | 86 | void GNUNET_ARM_disconnect (struct GNUNET_ARM_Handle *h); |
87 | GNUNET_ARM_disconnect (struct GNUNET_ARM_Handle *h); | ||
88 | 87 | ||
89 | 88 | ||
90 | /** | 89 | /** |
@@ -107,7 +106,7 @@ GNUNET_ARM_disconnect (struct GNUNET_ARM_Handle *h); | |||
107 | */ | 106 | */ |
108 | void | 107 | void |
109 | GNUNET_ARM_start_service (struct GNUNET_ARM_Handle *h, | 108 | GNUNET_ARM_start_service (struct GNUNET_ARM_Handle *h, |
110 | const char *service_name, | 109 | const char *service_name, |
111 | struct GNUNET_TIME_Relative timeout, | 110 | struct GNUNET_TIME_Relative timeout, |
112 | GNUNET_ARM_Callback cb, void *cb_cls); | 111 | GNUNET_ARM_Callback cb, void *cb_cls); |
113 | 112 | ||
@@ -125,7 +124,7 @@ GNUNET_ARM_start_service (struct GNUNET_ARM_Handle *h, | |||
125 | */ | 124 | */ |
126 | void | 125 | void |
127 | GNUNET_ARM_stop_service (struct GNUNET_ARM_Handle *h, | 126 | GNUNET_ARM_stop_service (struct GNUNET_ARM_Handle *h, |
128 | const char *service_name, | 127 | const char *service_name, |
129 | struct GNUNET_TIME_Relative timeout, | 128 | struct GNUNET_TIME_Relative timeout, |
130 | GNUNET_ARM_Callback cb, void *cb_cls); | 129 | GNUNET_ARM_Callback cb, void *cb_cls); |
131 | 130 | ||
diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h index 87bd4eba0..a6149ee5a 100644 --- a/src/include/gnunet_ats_service.h +++ b/src/include/gnunet_ats_service.h | |||
@@ -58,13 +58,21 @@ struct GNUNET_ATS_Handle; | |||
58 | * @param plugin_addr_len number of bytes in addr | 58 | * @param plugin_addr_len number of bytes in addr |
59 | * @param bandwidth assigned outbound bandwidth for the connection | 59 | * @param bandwidth assigned outbound bandwidth for the connection |
60 | */ | 60 | */ |
61 | typedef void (*GNUNET_TRANSPORT_ATS_AllocationNotification)(void *cls, | 61 | typedef void (*GNUNET_TRANSPORT_ATS_AllocationNotification) (void *cls, |
62 | const struct GNUNET_PeerIdentity *peer, | 62 | const struct |
63 | const char *plugin_name, | 63 | GNUNET_PeerIdentity |
64 | struct Session *session, | 64 | * peer, |
65 | const void *plugin_addr, | 65 | const char |
66 | size_t plugin_addr_len, | 66 | *plugin_name, |
67 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth); | 67 | struct Session * |
68 | session, | ||
69 | const void | ||
70 | *plugin_addr, | ||
71 | size_t | ||
72 | plugin_addr_len, | ||
73 | struct | ||
74 | GNUNET_BANDWIDTH_Value32NBO | ||
75 | bandwidth); | ||
68 | 76 | ||
69 | 77 | ||
70 | /** | 78 | /** |
@@ -75,10 +83,10 @@ typedef void (*GNUNET_TRANSPORT_ATS_AllocationNotification)(void *cls, | |||
75 | * @param alloc_cb_cls closure for 'alloc_cb' | 83 | * @param alloc_cb_cls closure for 'alloc_cb' |
76 | * @return ats context | 84 | * @return ats context |
77 | */ | 85 | */ |
78 | struct GNUNET_ATS_Handle * | 86 | struct GNUNET_ATS_Handle *GNUNET_ATS_init (const struct |
79 | GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | 87 | GNUNET_CONFIGURATION_Handle *cfg, |
80 | GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb, | 88 | GNUNET_TRANSPORT_ATS_AllocationNotification |
81 | void *alloc_cb_cls); | 89 | alloc_cb, void *alloc_cb_cls); |
82 | 90 | ||
83 | 91 | ||
84 | /** | 92 | /** |
@@ -86,8 +94,7 @@ GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
86 | * | 94 | * |
87 | * @param atc handle | 95 | * @param atc handle |
88 | */ | 96 | */ |
89 | void | 97 | void GNUNET_ATS_shutdown (struct GNUNET_ATS_Handle *atc); |
90 | GNUNET_ATS_shutdown (struct GNUNET_ATS_Handle *atc); | ||
91 | 98 | ||
92 | 99 | ||
93 | /** | 100 | /** |
@@ -102,14 +109,20 @@ GNUNET_ATS_shutdown (struct GNUNET_ATS_Handle *atc); | |||
102 | * @param ats performance data for the address (as far as known) | 109 | * @param ats performance data for the address (as far as known) |
103 | * @param ats_count number of performance records in 'ats' | 110 | * @param ats_count number of performance records in 'ats' |
104 | */ | 111 | */ |
105 | typedef void (*GNUNET_ATS_AddressSuggestionCallback)(void *cls, | 112 | typedef void (*GNUNET_ATS_AddressSuggestionCallback) (void *cls, |
106 | const struct GNUNET_PeerIdentity *peer, | 113 | const struct |
107 | const char *plugin_name, | 114 | GNUNET_PeerIdentity * |
108 | const void *plugin_addr, | 115 | peer, |
109 | size_t plugin_addr_len, | 116 | const char *plugin_name, |
110 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth, | 117 | const void *plugin_addr, |
111 | const struct GNUNET_TRANSPORT_ATS_Information *ats, | 118 | size_t plugin_addr_len, |
112 | uint32_t ats_count); | 119 | struct |
120 | GNUNET_BANDWIDTH_Value32NBO | ||
121 | bandwidth, | ||
122 | const struct | ||
123 | GNUNET_TRANSPORT_ATS_Information | ||
124 | * ats, | ||
125 | uint32_t ats_count); | ||
113 | 126 | ||
114 | 127 | ||
115 | /** | 128 | /** |
@@ -127,11 +140,15 @@ struct GNUNET_ATS_SuggestionContext; | |||
127 | * @param cb function to call with the address | 140 | * @param cb function to call with the address |
128 | * @param cb_cls closure for cb | 141 | * @param cb_cls closure for cb |
129 | */ | 142 | */ |
130 | struct GNUNET_ATS_SuggestionContext * | 143 | struct GNUNET_ATS_SuggestionContext *GNUNET_ATS_suggest_address (struct |
131 | GNUNET_ATS_suggest_address (struct GNUNET_ATS_Handle *atc, | 144 | GNUNET_ATS_Handle |
132 | const struct GNUNET_PeerIdentity *peer, | 145 | *atc, |
133 | GNUNET_ATS_AddressSuggestionCallback cb, | 146 | const struct |
134 | void *cb_cls); | 147 | GNUNET_PeerIdentity |
148 | *peer, | ||
149 | GNUNET_ATS_AddressSuggestionCallback | ||
150 | cb, | ||
151 | void *cb_cls); | ||
135 | 152 | ||
136 | 153 | ||
137 | /** | 154 | /** |
@@ -159,13 +176,13 @@ GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SuggestionContext *asc); | |||
159 | */ | 176 | */ |
160 | void | 177 | void |
161 | GNUNET_ATS_peer_connect (struct GNUNET_ATS_Handle *atc, | 178 | GNUNET_ATS_peer_connect (struct GNUNET_ATS_Handle *atc, |
162 | const struct GNUNET_PeerIdentity *peer, | 179 | const struct GNUNET_PeerIdentity *peer, |
163 | const char *plugin_name, | 180 | const char *plugin_name, |
164 | struct Session *session, | 181 | struct Session *session, |
165 | const void *plugin_addr, | 182 | const void *plugin_addr, |
166 | size_t plugin_addr_len, | 183 | size_t plugin_addr_len, |
167 | const struct GNUNET_TRANSPORT_ATS_Information *ats, | 184 | const struct GNUNET_TRANSPORT_ATS_Information *ats, |
168 | uint32_t ats_count); | 185 | uint32_t ats_count); |
169 | 186 | ||
170 | 187 | ||
171 | /** | 188 | /** |
@@ -178,7 +195,7 @@ GNUNET_ATS_peer_connect (struct GNUNET_ATS_Handle *atc, | |||
178 | */ | 195 | */ |
179 | void | 196 | void |
180 | GNUNET_ATS_peer_disconnect (struct GNUNET_ATS_Handle *atc, | 197 | GNUNET_ATS_peer_disconnect (struct GNUNET_ATS_Handle *atc, |
181 | const struct GNUNET_PeerIdentity *peer); | 198 | const struct GNUNET_PeerIdentity *peer); |
182 | 199 | ||
183 | 200 | ||
184 | /** | 201 | /** |
@@ -190,8 +207,8 @@ GNUNET_ATS_peer_disconnect (struct GNUNET_ATS_Handle *atc, | |||
190 | */ | 207 | */ |
191 | void | 208 | void |
192 | GNUNET_ATS_session_destroyed (struct GNUNET_ATS_Handle *atc, | 209 | GNUNET_ATS_session_destroyed (struct GNUNET_ATS_Handle *atc, |
193 | const struct GNUNET_PeerIdentity *peer, | 210 | const struct GNUNET_PeerIdentity *peer, |
194 | const struct Session *session); | 211 | const struct Session *session); |
195 | 212 | ||
196 | 213 | ||
197 | /** | 214 | /** |
@@ -214,14 +231,14 @@ GNUNET_ATS_session_destroyed (struct GNUNET_ATS_Handle *atc, | |||
214 | */ | 231 | */ |
215 | void | 232 | void |
216 | GNUNET_ATS_address_update (struct GNUNET_ATS_Handle *atc, | 233 | GNUNET_ATS_address_update (struct GNUNET_ATS_Handle *atc, |
217 | const struct GNUNET_PeerIdentity *peer, | 234 | const struct GNUNET_PeerIdentity *peer, |
218 | struct GNUNET_TIME_Absolute valid_until, | 235 | struct GNUNET_TIME_Absolute valid_until, |
219 | const char *plugin_name, | 236 | const char *plugin_name, |
220 | struct Session *session, | 237 | struct Session *session, |
221 | const void *plugin_addr, | 238 | const void *plugin_addr, |
222 | size_t plugin_addr_len, | 239 | size_t plugin_addr_len, |
223 | const struct GNUNET_TRANSPORT_ATS_Information *ats, | 240 | const struct GNUNET_TRANSPORT_ATS_Information *ats, |
224 | uint32_t ats_count); | 241 | uint32_t ats_count); |
225 | 242 | ||
226 | 243 | ||
227 | #endif | 244 | #endif |
diff --git a/src/include/gnunet_bandwidth_lib.h b/src/include/gnunet_bandwidth_lib.h index 43e75ed0a..059a6696c 100644 --- a/src/include/gnunet_bandwidth_lib.h +++ b/src/include/gnunet_bandwidth_lib.h | |||
@@ -107,9 +107,20 @@ GNUNET_BANDWIDTH_value_init (uint32_t bytes_per_second); | |||
107 | * @param deadline when is the deadline | 107 | * @param deadline when is the deadline |
108 | * @return number of bytes available at bps until deadline | 108 | * @return number of bytes available at bps until deadline |
109 | */ | 109 | */ |
110 | uint64_t | 110 | uint64_t |
111 | GNUNET_BANDWIDTH_value_get_available_until (struct GNUNET_BANDWIDTH_Value32NBO bps, | 111 | |
112 | struct GNUNET_TIME_Relative deadline); | 112 | |
113 | |||
114 | |||
115 | |||
116 | |||
117 | |||
118 | |||
119 | |||
120 | GNUNET_BANDWIDTH_value_get_available_until (struct GNUNET_BANDWIDTH_Value32NBO | ||
121 | bps, | ||
122 | struct GNUNET_TIME_Relative | ||
123 | deadline); | ||
113 | 124 | ||
114 | 125 | ||
115 | /** | 126 | /** |
@@ -122,7 +133,7 @@ GNUNET_BANDWIDTH_value_get_available_until (struct GNUNET_BANDWIDTH_Value32NBO b | |||
122 | */ | 133 | */ |
123 | struct GNUNET_TIME_Relative | 134 | struct GNUNET_TIME_Relative |
124 | GNUNET_BANDWIDTH_value_get_delay_for (struct GNUNET_BANDWIDTH_Value32NBO bps, | 135 | GNUNET_BANDWIDTH_value_get_delay_for (struct GNUNET_BANDWIDTH_Value32NBO bps, |
125 | uint64_t size); | 136 | uint64_t size); |
126 | 137 | ||
127 | 138 | ||
128 | 139 | ||
@@ -135,7 +146,7 @@ GNUNET_BANDWIDTH_value_get_delay_for (struct GNUNET_BANDWIDTH_Value32NBO bps, | |||
135 | */ | 146 | */ |
136 | struct GNUNET_BANDWIDTH_Value32NBO | 147 | struct GNUNET_BANDWIDTH_Value32NBO |
137 | GNUNET_BANDWIDTH_value_min (struct GNUNET_BANDWIDTH_Value32NBO b1, | 148 | GNUNET_BANDWIDTH_value_min (struct GNUNET_BANDWIDTH_Value32NBO b1, |
138 | struct GNUNET_BANDWIDTH_Value32NBO b2); | 149 | struct GNUNET_BANDWIDTH_Value32NBO b2); |
139 | 150 | ||
140 | 151 | ||
141 | /** | 152 | /** |
@@ -154,8 +165,8 @@ GNUNET_BANDWIDTH_value_min (struct GNUNET_BANDWIDTH_Value32NBO b1, | |||
154 | */ | 165 | */ |
155 | void | 166 | void |
156 | GNUNET_BANDWIDTH_tracker_init (struct GNUNET_BANDWIDTH_Tracker *av, | 167 | GNUNET_BANDWIDTH_tracker_init (struct GNUNET_BANDWIDTH_Tracker *av, |
157 | struct GNUNET_BANDWIDTH_Value32NBO bytes_per_second_limit, | 168 | struct GNUNET_BANDWIDTH_Value32NBO |
158 | uint32_t max_carry_s); | 169 | bytes_per_second_limit, uint32_t max_carry_s); |
159 | 170 | ||
160 | 171 | ||
161 | /** | 172 | /** |
@@ -171,7 +182,7 @@ GNUNET_BANDWIDTH_tracker_init (struct GNUNET_BANDWIDTH_Tracker *av, | |||
171 | */ | 182 | */ |
172 | int | 183 | int |
173 | GNUNET_BANDWIDTH_tracker_consume (struct GNUNET_BANDWIDTH_Tracker *av, | 184 | GNUNET_BANDWIDTH_tracker_consume (struct GNUNET_BANDWIDTH_Tracker *av, |
174 | ssize_t size); | 185 | ssize_t size); |
175 | 186 | ||
176 | 187 | ||
177 | /** | 188 | /** |
@@ -185,7 +196,7 @@ GNUNET_BANDWIDTH_tracker_consume (struct GNUNET_BANDWIDTH_Tracker *av, | |||
185 | */ | 196 | */ |
186 | struct GNUNET_TIME_Relative | 197 | struct GNUNET_TIME_Relative |
187 | GNUNET_BANDWIDTH_tracker_get_delay (struct GNUNET_BANDWIDTH_Tracker *av, | 198 | GNUNET_BANDWIDTH_tracker_get_delay (struct GNUNET_BANDWIDTH_Tracker *av, |
188 | size_t size); | 199 | size_t size); |
189 | 200 | ||
190 | 201 | ||
191 | /** | 202 | /** |
@@ -195,8 +206,15 @@ GNUNET_BANDWIDTH_tracker_get_delay (struct GNUNET_BANDWIDTH_Tracker *av, | |||
195 | * @param av tracker to query | 206 | * @param av tracker to query |
196 | * @return number of bytes available for consumption right now | 207 | * @return number of bytes available for consumption right now |
197 | */ | 208 | */ |
198 | int64_t | 209 | int64_t |
199 | GNUNET_BANDWIDTH_tracker_get_available (struct GNUNET_BANDWIDTH_Tracker *av); | 210 | |
211 | |||
212 | |||
213 | |||
214 | |||
215 | |||
216 | |||
217 | GNUNET_BANDWIDTH_tracker_get_available (struct GNUNET_BANDWIDTH_Tracker *av); | ||
200 | 218 | ||
201 | 219 | ||
202 | /** | 220 | /** |
@@ -207,7 +225,8 @@ GNUNET_BANDWIDTH_tracker_get_available (struct GNUNET_BANDWIDTH_Tracker *av); | |||
207 | */ | 225 | */ |
208 | void | 226 | void |
209 | GNUNET_BANDWIDTH_tracker_update_quota (struct GNUNET_BANDWIDTH_Tracker *av, | 227 | GNUNET_BANDWIDTH_tracker_update_quota (struct GNUNET_BANDWIDTH_Tracker *av, |
210 | struct GNUNET_BANDWIDTH_Value32NBO bytes_per_second_limit); | 228 | struct GNUNET_BANDWIDTH_Value32NBO |
229 | bytes_per_second_limit); | ||
211 | 230 | ||
212 | 231 | ||
213 | #if 0 /* keep Emacsens' auto-indent happy */ | 232 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_bio_lib.h b/src/include/gnunet_bio_lib.h index 15924f1ef..f0b486fd2 100644 --- a/src/include/gnunet_bio_lib.h +++ b/src/include/gnunet_bio_lib.h | |||
@@ -60,8 +60,7 @@ struct GNUNET_BIO_ReadHandle *GNUNET_BIO_read_open (const char *fn); | |||
60 | * @param emsg set to the error message | 60 | * @param emsg set to the error message |
61 | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise | 61 | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise |
62 | */ | 62 | */ |
63 | int GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, | 63 | int GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, char **emsg); |
64 | char **emsg); | ||
65 | 64 | ||
66 | 65 | ||
67 | /** | 66 | /** |
@@ -73,10 +72,8 @@ int GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, | |||
73 | * @param len the number of bytes to read | 72 | * @param len the number of bytes to read |
74 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | 73 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure |
75 | */ | 74 | */ |
76 | int GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, | 75 | int GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, |
77 | const char *what, | 76 | const char *what, void *result, size_t len); |
78 | void *result, | ||
79 | size_t len); | ||
80 | 77 | ||
81 | 78 | ||
82 | /** | 79 | /** |
@@ -89,10 +86,8 @@ int GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, | |||
89 | * @param len the number of bytes to read | 86 | * @param len the number of bytes to read |
90 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | 87 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure |
91 | */ | 88 | */ |
92 | int GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, | 89 | int GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, |
93 | const char *file, int line, | 90 | const char *file, int line, void *result, size_t len); |
94 | void *result, | ||
95 | size_t len); | ||
96 | 91 | ||
97 | /** | 92 | /** |
98 | * Read 0-terminated string from a file. | 93 | * Read 0-terminated string from a file. |
@@ -105,9 +100,7 @@ int GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, | |||
105 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | 100 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure |
106 | */ | 101 | */ |
107 | int GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, | 102 | int GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, |
108 | const char *what, | 103 | const char *what, char **result, size_t maxLen); |
109 | char **result, | ||
110 | size_t maxLen); | ||
111 | 104 | ||
112 | 105 | ||
113 | /** | 106 | /** |
@@ -118,9 +111,9 @@ int GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, | |||
118 | * @param result the buffer to store a pointer to the (allocated) metadata | 111 | * @param result the buffer to store a pointer to the (allocated) metadata |
119 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | 112 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure |
120 | */ | 113 | */ |
121 | int GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, | 114 | int GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, |
122 | const char *what, | 115 | const char *what, |
123 | struct GNUNET_CONTAINER_MetaData **result); | 116 | struct GNUNET_CONTAINER_MetaData **result); |
124 | 117 | ||
125 | 118 | ||
126 | /** | 119 | /** |
@@ -128,7 +121,7 @@ int GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, | |||
128 | * | 121 | * |
129 | * @param h hande to open file | 122 | * @param h hande to open file |
130 | * @param f address of float to read | 123 | * @param f address of float to read |
131 | */ | 124 | */ |
132 | #define GNUNET_BIO_read_float(h, f) (GNUNET_BIO_read_fn (h, __FILE__, __LINE__, f, sizeof(float))) | 125 | #define GNUNET_BIO_read_float(h, f) (GNUNET_BIO_read_fn (h, __FILE__, __LINE__, f, sizeof(float))) |
133 | 126 | ||
134 | 127 | ||
@@ -138,7 +131,7 @@ int GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, | |||
138 | * | 131 | * |
139 | * @param h hande to open file | 132 | * @param h hande to open file |
140 | * @param f address of double to read | 133 | * @param f address of double to read |
141 | */ | 134 | */ |
142 | #define GNUNET_BIO_read_double(h, f) (GNUNET_BIO_read_fn (h, __FILE__, __LINE__, f, sizeof(double))) | 135 | #define GNUNET_BIO_read_double(h, f) (GNUNET_BIO_read_fn (h, __FILE__, __LINE__, f, sizeof(double))) |
143 | 136 | ||
144 | 137 | ||
@@ -150,10 +143,9 @@ int GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, | |||
150 | * @param line line number in the code | 143 | * @param line line number in the code |
151 | * @param i address of 32-bit integer to read | 144 | * @param i address of 32-bit integer to read |
152 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 145 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
153 | */ | 146 | */ |
154 | int GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, | 147 | int GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, |
155 | const char *file, int line, | 148 | const char *file, int line, int32_t * i); |
156 | int32_t *i); | ||
157 | 149 | ||
158 | 150 | ||
159 | /** | 151 | /** |
@@ -161,7 +153,7 @@ int GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, | |||
161 | * | 153 | * |
162 | * @param h hande to open file | 154 | * @param h hande to open file |
163 | * @param i address of 32-bit integer to read | 155 | * @param i address of 32-bit integer to read |
164 | */ | 156 | */ |
165 | #define GNUNET_BIO_read_int32(h, i) GNUNET_BIO_read_int32__ (h, __FILE__, __LINE__, (int32_t*) i) | 157 | #define GNUNET_BIO_read_int32(h, i) GNUNET_BIO_read_int32__ (h, __FILE__, __LINE__, (int32_t*) i) |
166 | 158 | ||
167 | 159 | ||
@@ -173,10 +165,9 @@ int GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, | |||
173 | * @param line line number in the code | 165 | * @param line line number in the code |
174 | * @param i address of 64-bit integer to read | 166 | * @param i address of 64-bit integer to read |
175 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 167 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
176 | */ | 168 | */ |
177 | int GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, | 169 | int GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, |
178 | const char *file, int line, | 170 | const char *file, int line, int64_t * i); |
179 | int64_t *i); | ||
180 | 171 | ||
181 | 172 | ||
182 | /** | 173 | /** |
@@ -184,7 +175,7 @@ int GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, | |||
184 | * | 175 | * |
185 | * @param h hande to open file | 176 | * @param h hande to open file |
186 | * @param i address of 64-bit integer to read | 177 | * @param i address of 64-bit integer to read |
187 | */ | 178 | */ |
188 | #define GNUNET_BIO_read_int64(h, i) GNUNET_BIO_read_int64__ (h, __FILE__, __LINE__, (int64_t*) i) | 179 | #define GNUNET_BIO_read_int64(h, i) GNUNET_BIO_read_int64__ (h, __FILE__, __LINE__, (int64_t*) i) |
189 | 180 | ||
190 | 181 | ||
@@ -192,6 +183,7 @@ int GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, | |||
192 | * Handle for buffered writing. | 183 | * Handle for buffered writing. |
193 | */ | 184 | */ |
194 | struct GNUNET_BIO_WriteHandle; | 185 | struct GNUNET_BIO_WriteHandle; |
186 | |||
195 | /** | 187 | /** |
196 | * Open a file for writing. | 188 | * Open a file for writing. |
197 | * | 189 | * |
@@ -218,9 +210,8 @@ int GNUNET_BIO_write_close (struct GNUNET_BIO_WriteHandle *h); | |||
218 | * @param n number of bytes to write | 210 | * @param n number of bytes to write |
219 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 211 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
220 | */ | 212 | */ |
221 | int GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, | 213 | int GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, |
222 | const void *buffer, | 214 | const void *buffer, size_t n); |
223 | size_t n); | ||
224 | 215 | ||
225 | 216 | ||
226 | /** | 217 | /** |
@@ -230,8 +221,7 @@ int GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, | |||
230 | * @param s string to write (can be NULL) | 221 | * @param s string to write (can be NULL) |
231 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 222 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
232 | */ | 223 | */ |
233 | int GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, | 224 | int GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, const char *s); |
234 | const char *s); | ||
235 | 225 | ||
236 | 226 | ||
237 | 227 | ||
@@ -243,8 +233,8 @@ int GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, | |||
243 | * @param m metadata to write | 233 | * @param m metadata to write |
244 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 234 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
245 | */ | 235 | */ |
246 | int GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, | 236 | int GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, |
247 | const struct GNUNET_CONTAINER_MetaData *m); | 237 | const struct GNUNET_CONTAINER_MetaData *m); |
248 | 238 | ||
249 | 239 | ||
250 | 240 | ||
@@ -253,7 +243,7 @@ int GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, | |||
253 | * | 243 | * |
254 | * @param h hande to open file | 244 | * @param h hande to open file |
255 | * @param f float to write (must be a variable) | 245 | * @param f float to write (must be a variable) |
256 | */ | 246 | */ |
257 | #define GNUNET_BIO_write_float(h, f) GNUNET_BIO_write (h, &f, sizeof(float)) | 247 | #define GNUNET_BIO_write_float(h, f) GNUNET_BIO_write (h, &f, sizeof(float)) |
258 | 248 | ||
259 | 249 | ||
@@ -263,7 +253,7 @@ int GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, | |||
263 | * | 253 | * |
264 | * @param h hande to open file | 254 | * @param h hande to open file |
265 | * @param f double to write (must be a variable) | 255 | * @param f double to write (must be a variable) |
266 | */ | 256 | */ |
267 | #define GNUNET_BIO_write_double(h, f) GNUNET_BIO_write (h, &f, sizeof(double)) | 257 | #define GNUNET_BIO_write_double(h, f) GNUNET_BIO_write (h, &f, sizeof(double)) |
268 | 258 | ||
269 | 259 | ||
@@ -273,9 +263,8 @@ int GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, | |||
273 | * @param h hande to open file | 263 | * @param h hande to open file |
274 | * @param i address of 32-bit integer to write | 264 | * @param i address of 32-bit integer to write |
275 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 265 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
276 | */ | 266 | */ |
277 | int GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h, | 267 | int GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h, int32_t i); |
278 | int32_t i); | ||
279 | 268 | ||
280 | 269 | ||
281 | /** | 270 | /** |
@@ -284,9 +273,8 @@ int GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h, | |||
284 | * @param h hande to open file | 273 | * @param h hande to open file |
285 | * @param i address of 64-bit integer to write | 274 | * @param i address of 64-bit integer to write |
286 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 275 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
287 | */ | 276 | */ |
288 | int GNUNET_BIO_write_int64 (struct GNUNET_BIO_WriteHandle *h, | 277 | int GNUNET_BIO_write_int64 (struct GNUNET_BIO_WriteHandle *h, int64_t i); |
289 | int64_t i); | ||
290 | 278 | ||
291 | 279 | ||
292 | #if 0 /* keep Emacsens' auto-indent happy */ | 280 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h index 74ae2d322..ae6884869 100644 --- a/src/include/gnunet_block_lib.h +++ b/src/include/gnunet_block_lib.h | |||
@@ -39,113 +39,113 @@ extern "C" | |||
39 | /** | 39 | /** |
40 | * Blocks in the datastore and the datacache must have a unique type. | 40 | * Blocks in the datastore and the datacache must have a unique type. |
41 | */ | 41 | */ |
42 | enum GNUNET_BLOCK_Type | 42 | enum GNUNET_BLOCK_Type |
43 | { | 43 | { |
44 | /** | 44 | /** |
45 | * Any type of block, used as a wildcard when searching. Should | 45 | * Any type of block, used as a wildcard when searching. Should |
46 | * never be attached to a specific block. | 46 | * never be attached to a specific block. |
47 | */ | 47 | */ |
48 | GNUNET_BLOCK_TYPE_ANY = 0, | 48 | GNUNET_BLOCK_TYPE_ANY = 0, |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * Data block (leaf) in the CHK tree. | 51 | * Data block (leaf) in the CHK tree. |
52 | */ | 52 | */ |
53 | GNUNET_BLOCK_TYPE_FS_DBLOCK = 1, | 53 | GNUNET_BLOCK_TYPE_FS_DBLOCK = 1, |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * Inner block in the CHK tree. | 56 | * Inner block in the CHK tree. |
57 | */ | 57 | */ |
58 | GNUNET_BLOCK_TYPE_FS_IBLOCK = 2, | 58 | GNUNET_BLOCK_TYPE_FS_IBLOCK = 2, |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Type of a block representing a keyword search result. Note that | 61 | * Type of a block representing a keyword search result. Note that |
62 | * the values for KBLOCK, SBLOCK and NBLOCK must be consecutive. | 62 | * the values for KBLOCK, SBLOCK and NBLOCK must be consecutive. |
63 | */ | 63 | */ |
64 | GNUNET_BLOCK_TYPE_FS_KBLOCK = 3, | 64 | GNUNET_BLOCK_TYPE_FS_KBLOCK = 3, |
65 | 65 | ||
66 | /** | 66 | /** |
67 | * Type of a block that is used to advertise content in a namespace. | 67 | * Type of a block that is used to advertise content in a namespace. |
68 | */ | 68 | */ |
69 | GNUNET_BLOCK_TYPE_FS_SBLOCK = 4, | 69 | GNUNET_BLOCK_TYPE_FS_SBLOCK = 4, |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Type of a block that is used to advertise a namespace. | 72 | * Type of a block that is used to advertise a namespace. |
73 | */ | 73 | */ |
74 | GNUNET_BLOCK_TYPE_FS_NBLOCK = 5, | 74 | GNUNET_BLOCK_TYPE_FS_NBLOCK = 5, |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * Type of a block representing a block to be encoded on demand from disk. | 77 | * Type of a block representing a block to be encoded on demand from disk. |
78 | * Should never appear on the network directly. | 78 | * Should never appear on the network directly. |
79 | */ | 79 | */ |
80 | GNUNET_BLOCK_TYPE_FS_ONDEMAND = 6, | 80 | GNUNET_BLOCK_TYPE_FS_ONDEMAND = 6, |
81 | 81 | ||
82 | /** | 82 | /** |
83 | * Type of a block that contains a HELLO for a peer (for | 83 | * Type of a block that contains a HELLO for a peer (for |
84 | * DHT find-peer operations). | 84 | * DHT find-peer operations). |
85 | */ | 85 | */ |
86 | GNUNET_BLOCK_TYPE_DHT_HELLO = 7, | 86 | GNUNET_BLOCK_TYPE_DHT_HELLO = 7, |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * Block for testing. | 89 | * Block for testing. |
90 | */ | 90 | */ |
91 | GNUNET_BLOCK_TYPE_TEST = 8, | 91 | GNUNET_BLOCK_TYPE_TEST = 8, |
92 | 92 | ||
93 | #if HAVE_MALICIOUS | 93 | #if HAVE_MALICIOUS |
94 | /** | 94 | /** |
95 | * Block for simulating malicious peers. | 95 | * Block for simulating malicious peers. |
96 | */ | 96 | */ |
97 | GNUNET_BLOCK_DHT_MALICIOUS_MESSAGE_TYPE = 9, | 97 | GNUNET_BLOCK_DHT_MALICIOUS_MESSAGE_TYPE = 9, |
98 | #endif | 98 | #endif |
99 | 99 | ||
100 | /** | 100 | /** |
101 | * Block for storing .gnunet-domains | 101 | * Block for storing .gnunet-domains |
102 | */ | 102 | */ |
103 | GNUNET_BLOCK_TYPE_DNS = 10 | 103 | GNUNET_BLOCK_TYPE_DNS = 10 |
104 | }; | 104 | }; |
105 | 105 | ||
106 | 106 | ||
107 | /** | 107 | /** |
108 | * Possible ways for how a block may relate to a query. | 108 | * Possible ways for how a block may relate to a query. |
109 | */ | 109 | */ |
110 | enum GNUNET_BLOCK_EvaluationResult | 110 | enum GNUNET_BLOCK_EvaluationResult |
111 | { | 111 | { |
112 | /** | 112 | /** |
113 | * Valid result, and there may be more. | 113 | * Valid result, and there may be more. |
114 | */ | 114 | */ |
115 | GNUNET_BLOCK_EVALUATION_OK_MORE = 0, | 115 | GNUNET_BLOCK_EVALUATION_OK_MORE = 0, |
116 | 116 | ||
117 | /** | 117 | /** |
118 | * Last possible valid result. | 118 | * Last possible valid result. |
119 | */ | 119 | */ |
120 | GNUNET_BLOCK_EVALUATION_OK_LAST = 1, | 120 | GNUNET_BLOCK_EVALUATION_OK_LAST = 1, |
121 | 121 | ||
122 | /** | 122 | /** |
123 | * Valid result, but suppressed because it is a duplicate. | 123 | * Valid result, but suppressed because it is a duplicate. |
124 | */ | 124 | */ |
125 | GNUNET_BLOCK_EVALUATION_OK_DUPLICATE = 2, | 125 | GNUNET_BLOCK_EVALUATION_OK_DUPLICATE = 2, |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * Block does not match query (invalid result) | 128 | * Block does not match query (invalid result) |
129 | */ | 129 | */ |
130 | GNUNET_BLOCK_EVALUATION_RESULT_INVALID = 3, | 130 | GNUNET_BLOCK_EVALUATION_RESULT_INVALID = 3, |
131 | 131 | ||
132 | /** | 132 | /** |
133 | * Query is valid, no reply given. | 133 | * Query is valid, no reply given. |
134 | */ | 134 | */ |
135 | GNUNET_BLOCK_EVALUATION_REQUEST_VALID = 4, | 135 | GNUNET_BLOCK_EVALUATION_REQUEST_VALID = 4, |
136 | 136 | ||
137 | /** | 137 | /** |
138 | * Query format does not match block type (invalid query). For | 138 | * Query format does not match block type (invalid query). For |
139 | * example, xquery not given or xquery_size not appropriate for | 139 | * example, xquery not given or xquery_size not appropriate for |
140 | * type. | 140 | * type. |
141 | */ | 141 | */ |
142 | GNUNET_BLOCK_EVALUATION_REQUEST_INVALID = 5, | 142 | GNUNET_BLOCK_EVALUATION_REQUEST_INVALID = 5, |
143 | 143 | ||
144 | /** | 144 | /** |
145 | * Specified block type not supported by this plugin. | 145 | * Specified block type not supported by this plugin. |
146 | */ | 146 | */ |
147 | GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED = 6 | 147 | GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED = 6 |
148 | }; | 148 | }; |
149 | 149 | ||
150 | 150 | ||
151 | /** | 151 | /** |
@@ -163,8 +163,7 @@ struct GNUNET_BLOCK_Context; | |||
163 | */ | 163 | */ |
164 | void | 164 | void |
165 | GNUNET_BLOCK_mingle_hash (const GNUNET_HashCode * in, | 165 | GNUNET_BLOCK_mingle_hash (const GNUNET_HashCode * in, |
166 | uint32_t mingle_number, | 166 | uint32_t mingle_number, GNUNET_HashCode * hc); |
167 | GNUNET_HashCode * hc); | ||
168 | 167 | ||
169 | 168 | ||
170 | /** | 169 | /** |
@@ -173,8 +172,9 @@ GNUNET_BLOCK_mingle_hash (const GNUNET_HashCode * in, | |||
173 | * @param cfg configuration to use | 172 | * @param cfg configuration to use |
174 | * @return NULL on error | 173 | * @return NULL on error |
175 | */ | 174 | */ |
176 | struct GNUNET_BLOCK_Context * | 175 | struct GNUNET_BLOCK_Context *GNUNET_BLOCK_context_create (const struct |
177 | GNUNET_BLOCK_context_create (const struct GNUNET_CONFIGURATION_Handle *cfg); | 176 | GNUNET_CONFIGURATION_Handle |
177 | *cfg); | ||
178 | 178 | ||
179 | 179 | ||
180 | /** | 180 | /** |
@@ -182,8 +182,7 @@ GNUNET_BLOCK_context_create (const struct GNUNET_CONFIGURATION_Handle *cfg); | |||
182 | * | 182 | * |
183 | * @param ctx context to destroy | 183 | * @param ctx context to destroy |
184 | */ | 184 | */ |
185 | void | 185 | void GNUNET_BLOCK_context_destroy (struct GNUNET_BLOCK_Context *ctx); |
186 | GNUNET_BLOCK_context_destroy (struct GNUNET_BLOCK_Context *ctx); | ||
187 | 186 | ||
188 | 187 | ||
189 | /** | 188 | /** |
@@ -206,14 +205,13 @@ GNUNET_BLOCK_context_destroy (struct GNUNET_BLOCK_Context *ctx); | |||
206 | */ | 205 | */ |
207 | enum GNUNET_BLOCK_EvaluationResult | 206 | enum GNUNET_BLOCK_EvaluationResult |
208 | GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx, | 207 | GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx, |
209 | enum GNUNET_BLOCK_Type type, | 208 | enum GNUNET_BLOCK_Type type, |
210 | const GNUNET_HashCode *query, | 209 | const GNUNET_HashCode * query, |
211 | struct GNUNET_CONTAINER_BloomFilter **bf, | 210 | struct GNUNET_CONTAINER_BloomFilter **bf, |
212 | int32_t bf_mutator, | 211 | int32_t bf_mutator, |
213 | const void *xquery, | 212 | const void *xquery, |
214 | size_t xquery_size, | 213 | size_t xquery_size, |
215 | const void *reply_block, | 214 | const void *reply_block, size_t reply_block_size); |
216 | size_t reply_block_size); | ||
217 | 215 | ||
218 | 216 | ||
219 | /** | 217 | /** |
@@ -231,10 +229,9 @@ GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx, | |||
231 | */ | 229 | */ |
232 | int | 230 | int |
233 | GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx, | 231 | GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx, |
234 | enum GNUNET_BLOCK_Type type, | 232 | enum GNUNET_BLOCK_Type type, |
235 | const void *block, | 233 | const void *block, |
236 | size_t block_size, | 234 | size_t block_size, GNUNET_HashCode * key); |
237 | GNUNET_HashCode *key); | ||
238 | 235 | ||
239 | 236 | ||
240 | #if 0 /* keep Emacsens' auto-indent happy */ | 237 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_block_plugin.h b/src/include/gnunet_block_plugin.h index 3d3fb4001..885842157 100644 --- a/src/include/gnunet_block_plugin.h +++ b/src/include/gnunet_block_plugin.h | |||
@@ -51,15 +51,14 @@ | |||
51 | * @return characterization of result | 51 | * @return characterization of result |
52 | */ | 52 | */ |
53 | typedef enum GNUNET_BLOCK_EvaluationResult | 53 | typedef enum GNUNET_BLOCK_EvaluationResult |
54 | (*GNUNET_BLOCK_EvaluationFunction) (void *cls, | 54 | (*GNUNET_BLOCK_EvaluationFunction) (void *cls, |
55 | enum GNUNET_BLOCK_Type type, | 55 | enum GNUNET_BLOCK_Type type, |
56 | const GNUNET_HashCode *query, | 56 | const GNUNET_HashCode * query, |
57 | struct GNUNET_CONTAINER_BloomFilter **bf, | 57 | struct GNUNET_CONTAINER_BloomFilter ** |
58 | int32_t bf_mutator, | 58 | bf, int32_t bf_mutator, |
59 | const void *xquery, | 59 | const void *xquery, size_t xquery_size, |
60 | size_t xquery_size, | 60 | const void *reply_block, |
61 | const void *reply_block, | 61 | size_t reply_block_size); |
62 | size_t reply_block_size); | ||
63 | 62 | ||
64 | 63 | ||
65 | /** | 64 | /** |
@@ -76,12 +75,11 @@ typedef enum GNUNET_BLOCK_EvaluationResult | |||
76 | * (or if extracting a key from a block of this type does not work) | 75 | * (or if extracting a key from a block of this type does not work) |
77 | */ | 76 | */ |
78 | typedef int | 77 | typedef int |
79 | (*GNUNET_BLOCK_GetKeyFunction) (void *cls, | 78 | (*GNUNET_BLOCK_GetKeyFunction) (void *cls, |
80 | enum GNUNET_BLOCK_Type type, | 79 | enum GNUNET_BLOCK_Type type, |
81 | const void *block, | 80 | const void *block, |
82 | size_t block_size, | 81 | size_t block_size, GNUNET_HashCode * key); |
83 | GNUNET_HashCode *key); | 82 | |
84 | |||
85 | 83 | ||
86 | 84 | ||
87 | /** | 85 | /** |
diff --git a/src/include/gnunet_chat_service.h b/src/include/gnunet_chat_service.h index 0a45cf533..723c280e6 100644 --- a/src/include/gnunet_chat_service.h +++ b/src/include/gnunet_chat_service.h | |||
@@ -47,41 +47,41 @@ extern "C" | |||
47 | * Options for messaging. Compatible options can be OR'ed together. | 47 | * Options for messaging. Compatible options can be OR'ed together. |
48 | */ | 48 | */ |
49 | enum GNUNET_CHAT_MsgOptions | 49 | enum GNUNET_CHAT_MsgOptions |
50 | { | 50 | { |
51 | /** | 51 | /** |
52 | * No special options. | 52 | * No special options. |
53 | */ | 53 | */ |
54 | GNUNET_CHAT_MSG_OPTION_NONE = 0, | 54 | GNUNET_CHAT_MSG_OPTION_NONE = 0, |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * Encrypt the message so that only the receiver can decrypt it. | 57 | * Encrypt the message so that only the receiver can decrypt it. |
58 | */ | 58 | */ |
59 | GNUNET_CHAT_MSG_PRIVATE = 1, | 59 | GNUNET_CHAT_MSG_PRIVATE = 1, |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * Hide the identity of the sender. | 62 | * Hide the identity of the sender. |
63 | */ | 63 | */ |
64 | GNUNET_CHAT_MSG_ANONYMOUS = 2, | 64 | GNUNET_CHAT_MSG_ANONYMOUS = 2, |
65 | 65 | ||
66 | /** | 66 | /** |
67 | * Sign the content, authenticating the sender (using the provided private | 67 | * Sign the content, authenticating the sender (using the provided private |
68 | * key, which may represent a pseudonym). | 68 | * key, which may represent a pseudonym). |
69 | */ | 69 | */ |
70 | GNUNET_CHAT_MSG_AUTHENTICATED = 4, | 70 | GNUNET_CHAT_MSG_AUTHENTICATED = 4, |
71 | 71 | ||
72 | /** | 72 | /** |
73 | * Require signed acknowledgment before completing delivery (and of course, | 73 | * Require signed acknowledgment before completing delivery (and of course, |
74 | * only acknowledge if delivery is guaranteed). | 74 | * only acknowledge if delivery is guaranteed). |
75 | */ | 75 | */ |
76 | GNUNET_CHAT_MSG_ACKNOWLEDGED = 8, | 76 | GNUNET_CHAT_MSG_ACKNOWLEDGED = 8, |
77 | 77 | ||
78 | /** | 78 | /** |
79 | * Authenticate for the receiver, but ensure that receiver cannot prove | 79 | * Authenticate for the receiver, but ensure that receiver cannot prove |
80 | * authenticity to third parties later. (not yet implemented) | 80 | * authenticity to third parties later. (not yet implemented) |
81 | */ | 81 | */ |
82 | GNUNET_CHAT_MSG_OFF_THE_RECORD = 16, | 82 | GNUNET_CHAT_MSG_OFF_THE_RECORD = 16, |
83 | 83 | ||
84 | }; | 84 | }; |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Handle for a (joined) chat room. | 87 | * Handle for a (joined) chat room. |
@@ -110,12 +110,15 @@ typedef int (*GNUNET_CHAT_JoinCallback) (void *cls); | |||
110 | * accept (but user is away), GNUNET_SYSERR to signal denied delivery | 110 | * accept (but user is away), GNUNET_SYSERR to signal denied delivery |
111 | */ | 111 | */ |
112 | typedef int (*GNUNET_CHAT_MessageCallback) (void *cls, | 112 | typedef int (*GNUNET_CHAT_MessageCallback) (void *cls, |
113 | struct GNUNET_CHAT_Room *room, | 113 | struct GNUNET_CHAT_Room * room, |
114 | const GNUNET_HashCode *sender, | 114 | const GNUNET_HashCode * sender, |
115 | const struct GNUNET_CONTAINER_MetaData *member_info, | 115 | const struct |
116 | const char *message, | 116 | GNUNET_CONTAINER_MetaData * |
117 | struct GNUNET_TIME_Absolute timestamp, | 117 | member_info, const char *message, |
118 | enum GNUNET_CHAT_MsgOptions options); | 118 | struct GNUNET_TIME_Absolute |
119 | timestamp, | ||
120 | enum GNUNET_CHAT_MsgOptions | ||
121 | options); | ||
119 | 122 | ||
120 | /** | 123 | /** |
121 | * Callback used for notification that another room member has joined or left. | 124 | * Callback used for notification that another room member has joined or left. |
@@ -128,9 +131,14 @@ typedef int (*GNUNET_CHAT_MessageCallback) (void *cls, | |||
128 | * @return GNUNET_OK | 131 | * @return GNUNET_OK |
129 | */ | 132 | */ |
130 | typedef int (*GNUNET_CHAT_MemberListCallback) (void *cls, | 133 | typedef int (*GNUNET_CHAT_MemberListCallback) (void *cls, |
131 | const struct GNUNET_CONTAINER_MetaData *member_info, | 134 | const struct |
132 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *member_id, | 135 | GNUNET_CONTAINER_MetaData * |
133 | enum GNUNET_CHAT_MsgOptions options); | 136 | member_info, |
137 | const struct | ||
138 | GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded | ||
139 | * member_id, | ||
140 | enum GNUNET_CHAT_MsgOptions | ||
141 | options); | ||
134 | 142 | ||
135 | /** | 143 | /** |
136 | * Callback used for message delivery confirmations. | 144 | * Callback used for message delivery confirmations. |
@@ -144,10 +152,12 @@ typedef int (*GNUNET_CHAT_MemberListCallback) (void *cls, | |||
144 | * confirmations from anyone for this message | 152 | * confirmations from anyone for this message |
145 | */ | 153 | */ |
146 | typedef int (*GNUNET_CHAT_MessageConfirmation) (void *cls, | 154 | typedef int (*GNUNET_CHAT_MessageConfirmation) (void *cls, |
147 | struct GNUNET_CHAT_Room *room, | 155 | struct GNUNET_CHAT_Room * room, |
148 | uint32_t orig_seq_number, | 156 | uint32_t orig_seq_number, |
149 | struct GNUNET_TIME_Absolute timestamp, | 157 | struct GNUNET_TIME_Absolute |
150 | const GNUNET_HashCode *receiver); | 158 | timestamp, |
159 | const GNUNET_HashCode * | ||
160 | receiver); | ||
151 | 161 | ||
152 | /** | 162 | /** |
153 | * Join a chat room. | 163 | * Join a chat room. |
@@ -173,21 +183,26 @@ typedef int (*GNUNET_CHAT_MessageConfirmation) (void *cls, | |||
173 | * @param me member ID (pseudonym) | 183 | * @param me member ID (pseudonym) |
174 | * @return NULL on error | 184 | * @return NULL on error |
175 | */ | 185 | */ |
176 | struct GNUNET_CHAT_Room * | 186 | struct GNUNET_CHAT_Room *GNUNET_CHAT_join_room (const struct |
177 | GNUNET_CHAT_join_room (const struct GNUNET_CONFIGURATION_Handle *cfg, | 187 | GNUNET_CONFIGURATION_Handle |
178 | const char *nick_name, | 188 | *cfg, const char *nick_name, |
179 | struct GNUNET_CONTAINER_MetaData *member_info, | 189 | struct GNUNET_CONTAINER_MetaData |
180 | const char *room_name, | 190 | *member_info, |
181 | enum GNUNET_CHAT_MsgOptions msg_options, | 191 | const char *room_name, |
182 | GNUNET_CHAT_JoinCallback joinCallback, | 192 | enum GNUNET_CHAT_MsgOptions |
183 | void *join_cls, | 193 | msg_options, |
184 | GNUNET_CHAT_MessageCallback messageCallback, | 194 | GNUNET_CHAT_JoinCallback |
185 | void *message_cls, | 195 | joinCallback, void *join_cls, |
186 | GNUNET_CHAT_MemberListCallback memberCallback, | 196 | GNUNET_CHAT_MessageCallback |
187 | void *member_cls, | 197 | messageCallback, |
188 | GNUNET_CHAT_MessageConfirmation confirmationCallback, | 198 | void *message_cls, |
189 | void *confirmation_cls, | 199 | GNUNET_CHAT_MemberListCallback |
190 | GNUNET_HashCode *me); | 200 | memberCallback, |
201 | void *member_cls, | ||
202 | GNUNET_CHAT_MessageConfirmation | ||
203 | confirmationCallback, | ||
204 | void *confirmation_cls, | ||
205 | GNUNET_HashCode * me); | ||
191 | 206 | ||
192 | /** | 207 | /** |
193 | * Send a message. | 208 | * Send a message. |
@@ -202,15 +217,14 @@ void | |||
202 | GNUNET_CHAT_send_message (struct GNUNET_CHAT_Room *room, | 217 | GNUNET_CHAT_send_message (struct GNUNET_CHAT_Room *room, |
203 | const char *message, | 218 | const char *message, |
204 | enum GNUNET_CHAT_MsgOptions options, | 219 | enum GNUNET_CHAT_MsgOptions options, |
205 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *receiver, | 220 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded |
206 | uint32_t *sequence_number); | 221 | *receiver, uint32_t * sequence_number); |
207 | 222 | ||
208 | 223 | ||
209 | /** | 224 | /** |
210 | * Leave a chat room. | 225 | * Leave a chat room. |
211 | */ | 226 | */ |
212 | void | 227 | void GNUNET_CHAT_leave_room (struct GNUNET_CHAT_Room *chat_room); |
213 | GNUNET_CHAT_leave_room (struct GNUNET_CHAT_Room *chat_room); | ||
214 | 228 | ||
215 | 229 | ||
216 | #if 0 | 230 | #if 0 |
diff --git a/src/include/gnunet_client_lib.h b/src/include/gnunet_client_lib.h index 41dbe4efc..343960426 100644 --- a/src/include/gnunet_client_lib.h +++ b/src/include/gnunet_client_lib.h | |||
@@ -68,7 +68,7 @@ struct GNUNET_CLIENT_Connection *GNUNET_CLIENT_connect (const char | |||
68 | */ | 68 | */ |
69 | void | 69 | void |
70 | GNUNET_CLIENT_ignore_shutdown (struct GNUNET_CLIENT_Connection *h, | 70 | GNUNET_CLIENT_ignore_shutdown (struct GNUNET_CLIENT_Connection *h, |
71 | int do_ignore); | 71 | int do_ignore); |
72 | 72 | ||
73 | 73 | ||
74 | 74 | ||
@@ -88,7 +88,7 @@ GNUNET_CLIENT_ignore_shutdown (struct GNUNET_CLIENT_Connection *h, | |||
88 | * handle be completed? | 88 | * handle be completed? |
89 | */ | 89 | */ |
90 | void GNUNET_CLIENT_disconnect (struct GNUNET_CLIENT_Connection *sock, | 90 | void GNUNET_CLIENT_disconnect (struct GNUNET_CLIENT_Connection *sock, |
91 | int finish_pending_write); | 91 | int finish_pending_write); |
92 | 92 | ||
93 | /** | 93 | /** |
94 | * Type of a function to call when we receive a message | 94 | * Type of a function to call when we receive a message |
@@ -111,8 +111,7 @@ typedef void (*GNUNET_CLIENT_MessageHandler) (void *cls, | |||
111 | * GNUNET_YES on running | 111 | * GNUNET_YES on running |
112 | * GNUNET_SYSERR on failure to transmit message | 112 | * GNUNET_SYSERR on failure to transmit message |
113 | */ | 113 | */ |
114 | typedef void (*GNUNET_CLIENT_ShutdownTask) (void *cls, | 114 | typedef void (*GNUNET_CLIENT_ShutdownTask) (void *cls, int reason); |
115 | int reason); | ||
116 | 115 | ||
117 | /** | 116 | /** |
118 | * Read from the service. | 117 | * Read from the service. |
@@ -125,7 +124,7 @@ typedef void (*GNUNET_CLIENT_ShutdownTask) (void *cls, | |||
125 | void GNUNET_CLIENT_receive (struct GNUNET_CLIENT_Connection *sock, | 124 | void GNUNET_CLIENT_receive (struct GNUNET_CLIENT_Connection *sock, |
126 | GNUNET_CLIENT_MessageHandler handler, | 125 | GNUNET_CLIENT_MessageHandler handler, |
127 | void *handler_cls, | 126 | void *handler_cls, |
128 | struct GNUNET_TIME_Relative timeout); | 127 | struct GNUNET_TIME_Relative timeout); |
129 | 128 | ||
130 | 129 | ||
131 | /** | 130 | /** |
@@ -155,13 +154,12 @@ struct GNUNET_CLIENT_TransmitHandle; | |||
155 | * using GNUNET_CONNECTION_notify_transmit_ready_cancel) | 154 | * using GNUNET_CONNECTION_notify_transmit_ready_cancel) |
156 | */ | 155 | */ |
157 | struct GNUNET_CLIENT_TransmitHandle | 156 | struct GNUNET_CLIENT_TransmitHandle |
158 | *GNUNET_CLIENT_notify_transmit_ready (struct GNUNET_CLIENT_Connection *sock, | 157 | *GNUNET_CLIENT_notify_transmit_ready (struct GNUNET_CLIENT_Connection *sock, |
159 | size_t size, | 158 | size_t size, |
160 | struct GNUNET_TIME_Relative timeout, | 159 | struct GNUNET_TIME_Relative timeout, |
161 | int auto_retry, | 160 | int auto_retry, |
162 | GNUNET_CONNECTION_TransmitReadyNotify | 161 | GNUNET_CONNECTION_TransmitReadyNotify |
163 | notify, | 162 | notify, void *notify_cls); |
164 | void *notify_cls); | ||
165 | 163 | ||
166 | 164 | ||
167 | /** | 165 | /** |
@@ -170,7 +168,8 @@ struct GNUNET_CLIENT_TransmitHandle | |||
170 | * @param th handle from the original request. | 168 | * @param th handle from the original request. |
171 | */ | 169 | */ |
172 | void | 170 | void |
173 | GNUNET_CLIENT_notify_transmit_ready_cancel (struct GNUNET_CLIENT_TransmitHandle *th); | 171 | GNUNET_CLIENT_notify_transmit_ready_cancel (struct GNUNET_CLIENT_TransmitHandle |
172 | *th); | ||
174 | 173 | ||
175 | 174 | ||
176 | /** | 175 | /** |
@@ -196,11 +195,11 @@ GNUNET_CLIENT_notify_transmit_ready_cancel (struct GNUNET_CLIENT_TransmitHandle | |||
196 | */ | 195 | */ |
197 | int | 196 | int |
198 | GNUNET_CLIENT_transmit_and_get_response (struct GNUNET_CLIENT_Connection *sock, | 197 | GNUNET_CLIENT_transmit_and_get_response (struct GNUNET_CLIENT_Connection *sock, |
199 | const struct GNUNET_MessageHeader *hdr, | 198 | const struct GNUNET_MessageHeader *hdr, |
200 | struct GNUNET_TIME_Relative timeout, | 199 | struct GNUNET_TIME_Relative timeout, |
201 | int auto_retry, | 200 | int auto_retry, |
202 | GNUNET_CLIENT_MessageHandler rn, | 201 | GNUNET_CLIENT_MessageHandler rn, |
203 | void *rn_cls); | 202 | void *rn_cls); |
204 | 203 | ||
205 | 204 | ||
206 | /** | 205 | /** |
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 7e4f82ad4..036249e34 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -45,7 +45,7 @@ | |||
45 | #ifdef HAVE_STDARG_H | 45 | #ifdef HAVE_STDARG_H |
46 | #include <stdarg.h> | 46 | #include <stdarg.h> |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Version of the API (for entire gnunetutil.so library). | 50 | * Version of the API (for entire gnunetutil.so library). |
51 | */ | 51 | */ |
@@ -193,8 +193,7 @@ GNUNET_log_from (enum GNUNET_ErrorType kind, | |||
193 | * @param n number of log calls to ignore | 193 | * @param n number of log calls to ignore |
194 | * @param check_reset GNUNET_YES to assert that the log skip counter is currently zero | 194 | * @param check_reset GNUNET_YES to assert that the log skip counter is currently zero |
195 | */ | 195 | */ |
196 | void | 196 | void GNUNET_log_skip (unsigned int n, int check_reset); |
197 | GNUNET_log_skip (unsigned int n, int check_reset); | ||
198 | 197 | ||
199 | 198 | ||
200 | /** | 199 | /** |
@@ -206,8 +205,7 @@ GNUNET_log_skip (unsigned int n, int check_reset); | |||
206 | * @return GNUNET_OK on success, GNUNET_SYSERR if logfile could not be opened | 205 | * @return GNUNET_OK on success, GNUNET_SYSERR if logfile could not be opened |
207 | */ | 206 | */ |
208 | int | 207 | int |
209 | GNUNET_log_setup (const char *comp, | 208 | GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile); |
210 | const char *loglevel, const char *logfile); | ||
211 | 209 | ||
212 | 210 | ||
213 | /** | 211 | /** |
@@ -236,7 +234,7 @@ void GNUNET_logger_remove (GNUNET_Logger logger, void *logger_cls); | |||
236 | * @param hc the hash code | 234 | * @param hc the hash code |
237 | * @return string | 235 | * @return string |
238 | */ | 236 | */ |
239 | const char *GNUNET_h2s (const GNUNET_HashCode *hc); | 237 | const char *GNUNET_h2s (const GNUNET_HashCode * hc); |
240 | 238 | ||
241 | 239 | ||
242 | /** | 240 | /** |
@@ -248,7 +246,7 @@ const char *GNUNET_h2s (const GNUNET_HashCode *hc); | |||
248 | * @param hc the hash code | 246 | * @param hc the hash code |
249 | * @return string | 247 | * @return string |
250 | */ | 248 | */ |
251 | const char *GNUNET_h2s_full (const GNUNET_HashCode *hc); | 249 | const char *GNUNET_h2s_full (const GNUNET_HashCode * hc); |
252 | 250 | ||
253 | 251 | ||
254 | /** | 252 | /** |
@@ -273,8 +271,7 @@ const char *GNUNET_i2s (const struct GNUNET_PeerIdentity *pid); | |||
273 | * @return nicely formatted string for the address | 271 | * @return nicely formatted string for the address |
274 | * will be overwritten by next call to GNUNET_a2s. | 272 | * will be overwritten by next call to GNUNET_a2s. |
275 | */ | 273 | */ |
276 | const char *GNUNET_a2s (const struct sockaddr *addr, | 274 | const char *GNUNET_a2s (const struct sockaddr *addr, socklen_t addrlen); |
277 | socklen_t addrlen); | ||
278 | 275 | ||
279 | /** | 276 | /** |
280 | * Convert error type to string. | 277 | * Convert error type to string. |
@@ -515,7 +512,8 @@ void *GNUNET_xmalloc_ (size_t size, const char *filename, int linenumber); | |||
515 | * @param linenumber line where this call is being made (for debugging) | 512 | * @param linenumber line where this call is being made (for debugging) |
516 | * @return allocated memory, never NULL | 513 | * @return allocated memory, never NULL |
517 | */ | 514 | */ |
518 | void *GNUNET_xmemdup_ (const void *buf, size_t size, const char *filename, int linenumber); | 515 | void *GNUNET_xmemdup_ (const void *buf, size_t size, const char *filename, |
516 | int linenumber); | ||
519 | 517 | ||
520 | 518 | ||
521 | /** | 519 | /** |
@@ -569,7 +567,8 @@ char *GNUNET_xstrdup_ (const char *str, const char *filename, int linenumber); | |||
569 | * @param linenumber line where this call is being made (for debugging) | 567 | * @param linenumber line where this call is being made (for debugging) |
570 | * @return the duplicated string | 568 | * @return the duplicated string |
571 | */ | 569 | */ |
572 | char *GNUNET_xstrndup_ (const char *str, size_t len, const char *filename, int linenumber); | 570 | char *GNUNET_xstrndup_ (const char *str, size_t len, const char *filename, |
571 | int linenumber); | ||
573 | 572 | ||
574 | /** | 573 | /** |
575 | * Grow an array, the new elements are zeroed out. | 574 | * Grow an array, the new elements are zeroed out. |
@@ -596,11 +595,11 @@ void GNUNET_xgrow_ (void **old, | |||
596 | 595 | ||
597 | 596 | ||
598 | #if __STDC_VERSION__ < 199901L | 597 | #if __STDC_VERSION__ < 199901L |
599 | # if __GNUC__ >= 2 | 598 | #if __GNUC__ >= 2 |
600 | # define __func__ __FUNCTION__ | 599 | #define __func__ __FUNCTION__ |
601 | # else | 600 | #else |
602 | # define __func__ "<unknown>" | 601 | #define __func__ "<unknown>" |
603 | # endif | 602 | #endif |
604 | #endif | 603 | #endif |
605 | 604 | ||
606 | #endif /*GNUNET_COMMON_H_ */ | 605 | #endif /*GNUNET_COMMON_H_ */ |
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h index 642bbde53..4ecb3539f 100644 --- a/src/include/gnunet_configuration_lib.h +++ b/src/include/gnunet_configuration_lib.h | |||
@@ -58,8 +58,9 @@ struct GNUNET_CONFIGURATION_Handle *GNUNET_CONFIGURATION_create (void); | |||
58 | * @param cfg configuration to duplicate | 58 | * @param cfg configuration to duplicate |
59 | * @return duplicate configuration | 59 | * @return duplicate configuration |
60 | */ | 60 | */ |
61 | struct GNUNET_CONFIGURATION_Handle * | 61 | struct GNUNET_CONFIGURATION_Handle *GNUNET_CONFIGURATION_dup (const struct |
62 | GNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *cfg); | 62 | GNUNET_CONFIGURATION_Handle |
63 | *cfg); | ||
63 | 64 | ||
64 | 65 | ||
65 | /** | 66 | /** |
@@ -113,9 +114,10 @@ int GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
113 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 114 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
114 | */ | 115 | */ |
115 | int | 116 | int |
116 | GNUNET_CONFIGURATION_write_diffs(const struct GNUNET_CONFIGURATION_Handle *cfgDefault, | 117 | GNUNET_CONFIGURATION_write_diffs (const struct GNUNET_CONFIGURATION_Handle |
117 | const struct GNUNET_CONFIGURATION_Handle *cfgNew, | 118 | *cfgDefault, |
118 | const char* filename); | 119 | const struct GNUNET_CONFIGURATION_Handle |
120 | *cfgNew, const char *filename); | ||
119 | 121 | ||
120 | /** | 122 | /** |
121 | * Test if there are configuration options that were | 123 | * Test if there are configuration options that were |
@@ -124,7 +126,8 @@ GNUNET_CONFIGURATION_write_diffs(const struct GNUNET_CONFIGURATION_Handle *cfgDe | |||
124 | * @param cfg configuration to inspect | 126 | * @param cfg configuration to inspect |
125 | * @return GNUNET_NO if clean, GNUNET_YES if dirty, GNUNET_SYSERR on error (i.e. last save failed) | 127 | * @return GNUNET_NO if clean, GNUNET_YES if dirty, GNUNET_SYSERR on error (i.e. last save failed) |
126 | */ | 128 | */ |
127 | int GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg); | 129 | int GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle |
130 | *cfg); | ||
128 | 131 | ||
129 | 132 | ||
130 | /** | 133 | /** |
@@ -135,10 +138,10 @@ int GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg | |||
135 | * @param option name of the option | 138 | * @param option name of the option |
136 | * @param value value of the option | 139 | * @param value value of the option |
137 | */ | 140 | */ |
138 | typedef void (*GNUNET_CONFIGURATION_Iterator)(void *cls, | 141 | typedef void (*GNUNET_CONFIGURATION_Iterator) (void *cls, |
139 | const char *section, | 142 | const char *section, |
140 | const char *option, | 143 | const char *option, |
141 | const char *value); | 144 | const char *value); |
142 | 145 | ||
143 | 146 | ||
144 | /** | 147 | /** |
@@ -147,8 +150,8 @@ typedef void (*GNUNET_CONFIGURATION_Iterator)(void *cls, | |||
147 | * @param cls closure | 150 | * @param cls closure |
148 | * @param section name of the section | 151 | * @param section name of the section |
149 | */ | 152 | */ |
150 | typedef void (*GNUNET_CONFIGURATION_Section_Iterator)(void *cls, | 153 | typedef void (*GNUNET_CONFIGURATION_Section_Iterator) (void *cls, |
151 | const char *section); | 154 | const char *section); |
152 | 155 | ||
153 | 156 | ||
154 | /** | 157 | /** |
@@ -158,9 +161,9 @@ typedef void (*GNUNET_CONFIGURATION_Section_Iterator)(void *cls, | |||
158 | * @param iter function to call on each option | 161 | * @param iter function to call on each option |
159 | * @param iter_cls closure for iter | 162 | * @param iter_cls closure for iter |
160 | */ | 163 | */ |
161 | void GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg, | 164 | void GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle |
162 | GNUNET_CONFIGURATION_Iterator iter, | 165 | *cfg, GNUNET_CONFIGURATION_Iterator iter, |
163 | void *iter_cls); | 166 | void *iter_cls); |
164 | 167 | ||
165 | 168 | ||
166 | /** | 169 | /** |
@@ -170,9 +173,10 @@ void GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg | |||
170 | * @param iter function to call on each section | 173 | * @param iter function to call on each section |
171 | * @param iter_cls closure for iter | 174 | * @param iter_cls closure for iter |
172 | */ | 175 | */ |
173 | void GNUNET_CONFIGURATION_iterate_sections (const struct GNUNET_CONFIGURATION_Handle *cfg, | 176 | void GNUNET_CONFIGURATION_iterate_sections (const struct |
174 | GNUNET_CONFIGURATION_Section_Iterator iter, | 177 | GNUNET_CONFIGURATION_Handle *cfg, |
175 | void *iter_cls); | 178 | GNUNET_CONFIGURATION_Section_Iterator |
179 | iter, void *iter_cls); | ||
176 | 180 | ||
177 | 181 | ||
178 | /** | 182 | /** |
@@ -181,8 +185,8 @@ void GNUNET_CONFIGURATION_iterate_sections (const struct GNUNET_CONFIGURATION_Ha | |||
181 | * @param cfg configuration to inspect | 185 | * @param cfg configuration to inspect |
182 | * @param section name of the section to remove | 186 | * @param section name of the section to remove |
183 | */ | 187 | */ |
184 | void GNUNET_CONFIGURATION_remove_section (struct GNUNET_CONFIGURATION_Handle *cfg, | 188 | void GNUNET_CONFIGURATION_remove_section (struct GNUNET_CONFIGURATION_Handle |
185 | const char *section); | 189 | *cfg, const char *section); |
186 | 190 | ||
187 | /** | 191 | /** |
188 | * Get a configuration value that should be a number. | 192 | * Get a configuration value that should be a number. |
@@ -193,8 +197,9 @@ void GNUNET_CONFIGURATION_remove_section (struct GNUNET_CONFIGURATION_Handle *cf | |||
193 | * @param number where to store the numeric value of the option | 197 | * @param number where to store the numeric value of the option |
194 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 198 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
195 | */ | 199 | */ |
196 | int GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Handle | 200 | int GNUNET_CONFIGURATION_get_value_number (const struct |
197 | *cfg, const char *section, | 201 | GNUNET_CONFIGURATION_Handle *cfg, |
202 | const char *section, | ||
198 | const char *option, | 203 | const char *option, |
199 | unsigned long long *number); | 204 | unsigned long long *number); |
200 | 205 | ||
@@ -208,10 +213,11 @@ int GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Han | |||
208 | * @param time set to the time value stored in the configuration | 213 | * @param time set to the time value stored in the configuration |
209 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 214 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
210 | */ | 215 | */ |
211 | int GNUNET_CONFIGURATION_get_value_time (const struct GNUNET_CONFIGURATION_Handle | 216 | int GNUNET_CONFIGURATION_get_value_time (const struct |
212 | *cfg, const char *section, | 217 | GNUNET_CONFIGURATION_Handle *cfg, |
213 | const char *option, | 218 | const char *section, |
214 | struct GNUNET_TIME_Relative *time); | 219 | const char *option, |
220 | struct GNUNET_TIME_Relative *time); | ||
215 | 221 | ||
216 | 222 | ||
217 | /** | 223 | /** |
@@ -222,8 +228,9 @@ int GNUNET_CONFIGURATION_get_value_time (const struct GNUNET_CONFIGURATION_Handl | |||
222 | * @param option option of interest | 228 | * @param option option of interest |
223 | * @return GNUNET_YES if so, GNUNET_NO if not. | 229 | * @return GNUNET_YES if so, GNUNET_NO if not. |
224 | */ | 230 | */ |
225 | int GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg, | 231 | int GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle |
226 | const char *section, const char *option); | 232 | *cfg, const char *section, |
233 | const char *option); | ||
227 | 234 | ||
228 | 235 | ||
229 | /** | 236 | /** |
@@ -236,8 +243,9 @@ int GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *c | |||
236 | * value, or NULL if option is not specified | 243 | * value, or NULL if option is not specified |
237 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 244 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
238 | */ | 245 | */ |
239 | int GNUNET_CONFIGURATION_get_value_string (const struct GNUNET_CONFIGURATION_Handle | 246 | int GNUNET_CONFIGURATION_get_value_string (const struct |
240 | *cfg, const char *section, | 247 | GNUNET_CONFIGURATION_Handle *cfg, |
248 | const char *section, | ||
241 | const char *option, char **value); | 249 | const char *option, char **value); |
242 | 250 | ||
243 | 251 | ||
@@ -255,8 +263,7 @@ int GNUNET_CONFIGURATION_get_value_string (const struct GNUNET_CONFIGURATION_Han | |||
255 | int GNUNET_CONFIGURATION_get_value_filename (const struct | 263 | int GNUNET_CONFIGURATION_get_value_filename (const struct |
256 | GNUNET_CONFIGURATION_Handle *cfg, | 264 | GNUNET_CONFIGURATION_Handle *cfg, |
257 | const char *section, | 265 | const char *section, |
258 | const char *option, | 266 | const char *option, char **value); |
259 | char **value); | ||
260 | 267 | ||
261 | /** | 268 | /** |
262 | * Iterate over the set of filenames stored in a configuration value. | 269 | * Iterate over the set of filenames stored in a configuration value. |
@@ -285,10 +292,11 @@ int GNUNET_CONFIGURATION_iterate_value_filenames (const struct | |||
285 | * @param iter_cls closure for iter | 292 | * @param iter_cls closure for iter |
286 | */ | 293 | */ |
287 | void | 294 | void |
288 | GNUNET_CONFIGURATION_iterate_section_values (const struct GNUNET_CONFIGURATION_Handle *cfg, | 295 | GNUNET_CONFIGURATION_iterate_section_values (const struct |
289 | const char *section, | 296 | GNUNET_CONFIGURATION_Handle *cfg, |
290 | GNUNET_CONFIGURATION_Iterator iter, | 297 | const char *section, |
291 | void *iter_cls); | 298 | GNUNET_CONFIGURATION_Iterator iter, |
299 | void *iter_cls); | ||
292 | 300 | ||
293 | /** | 301 | /** |
294 | * Get a configuration value that should be in a set of | 302 | * Get a configuration value that should be in a set of |
@@ -302,8 +310,9 @@ GNUNET_CONFIGURATION_iterate_section_values (const struct GNUNET_CONFIGURATION_H | |||
302 | * or NULL if option is not specified and no default given | 310 | * or NULL if option is not specified and no default given |
303 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 311 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
304 | */ | 312 | */ |
305 | int GNUNET_CONFIGURATION_get_value_choice (const struct GNUNET_CONFIGURATION_Handle | 313 | int GNUNET_CONFIGURATION_get_value_choice (const struct |
306 | *cfg, const char *section, | 314 | GNUNET_CONFIGURATION_Handle *cfg, |
315 | const char *section, | ||
307 | const char *option, | 316 | const char *option, |
308 | const char **choices, | 317 | const char **choices, |
309 | const char **value); | 318 | const char **value); |
@@ -317,8 +326,9 @@ int GNUNET_CONFIGURATION_get_value_choice (const struct GNUNET_CONFIGURATION_Han | |||
317 | * @param option option of interest | 326 | * @param option option of interest |
318 | * @return GNUNET_YES, GNUNET_NO or if option has no valid value, GNUNET_SYSERR | 327 | * @return GNUNET_YES, GNUNET_NO or if option has no valid value, GNUNET_SYSERR |
319 | */ | 328 | */ |
320 | int GNUNET_CONFIGURATION_get_value_yesno (const struct GNUNET_CONFIGURATION_Handle | 329 | int GNUNET_CONFIGURATION_get_value_yesno (const struct |
321 | *cfg, const char *section, | 330 | GNUNET_CONFIGURATION_Handle *cfg, |
331 | const char *section, | ||
322 | const char *option); | 332 | const char *option); |
323 | 333 | ||
324 | /** | 334 | /** |
@@ -330,8 +340,9 @@ int GNUNET_CONFIGURATION_get_value_yesno (const struct GNUNET_CONFIGURATION_Hand | |||
330 | * @param orig string to $-expand (will be freed!) | 340 | * @param orig string to $-expand (will be freed!) |
331 | * @return $-expanded string | 341 | * @return $-expanded string |
332 | */ | 342 | */ |
333 | char *GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle | 343 | char *GNUNET_CONFIGURATION_expand_dollar (const struct |
334 | *cfg, char *orig); | 344 | GNUNET_CONFIGURATION_Handle *cfg, |
345 | char *orig); | ||
335 | 346 | ||
336 | 347 | ||
337 | /** | 348 | /** |
diff --git a/src/include/gnunet_connection_lib.h b/src/include/gnunet_connection_lib.h index 3184e821b..00b97d903 100644 --- a/src/include/gnunet_connection_lib.h +++ b/src/include/gnunet_connection_lib.h | |||
@@ -80,9 +80,11 @@ struct GNUNET_CONNECTION_Credentials | |||
80 | * for unknown address family (will be denied). | 80 | * for unknown address family (will be denied). |
81 | */ | 81 | */ |
82 | typedef int (*GNUNET_CONNECTION_AccessCheck) (void *cls, | 82 | typedef int (*GNUNET_CONNECTION_AccessCheck) (void *cls, |
83 | const struct GNUNET_CONNECTION_Credentials *ucred, | 83 | const struct |
84 | const struct sockaddr * addr, | 84 | GNUNET_CONNECTION_Credentials * |
85 | socklen_t addrlen); | 85 | ucred, |
86 | const struct sockaddr * addr, | ||
87 | socklen_t addrlen); | ||
86 | 88 | ||
87 | 89 | ||
88 | /** | 90 | /** |
@@ -98,10 +100,10 @@ typedef int (*GNUNET_CONNECTION_AccessCheck) (void *cls, | |||
98 | * @param errCode value of errno (on errors receiving) | 100 | * @param errCode value of errno (on errors receiving) |
99 | */ | 101 | */ |
100 | typedef void (*GNUNET_CONNECTION_Receiver) (void *cls, | 102 | typedef void (*GNUNET_CONNECTION_Receiver) (void *cls, |
101 | const void *buf, | 103 | const void *buf, |
102 | size_t available, | 104 | size_t available, |
103 | const struct sockaddr * addr, | 105 | const struct sockaddr * addr, |
104 | socklen_t addrlen, int errCode); | 106 | socklen_t addrlen, int errCode); |
105 | 107 | ||
106 | /** | 108 | /** |
107 | * Set the persist option on this connection handle. Indicates | 109 | * Set the persist option on this connection handle. Indicates |
@@ -110,8 +112,7 @@ typedef void (*GNUNET_CONNECTION_Receiver) (void *cls, | |||
110 | * | 112 | * |
111 | * @param sock the connection to set persistent | 113 | * @param sock the connection to set persistent |
112 | */ | 114 | */ |
113 | void | 115 | void GNUNET_CONNECTION_persist_ (struct GNUNET_CONNECTION_Handle *sock); |
114 | GNUNET_CONNECTION_persist_(struct GNUNET_CONNECTION_Handle *sock); | ||
115 | 116 | ||
116 | /** | 117 | /** |
117 | * Disable the "CORK" feature for communication with the given socket, | 118 | * Disable the "CORK" feature for communication with the given socket, |
@@ -124,8 +125,7 @@ GNUNET_CONNECTION_persist_(struct GNUNET_CONNECTION_Handle *sock); | |||
124 | * @param sock the connection to make flushing and blocking | 125 | * @param sock the connection to make flushing and blocking |
125 | * @return GNUNET_OK on success | 126 | * @return GNUNET_OK on success |
126 | */ | 127 | */ |
127 | int | 128 | int GNUNET_CONNECTION_disable_corking (struct GNUNET_CONNECTION_Handle *sock); |
128 | GNUNET_CONNECTION_disable_corking (struct GNUNET_CONNECTION_Handle *sock); | ||
129 | 129 | ||
130 | 130 | ||
131 | /** | 131 | /** |
@@ -137,9 +137,8 @@ GNUNET_CONNECTION_disable_corking (struct GNUNET_CONNECTION_Handle *sock); | |||
137 | * @return the boxed socket handle | 137 | * @return the boxed socket handle |
138 | */ | 138 | */ |
139 | struct GNUNET_CONNECTION_Handle | 139 | struct GNUNET_CONNECTION_Handle |
140 | *GNUNET_CONNECTION_create_from_existing (struct | 140 | *GNUNET_CONNECTION_create_from_existing (struct |
141 | GNUNET_NETWORK_Handle | 141 | GNUNET_NETWORK_Handle *osSocket); |
142 | *osSocket); | ||
143 | 142 | ||
144 | 143 | ||
145 | /** | 144 | /** |
@@ -152,11 +151,9 @@ struct GNUNET_CONNECTION_Handle | |||
152 | * @return the socket handle, NULL on error (for example, access refused) | 151 | * @return the socket handle, NULL on error (for example, access refused) |
153 | */ | 152 | */ |
154 | struct GNUNET_CONNECTION_Handle | 153 | struct GNUNET_CONNECTION_Handle |
155 | *GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck | 154 | *GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck |
156 | access, void *access_cls, | 155 | access, void *access_cls, |
157 | struct | 156 | struct GNUNET_NETWORK_Handle *lsock); |
158 | GNUNET_NETWORK_Handle | ||
159 | *lsock); | ||
160 | 157 | ||
161 | 158 | ||
162 | /** | 159 | /** |
@@ -170,9 +167,10 @@ struct GNUNET_CONNECTION_Handle | |||
170 | * @return the socket handle | 167 | * @return the socket handle |
171 | */ | 168 | */ |
172 | struct GNUNET_CONNECTION_Handle | 169 | struct GNUNET_CONNECTION_Handle |
173 | *GNUNET_CONNECTION_create_from_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 170 | *GNUNET_CONNECTION_create_from_connect (const struct |
174 | const char *hostname, | 171 | GNUNET_CONFIGURATION_Handle *cfg, |
175 | uint16_t port); | 172 | const char *hostname, |
173 | uint16_t port); | ||
176 | 174 | ||
177 | 175 | ||
178 | /** | 176 | /** |
@@ -184,10 +182,11 @@ struct GNUNET_CONNECTION_Handle | |||
184 | * @param unixpath path to connect to) | 182 | * @param unixpath path to connect to) |
185 | * @return the socket handle, NULL on systems without UNIX support | 183 | * @return the socket handle, NULL on systems without UNIX support |
186 | */ | 184 | */ |
187 | struct GNUNET_CONNECTION_Handle * | 185 | struct GNUNET_CONNECTION_Handle |
188 | GNUNET_CONNECTION_create_from_connect_to_unixpath (const struct | 186 | *GNUNET_CONNECTION_create_from_connect_to_unixpath (const struct |
189 | GNUNET_CONFIGURATION_Handle *cfg, | 187 | GNUNET_CONFIGURATION_Handle |
190 | const char *unixpath); | 188 | *cfg, |
189 | const char *unixpath); | ||
191 | 190 | ||
192 | 191 | ||
193 | 192 | ||
@@ -203,10 +202,9 @@ GNUNET_CONNECTION_create_from_connect_to_unixpath (const struct | |||
203 | * @return the socket handle | 202 | * @return the socket handle |
204 | */ | 203 | */ |
205 | struct GNUNET_CONNECTION_Handle | 204 | struct GNUNET_CONNECTION_Handle |
206 | *GNUNET_CONNECTION_create_from_sockaddr (int af_family, | 205 | *GNUNET_CONNECTION_create_from_sockaddr (int af_family, |
207 | const struct sockaddr | 206 | const struct sockaddr |
208 | *serv_addr, | 207 | *serv_addr, socklen_t addrlen); |
209 | socklen_t addrlen); | ||
210 | 208 | ||
211 | /** | 209 | /** |
212 | * Check if socket is valid (no fatal errors have happened so far). | 210 | * Check if socket is valid (no fatal errors have happened so far). |
@@ -216,8 +214,7 @@ struct GNUNET_CONNECTION_Handle | |||
216 | * @param sock socket to check | 214 | * @param sock socket to check |
217 | * @return GNUNET_YES if valid, GNUNET_NO otherwise | 215 | * @return GNUNET_YES if valid, GNUNET_NO otherwise |
218 | */ | 216 | */ |
219 | int GNUNET_CONNECTION_check (struct GNUNET_CONNECTION_Handle | 217 | int GNUNET_CONNECTION_check (struct GNUNET_CONNECTION_Handle *sock); |
220 | *sock); | ||
221 | 218 | ||
222 | 219 | ||
223 | /** | 220 | /** |
@@ -229,9 +226,8 @@ int GNUNET_CONNECTION_check (struct GNUNET_CONNECTION_Handle | |||
229 | * @return GNUNET_OK on success | 226 | * @return GNUNET_OK on success |
230 | */ | 227 | */ |
231 | int GNUNET_CONNECTION_get_address (struct | 228 | int GNUNET_CONNECTION_get_address (struct |
232 | GNUNET_CONNECTION_Handle | 229 | GNUNET_CONNECTION_Handle |
233 | *sock, void **addr, | 230 | *sock, void **addr, size_t * addrlen); |
234 | size_t * addrlen); | ||
235 | 231 | ||
236 | 232 | ||
237 | /** | 233 | /** |
@@ -249,7 +245,7 @@ int GNUNET_CONNECTION_get_address (struct | |||
249 | */ | 245 | */ |
250 | void | 246 | void |
251 | GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *sock, | 247 | GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *sock, |
252 | int finish_pending_write); | 248 | int finish_pending_write); |
253 | 249 | ||
254 | 250 | ||
255 | /** | 251 | /** |
@@ -267,10 +263,10 @@ GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *sock, | |||
267 | */ | 263 | */ |
268 | void | 264 | void |
269 | GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle | 265 | GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle |
270 | *sock, size_t max, | 266 | *sock, size_t max, |
271 | struct GNUNET_TIME_Relative timeout, | 267 | struct GNUNET_TIME_Relative timeout, |
272 | GNUNET_CONNECTION_Receiver receiver, | 268 | GNUNET_CONNECTION_Receiver receiver, |
273 | void *receiver_cls); | 269 | void *receiver_cls); |
274 | 270 | ||
275 | 271 | ||
276 | /** | 272 | /** |
@@ -281,9 +277,7 @@ GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle | |||
281 | * @param sock socket handle | 277 | * @param sock socket handle |
282 | * @return closure of the original receiver callback closure | 278 | * @return closure of the original receiver callback closure |
283 | */ | 279 | */ |
284 | void *GNUNET_CONNECTION_receive_cancel (struct | 280 | void *GNUNET_CONNECTION_receive_cancel (struct GNUNET_CONNECTION_Handle *sock); |
285 | GNUNET_CONNECTION_Handle | ||
286 | *sock); | ||
287 | 281 | ||
288 | 282 | ||
289 | /** | 283 | /** |
@@ -298,7 +292,8 @@ void *GNUNET_CONNECTION_receive_cancel (struct | |||
298 | * @return number of bytes written to buf | 292 | * @return number of bytes written to buf |
299 | */ | 293 | */ |
300 | typedef size_t (*GNUNET_CONNECTION_TransmitReadyNotify) (void *cls, | 294 | typedef size_t (*GNUNET_CONNECTION_TransmitReadyNotify) (void *cls, |
301 | size_t size, void *buf); | 295 | size_t size, |
296 | void *buf); | ||
302 | 297 | ||
303 | 298 | ||
304 | /** | 299 | /** |
@@ -337,14 +332,14 @@ struct GNUNET_CONNECTION_TransmitHandle; | |||
337 | * NULL if we are already going to notify someone else (busy) | 332 | * NULL if we are already going to notify someone else (busy) |
338 | */ | 333 | */ |
339 | struct GNUNET_CONNECTION_TransmitHandle | 334 | struct GNUNET_CONNECTION_TransmitHandle |
340 | *GNUNET_CONNECTION_notify_transmit_ready (struct | 335 | *GNUNET_CONNECTION_notify_transmit_ready (struct |
341 | GNUNET_CONNECTION_Handle | 336 | GNUNET_CONNECTION_Handle |
342 | *sock, size_t size, | 337 | *sock, size_t size, |
343 | struct | 338 | struct |
344 | GNUNET_TIME_Relative | 339 | GNUNET_TIME_Relative |
345 | timeout, | 340 | timeout, |
346 | GNUNET_CONNECTION_TransmitReadyNotify | 341 | GNUNET_CONNECTION_TransmitReadyNotify |
347 | notify, void *notify_cls); | 342 | notify, void *notify_cls); |
348 | 343 | ||
349 | 344 | ||
350 | /** | 345 | /** |
@@ -355,8 +350,8 @@ struct GNUNET_CONNECTION_TransmitHandle | |||
355 | */ | 350 | */ |
356 | void | 351 | void |
357 | GNUNET_CONNECTION_notify_transmit_ready_cancel (struct | 352 | GNUNET_CONNECTION_notify_transmit_ready_cancel (struct |
358 | GNUNET_CONNECTION_TransmitHandle | 353 | GNUNET_CONNECTION_TransmitHandle |
359 | *h); | 354 | *h); |
360 | 355 | ||
361 | 356 | ||
362 | /** | 357 | /** |
@@ -367,7 +362,7 @@ GNUNET_CONNECTION_notify_transmit_ready_cancel (struct | |||
367 | */ | 362 | */ |
368 | void | 363 | void |
369 | GNUNET_CONNECTION_ignore_shutdown (struct GNUNET_CONNECTION_Handle *sock, | 364 | GNUNET_CONNECTION_ignore_shutdown (struct GNUNET_CONNECTION_Handle *sock, |
370 | int do_ignore); | 365 | int do_ignore); |
371 | 366 | ||
372 | 367 | ||
373 | #if 0 /* keep Emacsens' auto-indent happy */ | 368 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h index 3319b710b..cfc7e0842 100644 --- a/src/include/gnunet_container_lib.h +++ b/src/include/gnunet_container_lib.h | |||
@@ -62,8 +62,7 @@ struct GNUNET_CONTAINER_BloomFilter; | |||
62 | * @return GNUNET_YES if next was updated | 62 | * @return GNUNET_YES if next was updated |
63 | * GNUNET_NO if there are no more entries | 63 | * GNUNET_NO if there are no more entries |
64 | */ | 64 | */ |
65 | typedef int (*GNUNET_HashCodeIterator) (void *cls, | 65 | typedef int (*GNUNET_HashCodeIterator) (void *cls, GNUNET_HashCode * next); |
66 | GNUNET_HashCode * next); | ||
67 | 66 | ||
68 | 67 | ||
69 | /** | 68 | /** |
@@ -76,15 +75,13 @@ typedef int (*GNUNET_HashCodeIterator) (void *cls, | |||
76 | * element (number of bits set per element in the set) | 75 | * element (number of bits set per element in the set) |
77 | * @return the bloomfilter | 76 | * @return the bloomfilter |
78 | */ | 77 | */ |
79 | struct GNUNET_CONTAINER_BloomFilter * | 78 | struct GNUNET_CONTAINER_BloomFilter *GNUNET_CONTAINER_bloomfilter_load (const |
80 | GNUNET_CONTAINER_bloomfilter_load (const | 79 | char |
81 | char | 80 | *filename, |
82 | *filename, | 81 | size_t |
83 | size_t | 82 | size, |
84 | size, | 83 | unsigned |
85 | unsigned | 84 | int k); |
86 | int | ||
87 | k); | ||
88 | 85 | ||
89 | 86 | ||
90 | /** | 87 | /** |
@@ -100,15 +97,13 @@ GNUNET_CONTAINER_bloomfilter_load (const | |||
100 | * element (number of bits set per element in the set) | 97 | * element (number of bits set per element in the set) |
101 | * @return the bloomfilter | 98 | * @return the bloomfilter |
102 | */ | 99 | */ |
103 | struct GNUNET_CONTAINER_BloomFilter * | 100 | struct GNUNET_CONTAINER_BloomFilter *GNUNET_CONTAINER_bloomfilter_init (const |
104 | GNUNET_CONTAINER_bloomfilter_init (const | 101 | char |
105 | char | 102 | *data, |
106 | *data, | 103 | size_t |
107 | size_t | 104 | size, |
108 | size, | 105 | unsigned |
109 | unsigned | 106 | int k); |
110 | int | ||
111 | k); | ||
112 | 107 | ||
113 | 108 | ||
114 | /** | 109 | /** |
@@ -121,8 +116,7 @@ GNUNET_CONTAINER_bloomfilter_init (const | |||
121 | */ | 116 | */ |
122 | int GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct | 117 | int GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct |
123 | GNUNET_CONTAINER_BloomFilter | 118 | GNUNET_CONTAINER_BloomFilter |
124 | *bf, char *data, | 119 | *bf, char *data, size_t size); |
125 | size_t size); | ||
126 | 120 | ||
127 | 121 | ||
128 | /** | 122 | /** |
@@ -159,8 +153,10 @@ void GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter | |||
159 | * @param bf the filter | 153 | * @param bf the filter |
160 | * @return copy of bf | 154 | * @return copy of bf |
161 | */ | 155 | */ |
162 | struct GNUNET_CONTAINER_BloomFilter * | 156 | struct GNUNET_CONTAINER_BloomFilter *GNUNET_CONTAINER_bloomfilter_copy (const |
163 | GNUNET_CONTAINER_bloomfilter_copy (const struct GNUNET_CONTAINER_BloomFilter *bf); | 157 | struct |
158 | GNUNET_CONTAINER_BloomFilter | ||
159 | *bf); | ||
164 | 160 | ||
165 | 161 | ||
166 | 162 | ||
@@ -180,9 +176,20 @@ void GNUNET_CONTAINER_bloomfilter_free (struct GNUNET_CONTAINER_BloomFilter | |||
180 | * @param bf the filter | 176 | * @param bf the filter |
181 | * @return number of bytes used for the data of the bloom filter | 177 | * @return number of bytes used for the data of the bloom filter |
182 | */ | 178 | */ |
183 | size_t | 179 | size_t |
180 | |||
181 | |||
182 | |||
183 | |||
184 | |||
185 | |||
186 | |||
187 | |||
188 | |||
189 | |||
190 | |||
184 | GNUNET_CONTAINER_bloomfilter_get_size (const struct GNUNET_CONTAINER_BloomFilter | 191 | GNUNET_CONTAINER_bloomfilter_get_size (const struct GNUNET_CONTAINER_BloomFilter |
185 | *bf); | 192 | *bf); |
186 | 193 | ||
187 | 194 | ||
188 | /** | 195 | /** |
@@ -218,8 +225,8 @@ int GNUNET_CONTAINER_bloomfilter_or (struct GNUNET_CONTAINER_BloomFilter *bf, | |||
218 | */ | 225 | */ |
219 | int | 226 | int |
220 | GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf, | 227 | GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf, |
221 | const struct GNUNET_CONTAINER_BloomFilter *to_or, | 228 | const struct GNUNET_CONTAINER_BloomFilter |
222 | size_t size); | 229 | *to_or, size_t size); |
223 | 230 | ||
224 | /** | 231 | /** |
225 | * Resize a bloom filter. Note that this operation | 232 | * Resize a bloom filter. Note that this operation |
@@ -250,8 +257,7 @@ struct GNUNET_CONTAINER_MetaData; | |||
250 | * | 257 | * |
251 | * @return empty meta-data container | 258 | * @return empty meta-data container |
252 | */ | 259 | */ |
253 | struct GNUNET_CONTAINER_MetaData * | 260 | struct GNUNET_CONTAINER_MetaData *GNUNET_CONTAINER_meta_data_create (void); |
254 | GNUNET_CONTAINER_meta_data_create (void); | ||
255 | 261 | ||
256 | /** | 262 | /** |
257 | * Duplicate a MetaData token. | 263 | * Duplicate a MetaData token. |
@@ -259,17 +265,17 @@ GNUNET_CONTAINER_meta_data_create (void); | |||
259 | * @param md what to duplicate | 265 | * @param md what to duplicate |
260 | * @return duplicate meta-data container | 266 | * @return duplicate meta-data container |
261 | */ | 267 | */ |
262 | struct GNUNET_CONTAINER_MetaData * | 268 | struct GNUNET_CONTAINER_MetaData *GNUNET_CONTAINER_meta_data_duplicate (const |
263 | GNUNET_CONTAINER_meta_data_duplicate (const struct | 269 | struct |
264 | GNUNET_CONTAINER_MetaData *md); | 270 | GNUNET_CONTAINER_MetaData |
271 | *md); | ||
265 | 272 | ||
266 | /** | 273 | /** |
267 | * Free meta data. | 274 | * Free meta data. |
268 | * | 275 | * |
269 | * @param md what to free | 276 | * @param md what to free |
270 | */ | 277 | */ |
271 | void | 278 | void GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md); |
272 | GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md); | ||
273 | 279 | ||
274 | /** | 280 | /** |
275 | * Test if two MDs are equal. We consider them equal if | 281 | * Test if two MDs are equal. We consider them equal if |
@@ -281,11 +287,11 @@ GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md); | |||
281 | * @param md2 other value to check | 287 | * @param md2 other value to check |
282 | * @return GNUNET_YES if they are equal | 288 | * @return GNUNET_YES if they are equal |
283 | */ | 289 | */ |
284 | int | 290 | int |
285 | GNUNET_CONTAINER_meta_data_test_equal (const struct | 291 | GNUNET_CONTAINER_meta_data_test_equal (const struct |
286 | GNUNET_CONTAINER_MetaData *md1, | 292 | GNUNET_CONTAINER_MetaData *md1, |
287 | const struct | 293 | const struct |
288 | GNUNET_CONTAINER_MetaData *md2); | 294 | GNUNET_CONTAINER_MetaData *md2); |
289 | 295 | ||
290 | 296 | ||
291 | /** | 297 | /** |
@@ -305,14 +311,13 @@ GNUNET_CONTAINER_meta_data_test_equal (const struct | |||
305 | * @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists | 311 | * @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists |
306 | * data_mime_type and plugin_name are not considered for "exists" checks | 312 | * data_mime_type and plugin_name are not considered for "exists" checks |
307 | */ | 313 | */ |
308 | int | 314 | int |
309 | GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md, | 315 | GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md, |
310 | const char *plugin_name, | 316 | const char *plugin_name, |
311 | enum EXTRACTOR_MetaType type, | 317 | enum EXTRACTOR_MetaType type, |
312 | enum EXTRACTOR_MetaFormat format, | 318 | enum EXTRACTOR_MetaFormat format, |
313 | const char *data_mime_type, | 319 | const char *data_mime_type, |
314 | const char *data, | 320 | const char *data, size_t data_len); |
315 | size_t data_len); | ||
316 | 321 | ||
317 | 322 | ||
318 | /** | 323 | /** |
@@ -322,9 +327,9 @@ GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md, | |||
322 | * @param md metadata to extend | 327 | * @param md metadata to extend |
323 | * @param in metadata to merge | 328 | * @param in metadata to merge |
324 | */ | 329 | */ |
325 | void | 330 | void |
326 | GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md, | 331 | GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md, |
327 | const struct GNUNET_CONTAINER_MetaData *in); | 332 | const struct GNUNET_CONTAINER_MetaData *in); |
328 | 333 | ||
329 | 334 | ||
330 | /** | 335 | /** |
@@ -337,11 +342,10 @@ GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md, | |||
337 | * @param data_len number of bytes in data | 342 | * @param data_len number of bytes in data |
338 | * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md | 343 | * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md |
339 | */ | 344 | */ |
340 | int | 345 | int |
341 | GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md, | 346 | GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md, |
342 | enum EXTRACTOR_MetaType type, | 347 | enum EXTRACTOR_MetaType type, |
343 | const char *data, | 348 | const char *data, size_t data_len); |
344 | size_t data_len); | ||
345 | 349 | ||
346 | 350 | ||
347 | /** | 351 | /** |
@@ -349,8 +353,7 @@ GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md, | |||
349 | * | 353 | * |
350 | * @param md metadata to manipulate | 354 | * @param md metadata to manipulate |
351 | */ | 355 | */ |
352 | void | 356 | void GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md); |
353 | GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md); | ||
354 | 357 | ||
355 | 358 | ||
356 | /** | 359 | /** |
@@ -359,10 +362,9 @@ GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md); | |||
359 | * | 362 | * |
360 | * @param md metadata to modify | 363 | * @param md metadata to modify |
361 | */ | 364 | */ |
362 | void | 365 | void |
363 | GNUNET_CONTAINER_meta_data_add_publication_date (struct | 366 | GNUNET_CONTAINER_meta_data_add_publication_date (struct |
364 | GNUNET_CONTAINER_MetaData | 367 | GNUNET_CONTAINER_MetaData *md); |
365 | *md); | ||
366 | 368 | ||
367 | 369 | ||
368 | /** | 370 | /** |
@@ -374,9 +376,9 @@ GNUNET_CONTAINER_meta_data_add_publication_date (struct | |||
374 | * @return number of entries | 376 | * @return number of entries |
375 | */ | 377 | */ |
376 | int GNUNET_CONTAINER_meta_data_iterate (const struct | 378 | int GNUNET_CONTAINER_meta_data_iterate (const struct |
377 | GNUNET_CONTAINER_MetaData *md, | 379 | GNUNET_CONTAINER_MetaData *md, |
378 | EXTRACTOR_MetaDataProcessor | 380 | EXTRACTOR_MetaDataProcessor |
379 | iter, void *iter_cls); | 381 | iter, void *iter_cls); |
380 | 382 | ||
381 | /** | 383 | /** |
382 | * Get the first MD entry of the given type. Caller | 384 | * Get the first MD entry of the given type. Caller |
@@ -388,10 +390,9 @@ int GNUNET_CONTAINER_meta_data_iterate (const struct | |||
388 | * @param type type to look for | 390 | * @param type type to look for |
389 | * @return NULL if no entry was found | 391 | * @return NULL if no entry was found |
390 | */ | 392 | */ |
391 | char * | 393 | char *GNUNET_CONTAINER_meta_data_get_by_type (const struct |
392 | GNUNET_CONTAINER_meta_data_get_by_type (const struct | 394 | GNUNET_CONTAINER_MetaData *md, |
393 | GNUNET_CONTAINER_MetaData *md, | 395 | enum EXTRACTOR_MetaType type); |
394 | enum EXTRACTOR_MetaType type); | ||
395 | 396 | ||
396 | 397 | ||
397 | /** | 398 | /** |
@@ -405,10 +406,9 @@ GNUNET_CONTAINER_meta_data_get_by_type (const struct | |||
405 | * @return NULL if we do not have any such entry, | 406 | * @return NULL if we do not have any such entry, |
406 | * otherwise client is responsible for freeing the value! | 407 | * otherwise client is responsible for freeing the value! |
407 | */ | 408 | */ |
408 | char * | 409 | char *GNUNET_CONTAINER_meta_data_get_first_by_types (const struct |
409 | GNUNET_CONTAINER_meta_data_get_first_by_types (const struct | 410 | GNUNET_CONTAINER_MetaData |
410 | GNUNET_CONTAINER_MetaData | 411 | *md, ...); |
411 | *md, ...); | ||
412 | 412 | ||
413 | /** | 413 | /** |
414 | * Get a thumbnail from the meta-data (if present). Only matches meta | 414 | * Get a thumbnail from the meta-data (if present). Only matches meta |
@@ -419,10 +419,10 @@ GNUNET_CONTAINER_meta_data_get_first_by_types (const struct | |||
419 | * freed by the caller! | 419 | * freed by the caller! |
420 | * @return number of bytes in thumbnail, 0 if not available | 420 | * @return number of bytes in thumbnail, 0 if not available |
421 | */ | 421 | */ |
422 | size_t | 422 | size_t |
423 | GNUNET_CONTAINER_meta_data_get_thumbnail (const struct | 423 | GNUNET_CONTAINER_meta_data_get_thumbnail (const struct |
424 | GNUNET_CONTAINER_MetaData | 424 | GNUNET_CONTAINER_MetaData |
425 | *md, unsigned char **thumb); | 425 | *md, unsigned char **thumb); |
426 | 426 | ||
427 | 427 | ||
428 | 428 | ||
@@ -463,14 +463,33 @@ enum GNUNET_CONTAINER_MetaDataSerializationOptions | |||
463 | * -1 on error (typically: not enough | 463 | * -1 on error (typically: not enough |
464 | * space) | 464 | * space) |
465 | */ | 465 | */ |
466 | ssize_t | 466 | ssize_t |
467 | |||
468 | |||
469 | |||
470 | |||
471 | |||
472 | |||
473 | |||
474 | |||
475 | |||
476 | |||
477 | |||
478 | |||
479 | |||
480 | |||
481 | |||
482 | |||
483 | |||
484 | |||
485 | |||
467 | GNUNET_CONTAINER_meta_data_serialize (const struct | 486 | GNUNET_CONTAINER_meta_data_serialize (const struct |
468 | GNUNET_CONTAINER_MetaData *md, | 487 | GNUNET_CONTAINER_MetaData *md, |
469 | char **target, | 488 | char **target, |
470 | size_t max, | 489 | size_t max, |
471 | enum | 490 | enum |
472 | GNUNET_CONTAINER_MetaDataSerializationOptions | 491 | GNUNET_CONTAINER_MetaDataSerializationOptions |
473 | opt); | 492 | opt); |
474 | 493 | ||
475 | 494 | ||
476 | /** | 495 | /** |
@@ -479,10 +498,28 @@ GNUNET_CONTAINER_meta_data_serialize (const struct | |||
479 | * @param md metadata to inspect | 498 | * @param md metadata to inspect |
480 | * @return number of bytes needed for serialization, -1 on error | 499 | * @return number of bytes needed for serialization, -1 on error |
481 | */ | 500 | */ |
482 | ssize_t | 501 | ssize_t |
502 | |||
503 | |||
504 | |||
505 | |||
506 | |||
507 | |||
508 | |||
509 | |||
510 | |||
511 | |||
512 | |||
513 | |||
514 | |||
515 | |||
516 | |||
517 | |||
518 | |||
519 | |||
520 | |||
483 | GNUNET_CONTAINER_meta_data_get_serialized_size (const struct | 521 | GNUNET_CONTAINER_meta_data_get_serialized_size (const struct |
484 | GNUNET_CONTAINER_MetaData | 522 | GNUNET_CONTAINER_MetaData *md); |
485 | *md); | ||
486 | 523 | ||
487 | 524 | ||
488 | /** | 525 | /** |
@@ -493,9 +530,11 @@ GNUNET_CONTAINER_meta_data_get_serialized_size (const struct | |||
493 | * @return MD on success, NULL on error (i.e. | 530 | * @return MD on success, NULL on error (i.e. |
494 | * bad format) | 531 | * bad format) |
495 | */ | 532 | */ |
496 | struct GNUNET_CONTAINER_MetaData * | 533 | struct GNUNET_CONTAINER_MetaData *GNUNET_CONTAINER_meta_data_deserialize (const |
497 | GNUNET_CONTAINER_meta_data_deserialize (const char *input, | 534 | char |
498 | size_t size); | 535 | *input, |
536 | size_t | ||
537 | size); | ||
499 | 538 | ||
500 | 539 | ||
501 | /* ******************************* HashMap **************************** */ | 540 | /* ******************************* HashMap **************************** */ |
@@ -561,7 +600,7 @@ typedef int (*GNUNET_CONTAINER_HashMapIterator) (void *cls, | |||
561 | * @return NULL on error | 600 | * @return NULL on error |
562 | */ | 601 | */ |
563 | struct GNUNET_CONTAINER_MultiHashMap | 602 | struct GNUNET_CONTAINER_MultiHashMap |
564 | *GNUNET_CONTAINER_multihashmap_create (unsigned int len); | 603 | *GNUNET_CONTAINER_multihashmap_create (unsigned int len); |
565 | 604 | ||
566 | 605 | ||
567 | /** | 606 | /** |
@@ -571,8 +610,7 @@ struct GNUNET_CONTAINER_MultiHashMap | |||
571 | * @param map the map | 610 | * @param map the map |
572 | */ | 611 | */ |
573 | void GNUNET_CONTAINER_multihashmap_destroy (struct | 612 | void GNUNET_CONTAINER_multihashmap_destroy (struct |
574 | GNUNET_CONTAINER_MultiHashMap | 613 | GNUNET_CONTAINER_MultiHashMap *map); |
575 | *map); | ||
576 | 614 | ||
577 | 615 | ||
578 | /** | 616 | /** |
@@ -630,8 +668,7 @@ int GNUNET_CONTAINER_multihashmap_remove_all (struct | |||
630 | */ | 668 | */ |
631 | int GNUNET_CONTAINER_multihashmap_contains (const struct | 669 | int GNUNET_CONTAINER_multihashmap_contains (const struct |
632 | GNUNET_CONTAINER_MultiHashMap | 670 | GNUNET_CONTAINER_MultiHashMap |
633 | *map, | 671 | *map, const GNUNET_HashCode * key); |
634 | const GNUNET_HashCode * key); | ||
635 | 672 | ||
636 | 673 | ||
637 | /** | 674 | /** |
@@ -645,10 +682,10 @@ int GNUNET_CONTAINER_multihashmap_contains (const struct | |||
645 | * GNUNET_NO if not | 682 | * GNUNET_NO if not |
646 | */ | 683 | */ |
647 | int GNUNET_CONTAINER_multihashmap_contains_value (const struct | 684 | int GNUNET_CONTAINER_multihashmap_contains_value (const struct |
648 | GNUNET_CONTAINER_MultiHashMap | 685 | GNUNET_CONTAINER_MultiHashMap |
649 | *map, | 686 | *map, |
650 | const GNUNET_HashCode * key, | 687 | const GNUNET_HashCode * key, |
651 | const void *value); | 688 | const void *value); |
652 | 689 | ||
653 | 690 | ||
654 | /** | 691 | /** |
@@ -667,8 +704,7 @@ int GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap | |||
667 | *map, const GNUNET_HashCode * key, | 704 | *map, const GNUNET_HashCode * key, |
668 | void *value, | 705 | void *value, |
669 | enum | 706 | enum |
670 | GNUNET_CONTAINER_MultiHashMapOption | 707 | GNUNET_CONTAINER_MultiHashMapOption opt); |
671 | opt); | ||
672 | 708 | ||
673 | /** | 709 | /** |
674 | * Get the number of key-value pairs in the map. | 710 | * Get the number of key-value pairs in the map. |
@@ -886,8 +922,9 @@ struct GNUNET_CONTAINER_HeapNode; | |||
886 | * @param order how should the heap be sorted? | 922 | * @param order how should the heap be sorted? |
887 | * @return handle to the heap | 923 | * @return handle to the heap |
888 | */ | 924 | */ |
889 | struct GNUNET_CONTAINER_Heap * | 925 | struct GNUNET_CONTAINER_Heap *GNUNET_CONTAINER_heap_create (enum |
890 | GNUNET_CONTAINER_heap_create (enum GNUNET_CONTAINER_HeapOrder order); | 926 | GNUNET_CONTAINER_HeapOrder |
927 | order); | ||
891 | 928 | ||
892 | 929 | ||
893 | /** | 930 | /** |
@@ -905,8 +942,7 @@ void GNUNET_CONTAINER_heap_destroy (struct GNUNET_CONTAINER_Heap *heap); | |||
905 | * @param heap heap to inspect | 942 | * @param heap heap to inspect |
906 | * @return NULL if heap is empty | 943 | * @return NULL if heap is empty |
907 | */ | 944 | */ |
908 | void * | 945 | void *GNUNET_CONTAINER_heap_peek (const struct GNUNET_CONTAINER_Heap *heap); |
909 | GNUNET_CONTAINER_heap_peek (const struct GNUNET_CONTAINER_Heap *heap); | ||
910 | 946 | ||
911 | 947 | ||
912 | /** | 948 | /** |
@@ -926,7 +962,8 @@ GNUNET_CONTAINER_heap_get_size (const struct GNUNET_CONTAINER_Heap *heap); | |||
926 | * @return cost of the node | 962 | * @return cost of the node |
927 | */ | 963 | */ |
928 | GNUNET_CONTAINER_HeapCostType | 964 | GNUNET_CONTAINER_HeapCostType |
929 | GNUNET_CONTAINER_heap_node_get_cost (const struct GNUNET_CONTAINER_HeapNode *node); | 965 | GNUNET_CONTAINER_heap_node_get_cost (const struct GNUNET_CONTAINER_HeapNode |
966 | *node); | ||
930 | 967 | ||
931 | /** | 968 | /** |
932 | * Iterator for heap | 969 | * Iterator for heap |
@@ -939,9 +976,10 @@ GNUNET_CONTAINER_heap_node_get_cost (const struct GNUNET_CONTAINER_HeapNode *nod | |||
939 | * GNUNET_NO if not. | 976 | * GNUNET_NO if not. |
940 | */ | 977 | */ |
941 | typedef int (*GNUNET_CONTAINER_HeapIterator) (void *cls, | 978 | typedef int (*GNUNET_CONTAINER_HeapIterator) (void *cls, |
942 | struct GNUNET_CONTAINER_HeapNode *node, | 979 | struct GNUNET_CONTAINER_HeapNode * |
943 | void *element, | 980 | node, void *element, |
944 | GNUNET_CONTAINER_HeapCostType cost); | 981 | GNUNET_CONTAINER_HeapCostType |
982 | cost); | ||
945 | 983 | ||
946 | 984 | ||
947 | /** | 985 | /** |
@@ -953,8 +991,8 @@ typedef int (*GNUNET_CONTAINER_HeapIterator) (void *cls, | |||
953 | */ | 991 | */ |
954 | void | 992 | void |
955 | GNUNET_CONTAINER_heap_iterate (const struct GNUNET_CONTAINER_Heap *heap, | 993 | GNUNET_CONTAINER_heap_iterate (const struct GNUNET_CONTAINER_Heap *heap, |
956 | GNUNET_CONTAINER_HeapIterator iterator, | 994 | GNUNET_CONTAINER_HeapIterator iterator, |
957 | void *iterator_cls); | 995 | void *iterator_cls); |
958 | 996 | ||
959 | 997 | ||
960 | /** | 998 | /** |
@@ -969,9 +1007,8 @@ GNUNET_CONTAINER_heap_iterate (const struct GNUNET_CONTAINER_Heap *heap, | |||
969 | * NULL if the heap is empty. | 1007 | * NULL if the heap is empty. |
970 | * | 1008 | * |
971 | */ | 1009 | */ |
972 | void * | 1010 | void *GNUNET_CONTAINER_heap_get_random (struct GNUNET_CONTAINER_Heap *heap, |
973 | GNUNET_CONTAINER_heap_get_random (struct GNUNET_CONTAINER_Heap *heap, | 1011 | uint32_t max); |
974 | uint32_t max); | ||
975 | 1012 | ||
976 | 1013 | ||
977 | /** | 1014 | /** |
@@ -985,8 +1022,7 @@ GNUNET_CONTAINER_heap_get_random (struct GNUNET_CONTAINER_Heap *heap, | |||
985 | * @return data stored at the next random node in the walk; | 1022 | * @return data stored at the next random node in the walk; |
986 | * NULL if the tree is empty. | 1023 | * NULL if the tree is empty. |
987 | */ | 1024 | */ |
988 | void * | 1025 | void *GNUNET_CONTAINER_heap_walk_get_next (struct GNUNET_CONTAINER_Heap *heap); |
989 | GNUNET_CONTAINER_heap_walk_get_next (struct GNUNET_CONTAINER_Heap *heap); | ||
990 | 1026 | ||
991 | 1027 | ||
992 | /** | 1028 | /** |
@@ -997,10 +1033,12 @@ GNUNET_CONTAINER_heap_walk_get_next (struct GNUNET_CONTAINER_Heap *heap); | |||
997 | * @param cost cost for the element | 1033 | * @param cost cost for the element |
998 | * @return node for the new element | 1034 | * @return node for the new element |
999 | */ | 1035 | */ |
1000 | struct GNUNET_CONTAINER_HeapNode * | 1036 | struct GNUNET_CONTAINER_HeapNode *GNUNET_CONTAINER_heap_insert (struct |
1001 | GNUNET_CONTAINER_heap_insert (struct GNUNET_CONTAINER_Heap *heap, | 1037 | GNUNET_CONTAINER_Heap |
1002 | void *element, | 1038 | *heap, |
1003 | GNUNET_CONTAINER_HeapCostType cost); | 1039 | void *element, |
1040 | GNUNET_CONTAINER_HeapCostType | ||
1041 | cost); | ||
1004 | 1042 | ||
1005 | 1043 | ||
1006 | /** | 1044 | /** |
@@ -1009,8 +1047,7 @@ GNUNET_CONTAINER_heap_insert (struct GNUNET_CONTAINER_Heap *heap, | |||
1009 | * @param heap heap to modify | 1047 | * @param heap heap to modify |
1010 | * @return element data stored at the root node | 1048 | * @return element data stored at the root node |
1011 | */ | 1049 | */ |
1012 | void * | 1050 | void *GNUNET_CONTAINER_heap_remove_root (struct GNUNET_CONTAINER_Heap *heap); |
1013 | GNUNET_CONTAINER_heap_remove_root (struct GNUNET_CONTAINER_Heap *heap); | ||
1014 | 1051 | ||
1015 | 1052 | ||
1016 | /** | 1053 | /** |
@@ -1019,8 +1056,8 @@ GNUNET_CONTAINER_heap_remove_root (struct GNUNET_CONTAINER_Heap *heap); | |||
1019 | * @param node node to remove | 1056 | * @param node node to remove |
1020 | * @return element data stored at the node, NULL if heap is empty | 1057 | * @return element data stored at the node, NULL if heap is empty |
1021 | */ | 1058 | */ |
1022 | void * | 1059 | void *GNUNET_CONTAINER_heap_remove_node (struct GNUNET_CONTAINER_HeapNode |
1023 | GNUNET_CONTAINER_heap_remove_node (struct GNUNET_CONTAINER_HeapNode *node); | 1060 | *node); |
1024 | 1061 | ||
1025 | 1062 | ||
1026 | /** | 1063 | /** |
@@ -1032,8 +1069,8 @@ GNUNET_CONTAINER_heap_remove_node (struct GNUNET_CONTAINER_HeapNode *node); | |||
1032 | */ | 1069 | */ |
1033 | void | 1070 | void |
1034 | GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_Heap *heap, | 1071 | GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_Heap *heap, |
1035 | struct GNUNET_CONTAINER_HeapNode *node, | 1072 | struct GNUNET_CONTAINER_HeapNode *node, |
1036 | GNUNET_CONTAINER_HeapCostType new_cost); | 1073 | GNUNET_CONTAINER_HeapCostType new_cost); |
1037 | 1074 | ||
1038 | 1075 | ||
1039 | /* ******************** Singly linked list *************** */ | 1076 | /* ******************** Singly linked list *************** */ |
@@ -1041,24 +1078,24 @@ GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_Heap *heap, | |||
1041 | /** | 1078 | /** |
1042 | * Possible ways for how data stored in the linked list | 1079 | * Possible ways for how data stored in the linked list |
1043 | * might be allocated. | 1080 | * might be allocated. |
1044 | */ | 1081 | */ |
1045 | enum GNUNET_CONTAINER_SListDisposition | 1082 | enum GNUNET_CONTAINER_SListDisposition |
1046 | { | 1083 | { |
1047 | /** | 1084 | /** |
1048 | * Single-linked list must copy the buffer. | 1085 | * Single-linked list must copy the buffer. |
1049 | */ | 1086 | */ |
1050 | GNUNET_CONTAINER_SLIST_DISPOSITION_TRANSIENT = 0, | 1087 | GNUNET_CONTAINER_SLIST_DISPOSITION_TRANSIENT = 0, |
1051 | 1088 | ||
1052 | /** | 1089 | /** |
1053 | * Data is static, no need to copy or free. | 1090 | * Data is static, no need to copy or free. |
1054 | */ | 1091 | */ |
1055 | GNUNET_CONTAINER_SLIST_DISPOSITION_STATIC = 2, | 1092 | GNUNET_CONTAINER_SLIST_DISPOSITION_STATIC = 2, |
1056 | 1093 | ||
1057 | /** | 1094 | /** |
1058 | * Data is dynamic, do not copy but free when done. | 1095 | * Data is dynamic, do not copy but free when done. |
1059 | */ | 1096 | */ |
1060 | GNUNET_CONTAINER_SLIST_DISPOSITION_DYNAMIC = 4 | 1097 | GNUNET_CONTAINER_SLIST_DISPOSITION_DYNAMIC = 4 |
1061 | }; | 1098 | }; |
1062 | 1099 | ||
1063 | 1100 | ||
1064 | 1101 | ||
@@ -1080,9 +1117,9 @@ struct GNUNET_CONTAINER_SList_Iterator; | |||
1080 | * @param buf payload buffer | 1117 | * @param buf payload buffer |
1081 | * @param len length of the buffer | 1118 | * @param len length of the buffer |
1082 | */ | 1119 | */ |
1083 | void GNUNET_CONTAINER_slist_add (struct GNUNET_CONTAINER_SList *l, | 1120 | void GNUNET_CONTAINER_slist_add (struct GNUNET_CONTAINER_SList *l, |
1084 | enum GNUNET_CONTAINER_SListDisposition disp, | 1121 | enum GNUNET_CONTAINER_SListDisposition disp, |
1085 | const void *buf, size_t len); | 1122 | const void *buf, size_t len); |
1086 | 1123 | ||
1087 | 1124 | ||
1088 | /** | 1125 | /** |
@@ -1093,8 +1130,8 @@ void GNUNET_CONTAINER_slist_add (struct GNUNET_CONTAINER_SList *l, | |||
1093 | * @param len length of the buffer | 1130 | * @param len length of the buffer |
1094 | */ | 1131 | */ |
1095 | void GNUNET_CONTAINER_slist_add_end (struct GNUNET_CONTAINER_SList *l, | 1132 | void GNUNET_CONTAINER_slist_add_end (struct GNUNET_CONTAINER_SList *l, |
1096 | enum GNUNET_CONTAINER_SListDisposition disp, | 1133 | enum GNUNET_CONTAINER_SListDisposition |
1097 | const void *buf, size_t len); | 1134 | disp, const void *buf, size_t len); |
1098 | 1135 | ||
1099 | 1136 | ||
1100 | /** | 1137 | /** |
@@ -1103,7 +1140,8 @@ void GNUNET_CONTAINER_slist_add_end (struct GNUNET_CONTAINER_SList *l, | |||
1103 | * @param src source | 1140 | * @param src source |
1104 | */ | 1141 | */ |
1105 | void | 1142 | void |
1106 | GNUNET_CONTAINER_slist_append (struct GNUNET_CONTAINER_SList *dst, struct GNUNET_CONTAINER_SList *src); | 1143 | GNUNET_CONTAINER_slist_append (struct GNUNET_CONTAINER_SList *dst, |
1144 | struct GNUNET_CONTAINER_SList *src); | ||
1107 | 1145 | ||
1108 | 1146 | ||
1109 | /** | 1147 | /** |
@@ -1126,8 +1164,9 @@ void GNUNET_CONTAINER_slist_destroy (struct GNUNET_CONTAINER_SList *l); | |||
1126 | * @param l list | 1164 | * @param l list |
1127 | * @return iterator pointing to the beginning, free using "GNUNET_free" | 1165 | * @return iterator pointing to the beginning, free using "GNUNET_free" |
1128 | */ | 1166 | */ |
1129 | struct GNUNET_CONTAINER_SList_Iterator * | 1167 | struct GNUNET_CONTAINER_SList_Iterator *GNUNET_CONTAINER_slist_begin (struct |
1130 | GNUNET_CONTAINER_slist_begin(struct GNUNET_CONTAINER_SList *l); | 1168 | GNUNET_CONTAINER_SList |
1169 | *l); | ||
1131 | 1170 | ||
1132 | 1171 | ||
1133 | /** | 1172 | /** |
@@ -1144,7 +1183,8 @@ void GNUNET_CONTAINER_slist_clear (struct GNUNET_CONTAINER_SList *l); | |||
1144 | * @param buf payload buffer to find | 1183 | * @param buf payload buffer to find |
1145 | * @param len length of the payload (number of bytes in buf) | 1184 | * @param len length of the payload (number of bytes in buf) |
1146 | */ | 1185 | */ |
1147 | int GNUNET_CONTAINER_slist_contains (const struct GNUNET_CONTAINER_SList *l, const void *buf, size_t len); | 1186 | int GNUNET_CONTAINER_slist_contains (const struct GNUNET_CONTAINER_SList *l, |
1187 | const void *buf, size_t len); | ||
1148 | 1188 | ||
1149 | 1189 | ||
1150 | /** | 1190 | /** |
@@ -1169,10 +1209,10 @@ void GNUNET_CONTAINER_slist_erase (struct GNUNET_CONTAINER_SList_Iterator *i); | |||
1169 | * @param buf payload buffer | 1209 | * @param buf payload buffer |
1170 | * @param len length of the payload | 1210 | * @param len length of the payload |
1171 | */ | 1211 | */ |
1172 | void GNUNET_CONTAINER_slist_insert (struct GNUNET_CONTAINER_SList_Iterator *before, | 1212 | void GNUNET_CONTAINER_slist_insert (struct GNUNET_CONTAINER_SList_Iterator |
1173 | enum GNUNET_CONTAINER_SListDisposition disp, | 1213 | *before, |
1174 | const void *buf, | 1214 | enum GNUNET_CONTAINER_SListDisposition disp, |
1175 | size_t len); | 1215 | const void *buf, size_t len); |
1176 | 1216 | ||
1177 | 1217 | ||
1178 | /** | 1218 | /** |
@@ -1199,16 +1239,16 @@ int GNUNET_CONTAINER_slist_end (struct GNUNET_CONTAINER_SList_Iterator *i); | |||
1199 | * @param len set to the payload length | 1239 | * @param len set to the payload length |
1200 | * @return payload | 1240 | * @return payload |
1201 | */ | 1241 | */ |
1202 | void * | 1242 | void *GNUNET_CONTAINER_slist_get (const struct GNUNET_CONTAINER_SList_Iterator |
1203 | GNUNET_CONTAINER_slist_get (const struct GNUNET_CONTAINER_SList_Iterator *i, | 1243 | *i, size_t * len); |
1204 | size_t *len); | ||
1205 | 1244 | ||
1206 | 1245 | ||
1207 | /** | 1246 | /** |
1208 | * Release an iterator | 1247 | * Release an iterator |
1209 | * @param i iterator | 1248 | * @param i iterator |
1210 | */ | 1249 | */ |
1211 | void GNUNET_CONTAINER_slist_iter_destroy (struct GNUNET_CONTAINER_SList_Iterator *i); | 1250 | void GNUNET_CONTAINER_slist_iter_destroy (struct GNUNET_CONTAINER_SList_Iterator |
1251 | *i); | ||
1212 | 1252 | ||
1213 | 1253 | ||
1214 | #if 0 /* keep Emacsens' auto-indent happy */ | 1254 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index 447711867..1bf82030d 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h | |||
@@ -59,9 +59,11 @@ struct GNUNET_CORE_Handle; | |||
59 | * @param atsi performance data for the connection | 59 | * @param atsi performance data for the connection |
60 | */ | 60 | */ |
61 | typedef void (*GNUNET_CORE_ConnectEventHandler) (void *cls, | 61 | typedef void (*GNUNET_CORE_ConnectEventHandler) (void *cls, |
62 | const struct | 62 | const struct |
63 | GNUNET_PeerIdentity *peer, | 63 | GNUNET_PeerIdentity * peer, |
64 | const struct GNUNET_TRANSPORT_ATS_Information *atsi); | 64 | const struct |
65 | GNUNET_TRANSPORT_ATS_Information | ||
66 | * atsi); | ||
65 | 67 | ||
66 | 68 | ||
67 | /** | 69 | /** |
@@ -76,12 +78,19 @@ typedef void (*GNUNET_CORE_ConnectEventHandler) (void *cls, | |||
76 | * @param atsi performance data for the connection | 78 | * @param atsi performance data for the connection |
77 | */ | 79 | */ |
78 | typedef void (*GNUNET_CORE_PeerStatusEventHandler) (void *cls, | 80 | typedef void (*GNUNET_CORE_PeerStatusEventHandler) (void *cls, |
79 | const struct | 81 | const struct |
80 | GNUNET_PeerIdentity *peer, | 82 | GNUNET_PeerIdentity * peer, |
81 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 83 | struct |
82 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 84 | GNUNET_BANDWIDTH_Value32NBO |
83 | struct GNUNET_TIME_Absolute timeout, | 85 | bandwidth_in, |
84 | const struct GNUNET_TRANSPORT_ATS_Information *atsi); | 86 | struct |
87 | GNUNET_BANDWIDTH_Value32NBO | ||
88 | bandwidth_out, | ||
89 | struct GNUNET_TIME_Absolute | ||
90 | timeout, | ||
91 | const struct | ||
92 | GNUNET_TRANSPORT_ATS_Information | ||
93 | * atsi); | ||
85 | 94 | ||
86 | 95 | ||
87 | /** | 96 | /** |
@@ -91,8 +100,8 @@ typedef void (*GNUNET_CORE_PeerStatusEventHandler) (void *cls, | |||
91 | * @param peer peer identity this notification is about | 100 | * @param peer peer identity this notification is about |
92 | */ | 101 | */ |
93 | typedef void (*GNUNET_CORE_DisconnectEventHandler) (void *cls, | 102 | typedef void (*GNUNET_CORE_DisconnectEventHandler) (void *cls, |
94 | const struct | 103 | const struct |
95 | GNUNET_PeerIdentity *peer); | 104 | GNUNET_PeerIdentity * peer); |
96 | 105 | ||
97 | 106 | ||
98 | /** | 107 | /** |
@@ -108,10 +117,11 @@ typedef void (*GNUNET_CORE_DisconnectEventHandler) (void *cls, | |||
108 | * GNUNET_SYSERR to close it (signal serious error) | 117 | * GNUNET_SYSERR to close it (signal serious error) |
109 | */ | 118 | */ |
110 | typedef int | 119 | typedef int |
111 | (*GNUNET_CORE_MessageCallback) (void *cls, | 120 | (*GNUNET_CORE_MessageCallback) (void *cls, |
112 | const struct GNUNET_PeerIdentity *other, | 121 | const struct GNUNET_PeerIdentity * other, |
113 | const struct GNUNET_MessageHeader *message, | 122 | const struct GNUNET_MessageHeader * message, |
114 | const struct GNUNET_TRANSPORT_ATS_Information *atsi); | 123 | const struct |
124 | GNUNET_TRANSPORT_ATS_Information * atsi); | ||
115 | 125 | ||
116 | 126 | ||
117 | /** | 127 | /** |
@@ -153,13 +163,13 @@ struct GNUNET_CORE_MessageHandler | |||
153 | * @param publicKey public key of this peer, NULL if we failed | 163 | * @param publicKey public key of this peer, NULL if we failed |
154 | */ | 164 | */ |
155 | typedef void | 165 | typedef void |
156 | (*GNUNET_CORE_StartupCallback) (void *cls, | 166 | (*GNUNET_CORE_StartupCallback) (void *cls, |
157 | struct GNUNET_CORE_Handle * server, | 167 | struct GNUNET_CORE_Handle * server, |
158 | const struct GNUNET_PeerIdentity * | 168 | const struct GNUNET_PeerIdentity * |
159 | my_identity, | 169 | my_identity, |
160 | const struct | 170 | const struct |
161 | GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded * | 171 | GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded * |
162 | publicKey); | 172 | publicKey); |
163 | 173 | ||
164 | 174 | ||
165 | /** | 175 | /** |
@@ -208,19 +218,27 @@ typedef void | |||
208 | * @return handle to the core service (only useful for disconnect until 'init' is called), | 218 | * @return handle to the core service (only useful for disconnect until 'init' is called), |
209 | * NULL on error (in this case, init is never called) | 219 | * NULL on error (in this case, init is never called) |
210 | */ | 220 | */ |
211 | struct GNUNET_CORE_Handle * | 221 | struct GNUNET_CORE_Handle *GNUNET_CORE_connect (const struct |
212 | GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 222 | GNUNET_CONFIGURATION_Handle |
213 | unsigned int queue_size, | 223 | *cfg, unsigned int queue_size, |
214 | void *cls, | 224 | void *cls, |
215 | GNUNET_CORE_StartupCallback init, | 225 | GNUNET_CORE_StartupCallback |
216 | GNUNET_CORE_ConnectEventHandler connects, | 226 | init, |
217 | GNUNET_CORE_DisconnectEventHandler disconnects, | 227 | GNUNET_CORE_ConnectEventHandler |
218 | GNUNET_CORE_PeerStatusEventHandler status_events, | 228 | connects, |
219 | GNUNET_CORE_MessageCallback inbound_notify, | 229 | GNUNET_CORE_DisconnectEventHandler |
220 | int inbound_hdr_only, | 230 | disconnects, |
221 | GNUNET_CORE_MessageCallback outbound_notify, | 231 | GNUNET_CORE_PeerStatusEventHandler |
222 | int outbound_hdr_only, | 232 | status_events, |
223 | const struct GNUNET_CORE_MessageHandler *handlers); | 233 | GNUNET_CORE_MessageCallback |
234 | inbound_notify, | ||
235 | int inbound_hdr_only, | ||
236 | GNUNET_CORE_MessageCallback | ||
237 | outbound_notify, | ||
238 | int outbound_hdr_only, | ||
239 | const struct | ||
240 | GNUNET_CORE_MessageHandler | ||
241 | *handlers); | ||
224 | 242 | ||
225 | 243 | ||
226 | /** | 244 | /** |
@@ -251,7 +269,7 @@ struct GNUNET_CORE_PeerRequestHandle; | |||
251 | * GNUNET_NO on timeout, | 269 | * GNUNET_NO on timeout, |
252 | * GNUNET_SYSERR if core was shut down | 270 | * GNUNET_SYSERR if core was shut down |
253 | */ | 271 | */ |
254 | typedef void (*GNUNET_CORE_ControlContinuation)(void *cls, int success); | 272 | typedef void (*GNUNET_CORE_ControlContinuation) (void *cls, int success); |
255 | 273 | ||
256 | 274 | ||
257 | /** | 275 | /** |
@@ -271,11 +289,17 @@ typedef void (*GNUNET_CORE_ControlContinuation)(void *cls, int success); | |||
271 | * @param cont_cls closure for cont | 289 | * @param cont_cls closure for cont |
272 | * @return NULL on error (cont will not be called), otherwise handle for cancellation | 290 | * @return NULL on error (cont will not be called), otherwise handle for cancellation |
273 | */ | 291 | */ |
274 | struct GNUNET_CORE_PeerRequestHandle * | 292 | struct GNUNET_CORE_PeerRequestHandle *GNUNET_CORE_peer_request_connect (struct |
275 | GNUNET_CORE_peer_request_connect (struct GNUNET_CORE_Handle *h, | 293 | GNUNET_CORE_Handle |
276 | const struct GNUNET_PeerIdentity * peer, | 294 | *h, |
277 | GNUNET_CORE_ControlContinuation cont, | 295 | const |
278 | void *cont_cls); | 296 | struct |
297 | GNUNET_PeerIdentity | ||
298 | *peer, | ||
299 | GNUNET_CORE_ControlContinuation | ||
300 | cont, | ||
301 | void | ||
302 | *cont_cls); | ||
279 | 303 | ||
280 | 304 | ||
281 | /** | 305 | /** |
@@ -285,7 +309,8 @@ GNUNET_CORE_peer_request_connect (struct GNUNET_CORE_Handle *h, | |||
285 | * @param req request handle that was returned for the original request | 309 | * @param req request handle that was returned for the original request |
286 | */ | 310 | */ |
287 | void | 311 | void |
288 | GNUNET_CORE_peer_request_connect_cancel (struct GNUNET_CORE_PeerRequestHandle *req); | 312 | GNUNET_CORE_peer_request_connect_cancel (struct GNUNET_CORE_PeerRequestHandle |
313 | *req); | ||
289 | 314 | ||
290 | 315 | ||
291 | /** | 316 | /** |
@@ -301,13 +326,15 @@ GNUNET_CORE_peer_request_connect_cancel (struct GNUNET_CORE_PeerRequestHandle *r | |||
301 | * @param preference current traffic preference for the given peer | 326 | * @param preference current traffic preference for the given peer |
302 | */ | 327 | */ |
303 | typedef void | 328 | typedef void |
304 | (*GNUNET_CORE_PeerConfigurationInfoCallback) (void *cls, | 329 | (*GNUNET_CORE_PeerConfigurationInfoCallback) (void *cls, |
305 | const struct | 330 | const struct |
306 | GNUNET_PeerIdentity *peer, | 331 | GNUNET_PeerIdentity * peer, |
307 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 332 | struct |
308 | int32_t amount, | 333 | GNUNET_BANDWIDTH_Value32NBO |
309 | struct GNUNET_TIME_Relative res_delay, | 334 | bandwidth_out, int32_t amount, |
310 | uint64_t preference); | 335 | struct GNUNET_TIME_Relative |
336 | res_delay, | ||
337 | uint64_t preference); | ||
311 | 338 | ||
312 | 339 | ||
313 | 340 | ||
@@ -342,15 +369,15 @@ struct GNUNET_CORE_InformationRequestContext; | |||
342 | * @param info_cls closure for info | 369 | * @param info_cls closure for info |
343 | * @return NULL on error | 370 | * @return NULL on error |
344 | */ | 371 | */ |
345 | struct GNUNET_CORE_InformationRequestContext * | 372 | struct GNUNET_CORE_InformationRequestContext |
346 | GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h, | 373 | *GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h, |
347 | const struct GNUNET_PeerIdentity *peer, | 374 | const struct GNUNET_PeerIdentity *peer, |
348 | struct GNUNET_TIME_Relative timeout, | 375 | struct GNUNET_TIME_Relative timeout, |
349 | struct GNUNET_BANDWIDTH_Value32NBO bw_out, | 376 | struct GNUNET_BANDWIDTH_Value32NBO |
350 | int32_t amount, | 377 | bw_out, int32_t amount, |
351 | uint64_t preference, | 378 | uint64_t preference, |
352 | GNUNET_CORE_PeerConfigurationInfoCallback info, | 379 | GNUNET_CORE_PeerConfigurationInfoCallback |
353 | void *info_cls); | 380 | info, void *info_cls); |
354 | 381 | ||
355 | 382 | ||
356 | /** | 383 | /** |
@@ -365,7 +392,9 @@ GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h, | |||
365 | * @param irc context returned by the original GNUNET_CORE_peer_get_info call | 392 | * @param irc context returned by the original GNUNET_CORE_peer_get_info call |
366 | */ | 393 | */ |
367 | void | 394 | void |
368 | GNUNET_CORE_peer_change_preference_cancel (struct GNUNET_CORE_InformationRequestContext *irc); | 395 | GNUNET_CORE_peer_change_preference_cancel (struct |
396 | GNUNET_CORE_InformationRequestContext | ||
397 | *irc); | ||
369 | 398 | ||
370 | 399 | ||
371 | /** | 400 | /** |
@@ -435,25 +464,25 @@ struct GNUNET_CORE_TransmitHandle; | |||
435 | * NULL if we can not even queue the request (insufficient | 464 | * NULL if we can not even queue the request (insufficient |
436 | * memory); if NULL is returned, "notify" will NOT be called. | 465 | * memory); if NULL is returned, "notify" will NOT be called. |
437 | */ | 466 | */ |
438 | struct GNUNET_CORE_TransmitHandle * | 467 | struct GNUNET_CORE_TransmitHandle *GNUNET_CORE_notify_transmit_ready (struct |
439 | GNUNET_CORE_notify_transmit_ready (struct | 468 | GNUNET_CORE_Handle |
440 | GNUNET_CORE_Handle | 469 | *handle, |
441 | *handle, | 470 | int cork, |
442 | int cork, | 471 | uint32_t |
443 | uint32_t priority, | 472 | priority, |
444 | struct | 473 | struct |
445 | GNUNET_TIME_Relative | 474 | GNUNET_TIME_Relative |
446 | maxdelay, | 475 | maxdelay, |
447 | const | 476 | const |
448 | struct | 477 | struct |
449 | GNUNET_PeerIdentity | 478 | GNUNET_PeerIdentity |
450 | *target, | 479 | *target, |
451 | size_t | 480 | size_t |
452 | notify_size, | 481 | notify_size, |
453 | GNUNET_CONNECTION_TransmitReadyNotify | 482 | GNUNET_CONNECTION_TransmitReadyNotify |
454 | notify, | 483 | notify, |
455 | void | 484 | void |
456 | *notify_cls); | 485 | *notify_cls); |
457 | 486 | ||
458 | 487 | ||
459 | /** | 488 | /** |
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index 883664534..ec71a791b 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h | |||
@@ -231,8 +231,7 @@ struct GNUNET_CRYPTO_AuthKey | |||
231 | * @param len the length of the buffer in bytes | 231 | * @param len the length of the buffer in bytes |
232 | * @return the resulting CRC32 checksum | 232 | * @return the resulting CRC32 checksum |
233 | */ | 233 | */ |
234 | int32_t GNUNET_CRYPTO_crc32_n (const void *buf, | 234 | int32_t GNUNET_CRYPTO_crc32_n (const void *buf, size_t len); |
235 | size_t len); | ||
236 | 235 | ||
237 | 236 | ||
238 | /** | 237 | /** |
@@ -242,8 +241,7 @@ int32_t GNUNET_CRYPTO_crc32_n (const void *buf, | |||
242 | * @param i the upper limit (exclusive) for the random number | 241 | * @param i the upper limit (exclusive) for the random number |
243 | * @return a random value in the interval [0,i) (exclusive). | 242 | * @return a random value in the interval [0,i) (exclusive). |
244 | */ | 243 | */ |
245 | uint32_t GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, | 244 | uint32_t GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, uint32_t i); |
246 | uint32_t i); | ||
247 | 245 | ||
248 | 246 | ||
249 | /** | 247 | /** |
@@ -254,7 +252,7 @@ uint32_t GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, | |||
254 | * @return random 64-bit number | 252 | * @return random 64-bit number |
255 | */ | 253 | */ |
256 | uint64_t GNUNET_CRYPTO_random_u64 (enum GNUNET_CRYPTO_Quality mode, | 254 | uint64_t GNUNET_CRYPTO_random_u64 (enum GNUNET_CRYPTO_Quality mode, |
257 | uint64_t max); | 255 | uint64_t max); |
258 | 256 | ||
259 | 257 | ||
260 | /** | 258 | /** |
@@ -298,12 +296,12 @@ int GNUNET_CRYPTO_aes_check_session_key (const struct | |||
298 | * @return the size of the encrypted block, -1 for errors | 296 | * @return the size of the encrypted block, -1 for errors |
299 | */ | 297 | */ |
300 | ssize_t GNUNET_CRYPTO_aes_encrypt (const void *block, | 298 | ssize_t GNUNET_CRYPTO_aes_encrypt (const void *block, |
301 | size_t len, | 299 | size_t len, |
302 | const struct GNUNET_CRYPTO_AesSessionKey | 300 | const struct GNUNET_CRYPTO_AesSessionKey |
303 | *sessionkey, | 301 | *sessionkey, |
304 | const struct | 302 | const struct |
305 | GNUNET_CRYPTO_AesInitializationVector *iv, | 303 | GNUNET_CRYPTO_AesInitializationVector *iv, |
306 | void *result); | 304 | void *result); |
307 | 305 | ||
308 | 306 | ||
309 | /** | 307 | /** |
@@ -316,11 +314,13 @@ ssize_t GNUNET_CRYPTO_aes_encrypt (const void *block, | |||
316 | * @param result address to store the result at | 314 | * @param result address to store the result at |
317 | * @return -1 on failure, size of decrypted block on success | 315 | * @return -1 on failure, size of decrypted block on success |
318 | */ | 316 | */ |
319 | ssize_t GNUNET_CRYPTO_aes_decrypt (const void *block, | 317 | ssize_t GNUNET_CRYPTO_aes_decrypt (const void *block, |
320 | size_t size, | 318 | size_t size, |
321 | const struct GNUNET_CRYPTO_AesSessionKey *sessionkey, | 319 | const struct GNUNET_CRYPTO_AesSessionKey |
322 | const struct GNUNET_CRYPTO_AesInitializationVector *iv, | 320 | *sessionkey, |
323 | void *result); | 321 | const struct |
322 | GNUNET_CRYPTO_AesInitializationVector *iv, | ||
323 | void *result); | ||
324 | 324 | ||
325 | 325 | ||
326 | /** | 326 | /** |
@@ -333,9 +333,8 @@ ssize_t GNUNET_CRYPTO_aes_decrypt (const void *block, | |||
333 | */ | 333 | */ |
334 | void | 334 | void |
335 | GNUNET_CRYPTO_aes_derive_iv (struct GNUNET_CRYPTO_AesInitializationVector *iv, | 335 | GNUNET_CRYPTO_aes_derive_iv (struct GNUNET_CRYPTO_AesInitializationVector *iv, |
336 | const struct GNUNET_CRYPTO_AesSessionKey *skey, | 336 | const struct GNUNET_CRYPTO_AesSessionKey *skey, |
337 | const void *salt, size_t salt_len, | 337 | const void *salt, size_t salt_len, ...); |
338 | ...); | ||
339 | 338 | ||
340 | 339 | ||
341 | /** | 340 | /** |
@@ -348,9 +347,8 @@ GNUNET_CRYPTO_aes_derive_iv (struct GNUNET_CRYPTO_AesInitializationVector *iv, | |||
348 | */ | 347 | */ |
349 | void | 348 | void |
350 | GNUNET_CRYPTO_aes_derive_iv_v (struct GNUNET_CRYPTO_AesInitializationVector *iv, | 349 | GNUNET_CRYPTO_aes_derive_iv_v (struct GNUNET_CRYPTO_AesInitializationVector *iv, |
351 | const struct GNUNET_CRYPTO_AesSessionKey *skey, | 350 | const struct GNUNET_CRYPTO_AesSessionKey *skey, |
352 | const void *salt, size_t salt_len, | 351 | const void *salt, size_t salt_len, va_list argp); |
353 | va_list argp); | ||
354 | 352 | ||
355 | 353 | ||
356 | /** | 354 | /** |
@@ -360,8 +358,7 @@ GNUNET_CRYPTO_aes_derive_iv_v (struct GNUNET_CRYPTO_AesInitializationVector *iv, | |||
360 | * safely cast to char*, a '\\0' termination is set). | 358 | * safely cast to char*, a '\\0' termination is set). |
361 | */ | 359 | */ |
362 | void GNUNET_CRYPTO_hash_to_enc (const GNUNET_HashCode * block, | 360 | void GNUNET_CRYPTO_hash_to_enc (const GNUNET_HashCode * block, |
363 | struct GNUNET_CRYPTO_HashAsciiEncoded | 361 | struct GNUNET_CRYPTO_HashAsciiEncoded *result); |
364 | *result); | ||
365 | 362 | ||
366 | 363 | ||
367 | /** | 364 | /** |
@@ -370,8 +367,7 @@ void GNUNET_CRYPTO_hash_to_enc (const GNUNET_HashCode * block, | |||
370 | * @param result where to store the GNUNET_CRYPTO_hash code | 367 | * @param result where to store the GNUNET_CRYPTO_hash code |
371 | * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong encoding | 368 | * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong encoding |
372 | */ | 369 | */ |
373 | int GNUNET_CRYPTO_hash_from_string (const char *enc, | 370 | int GNUNET_CRYPTO_hash_from_string (const char *enc, GNUNET_HashCode * result); |
374 | GNUNET_HashCode * result); | ||
375 | 371 | ||
376 | 372 | ||
377 | /** | 373 | /** |
@@ -386,7 +382,7 @@ int GNUNET_CRYPTO_hash_from_string (const char *enc, | |||
386 | * @return number between 0 and UINT32_MAX | 382 | * @return number between 0 and UINT32_MAX |
387 | */ | 383 | */ |
388 | uint32_t GNUNET_CRYPTO_hash_distance_u32 (const GNUNET_HashCode * a, | 384 | uint32_t GNUNET_CRYPTO_hash_distance_u32 (const GNUNET_HashCode * a, |
389 | const GNUNET_HashCode * b); | 385 | const GNUNET_HashCode * b); |
390 | 386 | ||
391 | 387 | ||
392 | /** | 388 | /** |
@@ -396,9 +392,7 @@ uint32_t GNUNET_CRYPTO_hash_distance_u32 (const GNUNET_HashCode * a, | |||
396 | * @param size size of the block | 392 | * @param size size of the block |
397 | * @param ret pointer to where to write the hashcode | 393 | * @param ret pointer to where to write the hashcode |
398 | */ | 394 | */ |
399 | void GNUNET_CRYPTO_hash (const void *block, | 395 | void GNUNET_CRYPTO_hash (const void *block, size_t size, GNUNET_HashCode * ret); |
400 | size_t size, | ||
401 | GNUNET_HashCode * ret); | ||
402 | 396 | ||
403 | 397 | ||
404 | /** | 398 | /** |
@@ -409,11 +403,10 @@ void GNUNET_CRYPTO_hash (const void *block, | |||
409 | * @param plaintext_len length of plaintext | 403 | * @param plaintext_len length of plaintext |
410 | * @param hmac where to store the hmac | 404 | * @param hmac where to store the hmac |
411 | */ | 405 | */ |
412 | void | 406 | void |
413 | GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key, | 407 | GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key, |
414 | const void *plaintext, | 408 | const void *plaintext, |
415 | size_t plaintext_len, | 409 | size_t plaintext_len, GNUNET_HashCode * hmac); |
416 | GNUNET_HashCode *hmac); | ||
417 | 410 | ||
418 | 411 | ||
419 | /** | 412 | /** |
@@ -443,12 +436,16 @@ struct GNUNET_CRYPTO_FileHashContext; | |||
443 | * @param callback_cls closure for callback | 436 | * @param callback_cls closure for callback |
444 | * @return NULL on (immediate) errror | 437 | * @return NULL on (immediate) errror |
445 | */ | 438 | */ |
446 | struct GNUNET_CRYPTO_FileHashContext * | 439 | struct GNUNET_CRYPTO_FileHashContext *GNUNET_CRYPTO_hash_file (enum |
447 | GNUNET_CRYPTO_hash_file (enum GNUNET_SCHEDULER_Priority priority, | 440 | GNUNET_SCHEDULER_Priority |
448 | const char *filename, | 441 | priority, |
449 | size_t blocksize, | 442 | const char |
450 | GNUNET_CRYPTO_HashCompletedCallback callback, | 443 | *filename, |
451 | void *callback_cls); | 444 | size_t blocksize, |
445 | GNUNET_CRYPTO_HashCompletedCallback | ||
446 | callback, | ||
447 | void | ||
448 | *callback_cls); | ||
452 | 449 | ||
453 | 450 | ||
454 | /** | 451 | /** |
@@ -456,8 +453,7 @@ GNUNET_CRYPTO_hash_file (enum GNUNET_SCHEDULER_Priority priority, | |||
456 | * | 453 | * |
457 | * @param fhc operation to cancel (callback must not yet have been invoked) | 454 | * @param fhc operation to cancel (callback must not yet have been invoked) |
458 | */ | 455 | */ |
459 | void | 456 | void GNUNET_CRYPTO_hash_file_cancel (struct GNUNET_CRYPTO_FileHashContext *fhc); |
460 | GNUNET_CRYPTO_hash_file_cancel (struct GNUNET_CRYPTO_FileHashContext *fhc); | ||
461 | 457 | ||
462 | 458 | ||
463 | /** | 459 | /** |
@@ -467,7 +463,7 @@ GNUNET_CRYPTO_hash_file_cancel (struct GNUNET_CRYPTO_FileHashContext *fhc); | |||
467 | * @param result hash code that is randomized | 463 | * @param result hash code that is randomized |
468 | */ | 464 | */ |
469 | void GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode, | 465 | void GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode, |
470 | GNUNET_HashCode * result); | 466 | GNUNET_HashCode * result); |
471 | 467 | ||
472 | 468 | ||
473 | /** | 469 | /** |
@@ -516,8 +512,7 @@ void GNUNET_CRYPTO_hash_xor (const GNUNET_HashCode * a, | |||
516 | void GNUNET_CRYPTO_hash_to_aes_key (const GNUNET_HashCode * hc, | 512 | void GNUNET_CRYPTO_hash_to_aes_key (const GNUNET_HashCode * hc, |
517 | struct GNUNET_CRYPTO_AesSessionKey *skey, | 513 | struct GNUNET_CRYPTO_AesSessionKey *skey, |
518 | struct | 514 | struct |
519 | GNUNET_CRYPTO_AesInitializationVector | 515 | GNUNET_CRYPTO_AesInitializationVector *iv); |
520 | *iv); | ||
521 | 516 | ||
522 | 517 | ||
523 | /** | 518 | /** |
@@ -527,8 +522,7 @@ void GNUNET_CRYPTO_hash_to_aes_key (const GNUNET_HashCode * hc, | |||
527 | * @param bit index into the hashcode, [0...159] | 522 | * @param bit index into the hashcode, [0...159] |
528 | * @return Bit \a bit from hashcode \a code, -1 for invalid index | 523 | * @return Bit \a bit from hashcode \a code, -1 for invalid index |
529 | */ | 524 | */ |
530 | int GNUNET_CRYPTO_hash_get_bit (const GNUNET_HashCode * code, | 525 | int GNUNET_CRYPTO_hash_get_bit (const GNUNET_HashCode * code, unsigned int bit); |
531 | unsigned int bit); | ||
532 | 526 | ||
533 | /** | 527 | /** |
534 | * Determine how many low order bits match in two | 528 | * Determine how many low order bits match in two |
@@ -542,7 +536,8 @@ int GNUNET_CRYPTO_hash_get_bit (const GNUNET_HashCode * code, | |||
542 | * | 536 | * |
543 | * @return the number of bits that match | 537 | * @return the number of bits that match |
544 | */ | 538 | */ |
545 | unsigned int GNUNET_CRYPTO_hash_matching_bits(const GNUNET_HashCode *first, const GNUNET_HashCode *second); | 539 | unsigned int GNUNET_CRYPTO_hash_matching_bits (const GNUNET_HashCode * first, |
540 | const GNUNET_HashCode * second); | ||
546 | 541 | ||
547 | 542 | ||
548 | /** | 543 | /** |
@@ -580,11 +575,10 @@ int GNUNET_CRYPTO_hash_xorcmp (const GNUNET_HashCode * h1, | |||
580 | * @param argp pair of void * & size_t for context chunks, terminated by NULL | 575 | * @param argp pair of void * & size_t for context chunks, terminated by NULL |
581 | */ | 576 | */ |
582 | void | 577 | void |
583 | GNUNET_CRYPTO_hmac_derive_key_v(struct GNUNET_CRYPTO_AuthKey *key, | 578 | GNUNET_CRYPTO_hmac_derive_key_v (struct GNUNET_CRYPTO_AuthKey *key, |
584 | const struct GNUNET_CRYPTO_AesSessionKey *rkey, | 579 | const struct GNUNET_CRYPTO_AesSessionKey *rkey, |
585 | const void *salt, | 580 | const void *salt, |
586 | size_t salt_len, | 581 | size_t salt_len, va_list argp); |
587 | va_list argp); | ||
588 | 582 | ||
589 | 583 | ||
590 | /** | 584 | /** |
@@ -596,11 +590,9 @@ GNUNET_CRYPTO_hmac_derive_key_v(struct GNUNET_CRYPTO_AuthKey *key, | |||
596 | * @param ... pair of void * & size_t for context chunks, terminated by NULL | 590 | * @param ... pair of void * & size_t for context chunks, terminated by NULL |
597 | */ | 591 | */ |
598 | void | 592 | void |
599 | GNUNET_CRYPTO_hmac_derive_key(struct GNUNET_CRYPTO_AuthKey *key, | 593 | GNUNET_CRYPTO_hmac_derive_key (struct GNUNET_CRYPTO_AuthKey *key, |
600 | const struct GNUNET_CRYPTO_AesSessionKey *rkey, | 594 | const struct GNUNET_CRYPTO_AesSessionKey *rkey, |
601 | const void *salt, | 595 | const void *salt, size_t salt_len, ...); |
602 | size_t salt_len, | ||
603 | ...); | ||
604 | 596 | ||
605 | /** | 597 | /** |
606 | * @brief Derive key | 598 | * @brief Derive key |
@@ -615,12 +607,11 @@ GNUNET_CRYPTO_hmac_derive_key(struct GNUNET_CRYPTO_AuthKey *key, | |||
615 | * @return GNUNET_YES on success | 607 | * @return GNUNET_YES on success |
616 | */ | 608 | */ |
617 | int | 609 | int |
618 | GNUNET_CRYPTO_hkdf (void *result, | 610 | GNUNET_CRYPTO_hkdf (void *result, |
619 | size_t out_len, | 611 | size_t out_len, |
620 | int xtr_algo, int prf_algo, | 612 | int xtr_algo, int prf_algo, |
621 | const void *xts, size_t xts_len, | 613 | const void *xts, size_t xts_len, |
622 | const void *skm, size_t skm_len, | 614 | const void *skm, size_t skm_len, ...); |
623 | ...); | ||
624 | 615 | ||
625 | 616 | ||
626 | /** | 617 | /** |
@@ -637,13 +628,12 @@ GNUNET_CRYPTO_hkdf (void *result, | |||
637 | * @return GNUNET_YES on success | 628 | * @return GNUNET_YES on success |
638 | */ | 629 | */ |
639 | int | 630 | int |
640 | GNUNET_CRYPTO_hkdf_v (void *result, | 631 | GNUNET_CRYPTO_hkdf_v (void *result, |
641 | size_t out_len, | 632 | size_t out_len, |
642 | int xtr_algo, | 633 | int xtr_algo, |
643 | int prf_algo, | 634 | int prf_algo, |
644 | const void *xts, size_t xts_len, | 635 | const void *xts, size_t xts_len, |
645 | const void *skm, size_t skm_len, | 636 | const void *skm, size_t skm_len, va_list argp); |
646 | va_list argp); | ||
647 | 637 | ||
648 | 638 | ||
649 | /** | 639 | /** |
@@ -658,11 +648,10 @@ GNUNET_CRYPTO_hkdf_v (void *result, | |||
658 | * @return GNUNET_YES on success | 648 | * @return GNUNET_YES on success |
659 | */ | 649 | */ |
660 | int | 650 | int |
661 | GNUNET_CRYPTO_kdf_v (void *result, | 651 | GNUNET_CRYPTO_kdf_v (void *result, |
662 | size_t out_len, | 652 | size_t out_len, |
663 | const void *xts, size_t xts_len, | 653 | const void *xts, size_t xts_len, |
664 | const void *skm, size_t skm_len, | 654 | const void *skm, size_t skm_len, va_list argp); |
665 | va_list argp); | ||
666 | 655 | ||
667 | 656 | ||
668 | /** | 657 | /** |
@@ -678,8 +667,8 @@ GNUNET_CRYPTO_kdf_v (void *result, | |||
678 | */ | 667 | */ |
679 | int | 668 | int |
680 | GNUNET_CRYPTO_kdf (void *result, size_t out_len, | 669 | GNUNET_CRYPTO_kdf (void *result, size_t out_len, |
681 | const void *xts, size_t xts_len, const void *skm, | 670 | const void *xts, size_t xts_len, const void *skm, |
682 | size_t skm_len, ...); | 671 | size_t skm_len, ...); |
683 | 672 | ||
684 | 673 | ||
685 | /** | 674 | /** |
@@ -696,8 +685,9 @@ struct GNUNET_CRYPTO_RsaPrivateKey *GNUNET_CRYPTO_rsa_key_create (void); | |||
696 | * @param buf the buffer where the private key data is stored | 685 | * @param buf the buffer where the private key data is stored |
697 | * @param len the length of the data in 'buffer' | 686 | * @param len the length of the data in 'buffer' |
698 | */ | 687 | */ |
699 | struct GNUNET_CRYPTO_RsaPrivateKey * | 688 | struct GNUNET_CRYPTO_RsaPrivateKey *GNUNET_CRYPTO_rsa_decode_key (const char |
700 | GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len); | 689 | *buf, |
690 | uint16_t len); | ||
701 | 691 | ||
702 | /** | 692 | /** |
703 | * Create a new private key by reading it from a file. If the | 693 | * Create a new private key by reading it from a file. If the |
@@ -714,7 +704,7 @@ GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len); | |||
714 | * permission denied) | 704 | * permission denied) |
715 | */ | 705 | */ |
716 | struct GNUNET_CRYPTO_RsaPrivateKey | 706 | struct GNUNET_CRYPTO_RsaPrivateKey |
717 | *GNUNET_CRYPTO_rsa_key_create_from_file (const char *filename); | 707 | *GNUNET_CRYPTO_rsa_key_create_from_file (const char *filename); |
718 | 708 | ||
719 | 709 | ||
720 | /** | 710 | /** |
@@ -725,7 +715,7 @@ struct GNUNET_CRYPTO_RsaPrivateKey | |||
725 | * @return some private key purely dependent on input | 715 | * @return some private key purely dependent on input |
726 | */ | 716 | */ |
727 | struct GNUNET_CRYPTO_RsaPrivateKey | 717 | struct GNUNET_CRYPTO_RsaPrivateKey |
728 | *GNUNET_CRYPTO_rsa_key_create_from_hash (const GNUNET_HashCode * hc); | 718 | *GNUNET_CRYPTO_rsa_key_create_from_hash (const GNUNET_HashCode * hc); |
729 | 719 | ||
730 | 720 | ||
731 | /** | 721 | /** |
@@ -775,11 +765,10 @@ int GNUNET_CRYPTO_rsa_encrypt (const void *block, | |||
775 | * @param max how many bytes of a result are expected? Must be exact. | 765 | * @param max how many bytes of a result are expected? Must be exact. |
776 | * @return the size of the decrypted block (that is, size) or -1 on error | 766 | * @return the size of the decrypted block (that is, size) or -1 on error |
777 | */ | 767 | */ |
778 | ssize_t GNUNET_CRYPTO_rsa_decrypt (const struct GNUNET_CRYPTO_RsaPrivateKey *key, | 768 | ssize_t GNUNET_CRYPTO_rsa_decrypt (const struct GNUNET_CRYPTO_RsaPrivateKey |
779 | const struct GNUNET_CRYPTO_RsaEncryptedData | 769 | *key, |
780 | *block, | 770 | const struct GNUNET_CRYPTO_RsaEncryptedData |
781 | void *result, | 771 | *block, void *result, size_t max); |
782 | size_t max); | ||
783 | 772 | ||
784 | 773 | ||
785 | /** | 774 | /** |
@@ -792,8 +781,7 @@ ssize_t GNUNET_CRYPTO_rsa_decrypt (const struct GNUNET_CRYPTO_RsaPrivateKey *key | |||
792 | */ | 781 | */ |
793 | int GNUNET_CRYPTO_rsa_sign (const struct GNUNET_CRYPTO_RsaPrivateKey *key, | 782 | int GNUNET_CRYPTO_rsa_sign (const struct GNUNET_CRYPTO_RsaPrivateKey *key, |
794 | const struct GNUNET_CRYPTO_RsaSignaturePurpose | 783 | const struct GNUNET_CRYPTO_RsaSignaturePurpose |
795 | *purpose, | 784 | *purpose, struct GNUNET_CRYPTO_RsaSignature *sig); |
796 | struct GNUNET_CRYPTO_RsaSignature *sig); | ||
797 | 785 | ||
798 | 786 | ||
799 | /** | 787 | /** |
diff --git a/src/include/gnunet_datacache_lib.h b/src/include/gnunet_datacache_lib.h index 5fcd99ad4..a1712b809 100644 --- a/src/include/gnunet_datacache_lib.h +++ b/src/include/gnunet_datacache_lib.h | |||
@@ -56,9 +56,10 @@ struct GNUNET_DATACACHE_Handle; | |||
56 | * @param section section in the configuration that contains our options | 56 | * @param section section in the configuration that contains our options |
57 | * @return handle to use to access the service | 57 | * @return handle to use to access the service |
58 | */ | 58 | */ |
59 | struct GNUNET_DATACACHE_Handle * | 59 | struct GNUNET_DATACACHE_Handle *GNUNET_DATACACHE_create (const struct |
60 | GNUNET_DATACACHE_create (const struct GNUNET_CONFIGURATION_Handle *cfg, | 60 | GNUNET_CONFIGURATION_Handle |
61 | const char *section); | 61 | *cfg, |
62 | const char *section); | ||
62 | 63 | ||
63 | 64 | ||
64 | /** | 65 | /** |
@@ -81,11 +82,11 @@ void GNUNET_DATACACHE_destroy (struct GNUNET_DATACACHE_Handle *h); | |||
81 | * @return GNUNET_OK to continue iterating, GNUNET_SYSERR to abort | 82 | * @return GNUNET_OK to continue iterating, GNUNET_SYSERR to abort |
82 | */ | 83 | */ |
83 | typedef int (*GNUNET_DATACACHE_Iterator) (void *cls, | 84 | typedef int (*GNUNET_DATACACHE_Iterator) (void *cls, |
84 | struct GNUNET_TIME_Absolute exp, | 85 | struct GNUNET_TIME_Absolute exp, |
85 | const GNUNET_HashCode * key, | 86 | const GNUNET_HashCode * key, |
86 | size_t size, | 87 | size_t size, |
87 | const char *data, | 88 | const char *data, |
88 | enum GNUNET_BLOCK_Type type); | 89 | enum GNUNET_BLOCK_Type type); |
89 | 90 | ||
90 | 91 | ||
91 | /** | 92 | /** |
@@ -99,13 +100,13 @@ typedef int (*GNUNET_DATACACHE_Iterator) (void *cls, | |||
99 | * @param discard_time when to discard the value in any case | 100 | * @param discard_time when to discard the value in any case |
100 | * @return GNUNET_OK on success, GNUNET_SYSERR on error (full, etc.) | 101 | * @return GNUNET_OK on success, GNUNET_SYSERR on error (full, etc.) |
101 | */ | 102 | */ |
102 | int | 103 | int |
103 | GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h, | 104 | GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h, |
104 | const GNUNET_HashCode * key, | 105 | const GNUNET_HashCode * key, |
105 | size_t size, | 106 | size_t size, |
106 | const char *data, | 107 | const char *data, |
107 | enum GNUNET_BLOCK_Type type, | 108 | enum GNUNET_BLOCK_Type type, |
108 | struct GNUNET_TIME_Absolute discard_time); | 109 | struct GNUNET_TIME_Absolute discard_time); |
109 | 110 | ||
110 | 111 | ||
111 | /** | 112 | /** |
@@ -119,12 +120,11 @@ GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h, | |||
119 | * @param iter_cls closure for iter | 120 | * @param iter_cls closure for iter |
120 | * @return the number of results found | 121 | * @return the number of results found |
121 | */ | 122 | */ |
122 | unsigned int | 123 | unsigned int |
123 | GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h, | 124 | GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h, |
124 | const GNUNET_HashCode * key, | 125 | const GNUNET_HashCode * key, |
125 | enum GNUNET_BLOCK_Type type, | 126 | enum GNUNET_BLOCK_Type type, |
126 | GNUNET_DATACACHE_Iterator iter, | 127 | GNUNET_DATACACHE_Iterator iter, void *iter_cls); |
127 | void *iter_cls); | ||
128 | 128 | ||
129 | 129 | ||
130 | #if 0 /* keep Emacsens' auto-indent happy */ | 130 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_datacache_plugin.h b/src/include/gnunet_datacache_plugin.h index cdacd474b..c7ce0bef1 100644 --- a/src/include/gnunet_datacache_plugin.h +++ b/src/include/gnunet_datacache_plugin.h | |||
@@ -45,9 +45,9 @@ extern "C" | |||
45 | * @param key key of the content that was deleted | 45 | * @param key key of the content that was deleted |
46 | * @param size number of bytes that were made available | 46 | * @param size number of bytes that were made available |
47 | */ | 47 | */ |
48 | typedef void (*GNUNET_DATACACHE_DeleteNotifyCallback)(void *cls, | 48 | typedef void (*GNUNET_DATACACHE_DeleteNotifyCallback) (void *cls, |
49 | const GNUNET_HashCode *key, | 49 | const GNUNET_HashCode * |
50 | size_t size); | 50 | key, size_t size); |
51 | 51 | ||
52 | 52 | ||
53 | /** | 53 | /** |
@@ -57,7 +57,7 @@ typedef void (*GNUNET_DATACACHE_DeleteNotifyCallback)(void *cls, | |||
57 | */ | 57 | */ |
58 | struct GNUNET_DATACACHE_PluginEnvironment | 58 | struct GNUNET_DATACACHE_PluginEnvironment |
59 | { | 59 | { |
60 | 60 | ||
61 | 61 | ||
62 | /** | 62 | /** |
63 | * Configuration to use. | 63 | * Configuration to use. |
@@ -91,11 +91,12 @@ struct GNUNET_DATACACHE_PluginEnvironment | |||
91 | /** | 91 | /** |
92 | * @brief struct returned by the initialization function of the plugin | 92 | * @brief struct returned by the initialization function of the plugin |
93 | */ | 93 | */ |
94 | struct GNUNET_DATACACHE_PluginFunctions { | 94 | struct GNUNET_DATACACHE_PluginFunctions |
95 | { | ||
95 | 96 | ||
96 | /** | 97 | /** |
97 | * Closure to pass to all plugin functions. | 98 | * Closure to pass to all plugin functions. |
98 | */ | 99 | */ |
99 | void *cls; | 100 | void *cls; |
100 | 101 | ||
101 | /** | 102 | /** |
@@ -108,12 +109,12 @@ struct GNUNET_DATACACHE_PluginFunctions { | |||
108 | * @param discard_time when to discard the value in any case | 109 | * @param discard_time when to discard the value in any case |
109 | * @return 0 on error, number of bytes used otherwise | 110 | * @return 0 on error, number of bytes used otherwise |
110 | */ | 111 | */ |
111 | size_t (*put) (void *cls, | 112 | size_t (*put) (void *cls, |
112 | const GNUNET_HashCode * key, | 113 | const GNUNET_HashCode * key, |
113 | size_t size, | 114 | size_t size, |
114 | const char *data, | 115 | const char *data, |
115 | enum GNUNET_BLOCK_Type type, | 116 | enum GNUNET_BLOCK_Type type, |
116 | struct GNUNET_TIME_Absolute discard_time); | 117 | struct GNUNET_TIME_Absolute discard_time); |
117 | 118 | ||
118 | 119 | ||
119 | /** | 120 | /** |
@@ -128,10 +129,9 @@ struct GNUNET_DATACACHE_PluginFunctions { | |||
128 | * @return the number of results found | 129 | * @return the number of results found |
129 | */ | 130 | */ |
130 | unsigned int (*get) (void *cls, | 131 | unsigned int (*get) (void *cls, |
131 | const GNUNET_HashCode * key, | 132 | const GNUNET_HashCode * key, |
132 | enum GNUNET_BLOCK_Type type, | 133 | enum GNUNET_BLOCK_Type type, |
133 | GNUNET_DATACACHE_Iterator iter, | 134 | GNUNET_DATACACHE_Iterator iter, void *iter_cls); |
134 | void *iter_cls); | ||
135 | 135 | ||
136 | 136 | ||
137 | /** | 137 | /** |
@@ -140,7 +140,7 @@ struct GNUNET_DATACACHE_PluginFunctions { | |||
140 | * | 140 | * |
141 | * @param cls closure (internal context for the plugin) | 141 | * @param cls closure (internal context for the plugin) |
142 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 142 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
143 | */ | 143 | */ |
144 | int (*del) (void *cls); | 144 | int (*del) (void *cls); |
145 | 145 | ||
146 | 146 | ||
diff --git a/src/include/gnunet_datastore_plugin.h b/src/include/gnunet_datastore_plugin.h index fe4cefb0a..f33588bce 100644 --- a/src/include/gnunet_datastore_plugin.h +++ b/src/include/gnunet_datastore_plugin.h | |||
@@ -48,8 +48,7 @@ | |||
48 | * @param delta change in disk utilization, | 48 | * @param delta change in disk utilization, |
49 | * 0 for "reset to empty" | 49 | * 0 for "reset to empty" |
50 | */ | 50 | */ |
51 | typedef void (*DiskUtilizationChange)(void *cls, | 51 | typedef void (*DiskUtilizationChange) (void *cls, int delta); |
52 | int delta); | ||
53 | 52 | ||
54 | 53 | ||
55 | /** | 54 | /** |
@@ -94,15 +93,14 @@ struct GNUNET_DATASTORE_PluginEnvironment | |||
94 | * GNUNET_NO to delete the item | 93 | * GNUNET_NO to delete the item |
95 | */ | 94 | */ |
96 | typedef int (*PluginDatumProcessor) (void *cls, | 95 | typedef int (*PluginDatumProcessor) (void *cls, |
97 | const GNUNET_HashCode * key, | 96 | const GNUNET_HashCode * key, |
98 | uint32_t size, | 97 | uint32_t size, |
99 | const void *data, | 98 | const void *data, |
100 | enum GNUNET_BLOCK_Type type, | 99 | enum GNUNET_BLOCK_Type type, |
101 | uint32_t priority, | 100 | uint32_t priority, |
102 | uint32_t anonymity, | 101 | uint32_t anonymity, |
103 | struct GNUNET_TIME_Absolute | 102 | struct GNUNET_TIME_Absolute |
104 | expiration, | 103 | expiration, uint64_t uid); |
105 | uint64_t uid); | ||
106 | 104 | ||
107 | /** | 105 | /** |
108 | * Get an estimate of how much space the database is | 106 | * Get an estimate of how much space the database is |
@@ -133,15 +131,14 @@ typedef unsigned long long (*PluginEstimateSize) (void *cls); | |||
133 | * GNUNET_SYSERR on failure | 131 | * GNUNET_SYSERR on failure |
134 | */ | 132 | */ |
135 | typedef int (*PluginPut) (void *cls, | 133 | typedef int (*PluginPut) (void *cls, |
136 | const GNUNET_HashCode * key, | 134 | const GNUNET_HashCode * key, |
137 | uint32_t size, | 135 | uint32_t size, |
138 | const void *data, | 136 | const void *data, |
139 | enum GNUNET_BLOCK_Type type, | 137 | enum GNUNET_BLOCK_Type type, |
140 | uint32_t priority, | 138 | uint32_t priority, |
141 | uint32_t anonymity, | 139 | uint32_t anonymity, |
142 | uint32_t replication, | 140 | uint32_t replication, |
143 | struct GNUNET_TIME_Absolute expiration, | 141 | struct GNUNET_TIME_Absolute expiration, char **msg); |
144 | char **msg); | ||
145 | 142 | ||
146 | 143 | ||
147 | /** | 144 | /** |
@@ -163,11 +160,11 @@ typedef int (*PluginPut) (void *cls, | |||
163 | * @param proc_cls closure for proc | 160 | * @param proc_cls closure for proc |
164 | */ | 161 | */ |
165 | typedef void (*PluginGetKey) (void *cls, | 162 | typedef void (*PluginGetKey) (void *cls, |
166 | uint64_t offset, | 163 | uint64_t offset, |
167 | const GNUNET_HashCode *key, | 164 | const GNUNET_HashCode * key, |
168 | const GNUNET_HashCode *vhash, | 165 | const GNUNET_HashCode * vhash, |
169 | enum GNUNET_BLOCK_Type type, | 166 | enum GNUNET_BLOCK_Type type, |
170 | PluginDatumProcessor proc, void *proc_cls); | 167 | PluginDatumProcessor proc, void *proc_cls); |
171 | 168 | ||
172 | 169 | ||
173 | 170 | ||
@@ -182,7 +179,7 @@ typedef void (*PluginGetKey) (void *cls, | |||
182 | * @param proc_cls closure for proc | 179 | * @param proc_cls closure for proc |
183 | */ | 180 | */ |
184 | typedef void (*PluginGetRandom) (void *cls, | 181 | typedef void (*PluginGetRandom) (void *cls, |
185 | PluginDatumProcessor proc, void *proc_cls); | 182 | PluginDatumProcessor proc, void *proc_cls); |
186 | 183 | ||
187 | 184 | ||
188 | /** | 185 | /** |
@@ -209,10 +206,9 @@ typedef void (*PluginGetRandom) (void *cls, | |||
209 | * @return GNUNET_OK on success | 206 | * @return GNUNET_OK on success |
210 | */ | 207 | */ |
211 | typedef int (*PluginUpdate) (void *cls, | 208 | typedef int (*PluginUpdate) (void *cls, |
212 | uint64_t uid, | 209 | uint64_t uid, |
213 | int delta, | 210 | int delta, |
214 | struct GNUNET_TIME_Absolute expire, | 211 | struct GNUNET_TIME_Absolute expire, char **msg); |
215 | char **msg); | ||
216 | 212 | ||
217 | 213 | ||
218 | /** | 214 | /** |
@@ -228,10 +224,9 @@ typedef int (*PluginUpdate) (void *cls, | |||
228 | * @param proc_cls closure for proc | 224 | * @param proc_cls closure for proc |
229 | */ | 225 | */ |
230 | typedef void (*PluginGetType) (void *cls, | 226 | typedef void (*PluginGetType) (void *cls, |
231 | uint64_t offset, | 227 | uint64_t offset, |
232 | enum GNUNET_BLOCK_Type type, | 228 | enum GNUNET_BLOCK_Type type, |
233 | PluginDatumProcessor proc, | 229 | PluginDatumProcessor proc, void *proc_cls); |
234 | void *proc_cls); | ||
235 | 230 | ||
236 | 231 | ||
237 | /** | 232 | /** |
diff --git a/src/include/gnunet_datastore_service.h b/src/include/gnunet_datastore_service.h index 4671cfbda..58c730aba 100644 --- a/src/include/gnunet_datastore_service.h +++ b/src/include/gnunet_datastore_service.h | |||
@@ -75,8 +75,7 @@ struct GNUNET_DATASTORE_Handle *GNUNET_DATASTORE_connect (const struct | |||
75 | * @param h handle to the datastore | 75 | * @param h handle to the datastore |
76 | * @param drop set to GNUNET_YES to delete all data in datastore (!) | 76 | * @param drop set to GNUNET_YES to delete all data in datastore (!) |
77 | */ | 77 | */ |
78 | void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, | 78 | void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, int drop); |
79 | int drop); | ||
80 | 79 | ||
81 | 80 | ||
82 | /** | 81 | /** |
@@ -89,9 +88,9 @@ void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, | |||
89 | * GNUNET_YES (or other positive value) on success | 88 | * GNUNET_YES (or other positive value) on success |
90 | * @param msg NULL on success, otherwise an error message | 89 | * @param msg NULL on success, otherwise an error message |
91 | */ | 90 | */ |
92 | typedef void (*GNUNET_DATASTORE_ContinuationWithStatus)(void *cls, | 91 | typedef void (*GNUNET_DATASTORE_ContinuationWithStatus) (void *cls, |
93 | int32_t success, | 92 | int32_t success, |
94 | const char *msg); | 93 | const char *msg); |
95 | 94 | ||
96 | 95 | ||
97 | /** | 96 | /** |
@@ -113,15 +112,21 @@ typedef void (*GNUNET_DATASTORE_ContinuationWithStatus)(void *cls, | |||
113 | * cancel; note that even if NULL is returned, the callback will be invoked | 112 | * cancel; note that even if NULL is returned, the callback will be invoked |
114 | * (or rather, will already have been invoked) | 113 | * (or rather, will already have been invoked) |
115 | */ | 114 | */ |
116 | struct GNUNET_DATASTORE_QueueEntry * | 115 | struct GNUNET_DATASTORE_QueueEntry *GNUNET_DATASTORE_reserve (struct |
117 | GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h, | 116 | GNUNET_DATASTORE_Handle |
118 | uint64_t amount, | 117 | *h, |
119 | uint32_t entries, | 118 | uint64_t amount, |
120 | unsigned int queue_priority, | 119 | uint32_t entries, |
121 | unsigned int max_queue_size, | 120 | unsigned int |
122 | struct GNUNET_TIME_Relative timeout, | 121 | queue_priority, |
123 | GNUNET_DATASTORE_ContinuationWithStatus cont, | 122 | unsigned int |
124 | void *cont_cls); | 123 | max_queue_size, |
124 | struct | ||
125 | GNUNET_TIME_Relative | ||
126 | timeout, | ||
127 | GNUNET_DATASTORE_ContinuationWithStatus | ||
128 | cont, | ||
129 | void *cont_cls); | ||
125 | 130 | ||
126 | 131 | ||
127 | /** | 132 | /** |
@@ -150,22 +155,29 @@ GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h, | |||
150 | * cancel; note that even if NULL is returned, the callback will be invoked | 155 | * cancel; note that even if NULL is returned, the callback will be invoked |
151 | * (or rather, will already have been invoked) | 156 | * (or rather, will already have been invoked) |
152 | */ | 157 | */ |
153 | struct GNUNET_DATASTORE_QueueEntry * | 158 | struct GNUNET_DATASTORE_QueueEntry *GNUNET_DATASTORE_put (struct |
154 | GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, | 159 | GNUNET_DATASTORE_Handle |
155 | uint32_t rid, | 160 | *h, uint32_t rid, |
156 | const GNUNET_HashCode * key, | 161 | const GNUNET_HashCode |
157 | size_t size, | 162 | * key, size_t size, |
158 | const void *data, | 163 | const void *data, |
159 | enum GNUNET_BLOCK_Type type, | 164 | enum GNUNET_BLOCK_Type |
160 | uint32_t priority, | 165 | type, |
161 | uint32_t anonymity, | 166 | uint32_t priority, |
162 | uint32_t replication, | 167 | uint32_t anonymity, |
163 | struct GNUNET_TIME_Absolute expiration, | 168 | uint32_t replication, |
164 | unsigned int queue_priority, | 169 | struct |
165 | unsigned int max_queue_size, | 170 | GNUNET_TIME_Absolute |
166 | struct GNUNET_TIME_Relative timeout, | 171 | expiration, |
167 | GNUNET_DATASTORE_ContinuationWithStatus cont, | 172 | unsigned int |
168 | void *cont_cls); | 173 | queue_priority, |
174 | unsigned int | ||
175 | max_queue_size, | ||
176 | struct | ||
177 | GNUNET_TIME_Relative | ||
178 | timeout, | ||
179 | GNUNET_DATASTORE_ContinuationWithStatus | ||
180 | cont, void *cont_cls); | ||
169 | 181 | ||
170 | 182 | ||
171 | /** | 183 | /** |
@@ -189,14 +201,24 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, | |||
189 | * cancel; note that even if NULL is returned, the callback will be invoked | 201 | * cancel; note that even if NULL is returned, the callback will be invoked |
190 | * (or rather, will already have been invoked) | 202 | * (or rather, will already have been invoked) |
191 | */ | 203 | */ |
192 | struct GNUNET_DATASTORE_QueueEntry * | 204 | struct GNUNET_DATASTORE_QueueEntry *GNUNET_DATASTORE_release_reserve (struct |
193 | GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h, | 205 | GNUNET_DATASTORE_Handle |
194 | uint32_t rid, | 206 | *h, |
195 | unsigned int queue_priority, | 207 | uint32_t |
196 | unsigned int max_queue_size, | 208 | rid, |
197 | struct GNUNET_TIME_Relative timeout, | 209 | unsigned |
198 | GNUNET_DATASTORE_ContinuationWithStatus cont, | 210 | int |
199 | void *cont_cls); | 211 | queue_priority, |
212 | unsigned | ||
213 | int | ||
214 | max_queue_size, | ||
215 | struct | ||
216 | GNUNET_TIME_Relative | ||
217 | timeout, | ||
218 | GNUNET_DATASTORE_ContinuationWithStatus | ||
219 | cont, | ||
220 | void | ||
221 | *cont_cls); | ||
200 | 222 | ||
201 | 223 | ||
202 | /** | 224 | /** |
@@ -216,16 +238,23 @@ GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h, | |||
216 | * cancel; note that even if NULL is returned, the callback will be invoked | 238 | * cancel; note that even if NULL is returned, the callback will be invoked |
217 | * (or rather, will already have been invoked) | 239 | * (or rather, will already have been invoked) |
218 | */ | 240 | */ |
219 | struct GNUNET_DATASTORE_QueueEntry * | 241 | struct GNUNET_DATASTORE_QueueEntry *GNUNET_DATASTORE_update (struct |
220 | GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, | 242 | GNUNET_DATASTORE_Handle |
221 | uint64_t uid, | 243 | *h, uint64_t uid, |
222 | uint32_t priority, | 244 | uint32_t priority, |
223 | struct GNUNET_TIME_Absolute expiration, | 245 | struct |
224 | unsigned int queue_priority, | 246 | GNUNET_TIME_Absolute |
225 | unsigned int max_queue_size, | 247 | expiration, |
226 | struct GNUNET_TIME_Relative timeout, | 248 | unsigned int |
227 | GNUNET_DATASTORE_ContinuationWithStatus cont, | 249 | queue_priority, |
228 | void *cont_cls); | 250 | unsigned int |
251 | max_queue_size, | ||
252 | struct | ||
253 | GNUNET_TIME_Relative | ||
254 | timeout, | ||
255 | GNUNET_DATASTORE_ContinuationWithStatus | ||
256 | cont, | ||
257 | void *cont_cls); | ||
229 | 258 | ||
230 | 259 | ||
231 | /** | 260 | /** |
@@ -249,16 +278,23 @@ GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, | |||
249 | * cancel; note that even if NULL is returned, the callback will be invoked | 278 | * cancel; note that even if NULL is returned, the callback will be invoked |
250 | * (or rather, will already have been invoked) | 279 | * (or rather, will already have been invoked) |
251 | */ | 280 | */ |
252 | struct GNUNET_DATASTORE_QueueEntry * | 281 | struct GNUNET_DATASTORE_QueueEntry *GNUNET_DATASTORE_remove (struct |
253 | GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h, | 282 | GNUNET_DATASTORE_Handle |
254 | const GNUNET_HashCode *key, | 283 | *h, |
255 | size_t size, | 284 | const |
256 | const void *data, | 285 | GNUNET_HashCode * |
257 | unsigned int queue_priority, | 286 | key, size_t size, |
258 | unsigned int max_queue_size, | 287 | const void *data, |
259 | struct GNUNET_TIME_Relative timeout, | 288 | unsigned int |
260 | GNUNET_DATASTORE_ContinuationWithStatus cont, | 289 | queue_priority, |
261 | void *cont_cls); | 290 | unsigned int |
291 | max_queue_size, | ||
292 | struct | ||
293 | GNUNET_TIME_Relative | ||
294 | timeout, | ||
295 | GNUNET_DATASTORE_ContinuationWithStatus | ||
296 | cont, | ||
297 | void *cont_cls); | ||
262 | 298 | ||
263 | 299 | ||
264 | /** | 300 | /** |
@@ -276,14 +312,14 @@ GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h, | |||
276 | * maybe 0 if no unique identifier is available | 312 | * maybe 0 if no unique identifier is available |
277 | */ | 313 | */ |
278 | typedef void (*GNUNET_DATASTORE_DatumProcessor) (void *cls, | 314 | typedef void (*GNUNET_DATASTORE_DatumProcessor) (void *cls, |
279 | const GNUNET_HashCode * key, | 315 | const GNUNET_HashCode * key, |
280 | size_t size, | 316 | size_t size, |
281 | const void *data, | 317 | const void *data, |
282 | enum GNUNET_BLOCK_Type type, | 318 | enum GNUNET_BLOCK_Type type, |
283 | uint32_t priority, | 319 | uint32_t priority, |
284 | uint32_t anonymity, | 320 | uint32_t anonymity, |
285 | struct GNUNET_TIME_Absolute | 321 | struct GNUNET_TIME_Absolute |
286 | expiration, uint64_t uid); | 322 | expiration, uint64_t uid); |
287 | 323 | ||
288 | 324 | ||
289 | /** | 325 | /** |
@@ -307,16 +343,26 @@ typedef void (*GNUNET_DATASTORE_DatumProcessor) (void *cls, | |||
307 | * @return NULL if the entry was not queued, otherwise a handle that can be used to | 343 | * @return NULL if the entry was not queued, otherwise a handle that can be used to |
308 | * cancel | 344 | * cancel |
309 | */ | 345 | */ |
310 | struct GNUNET_DATASTORE_QueueEntry * | 346 | struct GNUNET_DATASTORE_QueueEntry *GNUNET_DATASTORE_get_key (struct |
311 | GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, | 347 | GNUNET_DATASTORE_Handle |
312 | uint64_t offset, | 348 | *h, |
313 | const GNUNET_HashCode * key, | 349 | uint64_t offset, |
314 | enum GNUNET_BLOCK_Type type, | 350 | const |
315 | unsigned int queue_priority, | 351 | GNUNET_HashCode * |
316 | unsigned int max_queue_size, | 352 | key, |
317 | struct GNUNET_TIME_Relative timeout, | 353 | enum |
318 | GNUNET_DATASTORE_DatumProcessor proc, | 354 | GNUNET_BLOCK_Type |
319 | void *proc_cls); | 355 | type, |
356 | unsigned int | ||
357 | queue_priority, | ||
358 | unsigned int | ||
359 | max_queue_size, | ||
360 | struct | ||
361 | GNUNET_TIME_Relative | ||
362 | timeout, | ||
363 | GNUNET_DATASTORE_DatumProcessor | ||
364 | proc, | ||
365 | void *proc_cls); | ||
320 | 366 | ||
321 | 367 | ||
322 | /** | 368 | /** |
@@ -343,15 +389,27 @@ GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, | |||
343 | * @return NULL if the entry was not queued, otherwise a handle that can be used to | 389 | * @return NULL if the entry was not queued, otherwise a handle that can be used to |
344 | * cancel | 390 | * cancel |
345 | */ | 391 | */ |
346 | struct GNUNET_DATASTORE_QueueEntry * | 392 | struct GNUNET_DATASTORE_QueueEntry *GNUNET_DATASTORE_get_zero_anonymity (struct |
347 | GNUNET_DATASTORE_get_zero_anonymity (struct GNUNET_DATASTORE_Handle *h, | 393 | GNUNET_DATASTORE_Handle |
348 | uint64_t offset, | 394 | *h, |
349 | unsigned int queue_priority, | 395 | uint64_t |
350 | unsigned int max_queue_size, | 396 | offset, |
351 | struct GNUNET_TIME_Relative timeout, | 397 | unsigned |
352 | enum GNUNET_BLOCK_Type type, | 398 | int |
353 | GNUNET_DATASTORE_DatumProcessor proc, | 399 | queue_priority, |
354 | void *proc_cls); | 400 | unsigned |
401 | int | ||
402 | max_queue_size, | ||
403 | struct | ||
404 | GNUNET_TIME_Relative | ||
405 | timeout, | ||
406 | enum | ||
407 | GNUNET_BLOCK_Type | ||
408 | type, | ||
409 | GNUNET_DATASTORE_DatumProcessor | ||
410 | proc, | ||
411 | void | ||
412 | *proc_cls); | ||
355 | 413 | ||
356 | 414 | ||
357 | /** | 415 | /** |
@@ -373,13 +431,22 @@ GNUNET_DATASTORE_get_zero_anonymity (struct GNUNET_DATASTORE_Handle *h, | |||
373 | * @return NULL if the entry was not queued, otherwise a handle that can be used to | 431 | * @return NULL if the entry was not queued, otherwise a handle that can be used to |
374 | * cancel | 432 | * cancel |
375 | */ | 433 | */ |
376 | struct GNUNET_DATASTORE_QueueEntry * | 434 | struct GNUNET_DATASTORE_QueueEntry *GNUNET_DATASTORE_get_for_replication (struct |
377 | GNUNET_DATASTORE_get_for_replication (struct GNUNET_DATASTORE_Handle *h, | 435 | GNUNET_DATASTORE_Handle |
378 | unsigned int queue_priority, | 436 | *h, |
379 | unsigned int max_queue_size, | 437 | unsigned |
380 | struct GNUNET_TIME_Relative timeout, | 438 | int |
381 | GNUNET_DATASTORE_DatumProcessor proc, | 439 | queue_priority, |
382 | void *proc_cls); | 440 | unsigned |
441 | int | ||
442 | max_queue_size, | ||
443 | struct | ||
444 | GNUNET_TIME_Relative | ||
445 | timeout, | ||
446 | GNUNET_DATASTORE_DatumProcessor | ||
447 | proc, | ||
448 | void | ||
449 | *proc_cls); | ||
383 | 450 | ||
384 | 451 | ||
385 | 452 | ||
@@ -389,8 +456,7 @@ GNUNET_DATASTORE_get_for_replication (struct GNUNET_DATASTORE_Handle *h, | |||
389 | * | 456 | * |
390 | * @param qe operation to cancel | 457 | * @param qe operation to cancel |
391 | */ | 458 | */ |
392 | void | 459 | void GNUNET_DATASTORE_cancel (struct GNUNET_DATASTORE_QueueEntry *qe); |
393 | GNUNET_DATASTORE_cancel (struct GNUNET_DATASTORE_QueueEntry *qe); | ||
394 | 460 | ||
395 | 461 | ||
396 | #if 0 /* keep Emacsens' auto-indent happy */ | 462 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_dht_service.h b/src/include/gnunet_dht_service.h index 6660f646b..7c7f646e6 100644 --- a/src/include/gnunet_dht_service.h +++ b/src/include/gnunet_dht_service.h | |||
@@ -90,29 +90,29 @@ struct GNUNET_DHT_FindPeerHandle; | |||
90 | * Options for routing. | 90 | * Options for routing. |
91 | */ | 91 | */ |
92 | enum GNUNET_DHT_RouteOption | 92 | enum GNUNET_DHT_RouteOption |
93 | { | 93 | { |
94 | /** | 94 | /** |
95 | * Default. Do nothing special. | 95 | * Default. Do nothing special. |
96 | */ | 96 | */ |
97 | GNUNET_DHT_RO_NONE = 0, | 97 | GNUNET_DHT_RO_NONE = 0, |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * Each peer along the way should look at 'enc' (otherwise | 100 | * Each peer along the way should look at 'enc' (otherwise |
101 | * only the k-peers closest to the key should look at it). | 101 | * only the k-peers closest to the key should look at it). |
102 | */ | 102 | */ |
103 | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE = 1, | 103 | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE = 1, |
104 | 104 | ||
105 | /** | 105 | /** |
106 | * We should keep track of the route that the message | 106 | * We should keep track of the route that the message |
107 | * took in the P2P network. | 107 | * took in the P2P network. |
108 | */ | 108 | */ |
109 | GNUNET_DHT_RO_RECORD_ROUTE = 2, | 109 | GNUNET_DHT_RO_RECORD_ROUTE = 2, |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * Possible message option for query key randomization. | 112 | * Possible message option for query key randomization. |
113 | */ | 113 | */ |
114 | GNUNET_DHT_RO_BART = 4 | 114 | GNUNET_DHT_RO_BART = 4 |
115 | }; | 115 | }; |
116 | 116 | ||
117 | 117 | ||
118 | /** | 118 | /** |
@@ -123,9 +123,9 @@ enum GNUNET_DHT_RouteOption | |||
123 | * processing multiple GET/FIND requests in parallel | 123 | * processing multiple GET/FIND requests in parallel |
124 | * @return NULL on error | 124 | * @return NULL on error |
125 | */ | 125 | */ |
126 | struct GNUNET_DHT_Handle * | 126 | struct GNUNET_DHT_Handle *GNUNET_DHT_connect (const struct |
127 | GNUNET_DHT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 127 | GNUNET_CONFIGURATION_Handle *cfg, |
128 | unsigned int ht_len); | 128 | unsigned int ht_len); |
129 | 129 | ||
130 | 130 | ||
131 | /** | 131 | /** |
@@ -133,8 +133,7 @@ GNUNET_DHT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
133 | * | 133 | * |
134 | * @param handle connection to shut down | 134 | * @param handle connection to shut down |
135 | */ | 135 | */ |
136 | void | 136 | void GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle); |
137 | GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle); | ||
138 | 137 | ||
139 | 138 | ||
140 | /* *************** Standard API: get and put ******************* */ | 139 | /* *************** Standard API: get and put ******************* */ |
@@ -165,8 +164,7 @@ GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, | |||
165 | const char *data, | 164 | const char *data, |
166 | struct GNUNET_TIME_Absolute exp, | 165 | struct GNUNET_TIME_Absolute exp, |
167 | struct GNUNET_TIME_Relative timeout, | 166 | struct GNUNET_TIME_Relative timeout, |
168 | GNUNET_SCHEDULER_Task cont, | 167 | GNUNET_SCHEDULER_Task cont, void *cont_cls); |
169 | void *cont_cls); | ||
170 | 168 | ||
171 | 169 | ||
172 | /** | 170 | /** |
@@ -184,14 +182,15 @@ GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, | |||
184 | * @param size number of bytes in data | 182 | * @param size number of bytes in data |
185 | * @param data pointer to the result data | 183 | * @param data pointer to the result data |
186 | */ | 184 | */ |
187 | typedef void (*GNUNET_DHT_GetIterator)(void *cls, | 185 | typedef void (*GNUNET_DHT_GetIterator) (void *cls, |
188 | struct GNUNET_TIME_Absolute exp, | 186 | struct GNUNET_TIME_Absolute exp, |
189 | const GNUNET_HashCode * key, | 187 | const GNUNET_HashCode * key, |
190 | const struct GNUNET_PeerIdentity * const *get_path, | 188 | const struct GNUNET_PeerIdentity * |
191 | const struct GNUNET_PeerIdentity * const *put_path, | 189 | const *get_path, |
192 | enum GNUNET_BLOCK_Type type, | 190 | const struct GNUNET_PeerIdentity * |
193 | size_t size, | 191 | const *put_path, |
194 | const void *data); | 192 | enum GNUNET_BLOCK_Type type, |
193 | size_t size, const void *data); | ||
195 | 194 | ||
196 | 195 | ||
197 | 196 | ||
@@ -215,19 +214,23 @@ typedef void (*GNUNET_DHT_GetIterator)(void *cls, | |||
215 | * | 214 | * |
216 | * @return handle to stop the async get | 215 | * @return handle to stop the async get |
217 | */ | 216 | */ |
218 | struct GNUNET_DHT_GetHandle * | 217 | struct GNUNET_DHT_GetHandle *GNUNET_DHT_get_start (struct GNUNET_DHT_Handle |
219 | GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, | 218 | *handle, |
220 | struct GNUNET_TIME_Relative timeout, | 219 | struct GNUNET_TIME_Relative |
221 | enum GNUNET_BLOCK_Type type, | 220 | timeout, |
222 | const GNUNET_HashCode * key, | 221 | enum GNUNET_BLOCK_Type type, |
223 | uint32_t desired_replication_level, | 222 | const GNUNET_HashCode * key, |
224 | enum GNUNET_DHT_RouteOption options, | 223 | uint32_t |
225 | const struct GNUNET_CONTAINER_BloomFilter *bf, | 224 | desired_replication_level, |
226 | int32_t bf_mutator, | 225 | enum GNUNET_DHT_RouteOption |
227 | const void *xquery, | 226 | options, |
228 | size_t xquery_size, | 227 | const struct |
229 | GNUNET_DHT_GetIterator iter, | 228 | GNUNET_CONTAINER_BloomFilter |
230 | void *iter_cls); | 229 | *bf, int32_t bf_mutator, |
230 | const void *xquery, | ||
231 | size_t xquery_size, | ||
232 | GNUNET_DHT_GetIterator iter, | ||
233 | void *iter_cls); | ||
231 | 234 | ||
232 | 235 | ||
233 | /** | 236 | /** |
@@ -238,8 +241,7 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, | |||
238 | * On return get_handle will no longer be valid, caller | 241 | * On return get_handle will no longer be valid, caller |
239 | * must not use again!!! | 242 | * must not use again!!! |
240 | */ | 243 | */ |
241 | void | 244 | void GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle); |
242 | GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle); | ||
243 | 245 | ||
244 | 246 | ||
245 | /* ******** Special high-level API for finding peers *********** */ | 247 | /* ******** Special high-level API for finding peers *********** */ |
@@ -251,8 +253,9 @@ GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle); | |||
251 | * @param cls closure | 253 | * @param cls closure |
252 | * @param peer hello of a target (peer near key) | 254 | * @param peer hello of a target (peer near key) |
253 | */ | 255 | */ |
254 | typedef void (*GNUNET_DHT_FindPeerProcessor)(void *cls, | 256 | typedef void (*GNUNET_DHT_FindPeerProcessor) (void *cls, |
255 | const struct GNUNET_HELLO_Message *peer); | 257 | const struct GNUNET_HELLO_Message |
258 | * peer); | ||
256 | 259 | ||
257 | 260 | ||
258 | /** | 261 | /** |
@@ -267,13 +270,21 @@ typedef void (*GNUNET_DHT_FindPeerProcessor)(void *cls, | |||
267 | * @param proc_cls closure for proc | 270 | * @param proc_cls closure for proc |
268 | * @return handle to stop the async get, NULL on error | 271 | * @return handle to stop the async get, NULL on error |
269 | */ | 272 | */ |
270 | struct GNUNET_DHT_FindPeerHandle * | 273 | struct GNUNET_DHT_FindPeerHandle *GNUNET_DHT_find_peer_start (struct |
271 | GNUNET_DHT_find_peer_start (struct GNUNET_DHT_Handle *handle, | 274 | GNUNET_DHT_Handle |
272 | struct GNUNET_TIME_Relative timeout, | 275 | *handle, |
273 | const GNUNET_HashCode *key, | 276 | struct |
274 | enum GNUNET_DHT_RouteOption options, | 277 | GNUNET_TIME_Relative |
275 | GNUNET_DHT_FindPeerProcessor proc, | 278 | timeout, |
276 | void *proc_cls); | 279 | const |
280 | GNUNET_HashCode * | ||
281 | key, | ||
282 | enum | ||
283 | GNUNET_DHT_RouteOption | ||
284 | options, | ||
285 | GNUNET_DHT_FindPeerProcessor | ||
286 | proc, | ||
287 | void *proc_cls); | ||
277 | 288 | ||
278 | 289 | ||
279 | /** | 290 | /** |
@@ -300,10 +311,12 @@ GNUNET_DHT_find_peer_stop (struct GNUNET_DHT_FindPeerHandle *find_peer_handle); | |||
300 | * to the peers on the PUT path (or NULL if not recorded) | 311 | * to the peers on the PUT path (or NULL if not recorded) |
301 | * @param reply response | 312 | * @param reply response |
302 | */ | 313 | */ |
303 | typedef void (*GNUNET_DHT_ReplyProcessor)(void *cls, | 314 | typedef void (*GNUNET_DHT_ReplyProcessor) (void *cls, |
304 | const GNUNET_HashCode *key, | 315 | const GNUNET_HashCode * key, |
305 | const struct GNUNET_PeerIdentity * const *outgoing_path, | 316 | const struct GNUNET_PeerIdentity * |
306 | const struct GNUNET_MessageHeader *reply); | 317 | const *outgoing_path, |
318 | const struct GNUNET_MessageHeader * | ||
319 | reply); | ||
307 | 320 | ||
308 | 321 | ||
309 | /** | 322 | /** |
@@ -327,17 +340,25 @@ typedef void (*GNUNET_DHT_ReplyProcessor)(void *cls, | |||
327 | * @param cont_cls closure for cont | 340 | * @param cont_cls closure for cont |
328 | * @return handle to stop the request, NULL if the request is "fire and forget" | 341 | * @return handle to stop the request, NULL if the request is "fire and forget" |
329 | */ | 342 | */ |
330 | struct GNUNET_DHT_RouteHandle * | 343 | struct GNUNET_DHT_RouteHandle *GNUNET_DHT_route_start (struct GNUNET_DHT_Handle |
331 | GNUNET_DHT_route_start (struct GNUNET_DHT_Handle *handle, | 344 | *handle, |
332 | const GNUNET_HashCode *key, | 345 | const GNUNET_HashCode * |
333 | uint32_t desired_replication_level, | 346 | key, |
334 | enum GNUNET_DHT_RouteOption options, | 347 | uint32_t |
335 | const struct GNUNET_MessageHeader *enc, | 348 | desired_replication_level, |
336 | struct GNUNET_TIME_Relative timeout, | 349 | enum |
337 | GNUNET_DHT_ReplyProcessor iter, | 350 | GNUNET_DHT_RouteOption |
338 | void *iter_cls, | 351 | options, |
339 | GNUNET_SCHEDULER_Task cont, | 352 | const struct |
340 | void *cont_cls); | 353 | GNUNET_MessageHeader |
354 | *enc, | ||
355 | struct | ||
356 | GNUNET_TIME_Relative | ||
357 | timeout, | ||
358 | GNUNET_DHT_ReplyProcessor | ||
359 | iter, void *iter_cls, | ||
360 | GNUNET_SCHEDULER_Task | ||
361 | cont, void *cont_cls); | ||
341 | 362 | ||
342 | 363 | ||
343 | 364 | ||
@@ -346,8 +367,7 @@ GNUNET_DHT_route_start (struct GNUNET_DHT_Handle *handle, | |||
346 | * | 367 | * |
347 | * @param route_handle operation to stop. | 368 | * @param route_handle operation to stop. |
348 | */ | 369 | */ |
349 | void | 370 | void GNUNET_DHT_route_stop (struct GNUNET_DHT_RouteHandle *route_handle); |
350 | GNUNET_DHT_route_stop (struct GNUNET_DHT_RouteHandle *route_handle); | ||
351 | 371 | ||
352 | 372 | ||
353 | /* ***** Special API for controlling DHT routing maintenance ******* */ | 373 | /* ***** Special API for controlling DHT routing maintenance ******* */ |
@@ -366,8 +386,7 @@ GNUNET_DHT_route_stop (struct GNUNET_DHT_RouteHandle *route_handle); | |||
366 | */ | 386 | */ |
367 | void | 387 | void |
368 | GNUNET_DHT_find_peers (struct GNUNET_DHT_Handle *handle, | 388 | GNUNET_DHT_find_peers (struct GNUNET_DHT_Handle *handle, |
369 | GNUNET_SCHEDULER_Task cont, | 389 | GNUNET_SCHEDULER_Task cont, void *cont_cls); |
370 | void *cont_cls); | ||
371 | 390 | ||
372 | /* ***** Special API for testing robustness with malicious peers ******* */ | 391 | /* ***** Special API for testing robustness with malicious peers ******* */ |
373 | 392 | ||
@@ -387,9 +406,9 @@ GNUNET_DHT_find_peers (struct GNUNET_DHT_Handle *handle, | |||
387 | * @param cont_cls closure for cont | 406 | * @param cont_cls closure for cont |
388 | * | 407 | * |
389 | */ | 408 | */ |
390 | void | 409 | void |
391 | GNUNET_DHT_set_malicious_dropper (struct GNUNET_DHT_Handle *handle, GNUNET_SCHEDULER_Task cont, | 410 | GNUNET_DHT_set_malicious_dropper (struct GNUNET_DHT_Handle *handle, |
392 | void *cont_cls); | 411 | GNUNET_SCHEDULER_Task cont, void *cont_cls); |
393 | 412 | ||
394 | 413 | ||
395 | /** | 414 | /** |
@@ -401,10 +420,10 @@ GNUNET_DHT_set_malicious_dropper (struct GNUNET_DHT_Handle *handle, GNUNET_SCHED | |||
401 | * @param cont continuation to call when done (transmitting request to service) | 420 | * @param cont continuation to call when done (transmitting request to service) |
402 | * @param cont_cls closure for cont | 421 | * @param cont_cls closure for cont |
403 | */ | 422 | */ |
404 | void | 423 | void |
405 | GNUNET_DHT_set_malicious_putter (struct GNUNET_DHT_Handle *handle, | 424 | GNUNET_DHT_set_malicious_putter (struct GNUNET_DHT_Handle *handle, |
406 | struct GNUNET_TIME_Relative frequency, GNUNET_SCHEDULER_Task cont, | 425 | struct GNUNET_TIME_Relative frequency, |
407 | void *cont_cls); | 426 | GNUNET_SCHEDULER_Task cont, void *cont_cls); |
408 | 427 | ||
409 | 428 | ||
410 | /** | 429 | /** |
@@ -418,8 +437,8 @@ GNUNET_DHT_set_malicious_putter (struct GNUNET_DHT_Handle *handle, | |||
418 | */ | 437 | */ |
419 | void | 438 | void |
420 | GNUNET_DHT_set_malicious_getter (struct GNUNET_DHT_Handle *handle, | 439 | GNUNET_DHT_set_malicious_getter (struct GNUNET_DHT_Handle *handle, |
421 | struct GNUNET_TIME_Relative frequency, GNUNET_SCHEDULER_Task cont, | 440 | struct GNUNET_TIME_Relative frequency, |
422 | void *cont_cls); | 441 | GNUNET_SCHEDULER_Task cont, void *cont_cls); |
423 | 442 | ||
424 | 443 | ||
425 | #endif | 444 | #endif |
diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h index fdccebab0..5732a27d6 100644 --- a/src/include/gnunet_disk_lib.h +++ b/src/include/gnunet_disk_lib.h | |||
@@ -36,7 +36,8 @@ struct GNUNET_DISK_FileHandle; | |||
36 | struct GNUNET_DISK_PipeHandle; | 36 | struct GNUNET_DISK_PipeHandle; |
37 | 37 | ||
38 | 38 | ||
39 | enum GNUNET_FILE_Type { | 39 | enum GNUNET_FILE_Type |
40 | { | ||
40 | GNUNET_DISK_FILE, GNUNET_PIPE | 41 | GNUNET_DISK_FILE, GNUNET_PIPE |
41 | }; | 42 | }; |
42 | 43 | ||
@@ -74,7 +75,7 @@ struct GNUNET_DISK_FileHandle | |||
74 | int fd; | 75 | int fd; |
75 | 76 | ||
76 | #endif /* | 77 | #endif /* |
77 | */ | 78 | */ |
78 | }; | 79 | }; |
79 | 80 | ||
80 | 81 | ||
@@ -99,159 +100,159 @@ extern "C" | |||
99 | * Specifies how a file should be opened. | 100 | * Specifies how a file should be opened. |
100 | */ | 101 | */ |
101 | enum GNUNET_DISK_OpenFlags | 102 | enum GNUNET_DISK_OpenFlags |
102 | { | 103 | { |
103 | 104 | ||
104 | /** | 105 | /** |
105 | * Open the file for reading | 106 | * Open the file for reading |
106 | */ | 107 | */ |
107 | GNUNET_DISK_OPEN_READ = 1, | 108 | GNUNET_DISK_OPEN_READ = 1, |
108 | 109 | ||
109 | /** | 110 | /** |
110 | * Open the file for writing | 111 | * Open the file for writing |
111 | */ | 112 | */ |
112 | GNUNET_DISK_OPEN_WRITE = 2, | 113 | GNUNET_DISK_OPEN_WRITE = 2, |
113 | 114 | ||
114 | /** | 115 | /** |
115 | * Open the file for both reading and writing | 116 | * Open the file for both reading and writing |
116 | */ | 117 | */ |
117 | GNUNET_DISK_OPEN_READWRITE = 3, | 118 | GNUNET_DISK_OPEN_READWRITE = 3, |
118 | 119 | ||
119 | /** | 120 | /** |
120 | * Fail if file already exists | 121 | * Fail if file already exists |
121 | */ | 122 | */ |
122 | GNUNET_DISK_OPEN_FAILIFEXISTS = 4, | 123 | GNUNET_DISK_OPEN_FAILIFEXISTS = 4, |
123 | 124 | ||
124 | /** | 125 | /** |
125 | * Truncate file if it exists | 126 | * Truncate file if it exists |
126 | */ | 127 | */ |
127 | GNUNET_DISK_OPEN_TRUNCATE = 8, | 128 | GNUNET_DISK_OPEN_TRUNCATE = 8, |
128 | 129 | ||
129 | /** | 130 | /** |
130 | * Create file if it doesn't exist | 131 | * Create file if it doesn't exist |
131 | */ | 132 | */ |
132 | GNUNET_DISK_OPEN_CREATE = 16, | 133 | GNUNET_DISK_OPEN_CREATE = 16, |
133 | 134 | ||
134 | /** | 135 | /** |
135 | * Append to the file | 136 | * Append to the file |
136 | */ | 137 | */ |
137 | GNUNET_DISK_OPEN_APPEND = 32 | 138 | GNUNET_DISK_OPEN_APPEND = 32 |
138 | }; | 139 | }; |
139 | 140 | ||
140 | /** | 141 | /** |
141 | * Specifies what type of memory map is desired. | 142 | * Specifies what type of memory map is desired. |
142 | */ | 143 | */ |
143 | enum GNUNET_DISK_MapType | 144 | enum GNUNET_DISK_MapType |
144 | { | 145 | { |
145 | /** | 146 | /** |
146 | * Read-only memory map. | 147 | * Read-only memory map. |
147 | */ | 148 | */ |
148 | GNUNET_DISK_MAP_TYPE_READ = 1, | 149 | GNUNET_DISK_MAP_TYPE_READ = 1, |
149 | 150 | ||
150 | /** | 151 | /** |
151 | * Write-able memory map. | 152 | * Write-able memory map. |
152 | */ | 153 | */ |
153 | GNUNET_DISK_MAP_TYPE_WRITE = 2, | 154 | GNUNET_DISK_MAP_TYPE_WRITE = 2, |
154 | /** | 155 | /** |
155 | * Read-write memory map. | 156 | * Read-write memory map. |
156 | */ | 157 | */ |
157 | GNUNET_DISK_MAP_TYPE_READWRITE = 3 | 158 | GNUNET_DISK_MAP_TYPE_READWRITE = 3 |
158 | }; | 159 | }; |
159 | 160 | ||
160 | 161 | ||
161 | /** | 162 | /** |
162 | * File access permissions, UNIX-style. | 163 | * File access permissions, UNIX-style. |
163 | */ | 164 | */ |
164 | enum GNUNET_DISK_AccessPermissions | 165 | enum GNUNET_DISK_AccessPermissions |
165 | { | 166 | { |
166 | /** | 167 | /** |
167 | * Nobody is allowed to do anything to the file. | 168 | * Nobody is allowed to do anything to the file. |
168 | */ | 169 | */ |
169 | GNUNET_DISK_PERM_NONE = 0, | 170 | GNUNET_DISK_PERM_NONE = 0, |
170 | 171 | ||
171 | /** | 172 | /** |
172 | * Owner can read. | 173 | * Owner can read. |
173 | */ | 174 | */ |
174 | GNUNET_DISK_PERM_USER_READ = 1, | 175 | GNUNET_DISK_PERM_USER_READ = 1, |
175 | 176 | ||
176 | /** | 177 | /** |
177 | * Owner can write. | 178 | * Owner can write. |
178 | */ | 179 | */ |
179 | GNUNET_DISK_PERM_USER_WRITE = 2, | 180 | GNUNET_DISK_PERM_USER_WRITE = 2, |
180 | 181 | ||
181 | /** | 182 | /** |
182 | * Owner can execute. | 183 | * Owner can execute. |
183 | */ | 184 | */ |
184 | GNUNET_DISK_PERM_USER_EXEC = 4, | 185 | GNUNET_DISK_PERM_USER_EXEC = 4, |
185 | 186 | ||
186 | /** | 187 | /** |
187 | * Group can read. | 188 | * Group can read. |
188 | */ | 189 | */ |
189 | GNUNET_DISK_PERM_GROUP_READ = 8, | 190 | GNUNET_DISK_PERM_GROUP_READ = 8, |
190 | 191 | ||
191 | /** | 192 | /** |
192 | * Group can write. | 193 | * Group can write. |
193 | */ | 194 | */ |
194 | GNUNET_DISK_PERM_GROUP_WRITE = 16, | 195 | GNUNET_DISK_PERM_GROUP_WRITE = 16, |
195 | 196 | ||
196 | /** | 197 | /** |
197 | * Group can execute. | 198 | * Group can execute. |
198 | */ | 199 | */ |
199 | GNUNET_DISK_PERM_GROUP_EXEC = 32, | 200 | GNUNET_DISK_PERM_GROUP_EXEC = 32, |
200 | 201 | ||
201 | /** | 202 | /** |
202 | * Everybody can read. | 203 | * Everybody can read. |
203 | */ | 204 | */ |
204 | GNUNET_DISK_PERM_OTHER_READ = 64, | 205 | GNUNET_DISK_PERM_OTHER_READ = 64, |
205 | 206 | ||
206 | /** | 207 | /** |
207 | * Everybody can write. | 208 | * Everybody can write. |
208 | */ | 209 | */ |
209 | GNUNET_DISK_PERM_OTHER_WRITE = 128, | 210 | GNUNET_DISK_PERM_OTHER_WRITE = 128, |
210 | 211 | ||
211 | /** | 212 | /** |
212 | * Everybody can execute. | 213 | * Everybody can execute. |
213 | */ | 214 | */ |
214 | GNUNET_DISK_PERM_OTHER_EXEC = 256 | 215 | GNUNET_DISK_PERM_OTHER_EXEC = 256 |
215 | }; | 216 | }; |
216 | 217 | ||
217 | 218 | ||
218 | /** | 219 | /** |
219 | * Constants for specifying how to seek. | 220 | * Constants for specifying how to seek. |
220 | */ | 221 | */ |
221 | enum GNUNET_DISK_Seek | 222 | enum GNUNET_DISK_Seek |
222 | { | 223 | { |
223 | /** | 224 | /** |
224 | * Seek an absolute position (from the start of the file). | 225 | * Seek an absolute position (from the start of the file). |
225 | */ | 226 | */ |
226 | GNUNET_DISK_SEEK_SET, | 227 | GNUNET_DISK_SEEK_SET, |
227 | 228 | ||
228 | /** | 229 | /** |
229 | * Seek a relative position (from the current offset). | 230 | * Seek a relative position (from the current offset). |
230 | */ | 231 | */ |
231 | GNUNET_DISK_SEEK_CUR, | 232 | GNUNET_DISK_SEEK_CUR, |
232 | 233 | ||
233 | /** | 234 | /** |
234 | * Seek an absolute position from the end of the file. | 235 | * Seek an absolute position from the end of the file. |
235 | */ | 236 | */ |
236 | GNUNET_DISK_SEEK_END | 237 | GNUNET_DISK_SEEK_END |
237 | }; | 238 | }; |
238 | 239 | ||
239 | 240 | ||
240 | /** | 241 | /** |
241 | * Enumeration identifying the two ends of a pipe. | 242 | * Enumeration identifying the two ends of a pipe. |
242 | */ | 243 | */ |
243 | enum GNUNET_DISK_PipeEnd | 244 | enum GNUNET_DISK_PipeEnd |
244 | { | 245 | { |
245 | /** | 246 | /** |
246 | * The reading-end of a pipe. | 247 | * The reading-end of a pipe. |
247 | */ | 248 | */ |
248 | GNUNET_DISK_PIPE_END_READ = 0, | 249 | GNUNET_DISK_PIPE_END_READ = 0, |
249 | 250 | ||
250 | /** | 251 | /** |
251 | * The writing-end of a pipe. | 252 | * The writing-end of a pipe. |
252 | */ | 253 | */ |
253 | GNUNET_DISK_PIPE_END_WRITE = 1 | 254 | GNUNET_DISK_PIPE_END_WRITE = 1 |
254 | }; | 255 | }; |
255 | 256 | ||
256 | 257 | ||
257 | /** | 258 | /** |
@@ -292,9 +293,8 @@ int GNUNET_DISK_file_test (const char *fil); | |||
292 | * @return the new position on success, GNUNET_SYSERR otherwise | 293 | * @return the new position on success, GNUNET_SYSERR otherwise |
293 | */ | 294 | */ |
294 | off_t | 295 | off_t |
295 | GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle *h, | 296 | GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle *h, |
296 | off_t offset, | 297 | off_t offset, enum GNUNET_DISK_Seek whence); |
297 | enum GNUNET_DISK_Seek whence); | ||
298 | 298 | ||
299 | 299 | ||
300 | /** | 300 | /** |
@@ -310,8 +310,7 @@ GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle *h, | |||
310 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 310 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
311 | */ | 311 | */ |
312 | int GNUNET_DISK_file_size (const char *filename, | 312 | int GNUNET_DISK_file_size (const char *filename, |
313 | uint64_t *size, | 313 | uint64_t * size, int includeSymLinks); |
314 | int includeSymLinks); | ||
315 | 314 | ||
316 | 315 | ||
317 | /** | 316 | /** |
@@ -330,9 +329,8 @@ int GNUNET_DISK_file_size (const char *filename, | |||
330 | * @return GNUNET_OK on success | 329 | * @return GNUNET_OK on success |
331 | */ | 330 | */ |
332 | int GNUNET_DISK_file_get_identifiers (const char *filename, | 331 | int GNUNET_DISK_file_get_identifiers (const char *filename, |
333 | uint64_t *dev, | 332 | uint64_t * dev, uint64_t * ino); |
334 | uint64_t *ino); | 333 | |
335 | |||
336 | 334 | ||
337 | /** | 335 | /** |
338 | * Create an (empty) temporary file on disk. If the given name is not | 336 | * Create an (empty) temporary file on disk. If the given name is not |
@@ -345,8 +343,7 @@ int GNUNET_DISK_file_get_identifiers (const char *filename, | |||
345 | * @return NULL on error, otherwise name of fresh | 343 | * @return NULL on error, otherwise name of fresh |
346 | * file on disk in directory for temporary files | 344 | * file on disk in directory for temporary files |
347 | */ | 345 | */ |
348 | char * | 346 | char *GNUNET_DISK_mktemp (const char *t); |
349 | GNUNET_DISK_mktemp (const char *t); | ||
350 | 347 | ||
351 | 348 | ||
352 | /** | 349 | /** |
@@ -362,8 +359,11 @@ GNUNET_DISK_mktemp (const char *t); | |||
362 | * @return IO handle on success, NULL on error | 359 | * @return IO handle on success, NULL on error |
363 | */ | 360 | */ |
364 | struct GNUNET_DISK_FileHandle *GNUNET_DISK_file_open (const char *fn, | 361 | struct GNUNET_DISK_FileHandle *GNUNET_DISK_file_open (const char *fn, |
365 | enum GNUNET_DISK_OpenFlags flags, | 362 | enum GNUNET_DISK_OpenFlags |
366 | enum GNUNET_DISK_AccessPermissions perm); | 363 | flags, |
364 | enum | ||
365 | GNUNET_DISK_AccessPermissions | ||
366 | perm); | ||
367 | 367 | ||
368 | /** | 368 | /** |
369 | * Creates an interprocess channel | 369 | * Creates an interprocess channel |
@@ -373,8 +373,8 @@ struct GNUNET_DISK_FileHandle *GNUNET_DISK_file_open (const char *fn, | |||
373 | * @return handle to the new pipe, NULL on error | 373 | * @return handle to the new pipe, NULL on error |
374 | */ | 374 | */ |
375 | struct GNUNET_DISK_PipeHandle *GNUNET_DISK_pipe (int blocking, | 375 | struct GNUNET_DISK_PipeHandle *GNUNET_DISK_pipe (int blocking, |
376 | int inherit_read, | 376 | int inherit_read, |
377 | int inherit_write); | 377 | int inherit_write); |
378 | 378 | ||
379 | 379 | ||
380 | /** | 380 | /** |
@@ -392,8 +392,8 @@ int GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p); | |||
392 | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise | 392 | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise |
393 | */ | 393 | */ |
394 | int | 394 | int |
395 | GNUNET_DISK_pipe_close_end (struct GNUNET_DISK_PipeHandle *p, | 395 | GNUNET_DISK_pipe_close_end (struct GNUNET_DISK_PipeHandle *p, |
396 | enum GNUNET_DISK_PipeEnd end); | 396 | enum GNUNET_DISK_PipeEnd end); |
397 | 397 | ||
398 | /** | 398 | /** |
399 | * Close an open file. | 399 | * Close an open file. |
@@ -411,11 +411,12 @@ int GNUNET_DISK_file_close (struct GNUNET_DISK_FileHandle *h); | |||
411 | * @param n end to access | 411 | * @param n end to access |
412 | * @return handle for the respective end | 412 | * @return handle for the respective end |
413 | */ | 413 | */ |
414 | const struct GNUNET_DISK_FileHandle * | 414 | const struct GNUNET_DISK_FileHandle *GNUNET_DISK_pipe_handle (const struct |
415 | GNUNET_DISK_pipe_handle (const struct | 415 | GNUNET_DISK_PipeHandle |
416 | GNUNET_DISK_PipeHandle | 416 | *p, |
417 | *p, | 417 | enum |
418 | enum GNUNET_DISK_PipeEnd n); | 418 | GNUNET_DISK_PipeEnd |
419 | n); | ||
419 | 420 | ||
420 | /** | 421 | /** |
421 | * Read the contents of a binary file into a buffer. | 422 | * Read the contents of a binary file into a buffer. |
@@ -424,8 +425,8 @@ GNUNET_DISK_pipe_handle (const struct | |||
424 | * @param len the maximum number of bytes to read | 425 | * @param len the maximum number of bytes to read |
425 | * @return the number of bytes read on success, GNUNET_SYSERR on failure | 426 | * @return the number of bytes read on success, GNUNET_SYSERR on failure |
426 | */ | 427 | */ |
427 | ssize_t GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, void *result, | 428 | ssize_t GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, |
428 | size_t len); | 429 | void *result, size_t len); |
429 | 430 | ||
430 | 431 | ||
431 | /** | 432 | /** |
@@ -436,9 +437,7 @@ ssize_t GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, void *res | |||
436 | * @param len the maximum number of bytes to read | 437 | * @param len the maximum number of bytes to read |
437 | * @return number of bytes read, GNUNET_SYSERR on failure | 438 | * @return number of bytes read, GNUNET_SYSERR on failure |
438 | */ | 439 | */ |
439 | ssize_t GNUNET_DISK_fn_read (const char *fn, | 440 | ssize_t GNUNET_DISK_fn_read (const char *fn, void *result, size_t len); |
440 | void *result, | ||
441 | size_t len); | ||
442 | 441 | ||
443 | 442 | ||
444 | /** | 443 | /** |
@@ -449,9 +448,8 @@ ssize_t GNUNET_DISK_fn_read (const char *fn, | |||
449 | * @param n number of bytes to write | 448 | * @param n number of bytes to write |
450 | * @return number of bytes written on success, GNUNET_SYSERR on error | 449 | * @return number of bytes written on success, GNUNET_SYSERR on error |
451 | */ | 450 | */ |
452 | ssize_t GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle *h, | 451 | ssize_t GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle *h, |
453 | const void *buffer, | 452 | const void *buffer, size_t n); |
454 | size_t n); | ||
455 | 453 | ||
456 | 454 | ||
457 | /** | 455 | /** |
@@ -464,10 +462,10 @@ ssize_t GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle *h, | |||
464 | * @param mode file permissions | 462 | * @param mode file permissions |
465 | * @return number of bytes written on success, GNUNET_SYSERR on error | 463 | * @return number of bytes written on success, GNUNET_SYSERR on error |
466 | */ | 464 | */ |
467 | ssize_t GNUNET_DISK_fn_write (const char *fn, | 465 | ssize_t GNUNET_DISK_fn_write (const char *fn, |
468 | const void *buffer, | 466 | const void *buffer, |
469 | size_t n, | 467 | size_t n, |
470 | enum GNUNET_DISK_AccessPermissions mode); | 468 | enum GNUNET_DISK_AccessPermissions mode); |
471 | 469 | ||
472 | 470 | ||
473 | /** | 471 | /** |
@@ -489,8 +487,8 @@ int GNUNET_DISK_file_copy (const char *src, const char *dst); | |||
489 | * @return the number of files found, -1 on error | 487 | * @return the number of files found, -1 on error |
490 | */ | 488 | */ |
491 | int GNUNET_DISK_directory_scan (const char *dirName, | 489 | int GNUNET_DISK_directory_scan (const char *dirName, |
492 | GNUNET_FileNameCallback callback, | 490 | GNUNET_FileNameCallback callback, |
493 | void *callback_cls); | 491 | void *callback_cls); |
494 | 492 | ||
495 | 493 | ||
496 | /** | 494 | /** |
@@ -603,7 +601,7 @@ int GNUNET_DISK_directory_create (const char *dir); | |||
603 | */ | 601 | */ |
604 | int | 602 | int |
605 | GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, off_t lockStart, | 603 | GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, off_t lockStart, |
606 | off_t lockEnd, int excl); | 604 | off_t lockEnd, int excl); |
607 | 605 | ||
608 | 606 | ||
609 | /** | 607 | /** |
@@ -614,9 +612,8 @@ GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, off_t lockStart, | |||
614 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 612 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
615 | */ | 613 | */ |
616 | int | 614 | int |
617 | GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh, | 615 | GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh, |
618 | off_t unlockStart, | 616 | off_t unlockStart, off_t unlockEnd); |
619 | off_t unlockEnd); | ||
620 | 617 | ||
621 | 618 | ||
622 | /** | 619 | /** |
@@ -649,8 +646,8 @@ int GNUNET_DISK_file_change_owner (const char *filename, const char *user); | |||
649 | * private directory name. | 646 | * private directory name. |
650 | * @return the constructed filename | 647 | * @return the constructed filename |
651 | */ | 648 | */ |
652 | char *GNUNET_DISK_get_home_filename (const struct GNUNET_CONFIGURATION_Handle *cfg, | 649 | char *GNUNET_DISK_get_home_filename (const struct GNUNET_CONFIGURATION_Handle |
653 | const char *serviceName, ...); | 650 | *cfg, const char *serviceName, ...); |
654 | 651 | ||
655 | 652 | ||
656 | /** | 653 | /** |
@@ -666,9 +663,9 @@ struct GNUNET_DISK_MapHandle; | |||
666 | * @param len size of the mapping | 663 | * @param len size of the mapping |
667 | * @return pointer to the mapped memory region, NULL on failure | 664 | * @return pointer to the mapped memory region, NULL on failure |
668 | */ | 665 | */ |
669 | void *GNUNET_DISK_file_map (const struct GNUNET_DISK_FileHandle *h, | 666 | void *GNUNET_DISK_file_map (const struct GNUNET_DISK_FileHandle *h, |
670 | struct GNUNET_DISK_MapHandle **m, | 667 | struct GNUNET_DISK_MapHandle **m, |
671 | enum GNUNET_DISK_MapType access, size_t len); | 668 | enum GNUNET_DISK_MapType access, size_t len); |
672 | 669 | ||
673 | /** | 670 | /** |
674 | * Unmap a file | 671 | * Unmap a file |
@@ -693,7 +690,12 @@ int GNUNET_DISK_file_sync (const struct GNUNET_DISK_FileHandle *h); | |||
693 | * @return pipe handle on success, NULL on error | 690 | * @return pipe handle on success, NULL on error |
694 | */ | 691 | */ |
695 | struct GNUNET_DISK_FileHandle *GNUNET_DISK_npipe_create (char **fn, | 692 | struct GNUNET_DISK_FileHandle *GNUNET_DISK_npipe_create (char **fn, |
696 | enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm); | 693 | enum |
694 | GNUNET_DISK_OpenFlags | ||
695 | flags, | ||
696 | enum | ||
697 | GNUNET_DISK_AccessPermissions | ||
698 | perm); | ||
697 | 699 | ||
698 | /** | 700 | /** |
699 | * Opens already existing named pipe/FIFO | 701 | * Opens already existing named pipe/FIFO |
@@ -704,7 +706,12 @@ struct GNUNET_DISK_FileHandle *GNUNET_DISK_npipe_create (char **fn, | |||
704 | * @return pipe handle on success, NULL on error | 706 | * @return pipe handle on success, NULL on error |
705 | */ | 707 | */ |
706 | struct GNUNET_DISK_FileHandle *GNUNET_DISK_npipe_open (const char *fn, | 708 | struct GNUNET_DISK_FileHandle *GNUNET_DISK_npipe_open (const char *fn, |
707 | enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm); | 709 | enum |
710 | GNUNET_DISK_OpenFlags | ||
711 | flags, | ||
712 | enum | ||
713 | GNUNET_DISK_AccessPermissions | ||
714 | perm); | ||
708 | 715 | ||
709 | /** | 716 | /** |
710 | * Closes a named pipe/FIFO | 717 | * Closes a named pipe/FIFO |
diff --git a/src/include/gnunet_dv_service.h b/src/include/gnunet_dv_service.h index 65f0ee5f6..0da76c56c 100644 --- a/src/include/gnunet_dv_service.h +++ b/src/include/gnunet_dv_service.h | |||
@@ -76,8 +76,7 @@ int GNUNET_DV_send (struct GNUNET_DV_Handle *dv_handle, | |||
76 | struct GNUNET_TIME_Relative timeout, | 76 | struct GNUNET_TIME_Relative timeout, |
77 | const void *addr, | 77 | const void *addr, |
78 | size_t addrlen, | 78 | size_t addrlen, |
79 | GNUNET_TRANSPORT_TransmitContinuation | 79 | GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls); |
80 | cont, void *cont_cls); | ||
81 | 80 | ||
82 | 81 | ||
83 | 82 | ||
diff --git a/src/include/gnunet_fragmentation_lib.h b/src/include/gnunet_fragmentation_lib.h index e91e74c6f..da236478c 100644 --- a/src/include/gnunet_fragmentation_lib.h +++ b/src/include/gnunet_fragmentation_lib.h | |||
@@ -58,7 +58,8 @@ struct GNUNET_FRAGMENT_Context; | |||
58 | * @param msg the message that was created | 58 | * @param msg the message that was created |
59 | */ | 59 | */ |
60 | typedef void (*GNUNET_FRAGMENT_MessageProcessor) (void *cls, | 60 | typedef void (*GNUNET_FRAGMENT_MessageProcessor) (void *cls, |
61 | const struct GNUNET_MessageHeader *msg); | 61 | const struct |
62 | GNUNET_MessageHeader * msg); | ||
62 | 63 | ||
63 | 64 | ||
64 | /** | 65 | /** |
@@ -79,14 +80,22 @@ typedef void (*GNUNET_FRAGMENT_MessageProcessor) (void *cls, | |||
79 | * @param proc_cls closure for proc | 80 | * @param proc_cls closure for proc |
80 | * @return the fragmentation context | 81 | * @return the fragmentation context |
81 | */ | 82 | */ |
82 | struct GNUNET_FRAGMENT_Context * | 83 | struct GNUNET_FRAGMENT_Context *GNUNET_FRAGMENT_context_create (struct |
83 | GNUNET_FRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats, | 84 | GNUNET_STATISTICS_Handle |
84 | uint16_t mtu, | 85 | *stats, |
85 | struct GNUNET_BANDWIDTH_Tracker *tracker, | 86 | uint16_t mtu, |
86 | struct GNUNET_TIME_Relative delay, | 87 | struct |
87 | const struct GNUNET_MessageHeader *msg, | 88 | GNUNET_BANDWIDTH_Tracker |
88 | GNUNET_FRAGMENT_MessageProcessor proc, | 89 | *tracker, |
89 | void *proc_cls); | 90 | struct |
91 | GNUNET_TIME_Relative | ||
92 | delay, | ||
93 | const struct | ||
94 | GNUNET_MessageHeader | ||
95 | *msg, | ||
96 | GNUNET_FRAGMENT_MessageProcessor | ||
97 | proc, | ||
98 | void *proc_cls); | ||
90 | 99 | ||
91 | 100 | ||
92 | /** | 101 | /** |
@@ -112,7 +121,7 @@ GNUNET_FRAGMENT_context_transmission_done (struct GNUNET_FRAGMENT_Context *fc); | |||
112 | * GNUNET_SYSERR if this ack is not valid for this fc | 121 | * GNUNET_SYSERR if this ack is not valid for this fc |
113 | */ | 122 | */ |
114 | int GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc, | 123 | int GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc, |
115 | const struct GNUNET_MessageHeader *msg); | 124 | const struct GNUNET_MessageHeader *msg); |
116 | 125 | ||
117 | 126 | ||
118 | /** | 127 | /** |
@@ -144,8 +153,9 @@ struct GNUNET_DEFRAGMENT_Context; | |||
144 | * @param msg the message that was created | 153 | * @param msg the message that was created |
145 | */ | 154 | */ |
146 | typedef void (*GNUNET_DEFRAGMENT_AckProcessor) (void *cls, | 155 | typedef void (*GNUNET_DEFRAGMENT_AckProcessor) (void *cls, |
147 | uint32_t id, | 156 | uint32_t id, |
148 | const struct GNUNET_MessageHeader *msg); | 157 | const struct |
158 | GNUNET_MessageHeader * msg); | ||
149 | 159 | ||
150 | 160 | ||
151 | /** | 161 | /** |
@@ -161,13 +171,18 @@ typedef void (*GNUNET_DEFRAGMENT_AckProcessor) (void *cls, | |||
161 | * back to the other side) | 171 | * back to the other side) |
162 | * @return the defragmentation context | 172 | * @return the defragmentation context |
163 | */ | 173 | */ |
164 | struct GNUNET_DEFRAGMENT_Context * | 174 | struct GNUNET_DEFRAGMENT_Context *GNUNET_DEFRAGMENT_context_create (struct |
165 | GNUNET_DEFRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats, | 175 | GNUNET_STATISTICS_Handle |
166 | uint16_t mtu, | 176 | *stats, |
167 | unsigned int num_msgs, | 177 | uint16_t |
168 | void *cls, | 178 | mtu, |
169 | GNUNET_FRAGMENT_MessageProcessor proc, | 179 | unsigned int |
170 | GNUNET_DEFRAGMENT_AckProcessor ackp); | 180 | num_msgs, |
181 | void *cls, | ||
182 | GNUNET_FRAGMENT_MessageProcessor | ||
183 | proc, | ||
184 | GNUNET_DEFRAGMENT_AckProcessor | ||
185 | ackp); | ||
171 | 186 | ||
172 | 187 | ||
173 | /** | 188 | /** |
@@ -175,8 +190,7 @@ GNUNET_DEFRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats, | |||
175 | * | 190 | * |
176 | * @param dc defragmentation context | 191 | * @param dc defragmentation context |
177 | */ | 192 | */ |
178 | void | 193 | void GNUNET_DEFRAGMENT_context_destroy (struct GNUNET_DEFRAGMENT_Context *dc); |
179 | GNUNET_DEFRAGMENT_context_destroy (struct GNUNET_DEFRAGMENT_Context *dc); | ||
180 | 194 | ||
181 | 195 | ||
182 | /** | 196 | /** |
@@ -188,7 +202,7 @@ GNUNET_DEFRAGMENT_context_destroy (struct GNUNET_DEFRAGMENT_Context *dc); | |||
188 | */ | 202 | */ |
189 | int | 203 | int |
190 | GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc, | 204 | GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc, |
191 | const struct GNUNET_MessageHeader *msg); | 205 | const struct GNUNET_MessageHeader *msg); |
192 | 206 | ||
193 | 207 | ||
194 | #if 0 /* keep Emacsens' auto-indent happy */ | 208 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h index 04e7b606c..b6eb83609 100644 --- a/src/include/gnunet_fs_service.h +++ b/src/include/gnunet_fs_service.h | |||
@@ -80,8 +80,8 @@ struct GNUNET_FS_Uri; | |||
80 | * @return GNUNET_OK to continue to iterate, GNUNET_SYSERR to abort | 80 | * @return GNUNET_OK to continue to iterate, GNUNET_SYSERR to abort |
81 | */ | 81 | */ |
82 | typedef int (*GNUNET_FS_KeywordIterator) (void *cls, | 82 | typedef int (*GNUNET_FS_KeywordIterator) (void *cls, |
83 | const char *keyword, | 83 | const char *keyword, |
84 | int is_mandatory); | 84 | int is_mandatory); |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Get a unique key from a URI. This is for putting URIs | 87 | * Get a unique key from a URI. This is for putting URIs |
@@ -90,9 +90,8 @@ typedef int (*GNUNET_FS_KeywordIterator) (void *cls, | |||
90 | * @param uri uri to convert to a unique key | 90 | * @param uri uri to convert to a unique key |
91 | * @param key wherer to store the unique key | 91 | * @param key wherer to store the unique key |
92 | */ | 92 | */ |
93 | void | 93 | void |
94 | GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, | 94 | GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, GNUNET_HashCode * key); |
95 | GNUNET_HashCode * key); | ||
96 | 95 | ||
97 | /** | 96 | /** |
98 | * Convert a URI to a UTF-8 String. | 97 | * Convert a URI to a UTF-8 String. |
@@ -100,8 +99,7 @@ GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, | |||
100 | * @param uri uri to convert to a string | 99 | * @param uri uri to convert to a string |
101 | * @return the UTF-8 string | 100 | * @return the UTF-8 string |
102 | */ | 101 | */ |
103 | char * | 102 | char *GNUNET_FS_uri_to_string (const struct GNUNET_FS_Uri *uri); |
104 | GNUNET_FS_uri_to_string (const struct GNUNET_FS_Uri *uri); | ||
105 | 103 | ||
106 | /** | 104 | /** |
107 | * Convert keyword URI to a human readable format | 105 | * Convert keyword URI to a human readable format |
@@ -110,8 +108,7 @@ GNUNET_FS_uri_to_string (const struct GNUNET_FS_Uri *uri); | |||
110 | * @param uri ksk uri to convert to a string | 108 | * @param uri ksk uri to convert to a string |
111 | * @return string with the keywords | 109 | * @return string with the keywords |
112 | */ | 110 | */ |
113 | char * | 111 | char *GNUNET_FS_uri_ksk_to_string_fancy (const struct GNUNET_FS_Uri *uri); |
114 | GNUNET_FS_uri_ksk_to_string_fancy (const struct GNUNET_FS_Uri *uri); | ||
115 | 112 | ||
116 | 113 | ||
117 | /** | 114 | /** |
@@ -124,8 +121,7 @@ GNUNET_FS_uri_ksk_to_string_fancy (const struct GNUNET_FS_Uri *uri); | |||
124 | */ | 121 | */ |
125 | void | 122 | void |
126 | GNUNET_FS_uri_ksk_add_keyword (struct GNUNET_FS_Uri *uri, | 123 | GNUNET_FS_uri_ksk_add_keyword (struct GNUNET_FS_Uri *uri, |
127 | const char *keyword, | 124 | const char *keyword, int is_mandatory); |
128 | int is_mandatory); | ||
129 | 125 | ||
130 | 126 | ||
131 | /** | 127 | /** |
@@ -137,7 +133,7 @@ GNUNET_FS_uri_ksk_add_keyword (struct GNUNET_FS_Uri *uri, | |||
137 | */ | 133 | */ |
138 | void | 134 | void |
139 | GNUNET_FS_uri_ksk_remove_keyword (struct GNUNET_FS_Uri *uri, | 135 | GNUNET_FS_uri_ksk_remove_keyword (struct GNUNET_FS_Uri *uri, |
140 | const char *keyword); | 136 | const char *keyword); |
141 | 137 | ||
142 | 138 | ||
143 | /** | 139 | /** |
@@ -147,17 +143,14 @@ GNUNET_FS_uri_ksk_remove_keyword (struct GNUNET_FS_Uri *uri, | |||
147 | * @param emsg where to store the parser error message (if any) | 143 | * @param emsg where to store the parser error message (if any) |
148 | * @return NULL on error | 144 | * @return NULL on error |
149 | */ | 145 | */ |
150 | struct GNUNET_FS_Uri * | 146 | struct GNUNET_FS_Uri *GNUNET_FS_uri_parse (const char *uri, char **emsg); |
151 | GNUNET_FS_uri_parse (const char *uri, | ||
152 | char **emsg); | ||
153 | 147 | ||
154 | /** | 148 | /** |
155 | * Free URI. | 149 | * Free URI. |
156 | * | 150 | * |
157 | * @param uri uri to free | 151 | * @param uri uri to free |
158 | */ | 152 | */ |
159 | void | 153 | void GNUNET_FS_uri_destroy (struct GNUNET_FS_Uri *uri); |
160 | GNUNET_FS_uri_destroy (struct GNUNET_FS_Uri *uri); | ||
161 | 154 | ||
162 | 155 | ||
163 | /** | 156 | /** |
@@ -166,7 +159,7 @@ GNUNET_FS_uri_destroy (struct GNUNET_FS_Uri *uri); | |||
166 | * @param uri ksk uri to get the number of keywords from | 159 | * @param uri ksk uri to get the number of keywords from |
167 | * @return 0 if this is not a keyword URI | 160 | * @return 0 if this is not a keyword URI |
168 | */ | 161 | */ |
169 | unsigned int | 162 | unsigned int |
170 | GNUNET_FS_uri_ksk_get_keyword_count (const struct GNUNET_FS_Uri *uri); | 163 | GNUNET_FS_uri_ksk_get_keyword_count (const struct GNUNET_FS_Uri *uri); |
171 | 164 | ||
172 | 165 | ||
@@ -179,10 +172,10 @@ GNUNET_FS_uri_ksk_get_keyword_count (const struct GNUNET_FS_Uri *uri); | |||
179 | * @return -1 if this is not a keyword URI, otherwise number of | 172 | * @return -1 if this is not a keyword URI, otherwise number of |
180 | * keywords iterated over until iterator aborted | 173 | * keywords iterated over until iterator aborted |
181 | */ | 174 | */ |
182 | int | 175 | int |
183 | GNUNET_FS_uri_ksk_get_keywords (const struct GNUNET_FS_Uri *uri, | 176 | GNUNET_FS_uri_ksk_get_keywords (const struct GNUNET_FS_Uri *uri, |
184 | GNUNET_FS_KeywordIterator iterator, | 177 | GNUNET_FS_KeywordIterator iterator, |
185 | void *iterator_cls); | 178 | void *iterator_cls); |
186 | 179 | ||
187 | 180 | ||
188 | /** | 181 | /** |
@@ -194,7 +187,7 @@ GNUNET_FS_uri_ksk_get_keywords (const struct GNUNET_FS_Uri *uri, | |||
194 | */ | 187 | */ |
195 | int | 188 | int |
196 | GNUNET_FS_uri_loc_get_peer_identity (const struct GNUNET_FS_Uri *uri, | 189 | GNUNET_FS_uri_loc_get_peer_identity (const struct GNUNET_FS_Uri *uri, |
197 | struct GNUNET_PeerIdentity * peer); | 190 | struct GNUNET_PeerIdentity *peer); |
198 | 191 | ||
199 | 192 | ||
200 | /** | 193 | /** |
@@ -203,8 +196,8 @@ GNUNET_FS_uri_loc_get_peer_identity (const struct GNUNET_FS_Uri *uri, | |||
203 | * @param uri location URI to get the content URI from | 196 | * @param uri location URI to get the content URI from |
204 | * @return NULL if argument is not a location URI | 197 | * @return NULL if argument is not a location URI |
205 | */ | 198 | */ |
206 | struct GNUNET_FS_Uri * | 199 | struct GNUNET_FS_Uri *GNUNET_FS_uri_loc_get_uri (const struct GNUNET_FS_Uri |
207 | GNUNET_FS_uri_loc_get_uri (const struct GNUNET_FS_Uri *uri); | 200 | *uri); |
208 | 201 | ||
209 | 202 | ||
210 | /** | 203 | /** |
@@ -225,10 +218,13 @@ GNUNET_FS_uri_loc_get_expiration (const struct GNUNET_FS_Uri *uri); | |||
225 | * @param expiration_time how long will the content be offered? | 218 | * @param expiration_time how long will the content be offered? |
226 | * @return the location URI, NULL on error | 219 | * @return the location URI, NULL on error |
227 | */ | 220 | */ |
228 | struct GNUNET_FS_Uri * | 221 | struct GNUNET_FS_Uri *GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri |
229 | GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri *baseUri, | 222 | *baseUri, |
230 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 223 | const struct |
231 | struct GNUNET_TIME_Absolute expiration_time); | 224 | GNUNET_CONFIGURATION_Handle |
225 | *cfg, | ||
226 | struct GNUNET_TIME_Absolute | ||
227 | expiration_time); | ||
232 | 228 | ||
233 | 229 | ||
234 | /** | 230 | /** |
@@ -239,8 +235,8 @@ GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri *baseUri, | |||
239 | * @param uri the URI to canonicalize | 235 | * @param uri the URI to canonicalize |
240 | * @return canonicalized version of the URI, NULL on error | 236 | * @return canonicalized version of the URI, NULL on error |
241 | */ | 237 | */ |
242 | struct GNUNET_FS_Uri * | 238 | struct GNUNET_FS_Uri *GNUNET_FS_uri_ksk_canonicalize (const struct GNUNET_FS_Uri |
243 | GNUNET_FS_uri_ksk_canonicalize (const struct GNUNET_FS_Uri *uri); | 239 | *uri); |
244 | 240 | ||
245 | 241 | ||
246 | /** | 242 | /** |
@@ -252,9 +248,8 @@ GNUNET_FS_uri_ksk_canonicalize (const struct GNUNET_FS_Uri *uri); | |||
252 | * @param u2 second uri | 248 | * @param u2 second uri |
253 | * @return merged URI, NULL on error | 249 | * @return merged URI, NULL on error |
254 | */ | 250 | */ |
255 | struct GNUNET_FS_Uri * | 251 | struct GNUNET_FS_Uri *GNUNET_FS_uri_ksk_merge (const struct GNUNET_FS_Uri *u1, |
256 | GNUNET_FS_uri_ksk_merge (const struct GNUNET_FS_Uri *u1, | 252 | const struct GNUNET_FS_Uri *u2); |
257 | const struct GNUNET_FS_Uri *u2); | ||
258 | 253 | ||
259 | 254 | ||
260 | /** | 255 | /** |
@@ -263,8 +258,7 @@ GNUNET_FS_uri_ksk_merge (const struct GNUNET_FS_Uri *u1, | |||
263 | * @param uri the URI to duplicate | 258 | * @param uri the URI to duplicate |
264 | * @return copy of the URI | 259 | * @return copy of the URI |
265 | */ | 260 | */ |
266 | struct GNUNET_FS_Uri * | 261 | struct GNUNET_FS_Uri *GNUNET_FS_uri_dup (const struct GNUNET_FS_Uri *uri); |
267 | GNUNET_FS_uri_dup (const struct GNUNET_FS_Uri *uri); | ||
268 | 262 | ||
269 | 263 | ||
270 | /** | 264 | /** |
@@ -284,9 +278,8 @@ GNUNET_FS_uri_dup (const struct GNUNET_FS_Uri *uri); | |||
284 | * @return an FS URI for the given keywords, NULL | 278 | * @return an FS URI for the given keywords, NULL |
285 | * if keywords is not legal (i.e. empty). | 279 | * if keywords is not legal (i.e. empty). |
286 | */ | 280 | */ |
287 | struct GNUNET_FS_Uri * | 281 | struct GNUNET_FS_Uri *GNUNET_FS_uri_ksk_create (const char *keywords, |
288 | GNUNET_FS_uri_ksk_create (const char *keywords, | 282 | char **emsg); |
289 | char **emsg); | ||
290 | 283 | ||
291 | 284 | ||
292 | /** | 285 | /** |
@@ -306,9 +299,8 @@ GNUNET_FS_uri_ksk_create (const char *keywords, | |||
306 | * @return an FS URI for the given keywords, NULL | 299 | * @return an FS URI for the given keywords, NULL |
307 | * if keywords is not legal (i.e. empty). | 300 | * if keywords is not legal (i.e. empty). |
308 | */ | 301 | */ |
309 | struct GNUNET_FS_Uri * | 302 | struct GNUNET_FS_Uri *GNUNET_FS_uri_ksk_create_from_args (unsigned int argc, |
310 | GNUNET_FS_uri_ksk_create_from_args (unsigned int argc, | 303 | const char **argv); |
311 | const char **argv); | ||
312 | 304 | ||
313 | 305 | ||
314 | /** | 306 | /** |
@@ -318,9 +310,9 @@ GNUNET_FS_uri_ksk_create_from_args (unsigned int argc, | |||
318 | * @param u2 the other URI | 310 | * @param u2 the other URI |
319 | * @return GNUNET_YES if the URIs are equal | 311 | * @return GNUNET_YES if the URIs are equal |
320 | */ | 312 | */ |
321 | int | 313 | int |
322 | GNUNET_FS_uri_test_equal (const struct GNUNET_FS_Uri *u1, | 314 | GNUNET_FS_uri_test_equal (const struct GNUNET_FS_Uri *u1, |
323 | const struct GNUNET_FS_Uri *u2); | 315 | const struct GNUNET_FS_Uri *u2); |
324 | 316 | ||
325 | 317 | ||
326 | /** | 318 | /** |
@@ -329,8 +321,7 @@ GNUNET_FS_uri_test_equal (const struct GNUNET_FS_Uri *u1, | |||
329 | * @param uri the uri to check | 321 | * @param uri the uri to check |
330 | * @return GNUNET_YES if this is an SKS uri | 322 | * @return GNUNET_YES if this is an SKS uri |
331 | */ | 323 | */ |
332 | int | 324 | int GNUNET_FS_uri_test_sks (const struct GNUNET_FS_Uri *uri); |
333 | GNUNET_FS_uri_test_sks (const struct GNUNET_FS_Uri *uri); | ||
334 | 325 | ||
335 | 326 | ||
336 | /** | 327 | /** |
@@ -347,10 +338,8 @@ struct GNUNET_FS_Namespace; | |||
347 | * @param emsg where to store an error message | 338 | * @param emsg where to store an error message |
348 | * @return an FS URI for the given namespace and identifier | 339 | * @return an FS URI for the given namespace and identifier |
349 | */ | 340 | */ |
350 | struct GNUNET_FS_Uri * | 341 | struct GNUNET_FS_Uri *GNUNET_FS_uri_sks_create (struct GNUNET_FS_Namespace *ns, |
351 | GNUNET_FS_uri_sks_create (struct GNUNET_FS_Namespace *ns, | 342 | const char *id, char **emsg); |
352 | const char *id, | ||
353 | char **emsg); | ||
354 | 343 | ||
355 | 344 | ||
356 | /** | 345 | /** |
@@ -360,9 +349,8 @@ GNUNET_FS_uri_sks_create (struct GNUNET_FS_Namespace *ns, | |||
360 | * @param id identifier | 349 | * @param id identifier |
361 | * @return an FS URI for the given namespace and identifier | 350 | * @return an FS URI for the given namespace and identifier |
362 | */ | 351 | */ |
363 | struct GNUNET_FS_Uri * | 352 | struct GNUNET_FS_Uri *GNUNET_FS_uri_sks_create_from_nsid (GNUNET_HashCode * |
364 | GNUNET_FS_uri_sks_create_from_nsid (GNUNET_HashCode *nsid, | 353 | nsid, const char *id); |
365 | const char *id); | ||
366 | 354 | ||
367 | 355 | ||
368 | /** | 356 | /** |
@@ -373,9 +361,9 @@ GNUNET_FS_uri_sks_create_from_nsid (GNUNET_HashCode *nsid, | |||
373 | * @param nsid where to store the ID of the namespace | 361 | * @param nsid where to store the ID of the namespace |
374 | * @return GNUNET_OK on success | 362 | * @return GNUNET_OK on success |
375 | */ | 363 | */ |
376 | int | 364 | int |
377 | GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri, | 365 | GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri, |
378 | GNUNET_HashCode * nsid); | 366 | GNUNET_HashCode * nsid); |
379 | 367 | ||
380 | 368 | ||
381 | /** | 369 | /** |
@@ -384,8 +372,7 @@ GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri, | |||
384 | * @param uri the sks uri | 372 | * @param uri the sks uri |
385 | * @return NULL on error (not a valid SKS URI) | 373 | * @return NULL on error (not a valid SKS URI) |
386 | */ | 374 | */ |
387 | char * | 375 | char *GNUNET_FS_uri_sks_get_content_id (const struct GNUNET_FS_Uri *uri); |
388 | GNUNET_FS_uri_sks_get_content_id (const struct GNUNET_FS_Uri *uri); | ||
389 | 376 | ||
390 | 377 | ||
391 | /** | 378 | /** |
@@ -396,9 +383,8 @@ GNUNET_FS_uri_sks_get_content_id (const struct GNUNET_FS_Uri *uri); | |||
396 | * @param uri SKS uri to convert | 383 | * @param uri SKS uri to convert |
397 | * @return NULL on error (not an SKS URI) | 384 | * @return NULL on error (not an SKS URI) |
398 | */ | 385 | */ |
399 | char * | 386 | char *GNUNET_FS_uri_sks_to_string_fancy (struct GNUNET_CONFIGURATION_Handle |
400 | GNUNET_FS_uri_sks_to_string_fancy (struct GNUNET_CONFIGURATION_Handle *cfg, | 387 | *cfg, const struct GNUNET_FS_Uri *uri); |
401 | const struct GNUNET_FS_Uri *uri); | ||
402 | 388 | ||
403 | 389 | ||
404 | /** | 390 | /** |
@@ -407,8 +393,7 @@ GNUNET_FS_uri_sks_to_string_fancy (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
407 | * @param uri the uri | 393 | * @param uri the uri |
408 | * @return GNUNET_YES if this is a KSK uri | 394 | * @return GNUNET_YES if this is a KSK uri |
409 | */ | 395 | */ |
410 | int | 396 | int GNUNET_FS_uri_test_ksk (const struct GNUNET_FS_Uri *uri); |
411 | GNUNET_FS_uri_test_ksk (const struct GNUNET_FS_Uri *uri); | ||
412 | 397 | ||
413 | 398 | ||
414 | /** | 399 | /** |
@@ -417,8 +402,7 @@ GNUNET_FS_uri_test_ksk (const struct GNUNET_FS_Uri *uri); | |||
417 | * @param uri the uri to check | 402 | * @param uri the uri to check |
418 | * @return GNUNET_YES if this is a CHK uri | 403 | * @return GNUNET_YES if this is a CHK uri |
419 | */ | 404 | */ |
420 | int | 405 | int GNUNET_FS_uri_test_chk (const struct GNUNET_FS_Uri *uri); |
421 | GNUNET_FS_uri_test_chk (const struct GNUNET_FS_Uri *uri); | ||
422 | 406 | ||
423 | 407 | ||
424 | /** | 408 | /** |
@@ -428,8 +412,7 @@ GNUNET_FS_uri_test_chk (const struct GNUNET_FS_Uri *uri); | |||
428 | * @param uri the CHK (or LOC) URI to inspect | 412 | * @param uri the CHK (or LOC) URI to inspect |
429 | * @return size of the file as specified in the CHK URI | 413 | * @return size of the file as specified in the CHK URI |
430 | */ | 414 | */ |
431 | uint64_t | 415 | uint64_t GNUNET_FS_uri_chk_get_file_size (const struct GNUNET_FS_Uri *uri); |
432 | GNUNET_FS_uri_chk_get_file_size (const struct GNUNET_FS_Uri *uri); | ||
433 | 416 | ||
434 | 417 | ||
435 | /** | 418 | /** |
@@ -438,8 +421,7 @@ GNUNET_FS_uri_chk_get_file_size (const struct GNUNET_FS_Uri *uri); | |||
438 | * @param uri the uri to check | 421 | * @param uri the uri to check |
439 | * @return GNUNET_YES if this is a LOC uri | 422 | * @return GNUNET_YES if this is a LOC uri |
440 | */ | 423 | */ |
441 | int | 424 | int GNUNET_FS_uri_test_loc (const struct GNUNET_FS_Uri *uri); |
442 | GNUNET_FS_uri_test_loc (const struct GNUNET_FS_Uri *uri); | ||
443 | 425 | ||
444 | 426 | ||
445 | /** | 427 | /** |
@@ -450,8 +432,9 @@ GNUNET_FS_uri_test_loc (const struct GNUNET_FS_Uri *uri); | |||
450 | * @param md metadata to use | 432 | * @param md metadata to use |
451 | * @return NULL on error, otherwise a KSK URI | 433 | * @return NULL on error, otherwise a KSK URI |
452 | */ | 434 | */ |
453 | struct GNUNET_FS_Uri * | 435 | struct GNUNET_FS_Uri *GNUNET_FS_uri_ksk_create_from_meta_data (const struct |
454 | GNUNET_FS_uri_ksk_create_from_meta_data (const struct GNUNET_CONTAINER_MetaData *md); | 436 | GNUNET_CONTAINER_MetaData |
437 | *md); | ||
455 | 438 | ||
456 | 439 | ||
457 | /* ******************** command-line option parsing API *********************** */ | 440 | /* ******************** command-line option parsing API *********************** */ |
@@ -469,10 +452,9 @@ GNUNET_FS_uri_ksk_create_from_meta_data (const struct GNUNET_CONTAINER_MetaData | |||
469 | * @return GNUNET_OK on success | 452 | * @return GNUNET_OK on success |
470 | */ | 453 | */ |
471 | int | 454 | int |
472 | GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext* ctx, | 455 | GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext |
473 | void *scls, | 456 | *ctx, void *scls, const char *option, |
474 | const char *option, | 457 | const char *value); |
475 | const char *value); | ||
476 | 458 | ||
477 | 459 | ||
478 | /** | 460 | /** |
@@ -488,10 +470,9 @@ GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext* | |||
488 | * @return GNUNET_OK on success | 470 | * @return GNUNET_OK on success |
489 | */ | 471 | */ |
490 | int | 472 | int |
491 | GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext* ctx, | 473 | GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext |
492 | void *scls, | 474 | *ctx, void *scls, const char *option, |
493 | const char *option, | 475 | const char *value); |
494 | const char *value); | ||
495 | 476 | ||
496 | 477 | ||
497 | 478 | ||
@@ -636,7 +617,7 @@ enum GNUNET_FS_Status | |||
636 | * be generated in this case. | 617 | * be generated in this case. |
637 | */ | 618 | */ |
638 | GNUNET_FS_STATUS_SEARCH_SUSPEND, | 619 | GNUNET_FS_STATUS_SEARCH_SUSPEND, |
639 | 620 | ||
640 | /** | 621 | /** |
641 | * This search has yielded a result. | 622 | * This search has yielded a result. |
642 | */ | 623 | */ |
@@ -689,7 +670,7 @@ enum GNUNET_FS_Status | |||
689 | 670 | ||
690 | /** | 671 | /** |
691 | * Notification that we started to unindex a file. | 672 | * Notification that we started to unindex a file. |
692 | */ | 673 | */ |
693 | GNUNET_FS_STATUS_UNINDEX_START, | 674 | GNUNET_FS_STATUS_UNINDEX_START, |
694 | 675 | ||
695 | /** | 676 | /** |
@@ -724,7 +705,6 @@ enum GNUNET_FS_Status | |||
724 | * was stopped (final event for this action). | 705 | * was stopped (final event for this action). |
725 | */ | 706 | */ |
726 | GNUNET_FS_STATUS_UNINDEX_STOPPED | 707 | GNUNET_FS_STATUS_UNINDEX_STOPPED |
727 | |||
728 | }; | 708 | }; |
729 | 709 | ||
730 | 710 | ||
@@ -773,17 +753,19 @@ struct GNUNET_FS_FileInformation; | |||
773 | * information about what is going on. | 753 | * information about what is going on. |
774 | */ | 754 | */ |
775 | struct GNUNET_FS_ProgressInfo | 755 | struct GNUNET_FS_ProgressInfo |
776 | { | 756 | { |
777 | 757 | ||
778 | /** | 758 | /** |
779 | * Values that depend on the event type. | 759 | * Values that depend on the event type. |
780 | */ | 760 | */ |
781 | union { | 761 | union |
782 | 762 | { | |
763 | |||
783 | /** | 764 | /** |
784 | * Values for all "GNUNET_FS_STATUS_PUBLISH_*" events. | 765 | * Values for all "GNUNET_FS_STATUS_PUBLISH_*" events. |
785 | */ | 766 | */ |
786 | struct { | 767 | struct |
768 | { | ||
787 | 769 | ||
788 | /** | 770 | /** |
789 | * Context for controlling the upload. | 771 | * Context for controlling the upload. |
@@ -811,7 +793,7 @@ struct GNUNET_FS_ProgressInfo | |||
811 | * Name of the file being published; can be NULL. | 793 | * Name of the file being published; can be NULL. |
812 | */ | 794 | */ |
813 | const char *filename; | 795 | const char *filename; |
814 | 796 | ||
815 | /** | 797 | /** |
816 | * How large is the file overall? For directories, | 798 | * How large is the file overall? For directories, |
817 | * this is only the size of the directory itself, | 799 | * this is only the size of the directory itself, |
@@ -824,7 +806,7 @@ struct GNUNET_FS_ProgressInfo | |||
824 | * At what time do we expect to finish the upload? | 806 | * At what time do we expect to finish the upload? |
825 | * (will be a value in the past for completed | 807 | * (will be a value in the past for completed |
826 | * uploads). | 808 | * uploads). |
827 | */ | 809 | */ |
828 | struct GNUNET_TIME_Relative eta; | 810 | struct GNUNET_TIME_Relative eta; |
829 | 811 | ||
830 | /** | 812 | /** |
@@ -846,90 +828,96 @@ struct GNUNET_FS_ProgressInfo | |||
846 | /** | 828 | /** |
847 | * Additional values for specific events. | 829 | * Additional values for specific events. |
848 | */ | 830 | */ |
849 | union { | 831 | union |
832 | { | ||
850 | 833 | ||
851 | /** | 834 | /** |
852 | * These values are only valid for | 835 | * These values are only valid for |
853 | * GNUNET_FS_STATUS_PUBLISH_PROGRESS events. | 836 | * GNUNET_FS_STATUS_PUBLISH_PROGRESS events. |
854 | */ | 837 | */ |
855 | struct { | 838 | struct |
856 | 839 | { | |
857 | /** | 840 | |
841 | /** | ||
858 | * Data block we just published. | 842 | * Data block we just published. |
859 | */ | 843 | */ |
860 | const void *data; | 844 | const void *data; |
861 | 845 | ||
862 | /** | 846 | /** |
863 | * At what offset in the file is "data"? | 847 | * At what offset in the file is "data"? |
864 | */ | 848 | */ |
865 | uint64_t offset; | 849 | uint64_t offset; |
866 | 850 | ||
867 | /** | 851 | /** |
868 | * Length of the data block. | 852 | * Length of the data block. |
869 | */ | 853 | */ |
870 | uint64_t data_len; | 854 | uint64_t data_len; |
871 | 855 | ||
872 | /** | 856 | /** |
873 | * Depth of the given block in the tree; | 857 | * Depth of the given block in the tree; |
874 | * 0 would be the lowest level (DBLOCKs). | 858 | * 0 would be the lowest level (DBLOCKs). |
875 | */ | 859 | */ |
876 | unsigned int depth; | 860 | unsigned int depth; |
877 | 861 | ||
878 | } progress; | 862 | } progress; |
879 | 863 | ||
880 | /** | 864 | /** |
881 | * These values are only valid for | 865 | * These values are only valid for |
882 | * GNUNET_FS_STATUS_PUBLISH_RESUME events. | 866 | * GNUNET_FS_STATUS_PUBLISH_RESUME events. |
883 | */ | 867 | */ |
884 | struct { | 868 | struct |
885 | 869 | { | |
886 | /** | 870 | |
871 | /** | ||
887 | * Error message, NULL if no error was encountered so far. | 872 | * Error message, NULL if no error was encountered so far. |
888 | */ | 873 | */ |
889 | const char *message; | 874 | const char *message; |
890 | 875 | ||
891 | /** | 876 | /** |
892 | * URI of the file (if the download had been completed) | 877 | * URI of the file (if the download had been completed) |
893 | */ | 878 | */ |
894 | const struct GNUNET_FS_Uri *chk_uri; | 879 | const struct GNUNET_FS_Uri *chk_uri; |
895 | 880 | ||
896 | } resume; | 881 | } resume; |
897 | 882 | ||
898 | /** | 883 | /** |
899 | * These values are only valid for | 884 | * These values are only valid for |
900 | * GNUNET_FS_STATUS_PUBLISH_COMPLETED events. | 885 | * GNUNET_FS_STATUS_PUBLISH_COMPLETED events. |
901 | */ | 886 | */ |
902 | struct { | 887 | struct |
903 | 888 | { | |
904 | /** | 889 | |
890 | /** | ||
905 | * URI of the file. | 891 | * URI of the file. |
906 | */ | 892 | */ |
907 | const struct GNUNET_FS_Uri *chk_uri; | 893 | const struct GNUNET_FS_Uri *chk_uri; |
908 | 894 | ||
909 | } completed; | 895 | } completed; |
910 | 896 | ||
911 | /** | 897 | /** |
912 | * These values are only valid for | 898 | * These values are only valid for |
913 | * GNUNET_FS_STATUS_PUBLISH_ERROR events. | 899 | * GNUNET_FS_STATUS_PUBLISH_ERROR events. |
914 | */ | 900 | */ |
915 | struct { | 901 | struct |
916 | 902 | { | |
917 | /** | 903 | |
904 | /** | ||
918 | * Error message, never NULL. | 905 | * Error message, never NULL. |
919 | */ | 906 | */ |
920 | const char *message; | 907 | const char *message; |
921 | 908 | ||
922 | } error; | 909 | } error; |
923 | 910 | ||
924 | } specifics; | 911 | } specifics; |
925 | 912 | ||
926 | } publish; | 913 | } publish; |
927 | 914 | ||
928 | 915 | ||
929 | /** | 916 | /** |
930 | * Values for all "GNUNET_FS_STATUS_DOWNLOAD_*" events. | 917 | * Values for all "GNUNET_FS_STATUS_DOWNLOAD_*" events. |
931 | */ | 918 | */ |
932 | struct { | 919 | struct |
920 | { | ||
933 | 921 | ||
934 | /** | 922 | /** |
935 | * Context for controlling the download. | 923 | * Context for controlling the download. |
@@ -956,7 +944,7 @@ struct GNUNET_FS_ProgressInfo | |||
956 | * download was started from a search result. | 944 | * download was started from a search result. |
957 | */ | 945 | */ |
958 | void *sctx; | 946 | void *sctx; |
959 | 947 | ||
960 | /** | 948 | /** |
961 | * URI used for this download. | 949 | * URI used for this download. |
962 | */ | 950 | */ |
@@ -966,7 +954,7 @@ struct GNUNET_FS_ProgressInfo | |||
966 | * Name of the file that we are downloading. | 954 | * Name of the file that we are downloading. |
967 | */ | 955 | */ |
968 | const char *filename; | 956 | const char *filename; |
969 | 957 | ||
970 | /** | 958 | /** |
971 | * How large is the download overall? This | 959 | * How large is the download overall? This |
972 | * is NOT necessarily the size from the | 960 | * is NOT necessarily the size from the |
@@ -978,12 +966,12 @@ struct GNUNET_FS_ProgressInfo | |||
978 | * At what time do we expect to finish the download? | 966 | * At what time do we expect to finish the download? |
979 | * (will be a value in the past for completed | 967 | * (will be a value in the past for completed |
980 | * uploads). | 968 | * uploads). |
981 | */ | 969 | */ |
982 | struct GNUNET_TIME_Relative eta; | 970 | struct GNUNET_TIME_Relative eta; |
983 | 971 | ||
984 | /** | 972 | /** |
985 | * How long has this download been active? | 973 | * How long has this download been active? |
986 | */ | 974 | */ |
987 | struct GNUNET_TIME_Relative duration; | 975 | struct GNUNET_TIME_Relative duration; |
988 | 976 | ||
989 | /** | 977 | /** |
@@ -1004,83 +992,88 @@ struct GNUNET_FS_ProgressInfo | |||
1004 | /** | 992 | /** |
1005 | * Additional values for specific events. | 993 | * Additional values for specific events. |
1006 | */ | 994 | */ |
1007 | union { | 995 | union |
1008 | 996 | { | |
1009 | /** | 997 | |
998 | /** | ||
1010 | * These values are only valid for | 999 | * These values are only valid for |
1011 | * GNUNET_FS_STATUS_DOWNLOAD_PROGRESS events. | 1000 | * GNUNET_FS_STATUS_DOWNLOAD_PROGRESS events. |
1012 | */ | 1001 | */ |
1013 | struct { | 1002 | struct |
1014 | 1003 | { | |
1015 | /** | 1004 | |
1005 | /** | ||
1016 | * Data block we just obtained, can be NULL (even if | 1006 | * Data block we just obtained, can be NULL (even if |
1017 | * data_len > 0) if we found the entire block 'intact' on | 1007 | * data_len > 0) if we found the entire block 'intact' on |
1018 | * disk. In this case, it is also possible for 'data_len' | 1008 | * disk. In this case, it is also possible for 'data_len' |
1019 | * to be larger than an individual (32k) block. | 1009 | * to be larger than an individual (32k) block. |
1020 | */ | 1010 | */ |
1021 | const void *data; | 1011 | const void *data; |
1022 | 1012 | ||
1023 | /** | 1013 | /** |
1024 | * At what offset in the file is "data"? | 1014 | * At what offset in the file is "data"? |
1025 | */ | 1015 | */ |
1026 | uint64_t offset; | 1016 | uint64_t offset; |
1027 | 1017 | ||
1028 | /** | 1018 | /** |
1029 | * Length of the data block. | 1019 | * Length of the data block. |
1030 | */ | 1020 | */ |
1031 | uint64_t data_len; | 1021 | uint64_t data_len; |
1032 | 1022 | ||
1033 | /** | 1023 | /** |
1034 | * Depth of the given block in the tree; | 1024 | * Depth of the given block in the tree; |
1035 | * 0 would be the lowest level (DBLOCKS). | 1025 | * 0 would be the lowest level (DBLOCKS). |
1036 | */ | 1026 | */ |
1037 | unsigned int depth; | 1027 | unsigned int depth; |
1038 | 1028 | ||
1039 | } progress; | 1029 | } progress; |
1040 | 1030 | ||
1041 | /** | 1031 | /** |
1042 | * These values are only valid for | 1032 | * These values are only valid for |
1043 | * GNUNET_FS_STATUS_DOWNLOAD_START events. | 1033 | * GNUNET_FS_STATUS_DOWNLOAD_START events. |
1044 | */ | 1034 | */ |
1045 | struct { | 1035 | struct |
1036 | { | ||
1046 | 1037 | ||
1047 | /** | 1038 | /** |
1048 | * Known metadata for the download. | 1039 | * Known metadata for the download. |
1049 | */ | 1040 | */ |
1050 | const struct GNUNET_CONTAINER_MetaData *meta; | 1041 | const struct GNUNET_CONTAINER_MetaData *meta; |
1051 | 1042 | ||
1052 | } start; | 1043 | } start; |
1053 | 1044 | ||
1054 | /** | 1045 | /** |
1055 | * These values are only valid for | 1046 | * These values are only valid for |
1056 | * GNUNET_FS_STATUS_DOWNLOAD_RESUME events. | 1047 | * GNUNET_FS_STATUS_DOWNLOAD_RESUME events. |
1057 | */ | 1048 | */ |
1058 | struct { | 1049 | struct |
1050 | { | ||
1059 | 1051 | ||
1060 | /** | 1052 | /** |
1061 | * Known metadata for the download. | 1053 | * Known metadata for the download. |
1062 | */ | 1054 | */ |
1063 | const struct GNUNET_CONTAINER_MetaData *meta; | 1055 | const struct GNUNET_CONTAINER_MetaData *meta; |
1064 | 1056 | ||
1065 | /** | 1057 | /** |
1066 | * Error message, NULL if we have not encountered any error yet. | 1058 | * Error message, NULL if we have not encountered any error yet. |
1067 | */ | 1059 | */ |
1068 | const char *message; | 1060 | const char *message; |
1069 | 1061 | ||
1070 | } resume; | 1062 | } resume; |
1071 | 1063 | ||
1072 | /** | 1064 | /** |
1073 | * These values are only valid for | 1065 | * These values are only valid for |
1074 | * GNUNET_FS_STATUS_DOWNLOAD_ERROR events. | 1066 | * GNUNET_FS_STATUS_DOWNLOAD_ERROR events. |
1075 | */ | 1067 | */ |
1076 | struct { | 1068 | struct |
1069 | { | ||
1077 | 1070 | ||
1078 | /** | 1071 | /** |
1079 | * Error message. | 1072 | * Error message. |
1080 | */ | 1073 | */ |
1081 | const char *message; | 1074 | const char *message; |
1082 | 1075 | ||
1083 | } error; | 1076 | } error; |
1084 | 1077 | ||
1085 | } specifics; | 1078 | } specifics; |
1086 | 1079 | ||
@@ -1089,7 +1082,8 @@ struct GNUNET_FS_ProgressInfo | |||
1089 | /** | 1082 | /** |
1090 | * Values for all "GNUNET_FS_STATUS_SEARCH_*" events. | 1083 | * Values for all "GNUNET_FS_STATUS_SEARCH_*" events. |
1091 | */ | 1084 | */ |
1092 | struct { | 1085 | struct |
1086 | { | ||
1093 | 1087 | ||
1094 | /** | 1088 | /** |
1095 | * Context for controlling the search, NULL for | 1089 | * Context for controlling the search, NULL for |
@@ -1138,123 +1132,127 @@ struct GNUNET_FS_ProgressInfo | |||
1138 | /** | 1132 | /** |
1139 | * Additional values for specific events. | 1133 | * Additional values for specific events. |
1140 | */ | 1134 | */ |
1141 | union { | 1135 | union |
1142 | 1136 | { | |
1143 | /** | 1137 | |
1138 | /** | ||
1144 | * These values are only valid for | 1139 | * These values are only valid for |
1145 | * GNUNET_FS_STATUS_SEARCH_RESULT events. | 1140 | * GNUNET_FS_STATUS_SEARCH_RESULT events. |
1146 | */ | 1141 | */ |
1147 | struct { | 1142 | struct |
1148 | 1143 | { | |
1149 | /** | 1144 | |
1145 | /** | ||
1150 | * Metadata for the search result. | 1146 | * Metadata for the search result. |
1151 | */ | 1147 | */ |
1152 | const struct GNUNET_CONTAINER_MetaData *meta; | 1148 | const struct GNUNET_CONTAINER_MetaData *meta; |
1153 | 1149 | ||
1154 | /** | 1150 | /** |
1155 | * URI for the search result. | 1151 | * URI for the search result. |
1156 | */ | 1152 | */ |
1157 | const struct GNUNET_FS_Uri *uri; | 1153 | const struct GNUNET_FS_Uri *uri; |
1158 | 1154 | ||
1159 | /** | 1155 | /** |
1160 | * Handle to the result (for starting downloads). | 1156 | * Handle to the result (for starting downloads). |
1161 | */ | 1157 | */ |
1162 | struct GNUNET_FS_SearchResult *result; | 1158 | struct GNUNET_FS_SearchResult *result; |
1163 | 1159 | ||
1164 | /** | 1160 | /** |
1165 | * Applicability rank (the larger, the better the result | 1161 | * Applicability rank (the larger, the better the result |
1166 | * fits the search criteria). | 1162 | * fits the search criteria). |
1167 | */ | 1163 | */ |
1168 | uint32_t applicability_rank; | 1164 | uint32_t applicability_rank; |
1165 | |||
1166 | } result; | ||
1169 | 1167 | ||
1170 | } result; | 1168 | /** |
1171 | |||
1172 | /** | ||
1173 | * These values are only valid for | 1169 | * These values are only valid for |
1174 | * GNUNET_FS_STATUS_SEARCH_RESUME_RESULT events. | 1170 | * GNUNET_FS_STATUS_SEARCH_RESUME_RESULT events. |
1175 | */ | 1171 | */ |
1176 | struct { | 1172 | struct |
1177 | 1173 | { | |
1178 | /** | 1174 | |
1175 | /** | ||
1179 | * Metadata for the search result. | 1176 | * Metadata for the search result. |
1180 | */ | 1177 | */ |
1181 | const struct GNUNET_CONTAINER_MetaData *meta; | 1178 | const struct GNUNET_CONTAINER_MetaData *meta; |
1182 | 1179 | ||
1183 | /** | 1180 | /** |
1184 | * URI for the search result. | 1181 | * URI for the search result. |
1185 | */ | 1182 | */ |
1186 | const struct GNUNET_FS_Uri *uri; | 1183 | const struct GNUNET_FS_Uri *uri; |
1187 | 1184 | ||
1188 | /** | 1185 | /** |
1189 | * Handle to the result (for starting downloads). | 1186 | * Handle to the result (for starting downloads). |
1190 | */ | 1187 | */ |
1191 | struct GNUNET_FS_SearchResult *result; | 1188 | struct GNUNET_FS_SearchResult *result; |
1192 | 1189 | ||
1193 | /** | 1190 | /** |
1194 | * Current availability rank (negative: | 1191 | * Current availability rank (negative: |
1195 | * unavailable, positive: available) | 1192 | * unavailable, positive: available) |
1196 | */ | 1193 | */ |
1197 | int32_t availability_rank; | 1194 | int32_t availability_rank; |
1198 | 1195 | ||
1199 | /** | 1196 | /** |
1200 | * On how many total queries is the given | 1197 | * On how many total queries is the given |
1201 | * availability_rank based? | 1198 | * availability_rank based? |
1202 | */ | 1199 | */ |
1203 | uint32_t availability_certainty; | 1200 | uint32_t availability_certainty; |
1204 | 1201 | ||
1205 | /** | 1202 | /** |
1206 | * Updated applicability rank (the larger, | 1203 | * Updated applicability rank (the larger, |
1207 | * the better the result fits the search | 1204 | * the better the result fits the search |
1208 | * criteria). | 1205 | * criteria). |
1209 | */ | 1206 | */ |
1210 | uint32_t applicability_rank; | 1207 | uint32_t applicability_rank; |
1211 | 1208 | ||
1212 | } resume_result; | 1209 | } resume_result; |
1213 | 1210 | ||
1214 | /** | 1211 | /** |
1215 | * These values are only valid for | 1212 | * These values are only valid for |
1216 | * GNUNET_FS_STATUS_SEARCH_UPDATE events. | 1213 | * GNUNET_FS_STATUS_SEARCH_UPDATE events. |
1217 | */ | 1214 | */ |
1218 | struct { | 1215 | struct |
1216 | { | ||
1219 | 1217 | ||
1220 | /** | 1218 | /** |
1221 | * Private context set for for this result | 1219 | * Private context set for for this result |
1222 | * during the "RESULT" event. | 1220 | * during the "RESULT" event. |
1223 | */ | 1221 | */ |
1224 | void *cctx; | 1222 | void *cctx; |
1225 | 1223 | ||
1226 | /** | 1224 | /** |
1227 | * Metadata for the search result. | 1225 | * Metadata for the search result. |
1228 | */ | 1226 | */ |
1229 | const struct GNUNET_CONTAINER_MetaData *meta; | 1227 | const struct GNUNET_CONTAINER_MetaData *meta; |
1230 | 1228 | ||
1231 | /** | 1229 | /** |
1232 | * URI for the search result. | 1230 | * URI for the search result. |
1233 | */ | 1231 | */ |
1234 | const struct GNUNET_FS_Uri *uri; | 1232 | const struct GNUNET_FS_Uri *uri; |
1235 | 1233 | ||
1236 | /** | 1234 | /** |
1237 | * Current availability rank (negative: | 1235 | * Current availability rank (negative: |
1238 | * unavailable, positive: available) | 1236 | * unavailable, positive: available) |
1239 | */ | 1237 | */ |
1240 | int32_t availability_rank; | 1238 | int32_t availability_rank; |
1241 | 1239 | ||
1242 | /** | 1240 | /** |
1243 | * On how many total queries is the given | 1241 | * On how many total queries is the given |
1244 | * availability_rank based? | 1242 | * availability_rank based? |
1245 | */ | 1243 | */ |
1246 | uint32_t availability_certainty; | 1244 | uint32_t availability_certainty; |
1247 | 1245 | ||
1248 | /** | 1246 | /** |
1249 | * Updated applicability rank (the larger, | 1247 | * Updated applicability rank (the larger, |
1250 | * the better the result fits the search | 1248 | * the better the result fits the search |
1251 | * criteria). | 1249 | * criteria). |
1252 | */ | 1250 | */ |
1253 | uint32_t applicability_rank; | 1251 | uint32_t applicability_rank; |
1252 | |||
1253 | } update; | ||
1254 | 1254 | ||
1255 | } update; | 1255 | /** |
1256 | |||
1257 | /** | ||
1258 | * These values are only valid for | 1256 | * These values are only valid for |
1259 | * GNUNET_FS_STATUS_SEARCH_RESULT_SUSPEND events. | 1257 | * GNUNET_FS_STATUS_SEARCH_RESULT_SUSPEND events. |
1260 | * These events are automatically triggered for | 1258 | * These events are automatically triggered for |
@@ -1263,27 +1261,28 @@ struct GNUNET_FS_ProgressInfo | |||
1263 | * happens primarily to give the client a chance | 1261 | * happens primarily to give the client a chance |
1264 | * to clean up the "cctx" (if needed). | 1262 | * to clean up the "cctx" (if needed). |
1265 | */ | 1263 | */ |
1266 | struct { | 1264 | struct |
1265 | { | ||
1267 | 1266 | ||
1268 | /** | 1267 | /** |
1269 | * Private context set for for this result | 1268 | * Private context set for for this result |
1270 | * during the "RESULT" event. | 1269 | * during the "RESULT" event. |
1271 | */ | 1270 | */ |
1272 | void *cctx; | 1271 | void *cctx; |
1273 | 1272 | ||
1274 | /** | 1273 | /** |
1275 | * Metadata for the search result. | 1274 | * Metadata for the search result. |
1276 | */ | 1275 | */ |
1277 | const struct GNUNET_CONTAINER_MetaData *meta; | 1276 | const struct GNUNET_CONTAINER_MetaData *meta; |
1278 | 1277 | ||
1279 | /** | 1278 | /** |
1280 | * URI for the search result. | 1279 | * URI for the search result. |
1281 | */ | 1280 | */ |
1282 | const struct GNUNET_FS_Uri *uri; | 1281 | const struct GNUNET_FS_Uri *uri; |
1282 | |||
1283 | } result_suspend; | ||
1283 | 1284 | ||
1284 | } result_suspend; | 1285 | /** |
1285 | |||
1286 | /** | ||
1287 | * These values are only valid for | 1286 | * These values are only valid for |
1288 | * GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED events. | 1287 | * GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED events. |
1289 | * These events are automatically triggered for | 1288 | * These events are automatically triggered for |
@@ -1292,89 +1291,93 @@ struct GNUNET_FS_ProgressInfo | |||
1292 | * happens primarily to give the client a chance | 1291 | * happens primarily to give the client a chance |
1293 | * to clean up the "cctx" (if needed). | 1292 | * to clean up the "cctx" (if needed). |
1294 | */ | 1293 | */ |
1295 | struct { | 1294 | struct |
1295 | { | ||
1296 | 1296 | ||
1297 | /** | 1297 | /** |
1298 | * Private context set for for this result | 1298 | * Private context set for for this result |
1299 | * during the "RESULT" event. | 1299 | * during the "RESULT" event. |
1300 | */ | 1300 | */ |
1301 | void *cctx; | 1301 | void *cctx; |
1302 | 1302 | ||
1303 | /** | 1303 | /** |
1304 | * Metadata for the search result. | 1304 | * Metadata for the search result. |
1305 | */ | 1305 | */ |
1306 | const struct GNUNET_CONTAINER_MetaData *meta; | 1306 | const struct GNUNET_CONTAINER_MetaData *meta; |
1307 | 1307 | ||
1308 | /** | 1308 | /** |
1309 | * URI for the search result. | 1309 | * URI for the search result. |
1310 | */ | 1310 | */ |
1311 | const struct GNUNET_FS_Uri *uri; | 1311 | const struct GNUNET_FS_Uri *uri; |
1312 | 1312 | ||
1313 | } result_stopped; | 1313 | } result_stopped; |
1314 | 1314 | ||
1315 | /** | 1315 | /** |
1316 | * These values are only valid for | 1316 | * These values are only valid for |
1317 | * GNUNET_FS_STATUS_SEARCH_RESUME events. | 1317 | * GNUNET_FS_STATUS_SEARCH_RESUME events. |
1318 | */ | 1318 | */ |
1319 | struct { | 1319 | struct |
1320 | { | ||
1320 | 1321 | ||
1321 | /** | 1322 | /** |
1322 | * Error message, NULL if we have not encountered any error yet. | 1323 | * Error message, NULL if we have not encountered any error yet. |
1323 | */ | 1324 | */ |
1324 | const char *message; | 1325 | const char *message; |
1325 | 1326 | ||
1326 | /** | 1327 | /** |
1327 | * Is this search currently paused? | 1328 | * Is this search currently paused? |
1328 | */ | 1329 | */ |
1329 | int is_paused; | 1330 | int is_paused; |
1330 | 1331 | ||
1331 | } resume; | 1332 | } resume; |
1332 | 1333 | ||
1333 | /** | 1334 | /** |
1334 | * These values are only valid for | 1335 | * These values are only valid for |
1335 | * GNUNET_FS_STATUS_SEARCH_ERROR events. | 1336 | * GNUNET_FS_STATUS_SEARCH_ERROR events. |
1336 | */ | 1337 | */ |
1337 | struct { | 1338 | struct |
1339 | { | ||
1338 | 1340 | ||
1339 | /** | 1341 | /** |
1340 | * Error message. | 1342 | * Error message. |
1341 | */ | 1343 | */ |
1342 | const char *message; | 1344 | const char *message; |
1343 | 1345 | ||
1344 | } error; | 1346 | } error; |
1345 | 1347 | ||
1346 | /** | 1348 | /** |
1347 | * Values for all "GNUNET_FS_STATUS_SEARCH_RESULT_NAMESPACE" events. | 1349 | * Values for all "GNUNET_FS_STATUS_SEARCH_RESULT_NAMESPACE" events. |
1348 | */ | 1350 | */ |
1349 | struct { | 1351 | struct |
1350 | 1352 | { | |
1351 | /** | 1353 | |
1354 | /** | ||
1352 | * Handle to the namespace (NULL if it is not a local | 1355 | * Handle to the namespace (NULL if it is not a local |
1353 | * namespace). | 1356 | * namespace). |
1354 | */ | 1357 | */ |
1355 | struct GNUNET_FS_Namespace *ns; | 1358 | struct GNUNET_FS_Namespace *ns; |
1356 | 1359 | ||
1357 | /** | 1360 | /** |
1358 | * Short, human-readable name of the namespace. | 1361 | * Short, human-readable name of the namespace. |
1359 | */ | 1362 | */ |
1360 | const char *name; | 1363 | const char *name; |
1361 | 1364 | ||
1362 | /** | 1365 | /** |
1363 | * Root identifier for the namespace, can be NULL. | 1366 | * Root identifier for the namespace, can be NULL. |
1364 | */ | 1367 | */ |
1365 | const char *root; | 1368 | const char *root; |
1366 | 1369 | ||
1367 | /** | 1370 | /** |
1368 | * Metadata for the namespace. | 1371 | * Metadata for the namespace. |
1369 | */ | 1372 | */ |
1370 | const struct GNUNET_CONTAINER_MetaData *meta; | 1373 | const struct GNUNET_CONTAINER_MetaData *meta; |
1371 | 1374 | ||
1372 | /** | 1375 | /** |
1373 | * Hash-identifier for the namespace. | 1376 | * Hash-identifier for the namespace. |
1374 | */ | 1377 | */ |
1375 | GNUNET_HashCode id; | 1378 | GNUNET_HashCode id; |
1376 | 1379 | ||
1377 | } namespace; | 1380 | } namespace; |
1378 | 1381 | ||
1379 | } specifics; | 1382 | } specifics; |
1380 | 1383 | ||
@@ -1383,7 +1386,8 @@ struct GNUNET_FS_ProgressInfo | |||
1383 | /** | 1386 | /** |
1384 | * Values for all "GNUNET_FS_STATUS_UNINDEX_*" events. | 1387 | * Values for all "GNUNET_FS_STATUS_UNINDEX_*" events. |
1385 | */ | 1388 | */ |
1386 | struct { | 1389 | struct |
1390 | { | ||
1387 | 1391 | ||
1388 | /** | 1392 | /** |
1389 | * Context for controlling the unindexing. | 1393 | * Context for controlling the unindexing. |
@@ -1411,7 +1415,7 @@ struct GNUNET_FS_ProgressInfo | |||
1411 | * At what time do we expect to finish unindexing? | 1415 | * At what time do we expect to finish unindexing? |
1412 | * (will be a value in the past for completed | 1416 | * (will be a value in the past for completed |
1413 | * unindexing opeations). | 1417 | * unindexing opeations). |
1414 | */ | 1418 | */ |
1415 | struct GNUNET_TIME_Relative eta; | 1419 | struct GNUNET_TIME_Relative eta; |
1416 | 1420 | ||
1417 | /** | 1421 | /** |
@@ -1428,62 +1432,66 @@ struct GNUNET_FS_ProgressInfo | |||
1428 | /** | 1432 | /** |
1429 | * Additional values for specific events. | 1433 | * Additional values for specific events. |
1430 | */ | 1434 | */ |
1431 | union { | 1435 | union |
1436 | { | ||
1432 | 1437 | ||
1433 | /** | 1438 | /** |
1434 | * These values are only valid for | 1439 | * These values are only valid for |
1435 | * GNUNET_FS_STATUS_UNINDEX_PROGRESS events. | 1440 | * GNUNET_FS_STATUS_UNINDEX_PROGRESS events. |
1436 | */ | 1441 | */ |
1437 | struct { | 1442 | struct |
1438 | 1443 | { | |
1439 | /** | 1444 | |
1445 | /** | ||
1440 | * Data block we just unindexed. | 1446 | * Data block we just unindexed. |
1441 | */ | 1447 | */ |
1442 | const void *data; | 1448 | const void *data; |
1443 | 1449 | ||
1444 | /** | 1450 | /** |
1445 | * At what offset in the file is "data"? | 1451 | * At what offset in the file is "data"? |
1446 | */ | 1452 | */ |
1447 | uint64_t offset; | 1453 | uint64_t offset; |
1448 | 1454 | ||
1449 | /** | 1455 | /** |
1450 | * Length of the data block. | 1456 | * Length of the data block. |
1451 | */ | 1457 | */ |
1452 | uint64_t data_len; | 1458 | uint64_t data_len; |
1453 | 1459 | ||
1454 | /** | 1460 | /** |
1455 | * Depth of the given block in the tree; | 1461 | * Depth of the given block in the tree; |
1456 | * 0 would be the lowest level (DBLOCKS). | 1462 | * 0 would be the lowest level (DBLOCKS). |
1457 | */ | 1463 | */ |
1458 | unsigned int depth; | 1464 | unsigned int depth; |
1459 | 1465 | ||
1460 | } progress; | 1466 | } progress; |
1461 | 1467 | ||
1462 | /** | 1468 | /** |
1463 | * These values are only valid for | 1469 | * These values are only valid for |
1464 | * GNUNET_FS_STATUS_UNINDEX_RESUME events. | 1470 | * GNUNET_FS_STATUS_UNINDEX_RESUME events. |
1465 | */ | 1471 | */ |
1466 | struct { | 1472 | struct |
1473 | { | ||
1467 | 1474 | ||
1468 | /** | 1475 | /** |
1469 | * Error message, NULL if we have not encountered any error yet. | 1476 | * Error message, NULL if we have not encountered any error yet. |
1470 | */ | 1477 | */ |
1471 | const char *message; | 1478 | const char *message; |
1472 | 1479 | ||
1473 | } resume; | 1480 | } resume; |
1474 | 1481 | ||
1475 | /** | 1482 | /** |
1476 | * These values are only valid for | 1483 | * These values are only valid for |
1477 | * GNUNET_FS_STATUS_UNINDEX_ERROR events. | 1484 | * GNUNET_FS_STATUS_UNINDEX_ERROR events. |
1478 | */ | 1485 | */ |
1479 | struct { | 1486 | struct |
1487 | { | ||
1480 | 1488 | ||
1481 | /** | 1489 | /** |
1482 | * Error message. | 1490 | * Error message. |
1483 | */ | 1491 | */ |
1484 | const char *message; | 1492 | const char *message; |
1485 | 1493 | ||
1486 | } error; | 1494 | } error; |
1487 | 1495 | ||
1488 | } specifics; | 1496 | } specifics; |
1489 | 1497 | ||
@@ -1493,7 +1501,7 @@ struct GNUNET_FS_ProgressInfo | |||
1493 | 1501 | ||
1494 | /** | 1502 | /** |
1495 | * Specific status code (determines the event type). | 1503 | * Specific status code (determines the event type). |
1496 | */ | 1504 | */ |
1497 | enum GNUNET_FS_Status status; | 1505 | enum GNUNET_FS_Status status; |
1498 | 1506 | ||
1499 | }; | 1507 | }; |
@@ -1514,53 +1522,51 @@ struct GNUNET_FS_ProgressInfo | |||
1514 | * will be passed to future callbacks in the respective | 1522 | * will be passed to future callbacks in the respective |
1515 | * field in the GNUNET_FS_ProgressInfo struct. | 1523 | * field in the GNUNET_FS_ProgressInfo struct. |
1516 | */ | 1524 | */ |
1517 | typedef void* (*GNUNET_FS_ProgressCallback) | 1525 | typedef void *(*GNUNET_FS_ProgressCallback) |
1518 | (void *cls, | 1526 | (void *cls, const struct GNUNET_FS_ProgressInfo * info); |
1519 | const struct GNUNET_FS_ProgressInfo *info); | ||
1520 | 1527 | ||
1521 | 1528 | ||
1522 | /** | 1529 | /** |
1523 | * General (global) option flags for file-sharing. | 1530 | * General (global) option flags for file-sharing. |
1524 | */ | 1531 | */ |
1525 | enum GNUNET_FS_Flags | 1532 | enum GNUNET_FS_Flags |
1526 | { | 1533 | { |
1527 | /** | 1534 | /** |
1528 | * No special flags set. | 1535 | * No special flags set. |
1529 | */ | 1536 | */ |
1530 | GNUNET_FS_FLAGS_NONE = 0, | 1537 | GNUNET_FS_FLAGS_NONE = 0, |
1531 | 1538 | ||
1532 | /** | 1539 | /** |
1533 | * Is persistence of operations desired? | 1540 | * Is persistence of operations desired? |
1534 | * (will create SUSPEND/RESUME events). | 1541 | * (will create SUSPEND/RESUME events). |
1535 | */ | 1542 | */ |
1536 | GNUNET_FS_FLAGS_PERSISTENCE = 1, | 1543 | GNUNET_FS_FLAGS_PERSISTENCE = 1, |
1537 | 1544 | ||
1538 | /** | 1545 | /** |
1539 | * Should we automatically trigger probes for search results | 1546 | * Should we automatically trigger probes for search results |
1540 | * to determine availability? | 1547 | * to determine availability? |
1541 | * (will create GNUNET_FS_STATUS_SEARCH_UPDATE events). | 1548 | * (will create GNUNET_FS_STATUS_SEARCH_UPDATE events). |
1542 | */ | 1549 | */ |
1543 | GNUNET_FS_FLAGS_DO_PROBES = 2 | 1550 | GNUNET_FS_FLAGS_DO_PROBES = 2 |
1544 | 1551 | }; | |
1545 | }; | ||
1546 | 1552 | ||
1547 | /** | 1553 | /** |
1548 | * Options specified in the VARARGs portion of GNUNET_FS_start. | 1554 | * Options specified in the VARARGs portion of GNUNET_FS_start. |
1549 | */ | 1555 | */ |
1550 | enum GNUNET_FS_OPTIONS | 1556 | enum GNUNET_FS_OPTIONS |
1551 | { | 1557 | { |
1552 | 1558 | ||
1553 | /** | 1559 | /** |
1554 | * Last option in the VARARG list. | 1560 | * Last option in the VARARG list. |
1555 | */ | 1561 | */ |
1556 | GNUNET_FS_OPTIONS_END = 0, | 1562 | GNUNET_FS_OPTIONS_END = 0, |
1557 | 1563 | ||
1558 | /** | 1564 | /** |
1559 | * Select the desired amount of parallelism (this option should be | 1565 | * Select the desired amount of parallelism (this option should be |
1560 | * followed by an "unsigned int" giving the desired maximum number | 1566 | * followed by an "unsigned int" giving the desired maximum number |
1561 | * of parallel downloads). | 1567 | * of parallel downloads). |
1562 | */ | 1568 | */ |
1563 | GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM = 1, | 1569 | GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM = 1, |
1564 | 1570 | ||
1565 | /** | 1571 | /** |
1566 | * Maximum number of requests that should be pending at a given | 1572 | * Maximum number of requests that should be pending at a given |
@@ -1568,9 +1574,8 @@ enum GNUNET_FS_OPTIONS | |||
1568 | * if we are above this threshold, we should not activate any | 1574 | * if we are above this threshold, we should not activate any |
1569 | * additional downloads. | 1575 | * additional downloads. |
1570 | */ | 1576 | */ |
1571 | GNUNET_FS_OPTIONS_REQUEST_PARALLELISM = 2 | 1577 | GNUNET_FS_OPTIONS_REQUEST_PARALLELISM = 2 |
1572 | 1578 | }; | |
1573 | }; | ||
1574 | 1579 | ||
1575 | 1580 | ||
1576 | /** | 1581 | /** |
@@ -1621,8 +1626,7 @@ struct GNUNET_FS_BlockOptions | |||
1621 | /** | 1626 | /** |
1622 | * Return the current year (i.e. '2011'). | 1627 | * Return the current year (i.e. '2011'). |
1623 | */ | 1628 | */ |
1624 | unsigned int | 1629 | unsigned int GNUNET_FS_get_current_year (void); |
1625 | GNUNET_FS_get_current_year (void); | ||
1626 | 1630 | ||
1627 | 1631 | ||
1628 | /** | 1632 | /** |
@@ -1631,8 +1635,7 @@ GNUNET_FS_get_current_year (void); | |||
1631 | * @param year a year (after 1970, please ;-)). | 1635 | * @param year a year (after 1970, please ;-)). |
1632 | * @return absolute time for January 1st of that year. | 1636 | * @return absolute time for January 1st of that year. |
1633 | */ | 1637 | */ |
1634 | struct GNUNET_TIME_Absolute | 1638 | struct GNUNET_TIME_Absolute GNUNET_FS_year_to_time (unsigned int year); |
1635 | GNUNET_FS_year_to_time (unsigned int year); | ||
1636 | 1639 | ||
1637 | 1640 | ||
1638 | /** | 1641 | /** |
@@ -1652,13 +1655,12 @@ struct GNUNET_FS_Handle; | |||
1652 | * @param ... list of optional options, terminated with GNUNET_FS_OPTIONS_END | 1655 | * @param ... list of optional options, terminated with GNUNET_FS_OPTIONS_END |
1653 | * @return NULL on error | 1656 | * @return NULL on error |
1654 | */ | 1657 | */ |
1655 | struct GNUNET_FS_Handle * | 1658 | struct GNUNET_FS_Handle *GNUNET_FS_start (const struct |
1656 | GNUNET_FS_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | 1659 | GNUNET_CONFIGURATION_Handle *cfg, |
1657 | const char *client_name, | 1660 | const char *client_name, |
1658 | GNUNET_FS_ProgressCallback upcb, | 1661 | GNUNET_FS_ProgressCallback upcb, |
1659 | void *upcb_cls, | 1662 | void *upcb_cls, |
1660 | enum GNUNET_FS_Flags flags, | 1663 | enum GNUNET_FS_Flags flags, ...); |
1661 | ...); | ||
1662 | 1664 | ||
1663 | 1665 | ||
1664 | /** | 1666 | /** |
@@ -1667,9 +1669,8 @@ GNUNET_FS_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1667 | * called after this function returns. | 1669 | * called after this function returns. |
1668 | * | 1670 | * |
1669 | * @param h handle that was returned from GNUNET_FS_start | 1671 | * @param h handle that was returned from GNUNET_FS_start |
1670 | */ | 1672 | */ |
1671 | void | 1673 | void GNUNET_FS_stop (struct GNUNET_FS_Handle *h); |
1672 | GNUNET_FS_stop (struct GNUNET_FS_Handle *h); | ||
1673 | 1674 | ||
1674 | 1675 | ||
1675 | /** | 1676 | /** |
@@ -1681,12 +1682,11 @@ GNUNET_FS_stop (struct GNUNET_FS_Handle *h); | |||
1681 | * @return GNUNET_SYSERR on error, otherwise the number | 1682 | * @return GNUNET_SYSERR on error, otherwise the number |
1682 | * of meta-data items obtained | 1683 | * of meta-data items obtained |
1683 | */ | 1684 | */ |
1684 | int | 1685 | int |
1685 | GNUNET_FS_meta_data_extract_from_file (struct | 1686 | GNUNET_FS_meta_data_extract_from_file (struct |
1686 | GNUNET_CONTAINER_MetaData | 1687 | GNUNET_CONTAINER_MetaData |
1687 | *md, const char *filename, | 1688 | *md, const char *filename, |
1688 | struct EXTRACTOR_PluginList * | 1689 | struct EXTRACTOR_PluginList *extractors); |
1689 | extractors); | ||
1690 | 1690 | ||
1691 | 1691 | ||
1692 | /** | 1692 | /** |
@@ -1704,14 +1704,17 @@ GNUNET_FS_meta_data_extract_from_file (struct | |||
1704 | * this entry from the directory, GNUNET_SYSERR | 1704 | * this entry from the directory, GNUNET_SYSERR |
1705 | * to abort the iteration | 1705 | * to abort the iteration |
1706 | */ | 1706 | */ |
1707 | typedef int (*GNUNET_FS_FileInformationProcessor)(void *cls, | 1707 | typedef int (*GNUNET_FS_FileInformationProcessor) (void *cls, |
1708 | struct GNUNET_FS_FileInformation *fi, | 1708 | struct |
1709 | uint64_t length, | 1709 | GNUNET_FS_FileInformation * |
1710 | struct GNUNET_CONTAINER_MetaData *meta, | 1710 | fi, uint64_t length, |
1711 | struct GNUNET_FS_Uri **uri, | 1711 | struct |
1712 | struct GNUNET_FS_BlockOptions *bo, | 1712 | GNUNET_CONTAINER_MetaData * |
1713 | int *do_index, | 1713 | meta, |
1714 | void **client_info); | 1714 | struct GNUNET_FS_Uri ** uri, |
1715 | struct GNUNET_FS_BlockOptions | ||
1716 | * bo, int *do_index, | ||
1717 | void **client_info); | ||
1715 | 1718 | ||
1716 | 1719 | ||
1717 | /** | 1720 | /** |
@@ -1724,8 +1727,8 @@ typedef int (*GNUNET_FS_FileInformationProcessor)(void *cls, | |||
1724 | * can be passed to "GNUNET_FS_file_information_recover" | 1727 | * can be passed to "GNUNET_FS_file_information_recover" |
1725 | * to read this fi-struct from disk. | 1728 | * to read this fi-struct from disk. |
1726 | */ | 1729 | */ |
1727 | const char * | 1730 | const char *GNUNET_FS_file_information_get_id (struct GNUNET_FS_FileInformation |
1728 | GNUNET_FS_file_information_get_id (struct GNUNET_FS_FileInformation *s); | 1731 | *s); |
1729 | 1732 | ||
1730 | 1733 | ||
1731 | 1734 | ||
@@ -1743,14 +1746,17 @@ GNUNET_FS_file_information_get_id (struct GNUNET_FS_FileInformation *s); | |||
1743 | * @param bo block options | 1746 | * @param bo block options |
1744 | * @return publish structure entry for the file | 1747 | * @return publish structure entry for the file |
1745 | */ | 1748 | */ |
1746 | struct GNUNET_FS_FileInformation * | 1749 | struct GNUNET_FS_FileInformation |
1747 | GNUNET_FS_file_information_create_from_file (struct GNUNET_FS_Handle *h, | 1750 | *GNUNET_FS_file_information_create_from_file (struct GNUNET_FS_Handle *h, |
1748 | void *client_info, | 1751 | void *client_info, |
1749 | const char *filename, | 1752 | const char *filename, |
1750 | const struct GNUNET_FS_Uri *keywords, | 1753 | const struct GNUNET_FS_Uri |
1751 | const struct GNUNET_CONTAINER_MetaData *meta, | 1754 | *keywords, |
1752 | int do_index, | 1755 | const struct |
1753 | const struct GNUNET_FS_BlockOptions *bo); | 1756 | GNUNET_CONTAINER_MetaData |
1757 | *meta, int do_index, | ||
1758 | const struct | ||
1759 | GNUNET_FS_BlockOptions *bo); | ||
1754 | 1760 | ||
1755 | 1761 | ||
1756 | /** | 1762 | /** |
@@ -1769,15 +1775,17 @@ GNUNET_FS_file_information_create_from_file (struct GNUNET_FS_Handle *h, | |||
1769 | * @param bo block options | 1775 | * @param bo block options |
1770 | * @return publish structure entry for the file | 1776 | * @return publish structure entry for the file |
1771 | */ | 1777 | */ |
1772 | struct GNUNET_FS_FileInformation * | 1778 | struct GNUNET_FS_FileInformation |
1773 | GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h, | 1779 | *GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h, |
1774 | void *client_info, | 1780 | void *client_info, |
1775 | uint64_t length, | 1781 | uint64_t length, void *data, |
1776 | void *data, | 1782 | const struct GNUNET_FS_Uri |
1777 | const struct GNUNET_FS_Uri *keywords, | 1783 | *keywords, |
1778 | const struct GNUNET_CONTAINER_MetaData *meta, | 1784 | const struct |
1779 | int do_index, | 1785 | GNUNET_CONTAINER_MetaData |
1780 | const struct GNUNET_FS_BlockOptions *bo); | 1786 | *meta, int do_index, |
1787 | const struct | ||
1788 | GNUNET_FS_BlockOptions *bo); | ||
1781 | 1789 | ||
1782 | 1790 | ||
1783 | /** | 1791 | /** |
@@ -1796,11 +1804,9 @@ GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h, | |||
1796 | * @param emsg location for the reader to store an error message | 1804 | * @param emsg location for the reader to store an error message |
1797 | * @return number of bytes written, usually "max", 0 on error | 1805 | * @return number of bytes written, usually "max", 0 on error |
1798 | */ | 1806 | */ |
1799 | typedef size_t (*GNUNET_FS_DataReader)(void *cls, | 1807 | typedef size_t (*GNUNET_FS_DataReader) (void *cls, |
1800 | uint64_t offset, | 1808 | uint64_t offset, |
1801 | size_t max, | 1809 | size_t max, void *buf, char **emsg); |
1802 | void *buf, | ||
1803 | char **emsg); | ||
1804 | 1810 | ||
1805 | 1811 | ||
1806 | /** | 1812 | /** |
@@ -1819,16 +1825,19 @@ typedef size_t (*GNUNET_FS_DataReader)(void *cls, | |||
1819 | * @param bo block options | 1825 | * @param bo block options |
1820 | * @return publish structure entry for the file | 1826 | * @return publish structure entry for the file |
1821 | */ | 1827 | */ |
1822 | struct GNUNET_FS_FileInformation * | 1828 | struct GNUNET_FS_FileInformation |
1823 | GNUNET_FS_file_information_create_from_reader (struct GNUNET_FS_Handle *h, | 1829 | *GNUNET_FS_file_information_create_from_reader (struct GNUNET_FS_Handle *h, |
1824 | void *client_info, | 1830 | void *client_info, |
1825 | uint64_t length, | 1831 | uint64_t length, |
1826 | GNUNET_FS_DataReader reader, | 1832 | GNUNET_FS_DataReader reader, |
1827 | void *reader_cls, | 1833 | void *reader_cls, |
1828 | const struct GNUNET_FS_Uri *keywords, | 1834 | const struct GNUNET_FS_Uri |
1829 | const struct GNUNET_CONTAINER_MetaData *meta, | 1835 | *keywords, |
1830 | int do_index, | 1836 | const struct |
1831 | const struct GNUNET_FS_BlockOptions *bo); | 1837 | GNUNET_CONTAINER_MetaData |
1838 | *meta, int do_index, | ||
1839 | const struct | ||
1840 | GNUNET_FS_BlockOptions *bo); | ||
1832 | 1841 | ||
1833 | 1842 | ||
1834 | /** | 1843 | /** |
@@ -1841,9 +1850,9 @@ GNUNET_FS_file_information_create_from_reader (struct GNUNET_FS_Handle *h, | |||
1841 | * @param fi information about the file (should not be | 1850 | * @param fi information about the file (should not be |
1842 | * used henceforth by the caller) | 1851 | * used henceforth by the caller) |
1843 | */ | 1852 | */ |
1844 | typedef void (*GNUNET_FS_FileProcessor)(void *cls, | 1853 | typedef void (*GNUNET_FS_FileProcessor) (void *cls, |
1845 | const char *filename, | 1854 | const char *filename, |
1846 | struct GNUNET_FS_FileInformation *fi); | 1855 | struct GNUNET_FS_FileInformation * fi); |
1847 | 1856 | ||
1848 | 1857 | ||
1849 | /** | 1858 | /** |
@@ -1859,14 +1868,13 @@ typedef void (*GNUNET_FS_FileProcessor)(void *cls, | |||
1859 | * @param emsg where to store an error message (on errors) | 1868 | * @param emsg where to store an error message (on errors) |
1860 | * @return GNUNET_OK on success | 1869 | * @return GNUNET_OK on success |
1861 | */ | 1870 | */ |
1862 | typedef int (*GNUNET_FS_DirectoryScanner)(void *cls, | 1871 | typedef int (*GNUNET_FS_DirectoryScanner) (void *cls, |
1863 | struct GNUNET_FS_Handle *h, | 1872 | struct GNUNET_FS_Handle * h, |
1864 | const char *dirname, | 1873 | const char *dirname, |
1865 | int do_index, | 1874 | int do_index, |
1866 | const struct GNUNET_FS_BlockOptions *bo, | 1875 | const struct GNUNET_FS_BlockOptions * |
1867 | GNUNET_FS_FileProcessor proc, | 1876 | bo, GNUNET_FS_FileProcessor proc, |
1868 | void *proc_cls, | 1877 | void *proc_cls, char **emsg); |
1869 | char **emsg); | ||
1870 | 1878 | ||
1871 | 1879 | ||
1872 | 1880 | ||
@@ -1893,13 +1901,12 @@ typedef int (*GNUNET_FS_DirectoryScanner)(void *cls, | |||
1893 | */ | 1901 | */ |
1894 | int | 1902 | int |
1895 | GNUNET_FS_directory_scanner_default (void *cls, | 1903 | GNUNET_FS_directory_scanner_default (void *cls, |
1896 | struct GNUNET_FS_Handle *h, | 1904 | struct GNUNET_FS_Handle *h, |
1897 | const char *dirname, | 1905 | const char *dirname, |
1898 | int do_index, | 1906 | int do_index, |
1899 | const struct GNUNET_FS_BlockOptions *bo, | 1907 | const struct GNUNET_FS_BlockOptions *bo, |
1900 | GNUNET_FS_FileProcessor proc, | 1908 | GNUNET_FS_FileProcessor proc, |
1901 | void *proc_cls, | 1909 | void *proc_cls, char **emsg); |
1902 | char **emsg); | ||
1903 | 1910 | ||
1904 | 1911 | ||
1905 | /** | 1912 | /** |
@@ -1922,15 +1929,17 @@ GNUNET_FS_directory_scanner_default (void *cls, | |||
1922 | * @param emsg where to store an error message | 1929 | * @param emsg where to store an error message |
1923 | * @return publish structure entry for the directory, NULL on error | 1930 | * @return publish structure entry for the directory, NULL on error |
1924 | */ | 1931 | */ |
1925 | struct GNUNET_FS_FileInformation * | 1932 | struct GNUNET_FS_FileInformation |
1926 | GNUNET_FS_file_information_create_from_directory (struct GNUNET_FS_Handle *h, | 1933 | *GNUNET_FS_file_information_create_from_directory (struct GNUNET_FS_Handle |
1927 | void *client_info, | 1934 | *h, void *client_info, |
1928 | const char *filename, | 1935 | const char *filename, |
1929 | GNUNET_FS_DirectoryScanner scanner, | 1936 | GNUNET_FS_DirectoryScanner |
1930 | void *scanner_cls, | 1937 | scanner, |
1931 | int do_index, | 1938 | void *scanner_cls, |
1932 | const struct GNUNET_FS_BlockOptions *bo, | 1939 | int do_index, |
1933 | char **emsg); | 1940 | const struct |
1941 | GNUNET_FS_BlockOptions | ||
1942 | *bo, char **emsg); | ||
1934 | 1943 | ||
1935 | 1944 | ||
1936 | /** | 1945 | /** |
@@ -1947,12 +1956,17 @@ GNUNET_FS_file_information_create_from_directory (struct GNUNET_FS_Handle *h, | |||
1947 | * @param bo block options | 1956 | * @param bo block options |
1948 | * @return publish structure entry for the directory , NULL on error | 1957 | * @return publish structure entry for the directory , NULL on error |
1949 | */ | 1958 | */ |
1950 | struct GNUNET_FS_FileInformation * | 1959 | struct GNUNET_FS_FileInformation |
1951 | GNUNET_FS_file_information_create_empty_directory (struct GNUNET_FS_Handle *h, | 1960 | *GNUNET_FS_file_information_create_empty_directory (struct GNUNET_FS_Handle |
1952 | void *client_info, | 1961 | *h, void *client_info, |
1953 | const struct GNUNET_FS_Uri *keywords, | 1962 | const struct |
1954 | const struct GNUNET_CONTAINER_MetaData *meta, | 1963 | GNUNET_FS_Uri *keywords, |
1955 | const struct GNUNET_FS_BlockOptions *bo); | 1964 | const struct |
1965 | GNUNET_CONTAINER_MetaData | ||
1966 | *meta, | ||
1967 | const struct | ||
1968 | GNUNET_FS_BlockOptions | ||
1969 | *bo); | ||
1956 | 1970 | ||
1957 | 1971 | ||
1958 | /** | 1972 | /** |
@@ -1962,7 +1976,8 @@ GNUNET_FS_file_information_create_empty_directory (struct GNUNET_FS_Handle *h, | |||
1962 | * @return GNUNET_YES if so, GNUNET_NO if not | 1976 | * @return GNUNET_YES if so, GNUNET_NO if not |
1963 | */ | 1977 | */ |
1964 | int | 1978 | int |
1965 | GNUNET_FS_file_information_is_directory (const struct GNUNET_FS_FileInformation *ent); | 1979 | GNUNET_FS_file_information_is_directory (const struct GNUNET_FS_FileInformation |
1980 | *ent); | ||
1966 | 1981 | ||
1967 | 1982 | ||
1968 | /** | 1983 | /** |
@@ -1978,7 +1993,7 @@ GNUNET_FS_file_information_is_directory (const struct GNUNET_FS_FileInformation | |||
1978 | */ | 1993 | */ |
1979 | int | 1994 | int |
1980 | GNUNET_FS_file_information_add (struct GNUNET_FS_FileInformation *dir, | 1995 | GNUNET_FS_file_information_add (struct GNUNET_FS_FileInformation *dir, |
1981 | struct GNUNET_FS_FileInformation *ent); | 1996 | struct GNUNET_FS_FileInformation *ent); |
1982 | 1997 | ||
1983 | 1998 | ||
1984 | /** | 1999 | /** |
@@ -1997,8 +2012,8 @@ GNUNET_FS_file_information_add (struct GNUNET_FS_FileInformation *dir, | |||
1997 | */ | 2012 | */ |
1998 | void | 2013 | void |
1999 | GNUNET_FS_file_information_inspect (struct GNUNET_FS_FileInformation *dir, | 2014 | GNUNET_FS_file_information_inspect (struct GNUNET_FS_FileInformation *dir, |
2000 | GNUNET_FS_FileInformationProcessor proc, | 2015 | GNUNET_FS_FileInformationProcessor proc, |
2001 | void *proc_cls); | 2016 | void *proc_cls); |
2002 | 2017 | ||
2003 | 2018 | ||
2004 | /** | 2019 | /** |
@@ -2013,27 +2028,27 @@ GNUNET_FS_file_information_inspect (struct GNUNET_FS_FileInformation *dir, | |||
2013 | */ | 2028 | */ |
2014 | void | 2029 | void |
2015 | GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi, | 2030 | GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi, |
2016 | GNUNET_FS_FileInformationProcessor cleaner, | 2031 | GNUNET_FS_FileInformationProcessor cleaner, |
2017 | void *cleaner_cls); | 2032 | void *cleaner_cls); |
2018 | 2033 | ||
2019 | 2034 | ||
2020 | /** | 2035 | /** |
2021 | * Options for publishing. Compatible options | 2036 | * Options for publishing. Compatible options |
2022 | * can be OR'ed together. | 2037 | * can be OR'ed together. |
2023 | */ | 2038 | */ |
2024 | enum GNUNET_FS_PublishOptions | 2039 | enum GNUNET_FS_PublishOptions |
2025 | { | 2040 | { |
2026 | /** | 2041 | /** |
2027 | * No options (use defaults for everything). | 2042 | * No options (use defaults for everything). |
2028 | */ | 2043 | */ |
2029 | GNUNET_FS_PUBLISH_OPTION_NONE = 0, | 2044 | GNUNET_FS_PUBLISH_OPTION_NONE = 0, |
2030 | 2045 | ||
2031 | /** | 2046 | /** |
2032 | * Simulate publishing. With this option, no data will be stored | 2047 | * Simulate publishing. With this option, no data will be stored |
2033 | * in the datastore. Useful for computing URIs from files. | 2048 | * in the datastore. Useful for computing URIs from files. |
2034 | */ | 2049 | */ |
2035 | GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY = 1 | 2050 | GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY = 1 |
2036 | }; | 2051 | }; |
2037 | 2052 | ||
2038 | /** | 2053 | /** |
2039 | * Publish a file or directory. | 2054 | * Publish a file or directory. |
@@ -2048,13 +2063,19 @@ enum GNUNET_FS_PublishOptions | |||
2048 | * @param options options for the publication | 2063 | * @param options options for the publication |
2049 | * @return context that can be used to control the publish operation | 2064 | * @return context that can be used to control the publish operation |
2050 | */ | 2065 | */ |
2051 | struct GNUNET_FS_PublishContext * | 2066 | struct GNUNET_FS_PublishContext *GNUNET_FS_publish_start (struct |
2052 | GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, | 2067 | GNUNET_FS_Handle *h, |
2053 | struct GNUNET_FS_FileInformation *fi, | 2068 | struct |
2054 | struct GNUNET_FS_Namespace *namespace, | 2069 | GNUNET_FS_FileInformation |
2055 | const char *nid, | 2070 | *fi, |
2056 | const char *nuid, | 2071 | struct |
2057 | enum GNUNET_FS_PublishOptions options); | 2072 | GNUNET_FS_Namespace |
2073 | *namespace, | ||
2074 | const char *nid, | ||
2075 | const char *nuid, | ||
2076 | enum | ||
2077 | GNUNET_FS_PublishOptions | ||
2078 | options); | ||
2058 | 2079 | ||
2059 | 2080 | ||
2060 | /** | 2081 | /** |
@@ -2065,8 +2086,7 @@ GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, | |||
2065 | * | 2086 | * |
2066 | * @param pc context for the publication to stop | 2087 | * @param pc context for the publication to stop |
2067 | */ | 2088 | */ |
2068 | void | 2089 | void GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc); |
2069 | GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc); | ||
2070 | 2090 | ||
2071 | 2091 | ||
2072 | /** | 2092 | /** |
@@ -2077,10 +2097,10 @@ GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc); | |||
2077 | * @param uri URI under which the block is now available, NULL on error | 2097 | * @param uri URI under which the block is now available, NULL on error |
2078 | * @param emsg error message, NULL on success | 2098 | * @param emsg error message, NULL on success |
2079 | */ | 2099 | */ |
2080 | typedef void (*GNUNET_FS_PublishContinuation)(void *cls, | 2100 | typedef void (*GNUNET_FS_PublishContinuation) (void *cls, |
2081 | const struct GNUNET_FS_Uri *uri, | 2101 | const struct GNUNET_FS_Uri * uri, |
2082 | const char *emsg); | 2102 | const char *emsg); |
2083 | 2103 | ||
2084 | 2104 | ||
2085 | /** | 2105 | /** |
2086 | * Publish a KBlock on GNUnet. | 2106 | * Publish a KBlock on GNUnet. |
@@ -2096,13 +2116,12 @@ typedef void (*GNUNET_FS_PublishContinuation)(void *cls, | |||
2096 | */ | 2116 | */ |
2097 | void | 2117 | void |
2098 | GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, | 2118 | GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, |
2099 | const struct GNUNET_FS_Uri *ksk_uri, | 2119 | const struct GNUNET_FS_Uri *ksk_uri, |
2100 | const struct GNUNET_CONTAINER_MetaData *meta, | 2120 | const struct GNUNET_CONTAINER_MetaData *meta, |
2101 | const struct GNUNET_FS_Uri *uri, | 2121 | const struct GNUNET_FS_Uri *uri, |
2102 | const struct GNUNET_FS_BlockOptions *bo, | 2122 | const struct GNUNET_FS_BlockOptions *bo, |
2103 | enum GNUNET_FS_PublishOptions options, | 2123 | enum GNUNET_FS_PublishOptions options, |
2104 | GNUNET_FS_PublishContinuation cont, | 2124 | GNUNET_FS_PublishContinuation cont, void *cont_cls); |
2105 | void *cont_cls); | ||
2106 | 2125 | ||
2107 | 2126 | ||
2108 | /** | 2127 | /** |
@@ -2121,15 +2140,14 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, | |||
2121 | */ | 2140 | */ |
2122 | void | 2141 | void |
2123 | GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | 2142 | GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, |
2124 | struct GNUNET_FS_Namespace *namespace, | 2143 | struct GNUNET_FS_Namespace *namespace, |
2125 | const char *identifier, | 2144 | const char *identifier, |
2126 | const char *update, | 2145 | const char *update, |
2127 | const struct GNUNET_CONTAINER_MetaData *meta, | 2146 | const struct GNUNET_CONTAINER_MetaData *meta, |
2128 | const struct GNUNET_FS_Uri *uri, | 2147 | const struct GNUNET_FS_Uri *uri, |
2129 | const struct GNUNET_FS_BlockOptions *bo, | 2148 | const struct GNUNET_FS_BlockOptions *bo, |
2130 | enum GNUNET_FS_PublishOptions options, | 2149 | enum GNUNET_FS_PublishOptions options, |
2131 | GNUNET_FS_PublishContinuation cont, | 2150 | GNUNET_FS_PublishContinuation cont, void *cont_cls); |
2132 | void *cont_cls); | ||
2133 | 2151 | ||
2134 | 2152 | ||
2135 | /** | 2153 | /** |
@@ -2141,8 +2159,8 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | |||
2141 | * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort | 2159 | * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort |
2142 | */ | 2160 | */ |
2143 | typedef int (*GNUNET_FS_IndexedFileProcessor) (void *cls, | 2161 | typedef int (*GNUNET_FS_IndexedFileProcessor) (void *cls, |
2144 | const char *filename, | 2162 | const char *filename, |
2145 | const GNUNET_HashCode *file_id); | 2163 | const GNUNET_HashCode * file_id); |
2146 | 2164 | ||
2147 | 2165 | ||
2148 | /** | 2166 | /** |
@@ -2156,12 +2174,11 @@ typedef int (*GNUNET_FS_IndexedFileProcessor) (void *cls, | |||
2156 | * error) or "PREREQ_DONE" (on success) | 2174 | * error) or "PREREQ_DONE" (on success) |
2157 | * @param cont_cls closure for cont | 2175 | * @param cont_cls closure for cont |
2158 | */ | 2176 | */ |
2159 | void | 2177 | void |
2160 | GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h, | 2178 | GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h, |
2161 | GNUNET_FS_IndexedFileProcessor iterator, | 2179 | GNUNET_FS_IndexedFileProcessor iterator, |
2162 | void *iterator_cls, | 2180 | void *iterator_cls, |
2163 | GNUNET_SCHEDULER_Task cont, | 2181 | GNUNET_SCHEDULER_Task cont, void *cont_cls); |
2164 | void *cont_cls); | ||
2165 | 2182 | ||
2166 | 2183 | ||
2167 | /** | 2184 | /** |
@@ -2172,10 +2189,10 @@ GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h, | |||
2172 | * @param cctx initial value for the client context | 2189 | * @param cctx initial value for the client context |
2173 | * @return NULL on error, otherwise handle | 2190 | * @return NULL on error, otherwise handle |
2174 | */ | 2191 | */ |
2175 | struct GNUNET_FS_UnindexContext * | 2192 | struct GNUNET_FS_UnindexContext *GNUNET_FS_unindex_start (struct |
2176 | GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, | 2193 | GNUNET_FS_Handle *h, |
2177 | const char *filename, | 2194 | const char *filename, |
2178 | void *cctx); | 2195 | void *cctx); |
2179 | 2196 | ||
2180 | 2197 | ||
2181 | /** | 2198 | /** |
@@ -2183,8 +2200,7 @@ GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, | |||
2183 | * | 2200 | * |
2184 | * @param uc handle | 2201 | * @param uc handle |
2185 | */ | 2202 | */ |
2186 | void | 2203 | void GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc); |
2187 | GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc); | ||
2188 | 2204 | ||
2189 | 2205 | ||
2190 | /** | 2206 | /** |
@@ -2201,13 +2217,13 @@ GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc); | |||
2201 | */ | 2217 | */ |
2202 | void | 2218 | void |
2203 | GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, | 2219 | GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, |
2204 | struct GNUNET_FS_Uri *ksk_uri, | 2220 | struct GNUNET_FS_Uri *ksk_uri, |
2205 | struct GNUNET_FS_Namespace *namespace, | 2221 | struct GNUNET_FS_Namespace *namespace, |
2206 | const struct GNUNET_CONTAINER_MetaData *meta, | 2222 | const struct GNUNET_CONTAINER_MetaData *meta, |
2207 | const struct GNUNET_FS_BlockOptions *bo, | 2223 | const struct GNUNET_FS_BlockOptions *bo, |
2208 | const char *rootEntry, | 2224 | const char *rootEntry, |
2209 | GNUNET_FS_PublishContinuation cont, | 2225 | GNUNET_FS_PublishContinuation cont, |
2210 | void *cont_cls); | 2226 | void *cont_cls); |
2211 | 2227 | ||
2212 | 2228 | ||
2213 | /** | 2229 | /** |
@@ -2218,9 +2234,8 @@ GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, | |||
2218 | * @param name name to use for the namespace | 2234 | * @param name name to use for the namespace |
2219 | * @return handle to the namespace, NULL on error | 2235 | * @return handle to the namespace, NULL on error |
2220 | */ | 2236 | */ |
2221 | struct GNUNET_FS_Namespace * | 2237 | struct GNUNET_FS_Namespace *GNUNET_FS_namespace_create (struct GNUNET_FS_Handle |
2222 | GNUNET_FS_namespace_create (struct GNUNET_FS_Handle *h, | 2238 | *h, const char *name); |
2223 | const char *name); | ||
2224 | 2239 | ||
2225 | 2240 | ||
2226 | /** | 2241 | /** |
@@ -2234,9 +2249,8 @@ GNUNET_FS_namespace_create (struct GNUNET_FS_Handle *h, | |||
2234 | * | 2249 | * |
2235 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 2250 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
2236 | */ | 2251 | */ |
2237 | int | 2252 | int |
2238 | GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *namespace, | 2253 | GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *namespace, int freeze); |
2239 | int freeze); | ||
2240 | 2254 | ||
2241 | 2255 | ||
2242 | /** | 2256 | /** |
@@ -2249,8 +2263,8 @@ GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *namespace, | |||
2249 | * @param id hash identifier for the namespace | 2263 | * @param id hash identifier for the namespace |
2250 | */ | 2264 | */ |
2251 | typedef void (*GNUNET_FS_NamespaceInfoProcessor) (void *cls, | 2265 | typedef void (*GNUNET_FS_NamespaceInfoProcessor) (void *cls, |
2252 | const char *name, | 2266 | const char *name, |
2253 | const GNUNET_HashCode *id); | 2267 | const GNUNET_HashCode * id); |
2254 | 2268 | ||
2255 | 2269 | ||
2256 | /** | 2270 | /** |
@@ -2262,10 +2276,9 @@ typedef void (*GNUNET_FS_NamespaceInfoProcessor) (void *cls, | |||
2262 | * @param cb function to call on each known namespace | 2276 | * @param cb function to call on each known namespace |
2263 | * @param cb_cls closure for cb | 2277 | * @param cb_cls closure for cb |
2264 | */ | 2278 | */ |
2265 | void | 2279 | void |
2266 | GNUNET_FS_namespace_list (struct GNUNET_FS_Handle *h, | 2280 | GNUNET_FS_namespace_list (struct GNUNET_FS_Handle *h, |
2267 | GNUNET_FS_NamespaceInfoProcessor cb, | 2281 | GNUNET_FS_NamespaceInfoProcessor cb, void *cb_cls); |
2268 | void *cb_cls); | ||
2269 | 2282 | ||
2270 | 2283 | ||
2271 | /** | 2284 | /** |
@@ -2277,12 +2290,12 @@ GNUNET_FS_namespace_list (struct GNUNET_FS_Handle *h, | |||
2277 | * @param last_meta metadata associated with last_uri | 2290 | * @param last_meta metadata associated with last_uri |
2278 | * @param next_id identifier that should be used for updates | 2291 | * @param next_id identifier that should be used for updates |
2279 | */ | 2292 | */ |
2280 | typedef void | 2293 | typedef void |
2281 | (*GNUNET_FS_IdentifierProcessor)(void *cls, | 2294 | (*GNUNET_FS_IdentifierProcessor) (void *cls, |
2282 | const char *last_id, | 2295 | const char *last_id, |
2283 | const struct GNUNET_FS_Uri *last_uri, | 2296 | const struct GNUNET_FS_Uri * last_uri, |
2284 | const struct GNUNET_CONTAINER_MetaData *last_meta, | 2297 | const struct GNUNET_CONTAINER_MetaData * |
2285 | const char *next_id); | 2298 | last_meta, const char *next_id); |
2286 | 2299 | ||
2287 | 2300 | ||
2288 | /** | 2301 | /** |
@@ -2307,28 +2320,27 @@ typedef void | |||
2307 | */ | 2320 | */ |
2308 | void | 2321 | void |
2309 | GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace, | 2322 | GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace, |
2310 | const char *next_id, | 2323 | const char *next_id, |
2311 | GNUNET_FS_IdentifierProcessor ip, | 2324 | GNUNET_FS_IdentifierProcessor ip, |
2312 | void *ip_cls); | 2325 | void *ip_cls); |
2313 | 2326 | ||
2314 | 2327 | ||
2315 | /** | 2328 | /** |
2316 | * Options for searching. Compatible options | 2329 | * Options for searching. Compatible options |
2317 | * can be OR'ed together. | 2330 | * can be OR'ed together. |
2318 | */ | 2331 | */ |
2319 | enum GNUNET_FS_SearchOptions | 2332 | enum GNUNET_FS_SearchOptions |
2320 | { | 2333 | { |
2321 | /** | 2334 | /** |
2322 | * No options (use defaults for everything). | 2335 | * No options (use defaults for everything). |
2323 | */ | 2336 | */ |
2324 | GNUNET_FS_SEARCH_OPTION_NONE = 0, | 2337 | GNUNET_FS_SEARCH_OPTION_NONE = 0, |
2325 | 2338 | ||
2326 | /** | 2339 | /** |
2327 | * Only search the local host, do not search remote systems (no P2P) | 2340 | * Only search the local host, do not search remote systems (no P2P) |
2328 | */ | 2341 | */ |
2329 | GNUNET_FS_SEARCH_OPTION_LOOPBACK_ONLY = 1 | 2342 | GNUNET_FS_SEARCH_OPTION_LOOPBACK_ONLY = 1 |
2330 | 2343 | }; | |
2331 | }; | ||
2332 | 2344 | ||
2333 | 2345 | ||
2334 | /** | 2346 | /** |
@@ -2342,12 +2354,14 @@ enum GNUNET_FS_SearchOptions | |||
2342 | * @param cctx initial value for the client context | 2354 | * @param cctx initial value for the client context |
2343 | * @return context that can be used to control the search | 2355 | * @return context that can be used to control the search |
2344 | */ | 2356 | */ |
2345 | struct GNUNET_FS_SearchContext * | 2357 | struct GNUNET_FS_SearchContext *GNUNET_FS_search_start (struct GNUNET_FS_Handle |
2346 | GNUNET_FS_search_start (struct GNUNET_FS_Handle *h, | 2358 | *h, |
2347 | const struct GNUNET_FS_Uri *uri, | 2359 | const struct |
2348 | uint32_t anonymity, | 2360 | GNUNET_FS_Uri *uri, |
2349 | enum GNUNET_FS_SearchOptions options, | 2361 | uint32_t anonymity, |
2350 | void *cctx); | 2362 | enum |
2363 | GNUNET_FS_SearchOptions | ||
2364 | options, void *cctx); | ||
2351 | 2365 | ||
2352 | 2366 | ||
2353 | /** | 2367 | /** |
@@ -2355,8 +2369,7 @@ GNUNET_FS_search_start (struct GNUNET_FS_Handle *h, | |||
2355 | * | 2369 | * |
2356 | * @param sc context for the search that should be paused | 2370 | * @param sc context for the search that should be paused |
2357 | */ | 2371 | */ |
2358 | void | 2372 | void GNUNET_FS_search_pause (struct GNUNET_FS_SearchContext *sc); |
2359 | GNUNET_FS_search_pause (struct GNUNET_FS_SearchContext *sc); | ||
2360 | 2373 | ||
2361 | 2374 | ||
2362 | /** | 2375 | /** |
@@ -2364,8 +2377,7 @@ GNUNET_FS_search_pause (struct GNUNET_FS_SearchContext *sc); | |||
2364 | * | 2377 | * |
2365 | * @param sc context for the search that should be resumed | 2378 | * @param sc context for the search that should be resumed |
2366 | */ | 2379 | */ |
2367 | void | 2380 | void GNUNET_FS_search_continue (struct GNUNET_FS_SearchContext *sc); |
2368 | GNUNET_FS_search_continue (struct GNUNET_FS_SearchContext *sc); | ||
2369 | 2381 | ||
2370 | 2382 | ||
2371 | /** | 2383 | /** |
@@ -2373,8 +2385,7 @@ GNUNET_FS_search_continue (struct GNUNET_FS_SearchContext *sc); | |||
2373 | * | 2385 | * |
2374 | * @param sc context for the search that should be stopped | 2386 | * @param sc context for the search that should be stopped |
2375 | */ | 2387 | */ |
2376 | void | 2388 | void GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc); |
2377 | GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc); | ||
2378 | 2389 | ||
2379 | 2390 | ||
2380 | 2391 | ||
@@ -2383,29 +2394,29 @@ GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc); | |||
2383 | * Options for downloading. Compatible options | 2394 | * Options for downloading. Compatible options |
2384 | * can be OR'ed together. | 2395 | * can be OR'ed together. |
2385 | */ | 2396 | */ |
2386 | enum GNUNET_FS_DownloadOptions | 2397 | enum GNUNET_FS_DownloadOptions |
2387 | { | 2398 | { |
2388 | /** | 2399 | /** |
2389 | * No options (use defaults for everything). | 2400 | * No options (use defaults for everything). |
2390 | */ | 2401 | */ |
2391 | GNUNET_FS_DOWNLOAD_OPTION_NONE = 0, | 2402 | GNUNET_FS_DOWNLOAD_OPTION_NONE = 0, |
2392 | 2403 | ||
2393 | /** | 2404 | /** |
2394 | * Only download from the local host, do not access remote systems (no P2P) | 2405 | * Only download from the local host, do not access remote systems (no P2P) |
2395 | */ | 2406 | */ |
2396 | GNUNET_FS_DOWNLOAD_OPTION_LOOPBACK_ONLY = 1, | 2407 | GNUNET_FS_DOWNLOAD_OPTION_LOOPBACK_ONLY = 1, |
2397 | 2408 | ||
2398 | /** | 2409 | /** |
2399 | * Do a recursive download (that is, automatically trigger the | 2410 | * Do a recursive download (that is, automatically trigger the |
2400 | * download of files in directories). | 2411 | * download of files in directories). |
2401 | */ | 2412 | */ |
2402 | GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE = 2, | 2413 | GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE = 2, |
2403 | 2414 | ||
2404 | /** | 2415 | /** |
2405 | * Do not append temporary data to | 2416 | * Do not append temporary data to |
2406 | * the target file (for the IBlocks). | 2417 | * the target file (for the IBlocks). |
2407 | */ | 2418 | */ |
2408 | GNUNET_FS_DOWNLOAD_NO_TEMPORARIES = 4, | 2419 | GNUNET_FS_DOWNLOAD_NO_TEMPORARIES = 4, |
2409 | 2420 | ||
2410 | /** | 2421 | /** |
2411 | * Internal option used to flag this download as a 'probe' for a | 2422 | * Internal option used to flag this download as a 'probe' for a |
@@ -2414,9 +2425,8 @@ enum GNUNET_FS_DownloadOptions | |||
2414 | * Also, probe downloads are not serialized on suspension. Normal | 2425 | * Also, probe downloads are not serialized on suspension. Normal |
2415 | * clients should not use this! | 2426 | * clients should not use this! |
2416 | */ | 2427 | */ |
2417 | GNUNET_FS_DOWNLOAD_IS_PROBE = (1<<31) | 2428 | GNUNET_FS_DOWNLOAD_IS_PROBE = (1 << 31) |
2418 | 2429 | }; | |
2419 | }; | ||
2420 | 2430 | ||
2421 | 2431 | ||
2422 | 2432 | ||
@@ -2450,18 +2460,26 @@ enum GNUNET_FS_DownloadOptions | |||
2450 | * for top-level downloads; useful for manually-triggered recursive downloads) | 2460 | * for top-level downloads; useful for manually-triggered recursive downloads) |
2451 | * @return context that can be used to control this download | 2461 | * @return context that can be used to control this download |
2452 | */ | 2462 | */ |
2453 | struct GNUNET_FS_DownloadContext * | 2463 | struct GNUNET_FS_DownloadContext *GNUNET_FS_download_start (struct |
2454 | GNUNET_FS_download_start (struct GNUNET_FS_Handle *h, | 2464 | GNUNET_FS_Handle *h, |
2455 | const struct GNUNET_FS_Uri *uri, | 2465 | const struct |
2456 | const struct GNUNET_CONTAINER_MetaData *meta, | 2466 | GNUNET_FS_Uri *uri, |
2457 | const char *filename, | 2467 | const struct |
2458 | const char *tempname, | 2468 | GNUNET_CONTAINER_MetaData |
2459 | uint64_t offset, | 2469 | *meta, |
2460 | uint64_t length, | 2470 | const char |
2461 | uint32_t anonymity, | 2471 | *filename, |
2462 | enum GNUNET_FS_DownloadOptions options, | 2472 | const char |
2463 | void *cctx, | 2473 | *tempname, |
2464 | struct GNUNET_FS_DownloadContext *parent); | 2474 | uint64_t offset, |
2475 | uint64_t length, | ||
2476 | uint32_t anonymity, | ||
2477 | enum | ||
2478 | GNUNET_FS_DownloadOptions | ||
2479 | options, void *cctx, | ||
2480 | struct | ||
2481 | GNUNET_FS_DownloadContext | ||
2482 | *parent); | ||
2465 | 2483 | ||
2466 | 2484 | ||
2467 | /** | 2485 | /** |
@@ -2498,16 +2516,29 @@ GNUNET_FS_download_start (struct GNUNET_FS_Handle *h, | |||
2498 | * @param cctx initial value for the client context for this download | 2516 | * @param cctx initial value for the client context for this download |
2499 | * @return context that can be used to control this download | 2517 | * @return context that can be used to control this download |
2500 | */ | 2518 | */ |
2501 | struct GNUNET_FS_DownloadContext * | 2519 | struct GNUNET_FS_DownloadContext *GNUNET_FS_download_start_from_search (struct |
2502 | GNUNET_FS_download_start_from_search (struct GNUNET_FS_Handle *h, | 2520 | GNUNET_FS_Handle |
2503 | struct GNUNET_FS_SearchResult *sr, | 2521 | *h, |
2504 | const char *filename, | 2522 | struct |
2505 | const char *tempname, | 2523 | GNUNET_FS_SearchResult |
2506 | uint64_t offset, | 2524 | *sr, |
2507 | uint64_t length, | 2525 | const |
2508 | uint32_t anonymity, | 2526 | char |
2509 | enum GNUNET_FS_DownloadOptions options, | 2527 | *filename, |
2510 | void *cctx); | 2528 | const |
2529 | char | ||
2530 | *tempname, | ||
2531 | uint64_t | ||
2532 | offset, | ||
2533 | uint64_t | ||
2534 | length, | ||
2535 | uint32_t | ||
2536 | anonymity, | ||
2537 | enum | ||
2538 | GNUNET_FS_DownloadOptions | ||
2539 | options, | ||
2540 | void | ||
2541 | *cctx); | ||
2511 | 2542 | ||
2512 | 2543 | ||
2513 | /** | 2544 | /** |
@@ -2517,8 +2548,7 @@ GNUNET_FS_download_start_from_search (struct GNUNET_FS_Handle *h, | |||
2517 | * @param do_delete delete files of incomplete downloads | 2548 | * @param do_delete delete files of incomplete downloads |
2518 | */ | 2549 | */ |
2519 | void | 2550 | void |
2520 | GNUNET_FS_download_stop (struct GNUNET_FS_DownloadContext *dc, | 2551 | GNUNET_FS_download_stop (struct GNUNET_FS_DownloadContext *dc, int do_delete); |
2521 | int do_delete); | ||
2522 | 2552 | ||
2523 | 2553 | ||
2524 | 2554 | ||
@@ -2536,8 +2566,9 @@ GNUNET_FS_download_stop (struct GNUNET_FS_DownloadContext *dc, | |||
2536 | * @return GNUNET_YES if it is, GNUNET_NO if it is not, GNUNET_SYSERR if | 2566 | * @return GNUNET_YES if it is, GNUNET_NO if it is not, GNUNET_SYSERR if |
2537 | * we have no mime-type information (treat as 'GNUNET_NO') | 2567 | * we have no mime-type information (treat as 'GNUNET_NO') |
2538 | */ | 2568 | */ |
2539 | int | 2569 | int |
2540 | GNUNET_FS_meta_data_test_for_directory (const struct GNUNET_CONTAINER_MetaData *md); | 2570 | GNUNET_FS_meta_data_test_for_directory (const struct GNUNET_CONTAINER_MetaData |
2571 | *md); | ||
2541 | 2572 | ||
2542 | 2573 | ||
2543 | /** | 2574 | /** |
@@ -2546,8 +2577,7 @@ GNUNET_FS_meta_data_test_for_directory (const struct GNUNET_CONTAINER_MetaData * | |||
2546 | * | 2577 | * |
2547 | * @param md metadata to add mimetype to | 2578 | * @param md metadata to add mimetype to |
2548 | */ | 2579 | */ |
2549 | void | 2580 | void GNUNET_FS_meta_data_make_directory (struct GNUNET_CONTAINER_MetaData *md); |
2550 | GNUNET_FS_meta_data_make_directory (struct GNUNET_CONTAINER_MetaData *md); | ||
2551 | 2581 | ||
2552 | 2582 | ||
2553 | /** | 2583 | /** |
@@ -2556,8 +2586,8 @@ GNUNET_FS_meta_data_make_directory (struct GNUNET_CONTAINER_MetaData *md); | |||
2556 | * @param md given meta data | 2586 | * @param md given meta data |
2557 | * @return NULL if meta data is useless for suggesting a filename | 2587 | * @return NULL if meta data is useless for suggesting a filename |
2558 | */ | 2588 | */ |
2559 | char * | 2589 | char *GNUNET_FS_meta_data_suggest_filename (const struct |
2560 | GNUNET_FS_meta_data_suggest_filename (const struct GNUNET_CONTAINER_MetaData *md); | 2590 | GNUNET_CONTAINER_MetaData *md); |
2561 | 2591 | ||
2562 | 2592 | ||
2563 | /** | 2593 | /** |
@@ -2575,12 +2605,14 @@ GNUNET_FS_meta_data_suggest_filename (const struct GNUNET_CONTAINER_MetaData *md | |||
2575 | * embedded with the directory itself). | 2605 | * embedded with the directory itself). |
2576 | * @param data data available for the file (length bytes) | 2606 | * @param data data available for the file (length bytes) |
2577 | */ | 2607 | */ |
2578 | typedef void (*GNUNET_FS_DirectoryEntryProcessor)(void *cls, | 2608 | typedef void (*GNUNET_FS_DirectoryEntryProcessor) (void *cls, |
2579 | const char *filename, | 2609 | const char *filename, |
2580 | const struct GNUNET_FS_Uri *uri, | 2610 | const struct GNUNET_FS_Uri * |
2581 | const struct GNUNET_CONTAINER_MetaData *meta, | 2611 | uri, |
2582 | size_t length, | 2612 | const struct |
2583 | const void *data); | 2613 | GNUNET_CONTAINER_MetaData * |
2614 | meta, size_t length, | ||
2615 | const void *data); | ||
2584 | 2616 | ||
2585 | 2617 | ||
2586 | /** | 2618 | /** |
@@ -2602,12 +2634,12 @@ typedef void (*GNUNET_FS_DirectoryEntryProcessor)(void *cls, | |||
2602 | * GNUNET_NO if this could be part of a directory (but not 100% OK) | 2634 | * GNUNET_NO if this could be part of a directory (but not 100% OK) |
2603 | * GNUNET_SYSERR if 'data' does not represent a directory | 2635 | * GNUNET_SYSERR if 'data' does not represent a directory |
2604 | */ | 2636 | */ |
2605 | int | 2637 | int |
2606 | GNUNET_FS_directory_list_contents (size_t size, | 2638 | GNUNET_FS_directory_list_contents (size_t size, |
2607 | const void *data, | 2639 | const void *data, |
2608 | uint64_t offset, | 2640 | uint64_t offset, |
2609 | GNUNET_FS_DirectoryEntryProcessor dep, | 2641 | GNUNET_FS_DirectoryEntryProcessor dep, |
2610 | void *dep_cls); | 2642 | void *dep_cls); |
2611 | 2643 | ||
2612 | 2644 | ||
2613 | /** | 2645 | /** |
@@ -2620,8 +2652,10 @@ struct GNUNET_FS_DirectoryBuilder; | |||
2620 | * | 2652 | * |
2621 | * @param mdir metadata for the directory | 2653 | * @param mdir metadata for the directory |
2622 | */ | 2654 | */ |
2623 | struct GNUNET_FS_DirectoryBuilder * | 2655 | struct GNUNET_FS_DirectoryBuilder *GNUNET_FS_directory_builder_create (const |
2624 | GNUNET_FS_directory_builder_create (const struct GNUNET_CONTAINER_MetaData *mdir); | 2656 | struct |
2657 | GNUNET_CONTAINER_MetaData | ||
2658 | *mdir); | ||
2625 | 2659 | ||
2626 | 2660 | ||
2627 | /** | 2661 | /** |
@@ -2636,10 +2670,10 @@ GNUNET_FS_directory_builder_create (const struct GNUNET_CONTAINER_MetaData *mdir | |||
2636 | */ | 2670 | */ |
2637 | void | 2671 | void |
2638 | GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld, | 2672 | GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld, |
2639 | const struct GNUNET_FS_Uri *uri, | 2673 | const struct GNUNET_FS_Uri *uri, |
2640 | const struct GNUNET_CONTAINER_MetaData *md, | 2674 | const struct GNUNET_CONTAINER_MetaData *md, |
2641 | const void *data); | 2675 | const void *data); |
2642 | 2676 | ||
2643 | 2677 | ||
2644 | /** | 2678 | /** |
2645 | * Finish building the directory. Frees the | 2679 | * Finish building the directory. Frees the |
@@ -2653,8 +2687,7 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld, | |||
2653 | */ | 2687 | */ |
2654 | int | 2688 | int |
2655 | GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld, | 2689 | GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld, |
2656 | size_t *rsize, | 2690 | size_t * rsize, void **rdata); |
2657 | void **rdata); | ||
2658 | 2691 | ||
2659 | 2692 | ||
2660 | #if 0 /* keep Emacsens' auto-indent happy */ | 2693 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_getopt_lib.h b/src/include/gnunet_getopt_lib.h index 8691fba2f..9c34810b2 100644 --- a/src/include/gnunet_getopt_lib.h +++ b/src/include/gnunet_getopt_lib.h | |||
@@ -86,11 +86,11 @@ struct GNUNET_GETOPT_CommandLineProcessorContext | |||
86 | * @return GNUNET_OK to continue processing other options, GNUNET_SYSERR to abort | 86 | * @return GNUNET_OK to continue processing other options, GNUNET_SYSERR to abort |
87 | */ | 87 | */ |
88 | typedef | 88 | typedef |
89 | int (*GNUNET_GETOPT_CommandLineOptionProcessor) (struct | 89 | int (*GNUNET_GETOPT_CommandLineOptionProcessor) (struct |
90 | GNUNET_GETOPT_CommandLineProcessorContext | 90 | GNUNET_GETOPT_CommandLineProcessorContext |
91 | * ctx, void *scls, | 91 | * ctx, void *scls, |
92 | const char *option, | 92 | const char *option, |
93 | const char *value); | 93 | const char *value); |
94 | 94 | ||
95 | /** | 95 | /** |
96 | * @brief Definition of a command line option. | 96 | * @brief Definition of a command line option. |
diff --git a/src/include/gnunet_hello_lib.h b/src/include/gnunet_hello_lib.h index f1b67121e..a3e4ba0f0 100644 --- a/src/include/gnunet_hello_lib.h +++ b/src/include/gnunet_hello_lib.h | |||
@@ -61,6 +61,13 @@ struct GNUNET_HELLO_Message; | |||
61 | * the target buffer was not big enough. | 61 | * the target buffer was not big enough. |
62 | */ | 62 | */ |
63 | size_t | 63 | size_t |
64 | |||
65 | |||
66 | |||
67 | |||
68 | |||
69 | |||
70 | |||
64 | GNUNET_HELLO_add_address (const char *tname, | 71 | GNUNET_HELLO_add_address (const char *tname, |
65 | struct GNUNET_TIME_Absolute expiration, | 72 | struct GNUNET_TIME_Absolute expiration, |
66 | const void *addr, | 73 | const void *addr, |
@@ -79,8 +86,8 @@ GNUNET_HELLO_add_address (const char *tname, | |||
79 | * end of the iteration. | 86 | * end of the iteration. |
80 | */ | 87 | */ |
81 | typedef size_t | 88 | typedef size_t |
82 | (*GNUNET_HELLO_GenerateAddressListCallback) (void *cls, | 89 | (*GNUNET_HELLO_GenerateAddressListCallback) (void *cls, |
83 | size_t max, void *buf); | 90 | size_t max, void *buf); |
84 | 91 | ||
85 | 92 | ||
86 | /** | 93 | /** |
@@ -136,12 +143,11 @@ struct GNUNET_HELLO_Message *GNUNET_HELLO_merge (const struct | |||
136 | * zero if the some addresses with expirations >= now | 143 | * zero if the some addresses with expirations >= now |
137 | * do not match at all | 144 | * do not match at all |
138 | */ | 145 | */ |
139 | struct GNUNET_TIME_Absolute | 146 | struct GNUNET_TIME_Absolute |
140 | GNUNET_HELLO_equals (const struct | 147 | GNUNET_HELLO_equals (const struct |
141 | GNUNET_HELLO_Message *h1, | 148 | GNUNET_HELLO_Message *h1, |
142 | const struct | 149 | const struct |
143 | GNUNET_HELLO_Message *h2, | 150 | GNUNET_HELLO_Message *h2, struct GNUNET_TIME_Absolute now); |
144 | struct GNUNET_TIME_Absolute now); | ||
145 | 151 | ||
146 | 152 | ||
147 | /** | 153 | /** |
@@ -157,11 +163,10 @@ GNUNET_HELLO_equals (const struct | |||
157 | * GNUNET_SYSERR to stop iterating (but keep current address) | 163 | * GNUNET_SYSERR to stop iterating (but keep current address) |
158 | */ | 164 | */ |
159 | typedef int | 165 | typedef int |
160 | (*GNUNET_HELLO_AddressIterator) (void *cls, | 166 | (*GNUNET_HELLO_AddressIterator) (void *cls, |
161 | const char *tname, | 167 | const char *tname, |
162 | struct GNUNET_TIME_Absolute expiration, | 168 | struct GNUNET_TIME_Absolute expiration, |
163 | const void *addr, | 169 | const void *addr, uint16_t addrlen); |
164 | uint16_t addrlen); | ||
165 | 170 | ||
166 | 171 | ||
167 | /** | 172 | /** |
@@ -182,8 +187,7 @@ struct GNUNET_HELLO_Message *GNUNET_HELLO_iterate_addresses (const struct | |||
182 | int | 187 | int |
183 | return_modified, | 188 | return_modified, |
184 | GNUNET_HELLO_AddressIterator | 189 | GNUNET_HELLO_AddressIterator |
185 | it, | 190 | it, void *it_cls); |
186 | void *it_cls); | ||
187 | 191 | ||
188 | 192 | ||
189 | /** | 193 | /** |
@@ -230,7 +234,7 @@ GNUNET_HELLO_get_key (const struct GNUNET_HELLO_Message *hello, | |||
230 | */ | 234 | */ |
231 | int | 235 | int |
232 | GNUNET_HELLO_get_id (const struct GNUNET_HELLO_Message *hello, | 236 | GNUNET_HELLO_get_id (const struct GNUNET_HELLO_Message *hello, |
233 | struct GNUNET_PeerIdentity *peer); | 237 | struct GNUNET_PeerIdentity *peer); |
234 | 238 | ||
235 | 239 | ||
236 | /** | 240 | /** |
@@ -241,8 +245,9 @@ GNUNET_HELLO_get_id (const struct GNUNET_HELLO_Message *hello, | |||
241 | * | 245 | * |
242 | * @return header or NULL if the HELLO was malformed | 246 | * @return header or NULL if the HELLO was malformed |
243 | */ | 247 | */ |
244 | struct GNUNET_MessageHeader * | 248 | struct GNUNET_MessageHeader *GNUNET_HELLO_get_header (struct |
245 | GNUNET_HELLO_get_header (struct GNUNET_HELLO_Message *hello); | 249 | GNUNET_HELLO_Message |
250 | *hello); | ||
246 | 251 | ||
247 | /* ifndef GNUNET_HELLO_LIB_H */ | 252 | /* ifndef GNUNET_HELLO_LIB_H */ |
248 | #endif | 253 | #endif |
diff --git a/src/include/gnunet_load_lib.h b/src/include/gnunet_load_lib.h index ea2ad588e..40323e709 100644 --- a/src/include/gnunet_load_lib.h +++ b/src/include/gnunet_load_lib.h | |||
@@ -51,8 +51,8 @@ struct GNUNET_LOAD_Value; | |||
51 | * frequency, 0-load values will be added to the load | 51 | * frequency, 0-load values will be added to the load |
52 | * @return the new load value | 52 | * @return the new load value |
53 | */ | 53 | */ |
54 | struct GNUNET_LOAD_Value * | 54 | struct GNUNET_LOAD_Value *GNUNET_LOAD_value_init (struct GNUNET_TIME_Relative |
55 | GNUNET_LOAD_value_init (struct GNUNET_TIME_Relative autodecline); | 55 | autodecline); |
56 | 56 | ||
57 | 57 | ||
58 | /** | 58 | /** |
@@ -63,7 +63,7 @@ GNUNET_LOAD_value_init (struct GNUNET_TIME_Relative autodecline); | |||
63 | */ | 63 | */ |
64 | void | 64 | void |
65 | GNUNET_LOAD_value_set_decline (struct GNUNET_LOAD_Value *load, | 65 | GNUNET_LOAD_value_set_decline (struct GNUNET_LOAD_Value *load, |
66 | struct GNUNET_TIME_Relative autodecline); | 66 | struct GNUNET_TIME_Relative autodecline); |
67 | 67 | ||
68 | 68 | ||
69 | /** | 69 | /** |
@@ -83,8 +83,7 @@ GNUNET_LOAD_value_set_decline (struct GNUNET_LOAD_Value *load, | |||
83 | * 100 if the latest updates were so large | 83 | * 100 if the latest updates were so large |
84 | * that we could not do proper calculations | 84 | * that we could not do proper calculations |
85 | */ | 85 | */ |
86 | double | 86 | double GNUNET_LOAD_get_load (struct GNUNET_LOAD_Value *load); |
87 | GNUNET_LOAD_get_load (struct GNUNET_LOAD_Value *load); | ||
88 | 87 | ||
89 | 88 | ||
90 | /** | 89 | /** |
@@ -93,8 +92,7 @@ GNUNET_LOAD_get_load (struct GNUNET_LOAD_Value *load); | |||
93 | * @param load load handle | 92 | * @param load load handle |
94 | * @return zero if update was never called | 93 | * @return zero if update was never called |
95 | */ | 94 | */ |
96 | double | 95 | double GNUNET_LOAD_get_average (struct GNUNET_LOAD_Value *load); |
97 | GNUNET_LOAD_get_average (struct GNUNET_LOAD_Value *load); | ||
98 | 96 | ||
99 | 97 | ||
100 | /** | 98 | /** |
@@ -103,9 +101,7 @@ GNUNET_LOAD_get_average (struct GNUNET_LOAD_Value *load); | |||
103 | * @param load to update | 101 | * @param load to update |
104 | * @param data latest measurement value (for example, delay) | 102 | * @param data latest measurement value (for example, delay) |
105 | */ | 103 | */ |
106 | void | 104 | void GNUNET_LOAD_update (struct GNUNET_LOAD_Value *load, uint64_t data); |
107 | GNUNET_LOAD_update (struct GNUNET_LOAD_Value *load, | ||
108 | uint64_t data); | ||
109 | 105 | ||
110 | 106 | ||
111 | #if 0 /* keep Emacsens' auto-indent happy */ | 107 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_mesh_service.h b/src/include/gnunet_mesh_service.h index 25744248b..7e332c749 100644 --- a/src/include/gnunet_mesh_service.h +++ b/src/include/gnunet_mesh_service.h | |||
@@ -68,12 +68,13 @@ struct GNUNET_MESH_Tunnel; | |||
68 | * GNUNET_SYSERR to close it (signal serious error) | 68 | * GNUNET_SYSERR to close it (signal serious error) |
69 | */ | 69 | */ |
70 | typedef int | 70 | typedef int |
71 | (*GNUNET_MESH_MessageCallback) (void *cls, | 71 | (*GNUNET_MESH_MessageCallback) (void *cls, |
72 | struct GNUNET_MESH_Tunnel *tunnel, | 72 | struct GNUNET_MESH_Tunnel * tunnel, |
73 | void **tunnel_ctx, | 73 | void **tunnel_ctx, |
74 | const struct GNUNET_PeerIdentity *sender, | 74 | const struct GNUNET_PeerIdentity * sender, |
75 | const struct GNUNET_MessageHeader *message, | 75 | const struct GNUNET_MessageHeader * message, |
76 | const struct GNUNET_TRANSPORT_ATS_Information *atsi); | 76 | const struct |
77 | GNUNET_TRANSPORT_ATS_Information * atsi); | ||
77 | 78 | ||
78 | 79 | ||
79 | /** | 80 | /** |
@@ -110,9 +111,9 @@ struct GNUNET_MESH_MessageHandler | |||
110 | * @param tunnel connection to the other end (henceforth invalid) | 111 | * @param tunnel connection to the other end (henceforth invalid) |
111 | * @param tunnel_ctx place where local state associated with the tunnel is stored | 112 | * @param tunnel_ctx place where local state associated with the tunnel is stored |
112 | */ | 113 | */ |
113 | typedef void (GNUNET_MESH_TunnelEndHandler)(void *cls, | 114 | typedef void (GNUNET_MESH_TunnelEndHandler) (void *cls, |
114 | const struct GNUNET_MESH_Tunnel *tunnel, | 115 | const struct GNUNET_MESH_Tunnel * |
115 | void **tunnel_ctx); | 116 | tunnel, void **tunnel_ctx); |
116 | 117 | ||
117 | 118 | ||
118 | /** | 119 | /** |
@@ -135,12 +136,17 @@ typedef uint32_t GNUNET_MESH_ApplicationType; | |||
135 | * @return handle to the mesh service | 136 | * @return handle to the mesh service |
136 | * NULL on error (in this case, init is never called) | 137 | * NULL on error (in this case, init is never called) |
137 | */ | 138 | */ |
138 | struct GNUNET_MESH_Handle * | 139 | struct GNUNET_MESH_Handle *GNUNET_MESH_connect (const struct |
139 | GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 140 | GNUNET_CONFIGURATION_Handle |
140 | void *cls, | 141 | *cfg, void *cls, |
141 | GNUNET_MESH_TunnelEndHandler cleaner, | 142 | GNUNET_MESH_TunnelEndHandler |
142 | const struct GNUNET_MESH_MessageHandler *handlers, | 143 | cleaner, |
143 | const GNUNET_MESH_ApplicationType *stypes); | 144 | const struct |
145 | GNUNET_MESH_MessageHandler | ||
146 | *handlers, | ||
147 | const | ||
148 | GNUNET_MESH_ApplicationType | ||
149 | *stypes); | ||
144 | 150 | ||
145 | /** | 151 | /** |
146 | * Get the peer on the other side of this tunnel if it is just one. Return NULL otherwise | 152 | * Get the peer on the other side of this tunnel if it is just one. Return NULL otherwise |
@@ -148,8 +154,9 @@ GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
148 | * @param tunnel the tunnel | 154 | * @param tunnel the tunnel |
149 | * @return the peer or NULL | 155 | * @return the peer or NULL |
150 | */ | 156 | */ |
151 | const struct GNUNET_PeerIdentity* | 157 | const struct GNUNET_PeerIdentity *GNUNET_MESH_get_peer (const struct |
152 | GNUNET_MESH_get_peer(const struct GNUNET_MESH_Tunnel* tunnel); | 158 | GNUNET_MESH_Tunnel |
159 | *tunnel); | ||
153 | 160 | ||
154 | 161 | ||
155 | /** | 162 | /** |
@@ -170,7 +177,9 @@ void GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle); | |||
170 | * @param peer peer identity the tunnel stopped working with | 177 | * @param peer peer identity the tunnel stopped working with |
171 | */ | 178 | */ |
172 | typedef void (*GNUNET_MESH_TunnelDisconnectHandler) (void *cls, | 179 | typedef void (*GNUNET_MESH_TunnelDisconnectHandler) (void *cls, |
173 | const struct GNUNET_PeerIdentity *peer); | 180 | const struct |
181 | GNUNET_PeerIdentity * | ||
182 | peer); | ||
174 | 183 | ||
175 | 184 | ||
176 | /** | 185 | /** |
@@ -181,8 +190,11 @@ typedef void (*GNUNET_MESH_TunnelDisconnectHandler) (void *cls, | |||
181 | * @param atsi performance data for the connection | 190 | * @param atsi performance data for the connection |
182 | */ | 191 | */ |
183 | typedef void (*GNUNET_MESH_TunnelConnectHandler) (void *cls, | 192 | typedef void (*GNUNET_MESH_TunnelConnectHandler) (void *cls, |
184 | const struct GNUNET_PeerIdentity *peer, | 193 | const struct |
185 | const struct GNUNET_TRANSPORT_ATS_Information *atsi); | 194 | GNUNET_PeerIdentity * peer, |
195 | const struct | ||
196 | GNUNET_TRANSPORT_ATS_Information | ||
197 | * atsi); | ||
186 | 198 | ||
187 | 199 | ||
188 | 200 | ||
@@ -206,14 +218,23 @@ struct GNUNET_MESH_PeerRequestHandle; | |||
206 | * @param handler_cls closure for handler | 218 | * @param handler_cls closure for handler |
207 | * @return NULL on error (handler will not be called), otherwise handle for cancellation | 219 | * @return NULL on error (handler will not be called), otherwise handle for cancellation |
208 | */ | 220 | */ |
209 | struct GNUNET_MESH_Tunnel * | 221 | struct GNUNET_MESH_Tunnel *GNUNET_MESH_peer_request_connect_any (struct |
210 | GNUNET_MESH_peer_request_connect_any (struct GNUNET_MESH_Handle *h, | 222 | GNUNET_MESH_Handle |
211 | struct GNUNET_TIME_Relative timeout, | 223 | *h, |
212 | unsigned int num_peers, | 224 | struct |
213 | const struct GNUNET_PeerIdentity *peers, | 225 | GNUNET_TIME_Relative |
214 | GNUNET_MESH_TunnelConnectHandler connect_handler, | 226 | timeout, |
215 | GNUNET_MESH_TunnelDisconnectHandler disconnect_handler, | 227 | unsigned int |
216 | void *handler_cls); | 228 | num_peers, |
229 | const struct | ||
230 | GNUNET_PeerIdentity | ||
231 | *peers, | ||
232 | GNUNET_MESH_TunnelConnectHandler | ||
233 | connect_handler, | ||
234 | GNUNET_MESH_TunnelDisconnectHandler | ||
235 | disconnect_handler, | ||
236 | void | ||
237 | *handler_cls); | ||
217 | 238 | ||
218 | 239 | ||
219 | /** | 240 | /** |
@@ -233,14 +254,23 @@ GNUNET_MESH_peer_request_connect_any (struct GNUNET_MESH_Handle *h, | |||
233 | * @param handler_cls closure for handler | 254 | * @param handler_cls closure for handler |
234 | * @return NULL on error (handler will not be called), otherwise handle for cancellation | 255 | * @return NULL on error (handler will not be called), otherwise handle for cancellation |
235 | */ | 256 | */ |
236 | struct GNUNET_MESH_Tunnel * | 257 | struct GNUNET_MESH_Tunnel *GNUNET_MESH_peer_request_connect_all (struct |
237 | GNUNET_MESH_peer_request_connect_all (struct GNUNET_MESH_Handle *h, | 258 | GNUNET_MESH_Handle |
238 | struct GNUNET_TIME_Relative timeout, | 259 | *h, |
239 | unsigned int num_peers, | 260 | struct |
240 | const struct GNUNET_PeerIdentity *peers, | 261 | GNUNET_TIME_Relative |
241 | GNUNET_MESH_TunnelConnectHandler connect_handler, | 262 | timeout, |
242 | GNUNET_MESH_TunnelDisconnectHandler disconnect_handler, | 263 | unsigned int |
243 | void *handler_cls); | 264 | num_peers, |
265 | const struct | ||
266 | GNUNET_PeerIdentity | ||
267 | *peers, | ||
268 | GNUNET_MESH_TunnelConnectHandler | ||
269 | connect_handler, | ||
270 | GNUNET_MESH_TunnelDisconnectHandler | ||
271 | disconnect_handler, | ||
272 | void | ||
273 | *handler_cls); | ||
244 | 274 | ||
245 | 275 | ||
246 | /** | 276 | /** |
@@ -253,8 +283,8 @@ GNUNET_MESH_peer_request_connect_all (struct GNUNET_MESH_Handle *h, | |||
253 | */ | 283 | */ |
254 | void | 284 | void |
255 | GNUNET_MESH_peer_request_connect_add (struct GNUNET_MESH_Tunnel *tunnel, | 285 | GNUNET_MESH_peer_request_connect_add (struct GNUNET_MESH_Tunnel *tunnel, |
256 | struct GNUNET_TIME_Relative timeout, | 286 | struct GNUNET_TIME_Relative timeout, |
257 | const struct GNUNET_PeerIdentity *peer); | 287 | const struct GNUNET_PeerIdentity *peer); |
258 | 288 | ||
259 | 289 | ||
260 | /** | 290 | /** |
@@ -266,7 +296,7 @@ GNUNET_MESH_peer_request_connect_add (struct GNUNET_MESH_Tunnel *tunnel, | |||
266 | */ | 296 | */ |
267 | void | 297 | void |
268 | GNUNET_MESH_peer_request_connect_del (struct GNUNET_MESH_Tunnel *tunnel, | 298 | GNUNET_MESH_peer_request_connect_del (struct GNUNET_MESH_Tunnel *tunnel, |
269 | const struct GNUNET_PeerIdentity *peer); | 299 | const struct GNUNET_PeerIdentity *peer); |
270 | 300 | ||
271 | 301 | ||
272 | /** | 302 | /** |
@@ -286,13 +316,20 @@ GNUNET_MESH_peer_request_connect_del (struct GNUNET_MESH_Tunnel *tunnel, | |||
286 | * @param handler_cls closure for handler | 316 | * @param handler_cls closure for handler |
287 | * @return NULL on error (handler will not be called), otherwise handle for cancellation | 317 | * @return NULL on error (handler will not be called), otherwise handle for cancellation |
288 | */ | 318 | */ |
289 | struct GNUNET_MESH_Tunnel * | 319 | struct GNUNET_MESH_Tunnel *GNUNET_MESH_peer_request_connect_by_type (struct |
290 | GNUNET_MESH_peer_request_connect_by_type (struct GNUNET_MESH_Handle *h, | 320 | GNUNET_MESH_Handle |
291 | struct GNUNET_TIME_Relative timeout, | 321 | *h, |
292 | GNUNET_MESH_ApplicationType app_type, | 322 | struct |
293 | GNUNET_MESH_TunnelConnectHandler connect_handler, | 323 | GNUNET_TIME_Relative |
294 | GNUNET_MESH_TunnelDisconnectHandler disconnect_handler, | 324 | timeout, |
295 | void *handler_cls); | 325 | GNUNET_MESH_ApplicationType |
326 | app_type, | ||
327 | GNUNET_MESH_TunnelConnectHandler | ||
328 | connect_handler, | ||
329 | GNUNET_MESH_TunnelDisconnectHandler | ||
330 | disconnect_handler, | ||
331 | void | ||
332 | *handler_cls); | ||
296 | 333 | ||
297 | 334 | ||
298 | /** | 335 | /** |
@@ -301,8 +338,7 @@ GNUNET_MESH_peer_request_connect_by_type (struct GNUNET_MESH_Handle *h, | |||
301 | * | 338 | * |
302 | * @param req request handle that was returned for the original request | 339 | * @param req request handle that was returned for the original request |
303 | */ | 340 | */ |
304 | void | 341 | void GNUNET_MESH_peer_request_connect_cancel (struct GNUNET_MESH_Tunnel *req); |
305 | GNUNET_MESH_peer_request_connect_cancel (struct GNUNET_MESH_Tunnel *req); | ||
306 | 342 | ||
307 | 343 | ||
308 | /** | 344 | /** |
@@ -332,22 +368,25 @@ struct GNUNET_MESH_TransmitHandle; | |||
332 | * NULL if we can not even queue the request (insufficient | 368 | * NULL if we can not even queue the request (insufficient |
333 | * memory); if NULL is returned, "notify" will NOT be called. | 369 | * memory); if NULL is returned, "notify" will NOT be called. |
334 | */ | 370 | */ |
335 | struct GNUNET_MESH_TransmitHandle * | 371 | struct GNUNET_MESH_TransmitHandle *GNUNET_MESH_notify_transmit_ready (struct |
336 | GNUNET_MESH_notify_transmit_ready (struct | 372 | GNUNET_MESH_Tunnel |
337 | GNUNET_MESH_Tunnel | 373 | *tunnel, |
338 | *tunnel, | 374 | int cork, |
339 | int cork, | 375 | uint32_t |
340 | uint32_t priority, | 376 | priority, |
341 | struct | 377 | struct |
342 | GNUNET_TIME_Relative | 378 | GNUNET_TIME_Relative |
343 | maxdelay, | 379 | maxdelay, |
344 | const struct GNUNET_PeerIdentity *target, | 380 | const |
345 | size_t | 381 | struct |
346 | notify_size, | 382 | GNUNET_PeerIdentity |
347 | GNUNET_CONNECTION_TransmitReadyNotify | 383 | *target, |
348 | notify, | 384 | size_t |
349 | void | 385 | notify_size, |
350 | *notify_cls); | 386 | GNUNET_CONNECTION_TransmitReadyNotify |
387 | notify, | ||
388 | void | ||
389 | *notify_cls); | ||
351 | 390 | ||
352 | 391 | ||
353 | /** | 392 | /** |
@@ -359,13 +398,16 @@ void | |||
359 | GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle | 398 | GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle |
360 | *th); | 399 | *th); |
361 | 400 | ||
362 | void GNUNET_MESH_tunnel_set_head(struct GNUNET_MESH_Tunnel* tunnel, void* head); | 401 | void GNUNET_MESH_tunnel_set_head (struct GNUNET_MESH_Tunnel *tunnel, |
363 | void GNUNET_MESH_tunnel_set_tail(struct GNUNET_MESH_Tunnel* tunnel, void* tail); | 402 | void *head); |
364 | void* GNUNET_MESH_tunnel_get_head(struct GNUNET_MESH_Tunnel* tunnel); | 403 | void GNUNET_MESH_tunnel_set_tail (struct GNUNET_MESH_Tunnel *tunnel, |
365 | void* GNUNET_MESH_tunnel_get_tail(struct GNUNET_MESH_Tunnel* tunnel); | 404 | void *tail); |
405 | void *GNUNET_MESH_tunnel_get_head (struct GNUNET_MESH_Tunnel *tunnel); | ||
406 | void *GNUNET_MESH_tunnel_get_tail (struct GNUNET_MESH_Tunnel *tunnel); | ||
366 | 407 | ||
367 | void GNUNET_MESH_tunnel_set_data(struct GNUNET_MESH_Tunnel* tunnel, void* data); | 408 | void GNUNET_MESH_tunnel_set_data (struct GNUNET_MESH_Tunnel *tunnel, |
368 | void* GNUNET_MESH_tunnel_get_data(struct GNUNET_MESH_Tunnel* tunnel); | 409 | void *data); |
410 | void *GNUNET_MESH_tunnel_get_data (struct GNUNET_MESH_Tunnel *tunnel); | ||
369 | 411 | ||
370 | #if 0 /* keep Emacsens' auto-indent happy */ | 412 | #if 0 /* keep Emacsens' auto-indent happy */ |
371 | { | 413 | { |
diff --git a/src/include/gnunet_mesh_service_new.h b/src/include/gnunet_mesh_service_new.h index 7d1570550..7146faa75 100644 --- a/src/include/gnunet_mesh_service_new.h +++ b/src/include/gnunet_mesh_service_new.h | |||
@@ -68,13 +68,13 @@ struct GNUNET_MESH_Tunnel; | |||
68 | * GNUNET_SYSERR to close it (signal serious error) | 68 | * GNUNET_SYSERR to close it (signal serious error) |
69 | */ | 69 | */ |
70 | typedef int | 70 | typedef int |
71 | (*GNUNET_MESH_MessageCallback) (void *cls, | 71 | (*GNUNET_MESH_MessageCallback) (void *cls, |
72 | struct GNUNET_MESH_Tunnel *tunnel, | 72 | struct GNUNET_MESH_Tunnel * tunnel, |
73 | void **tunnel_ctx, | 73 | void **tunnel_ctx, |
74 | const struct GNUNET_PeerIdentity *sender, | 74 | const struct GNUNET_PeerIdentity * sender, |
75 | const struct GNUNET_MessageHeader *message, | 75 | const struct GNUNET_MessageHeader * message, |
76 | const struct GNUNET_TRANSPORT_ATS_Information | 76 | const struct |
77 | *atsi); | 77 | GNUNET_TRANSPORT_ATS_Information * atsi); |
78 | 78 | ||
79 | 79 | ||
80 | /** | 80 | /** |
@@ -112,10 +112,9 @@ struct GNUNET_MESH_MessageHandler | |||
112 | * @param tunnel_ctx place where local state associated | 112 | * @param tunnel_ctx place where local state associated |
113 | * with the tunnel is stored | 113 | * with the tunnel is stored |
114 | */ | 114 | */ |
115 | typedef void (GNUNET_MESH_TunnelEndHandler)(void *cls, | 115 | typedef void (GNUNET_MESH_TunnelEndHandler) (void *cls, |
116 | const struct GNUNET_MESH_Tunnel | 116 | const struct GNUNET_MESH_Tunnel |
117 | *tunnel, | 117 | * tunnel, void **tunnel_ctx); |
118 | void **tunnel_ctx); | ||
119 | 118 | ||
120 | 119 | ||
121 | /** | 120 | /** |
@@ -139,12 +138,17 @@ typedef uint32_t GNUNET_MESH_ApplicationType; | |||
139 | * @return handle to the mesh service NULL on error | 138 | * @return handle to the mesh service NULL on error |
140 | * (in this case, init is never called) | 139 | * (in this case, init is never called) |
141 | */ | 140 | */ |
142 | struct GNUNET_MESH_Handle * | 141 | struct GNUNET_MESH_Handle *GNUNET_MESH_connect (const struct |
143 | GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 142 | GNUNET_CONFIGURATION_Handle |
144 | void *cls, | 143 | *cfg, void *cls, |
145 | GNUNET_MESH_TunnelEndHandler cleaner, | 144 | GNUNET_MESH_TunnelEndHandler |
146 | const struct GNUNET_MESH_MessageHandler *handlers, | 145 | cleaner, |
147 | const GNUNET_MESH_ApplicationType *stypes); | 146 | const struct |
147 | GNUNET_MESH_MessageHandler | ||
148 | *handlers, | ||
149 | const | ||
150 | GNUNET_MESH_ApplicationType | ||
151 | *stypes); | ||
148 | 152 | ||
149 | 153 | ||
150 | /** | 154 | /** |
@@ -162,7 +166,9 @@ void GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle); | |||
162 | * @param peer peer identity the tunnel stopped working with | 166 | * @param peer peer identity the tunnel stopped working with |
163 | */ | 167 | */ |
164 | typedef void (*GNUNET_MESH_TunnelDisconnectHandler) (void *cls, | 168 | typedef void (*GNUNET_MESH_TunnelDisconnectHandler) (void *cls, |
165 | const struct GNUNET_PeerIdentity *peer); | 169 | const struct |
170 | GNUNET_PeerIdentity * | ||
171 | peer); | ||
166 | 172 | ||
167 | 173 | ||
168 | /** | 174 | /** |
@@ -173,8 +179,11 @@ typedef void (*GNUNET_MESH_TunnelDisconnectHandler) (void *cls, | |||
173 | * @param atsi performance data for the connection | 179 | * @param atsi performance data for the connection |
174 | */ | 180 | */ |
175 | typedef void (*GNUNET_MESH_TunnelConnectHandler) (void *cls, | 181 | typedef void (*GNUNET_MESH_TunnelConnectHandler) (void *cls, |
176 | const struct GNUNET_PeerIdentity *peer, | 182 | const struct |
177 | const struct GNUNET_TRANSPORT_ATS_Information *atsi); | 183 | GNUNET_PeerIdentity * peer, |
184 | const struct | ||
185 | GNUNET_TRANSPORT_ATS_Information | ||
186 | * atsi); | ||
178 | 187 | ||
179 | 188 | ||
180 | 189 | ||
@@ -187,21 +196,20 @@ typedef void (*GNUNET_MESH_TunnelConnectHandler) (void *cls, | |||
187 | * @param disconnect_handler function to call when peers are disconnected | 196 | * @param disconnect_handler function to call when peers are disconnected |
188 | * @param handler_cls closure for connect/disconnect handlers | 197 | * @param handler_cls closure for connect/disconnect handlers |
189 | */ | 198 | */ |
190 | struct GNUNET_MESH_Tunnel * | 199 | struct GNUNET_MESH_Tunnel *GNUNET_MESH_tunnel_create (struct GNUNET_MESH_Handle |
191 | GNUNET_MESH_tunnel_create (struct GNUNET_MESH_Handle *h, | 200 | *h, |
192 | GNUNET_MESH_TunnelConnectHandler | 201 | GNUNET_MESH_TunnelConnectHandler |
193 | connect_handler, | 202 | connect_handler, |
194 | GNUNET_MESH_TunnelDisconnectHandler | 203 | GNUNET_MESH_TunnelDisconnectHandler |
195 | disconnect_handler, | 204 | disconnect_handler, |
196 | void *handler_cls); | 205 | void *handler_cls); |
197 | 206 | ||
198 | /** | 207 | /** |
199 | * Destroy an existing tunnel. | 208 | * Destroy an existing tunnel. |
200 | * | 209 | * |
201 | * @param tun tunnel handle | 210 | * @param tun tunnel handle |
202 | */ | 211 | */ |
203 | void | 212 | void GNUNET_MESH_tunnel_destroy (struct GNUNET_MESH_Tunnel *tun); |
204 | GNUNET_MESH_tunnel_destroy (struct GNUNET_MESH_Tunnel *tun); | ||
205 | 213 | ||
206 | 214 | ||
207 | /** | 215 | /** |
@@ -214,8 +222,8 @@ GNUNET_MESH_tunnel_destroy (struct GNUNET_MESH_Tunnel *tun); | |||
214 | */ | 222 | */ |
215 | void | 223 | void |
216 | GNUNET_MESH_peer_request_connect_add (struct GNUNET_MESH_Tunnel *tunnel, | 224 | GNUNET_MESH_peer_request_connect_add (struct GNUNET_MESH_Tunnel *tunnel, |
217 | struct GNUNET_TIME_Relative timeout, | 225 | struct GNUNET_TIME_Relative timeout, |
218 | const struct GNUNET_PeerIdentity *peer); | 226 | const struct GNUNET_PeerIdentity *peer); |
219 | 227 | ||
220 | 228 | ||
221 | /** | 229 | /** |
@@ -227,7 +235,7 @@ GNUNET_MESH_peer_request_connect_add (struct GNUNET_MESH_Tunnel *tunnel, | |||
227 | */ | 235 | */ |
228 | void | 236 | void |
229 | GNUNET_MESH_peer_request_connect_del (struct GNUNET_MESH_Tunnel *tunnel, | 237 | GNUNET_MESH_peer_request_connect_del (struct GNUNET_MESH_Tunnel *tunnel, |
230 | const struct GNUNET_PeerIdentity *peer); | 238 | const struct GNUNET_PeerIdentity *peer); |
231 | 239 | ||
232 | 240 | ||
233 | /** | 241 | /** |
@@ -241,8 +249,8 @@ GNUNET_MESH_peer_request_connect_del (struct GNUNET_MESH_Tunnel *tunnel, | |||
241 | */ | 249 | */ |
242 | void | 250 | void |
243 | GNUNET_MESH_peer_request_connect_by_type (struct GNUNET_MESH_Tunnel *tunnel, | 251 | GNUNET_MESH_peer_request_connect_by_type (struct GNUNET_MESH_Tunnel *tunnel, |
244 | struct GNUNET_TIME_Relative timeout, | 252 | struct GNUNET_TIME_Relative timeout, |
245 | GNUNET_MESH_ApplicationType app_type); | 253 | GNUNET_MESH_ApplicationType app_type); |
246 | 254 | ||
247 | 255 | ||
248 | /** | 256 | /** |
@@ -271,22 +279,25 @@ struct GNUNET_MESH_TransmitHandle; | |||
271 | * NULL if we can not even queue the request (insufficient | 279 | * NULL if we can not even queue the request (insufficient |
272 | * memory); if NULL is returned, "notify" will NOT be called. | 280 | * memory); if NULL is returned, "notify" will NOT be called. |
273 | */ | 281 | */ |
274 | struct GNUNET_MESH_TransmitHandle * | 282 | struct GNUNET_MESH_TransmitHandle *GNUNET_MESH_notify_transmit_ready (struct |
275 | GNUNET_MESH_notify_transmit_ready (struct | 283 | GNUNET_MESH_Tunnel |
276 | GNUNET_MESH_Tunnel | 284 | *tunnel, |
277 | *tunnel, | 285 | int cork, |
278 | int cork, | 286 | uint32_t |
279 | uint32_t priority, | 287 | priority, |
280 | struct | 288 | struct |
281 | GNUNET_TIME_Relative | 289 | GNUNET_TIME_Relative |
282 | maxdelay, | 290 | maxdelay, |
283 | const struct GNUNET_PeerIdentity *target, | 291 | const |
284 | size_t | 292 | struct |
285 | notify_size, | 293 | GNUNET_PeerIdentity |
286 | GNUNET_CONNECTION_TransmitReadyNotify | 294 | *target, |
287 | notify, | 295 | size_t |
288 | void | 296 | notify_size, |
289 | *notify_cls); | 297 | GNUNET_CONNECTION_TransmitReadyNotify |
298 | notify, | ||
299 | void | ||
300 | *notify_cls); | ||
290 | 301 | ||
291 | 302 | ||
292 | /** | 303 | /** |
diff --git a/src/include/gnunet_nat_lib.h b/src/include/gnunet_nat_lib.h index 2ab3eccb6..a84f684a7 100644 --- a/src/include/gnunet_nat_lib.h +++ b/src/include/gnunet_nat_lib.h | |||
@@ -41,9 +41,9 @@ | |||
41 | * @param addr either the previous or the new public IP address | 41 | * @param addr either the previous or the new public IP address |
42 | * @param addrlen actual lenght of the address | 42 | * @param addrlen actual lenght of the address |
43 | */ | 43 | */ |
44 | typedef void (*GNUNET_NAT_AddressCallback) (void *cls, | 44 | typedef void (*GNUNET_NAT_AddressCallback) (void *cls, |
45 | int add_remove, | 45 | int add_remove, |
46 | const struct sockaddr *addr, | 46 | const struct sockaddr * addr, |
47 | socklen_t addrlen); | 47 | socklen_t addrlen); |
48 | 48 | ||
49 | 49 | ||
@@ -56,9 +56,9 @@ typedef void (*GNUNET_NAT_AddressCallback) (void *cls, | |||
56 | * @param addr public IP address of the other peer | 56 | * @param addr public IP address of the other peer |
57 | * @param addrlen actual lenght of the address | 57 | * @param addrlen actual lenght of the address |
58 | */ | 58 | */ |
59 | typedef void (*GNUNET_NAT_ReversalCallback) (void *cls, | 59 | typedef void (*GNUNET_NAT_ReversalCallback) (void *cls, |
60 | const struct sockaddr *addr, | 60 | const struct sockaddr * addr, |
61 | socklen_t addrlen); | 61 | socklen_t addrlen); |
62 | 62 | ||
63 | 63 | ||
64 | /** | 64 | /** |
@@ -87,16 +87,17 @@ struct GNUNET_NAT_Handle; | |||
87 | * @param callback_cls closure for callback | 87 | * @param callback_cls closure for callback |
88 | * @return NULL on error, otherwise handle that can be used to unregister | 88 | * @return NULL on error, otherwise handle that can be used to unregister |
89 | */ | 89 | */ |
90 | struct GNUNET_NAT_Handle * | 90 | struct GNUNET_NAT_Handle *GNUNET_NAT_register (const struct |
91 | GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, | 91 | GNUNET_CONFIGURATION_Handle *cfg, |
92 | int is_tcp, | 92 | int is_tcp, uint16_t adv_port, |
93 | uint16_t adv_port, | 93 | unsigned int num_addrs, |
94 | unsigned int num_addrs, | 94 | const struct sockaddr **addrs, |
95 | const struct sockaddr **addrs, | 95 | const socklen_t * addrlens, |
96 | const socklen_t *addrlens, | 96 | GNUNET_NAT_AddressCallback |
97 | GNUNET_NAT_AddressCallback address_callback, | 97 | address_callback, |
98 | GNUNET_NAT_ReversalCallback reversal_callback, | 98 | GNUNET_NAT_ReversalCallback |
99 | void *callback_cls); | 99 | reversal_callback, |
100 | void *callback_cls); | ||
100 | 101 | ||
101 | 102 | ||
102 | /** | 103 | /** |
@@ -111,8 +112,7 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
111 | */ | 112 | */ |
112 | int | 113 | int |
113 | GNUNET_NAT_test_address (struct GNUNET_NAT_Handle *h, | 114 | GNUNET_NAT_test_address (struct GNUNET_NAT_Handle *h, |
114 | const void *addr, | 115 | const void *addr, socklen_t addrlen); |
115 | socklen_t addrlen); | ||
116 | 116 | ||
117 | 117 | ||
118 | /** | 118 | /** |
@@ -125,7 +125,7 @@ GNUNET_NAT_test_address (struct GNUNET_NAT_Handle *h, | |||
125 | */ | 125 | */ |
126 | void | 126 | void |
127 | GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h, | 127 | GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h, |
128 | const struct sockaddr_in *sa); | 128 | const struct sockaddr_in *sa); |
129 | 129 | ||
130 | 130 | ||
131 | 131 | ||
@@ -135,8 +135,7 @@ GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h, | |||
135 | * | 135 | * |
136 | * @param h the handle to stop | 136 | * @param h the handle to stop |
137 | */ | 137 | */ |
138 | void | 138 | void GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *h); |
139 | GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *h); | ||
140 | 139 | ||
141 | 140 | ||
142 | /** | 141 | /** |
@@ -153,8 +152,7 @@ struct GNUNET_NAT_Test; | |||
153 | * GNUNET_SYSERR if the test could not be | 152 | * GNUNET_SYSERR if the test could not be |
154 | * properly started (internal failure) | 153 | * properly started (internal failure) |
155 | */ | 154 | */ |
156 | typedef void (*GNUNET_NAT_TestCallback)(void *cls, | 155 | typedef void (*GNUNET_NAT_TestCallback) (void *cls, int success); |
157 | int success); | ||
158 | 156 | ||
159 | /** | 157 | /** |
160 | * Start testing if NAT traversal works using the | 158 | * Start testing if NAT traversal works using the |
@@ -168,13 +166,12 @@ typedef void (*GNUNET_NAT_TestCallback)(void *cls, | |||
168 | * @param report_cls closure for report | 166 | * @param report_cls closure for report |
169 | * @return handle to cancel NAT test | 167 | * @return handle to cancel NAT test |
170 | */ | 168 | */ |
171 | struct GNUNET_NAT_Test * | 169 | struct GNUNET_NAT_Test *GNUNET_NAT_test_start (const struct |
172 | GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | 170 | GNUNET_CONFIGURATION_Handle *cfg, |
173 | int is_tcp, | 171 | int is_tcp, uint16_t bnd_port, |
174 | uint16_t bnd_port, | 172 | uint16_t adv_port, |
175 | uint16_t adv_port, | 173 | GNUNET_NAT_TestCallback report, |
176 | GNUNET_NAT_TestCallback report, | 174 | void *report_cls); |
177 | void *report_cls); | ||
178 | 175 | ||
179 | 176 | ||
180 | /** | 177 | /** |
@@ -182,8 +179,7 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
182 | * | 179 | * |
183 | * @param tst test to stop. | 180 | * @param tst test to stop. |
184 | */ | 181 | */ |
185 | void | 182 | void GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst); |
186 | GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst); | ||
187 | 183 | ||
188 | 184 | ||
189 | /** | 185 | /** |
@@ -192,8 +188,7 @@ GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst); | |||
192 | * @param cls closure | 188 | * @param cls closure |
193 | * @param addr the address, NULL on errors | 189 | * @param addr the address, NULL on errors |
194 | */ | 190 | */ |
195 | typedef void (*GNUNET_NAT_IPCallback)(void *cls, | 191 | typedef void (*GNUNET_NAT_IPCallback) (void *cls, const struct in_addr * addr); |
196 | const struct in_addr *addr); | ||
197 | 192 | ||
198 | 193 | ||
199 | 194 | ||
@@ -211,10 +206,13 @@ struct GNUNET_NAT_ExternalHandle; | |||
211 | * @param cb_cls closure for 'cb' | 206 | * @param cb_cls closure for 'cb' |
212 | * @return handle for cancellation (can only be used until 'cb' is called), NULL on error | 207 | * @return handle for cancellation (can only be used until 'cb' is called), NULL on error |
213 | */ | 208 | */ |
214 | struct GNUNET_NAT_ExternalHandle * | 209 | struct GNUNET_NAT_ExternalHandle *GNUNET_NAT_mini_get_external_ipv4 (struct |
215 | GNUNET_NAT_mini_get_external_ipv4 (struct GNUNET_TIME_Relative timeout, | 210 | GNUNET_TIME_Relative |
216 | GNUNET_NAT_IPCallback cb, | 211 | timeout, |
217 | void *cb_cls); | 212 | GNUNET_NAT_IPCallback |
213 | cb, | ||
214 | void | ||
215 | *cb_cls); | ||
218 | 216 | ||
219 | 217 | ||
220 | /** | 218 | /** |
@@ -228,7 +226,7 @@ GNUNET_NAT_mini_get_external_ipv4_cancel (struct GNUNET_NAT_ExternalHandle *eh); | |||
228 | 226 | ||
229 | /** | 227 | /** |
230 | * Handle to a mapping created with upnpc. | 228 | * Handle to a mapping created with upnpc. |
231 | */ | 229 | */ |
232 | struct GNUNET_NAT_MiniHandle; | 230 | struct GNUNET_NAT_MiniHandle; |
233 | 231 | ||
234 | 232 | ||
@@ -245,11 +243,10 @@ struct GNUNET_NAT_MiniHandle; | |||
245 | * @param ac_cls closure for 'ac' | 243 | * @param ac_cls closure for 'ac' |
246 | * @return NULL on error | 244 | * @return NULL on error |
247 | */ | 245 | */ |
248 | struct GNUNET_NAT_MiniHandle * | 246 | struct GNUNET_NAT_MiniHandle *GNUNET_NAT_mini_map_start (uint16_t port, |
249 | GNUNET_NAT_mini_map_start (uint16_t port, | 247 | int is_tcp, |
250 | int is_tcp, | 248 | GNUNET_NAT_AddressCallback |
251 | GNUNET_NAT_AddressCallback ac, | 249 | ac, void *ac_cls); |
252 | void *ac_cls); | ||
253 | 250 | ||
254 | 251 | ||
255 | /** | 252 | /** |
@@ -260,10 +257,9 @@ GNUNET_NAT_mini_map_start (uint16_t port, | |||
260 | * | 257 | * |
261 | * @param mini the handle | 258 | * @param mini the handle |
262 | */ | 259 | */ |
263 | void | 260 | void GNUNET_NAT_mini_map_stop (struct GNUNET_NAT_MiniHandle *mini); |
264 | GNUNET_NAT_mini_map_stop (struct GNUNET_NAT_MiniHandle *mini); | ||
265 | 261 | ||
266 | 262 | ||
267 | #endif | 263 | #endif |
268 | 264 | ||
269 | /* end of gnunet_nat_lib.h */ | 265 | /* end of gnunet_nat_lib.h */ |
diff --git a/src/include/gnunet_network_lib.h b/src/include/gnunet_network_lib.h index 1405efa2a..ecc4adf41 100644 --- a/src/include/gnunet_network_lib.h +++ b/src/include/gnunet_network_lib.h | |||
@@ -98,8 +98,7 @@ struct GNUNET_NETWORK_Handle *GNUNET_NETWORK_socket_accept (const struct | |||
98 | * @param fd socket to box | 98 | * @param fd socket to box |
99 | * @return NULL on error (including not supported on target platform) | 99 | * @return NULL on error (including not supported on target platform) |
100 | */ | 100 | */ |
101 | struct GNUNET_NETWORK_Handle * | 101 | struct GNUNET_NETWORK_Handle *GNUNET_NETWORK_socket_box_native (int fd); |
102 | GNUNET_NETWORK_socket_box_native (int fd); | ||
103 | 102 | ||
104 | 103 | ||
105 | /** | 104 | /** |
@@ -181,10 +180,16 @@ GNUNET_NETWORK_socket_recvfrom_amount (const struct GNUNET_NETWORK_Handle | |||
181 | * @param addrlen length of the addr | 180 | * @param addrlen length of the addr |
182 | */ | 181 | */ |
183 | ssize_t | 182 | ssize_t |
183 | |||
184 | |||
185 | |||
186 | |||
187 | |||
188 | |||
189 | |||
184 | GNUNET_NETWORK_socket_recvfrom (const struct GNUNET_NETWORK_Handle *desc, | 190 | GNUNET_NETWORK_socket_recvfrom (const struct GNUNET_NETWORK_Handle *desc, |
185 | void *buffer, size_t length, | 191 | void *buffer, size_t length, |
186 | struct sockaddr *src_addr, | 192 | struct sockaddr *src_addr, socklen_t * addrlen); |
187 | socklen_t * addrlen); | ||
188 | 193 | ||
189 | 194 | ||
190 | /** | 195 | /** |
@@ -322,8 +327,8 @@ void GNUNET_NETWORK_fdset_set (struct GNUNET_NETWORK_FDSet *fds, | |||
322 | * @param h the file handle to add | 327 | * @param h the file handle to add |
323 | */ | 328 | */ |
324 | void | 329 | void |
325 | GNUNET_NETWORK_fdset_handle_set_native_w32_handle (struct GNUNET_NETWORK_FDSet *fds, | 330 | GNUNET_NETWORK_fdset_handle_set_native_w32_handle (struct GNUNET_NETWORK_FDSet |
326 | HANDLE h); | 331 | *fds, HANDLE h); |
327 | #endif | 332 | #endif |
328 | 333 | ||
329 | 334 | ||
@@ -380,8 +385,7 @@ void GNUNET_NETWORK_fdset_copy_native (struct GNUNET_NETWORK_FDSet *to, | |||
380 | * @param to destination | 385 | * @param to destination |
381 | * @param nfd native FD to set | 386 | * @param nfd native FD to set |
382 | */ | 387 | */ |
383 | void GNUNET_NETWORK_fdset_set_native (struct GNUNET_NETWORK_FDSet *to, | 388 | void GNUNET_NETWORK_fdset_set_native (struct GNUNET_NETWORK_FDSet *to, int nfd); |
384 | int nfd); | ||
385 | 389 | ||
386 | 390 | ||
387 | /** | 391 | /** |
@@ -391,9 +395,9 @@ void GNUNET_NETWORK_fdset_set_native (struct GNUNET_NETWORK_FDSet *to, | |||
391 | * @param nfd native FD to test, -1 for none | 395 | * @param nfd native FD to test, -1 for none |
392 | * @return GNUNET_YES if to contains nfd | 396 | * @return GNUNET_YES if to contains nfd |
393 | */ | 397 | */ |
394 | int | 398 | int |
395 | GNUNET_NETWORK_fdset_test_native (const struct GNUNET_NETWORK_FDSet *to, | 399 | GNUNET_NETWORK_fdset_test_native (const struct GNUNET_NETWORK_FDSet *to, |
396 | int nfd); | 400 | int nfd); |
397 | 401 | ||
398 | 402 | ||
399 | /** | 403 | /** |
@@ -412,8 +416,7 @@ void GNUNET_NETWORK_fdset_handle_set (struct GNUNET_NETWORK_FDSet *fds, | |||
412 | * @return GNUNET_YES if the file handle is part of the set | 416 | * @return GNUNET_YES if the file handle is part of the set |
413 | */ | 417 | */ |
414 | int GNUNET_NETWORK_fdset_handle_isset (const struct GNUNET_NETWORK_FDSet *fds, | 418 | int GNUNET_NETWORK_fdset_handle_isset (const struct GNUNET_NETWORK_FDSet *fds, |
415 | const struct GNUNET_DISK_FileHandle | 419 | const struct GNUNET_DISK_FileHandle *h); |
416 | *h); | ||
417 | 420 | ||
418 | 421 | ||
419 | /** | 422 | /** |
diff --git a/src/include/gnunet_nse_service.h b/src/include/gnunet_nse_service.h index dca2e105f..91711ef5b 100644 --- a/src/include/gnunet_nse_service.h +++ b/src/include/gnunet_nse_service.h | |||
@@ -63,8 +63,7 @@ struct GNUNET_NSE_Handle; | |||
63 | */ | 63 | */ |
64 | typedef void (*GNUNET_NSE_Callback) (void *cls, | 64 | typedef void (*GNUNET_NSE_Callback) (void *cls, |
65 | struct GNUNET_TIME_Absolute timestamp, | 65 | struct GNUNET_TIME_Absolute timestamp, |
66 | double logestimate, | 66 | double logestimate, double std_dev); |
67 | double std_dev); | ||
68 | 67 | ||
69 | 68 | ||
70 | /** | 69 | /** |
@@ -85,9 +84,10 @@ typedef void (*GNUNET_NSE_Callback) (void *cls, | |||
85 | * | 84 | * |
86 | * @return handle to use | 85 | * @return handle to use |
87 | */ | 86 | */ |
88 | struct GNUNET_NSE_Handle * | 87 | struct GNUNET_NSE_Handle *GNUNET_NSE_connect (const struct |
89 | GNUNET_NSE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 88 | GNUNET_CONFIGURATION_Handle *cfg, |
90 | GNUNET_NSE_Callback func, void *func_cls); | 89 | GNUNET_NSE_Callback func, |
90 | void *func_cls); | ||
91 | 91 | ||
92 | 92 | ||
93 | /** | 93 | /** |
@@ -96,8 +96,7 @@ GNUNET_NSE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
96 | * @param h handle to destroy | 96 | * @param h handle to destroy |
97 | * | 97 | * |
98 | */ | 98 | */ |
99 | void | 99 | void GNUNET_NSE_disconnect (struct GNUNET_NSE_Handle *h); |
100 | GNUNET_NSE_disconnect (struct GNUNET_NSE_Handle *h); | ||
101 | 100 | ||
102 | 101 | ||
103 | #if 0 /* keep Emacsens' auto-indent happy */ | 102 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_os_lib.h b/src/include/gnunet_os_lib.h index 48027e922..b285e3b60 100644 --- a/src/include/gnunet_os_lib.h +++ b/src/include/gnunet_os_lib.h | |||
@@ -211,8 +211,7 @@ void GNUNET_OS_process_close (struct GNUNET_OS_Process *proc); | |||
211 | * | 211 | * |
212 | * @return the current process id | 212 | * @return the current process id |
213 | */ | 213 | */ |
214 | pid_t | 214 | pid_t GNUNET_OS_process_get_pid (struct GNUNET_OS_Process *proc); |
215 | GNUNET_OS_process_get_pid (struct GNUNET_OS_Process *proc); | ||
216 | 215 | ||
217 | /** | 216 | /** |
218 | * Set process priority | 217 | * Set process priority |
@@ -234,10 +233,11 @@ int GNUNET_OS_set_process_priority (struct GNUNET_OS_Process *proc, | |||
234 | * @param ... NULL-terminated list of arguments to the process | 233 | * @param ... NULL-terminated list of arguments to the process |
235 | * @return pointer to process structure of the new process, NULL on error | 234 | * @return pointer to process structure of the new process, NULL on error |
236 | */ | 235 | */ |
237 | struct GNUNET_OS_Process * | 236 | struct GNUNET_OS_Process *GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle |
238 | GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, | 237 | *pipe_stdin, |
239 | struct GNUNET_DISK_PipeHandle *pipe_stdout, | 238 | struct GNUNET_DISK_PipeHandle |
240 | const char *filename, ...); | 239 | *pipe_stdout, |
240 | const char *filename, ...); | ||
241 | 241 | ||
242 | 242 | ||
243 | /** | 243 | /** |
@@ -249,11 +249,14 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
249 | * @param va NULL-terminated list of arguments to the process | 249 | * @param va NULL-terminated list of arguments to the process |
250 | * @return pointer to process structure of the new process, NULL on error | 250 | * @return pointer to process structure of the new process, NULL on error |
251 | */ | 251 | */ |
252 | struct GNUNET_OS_Process * | 252 | struct GNUNET_OS_Process *GNUNET_OS_start_process_va (struct |
253 | GNUNET_OS_start_process_va (struct GNUNET_DISK_PipeHandle *pipe_stdin, | 253 | GNUNET_DISK_PipeHandle |
254 | struct GNUNET_DISK_PipeHandle *pipe_stdout, | 254 | *pipe_stdin, |
255 | const char *filename, | 255 | struct |
256 | va_list va); | 256 | GNUNET_DISK_PipeHandle |
257 | *pipe_stdout, | ||
258 | const char *filename, | ||
259 | va_list va); | ||
257 | 260 | ||
258 | /** | 261 | /** |
259 | * Start a process. | 262 | * Start a process. |
@@ -265,9 +268,9 @@ GNUNET_OS_start_process_va (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
265 | * including the process name as the first argument | 268 | * including the process name as the first argument |
266 | * @return pointer to process structure of the new process, NULL on error | 269 | * @return pointer to process structure of the new process, NULL on error |
267 | */ | 270 | */ |
268 | struct GNUNET_OS_Process * | 271 | struct GNUNET_OS_Process *GNUNET_OS_start_process_v (const int *lsocks, |
269 | GNUNET_OS_start_process_v (const int *lsocks, const char *filename, | 272 | const char *filename, |
270 | char *const argv[]); | 273 | char *const argv[]); |
271 | 274 | ||
272 | 275 | ||
273 | /** | 276 | /** |
@@ -281,16 +284,14 @@ struct GNUNET_OS_CommandHandle; | |||
281 | * @param cls closure | 284 | * @param cls closure |
282 | * @param line line of output from a command, NULL for the end | 285 | * @param line line of output from a command, NULL for the end |
283 | */ | 286 | */ |
284 | typedef void (*GNUNET_OS_LineProcessor)(void *cls, | 287 | typedef void (*GNUNET_OS_LineProcessor) (void *cls, const char *line); |
285 | const char *line); | ||
286 | 288 | ||
287 | /** | 289 | /** |
288 | * Stop/kill a command. | 290 | * Stop/kill a command. |
289 | * | 291 | * |
290 | * @param cmd handle to the process | 292 | * @param cmd handle to the process |
291 | */ | 293 | */ |
292 | void | 294 | void GNUNET_OS_command_stop (struct GNUNET_OS_CommandHandle *cmd); |
293 | GNUNET_OS_command_stop (struct GNUNET_OS_CommandHandle *cmd); | ||
294 | 295 | ||
295 | 296 | ||
296 | /** | 297 | /** |
@@ -304,12 +305,12 @@ GNUNET_OS_command_stop (struct GNUNET_OS_CommandHandle *cmd); | |||
304 | * @param ... arguments to command | 305 | * @param ... arguments to command |
305 | * @return NULL on error | 306 | * @return NULL on error |
306 | */ | 307 | */ |
307 | struct GNUNET_OS_CommandHandle * | 308 | struct GNUNET_OS_CommandHandle *GNUNET_OS_command_run (GNUNET_OS_LineProcessor |
308 | GNUNET_OS_command_run (GNUNET_OS_LineProcessor proc, | 309 | proc, void *proc_cls, |
309 | void *proc_cls, | 310 | struct |
310 | struct GNUNET_TIME_Relative timeout, | 311 | GNUNET_TIME_Relative |
311 | const char *binary, | 312 | timeout, |
312 | ...); | 313 | const char *binary, ...); |
313 | 314 | ||
314 | 315 | ||
315 | /** | 316 | /** |
@@ -321,7 +322,8 @@ GNUNET_OS_command_run (GNUNET_OS_LineProcessor proc, | |||
321 | * @return GNUNET_OK on success, GNUNET_NO if the process is still running, GNUNET_SYSERR otherwise | 322 | * @return GNUNET_OK on success, GNUNET_NO if the process is still running, GNUNET_SYSERR otherwise |
322 | */ | 323 | */ |
323 | int GNUNET_OS_process_status (struct GNUNET_OS_Process *proc, | 324 | int GNUNET_OS_process_status (struct GNUNET_OS_Process *proc, |
324 | enum GNUNET_OS_ProcessStatusType *type, unsigned long *code); | 325 | enum GNUNET_OS_ProcessStatusType *type, |
326 | unsigned long *code); | ||
325 | 327 | ||
326 | 328 | ||
327 | /** | 329 | /** |
@@ -343,7 +345,7 @@ int GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc); | |||
343 | void | 345 | void |
344 | GNUNET_OS_install_parent_control_handler (void *cls, | 346 | GNUNET_OS_install_parent_control_handler (void *cls, |
345 | const struct | 347 | const struct |
346 | GNUNET_SCHEDULER_TaskContext * tc); | 348 | GNUNET_SCHEDULER_TaskContext *tc); |
347 | 349 | ||
348 | 350 | ||
349 | /** | 351 | /** |
@@ -357,8 +359,7 @@ GNUNET_OS_install_parent_control_handler (void *cls, | |||
357 | * GNUNET_NO if not SUID (but binary exists) | 359 | * GNUNET_NO if not SUID (but binary exists) |
358 | * GNUNET_SYSERR on error (no such binary or not executable) | 360 | * GNUNET_SYSERR on error (no such binary or not executable) |
359 | */ | 361 | */ |
360 | int | 362 | int GNUNET_OS_check_helper_binary (const char *binary); |
361 | GNUNET_OS_check_helper_binary (const char *binary); | ||
362 | 363 | ||
363 | 364 | ||
364 | #if 0 /* keep Emacsens' auto-indent happy */ | 365 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_peer_lib.h b/src/include/gnunet_peer_lib.h index b6cba7d32..da364dd44 100644 --- a/src/include/gnunet_peer_lib.h +++ b/src/include/gnunet_peer_lib.h | |||
@@ -63,7 +63,7 @@ GNUNET_PEER_Id GNUNET_PEER_search (const struct GNUNET_PeerIdentity *pid); | |||
63 | * @param pid identity to intern | 63 | * @param pid identity to intern |
64 | * @return the interned identity. | 64 | * @return the interned identity. |
65 | */ | 65 | */ |
66 | GNUNET_PEER_Id GNUNET_PEER_intern (const struct GNUNET_PeerIdentity * pid); | 66 | GNUNET_PEER_Id GNUNET_PEER_intern (const struct GNUNET_PeerIdentity *pid); |
67 | 67 | ||
68 | 68 | ||
69 | /** | 69 | /** |
@@ -81,8 +81,7 @@ void GNUNET_PEER_change_rc (GNUNET_PEER_Id id, int delta); | |||
81 | * @param ids array of PIDs to decrement the RCs of | 81 | * @param ids array of PIDs to decrement the RCs of |
82 | * @param count size of the ids array | 82 | * @param count size of the ids array |
83 | */ | 83 | */ |
84 | void GNUNET_PEER_decrement_rcs (const GNUNET_PEER_Id * ids, | 84 | void GNUNET_PEER_decrement_rcs (const GNUNET_PEER_Id *ids, unsigned int count); |
85 | unsigned int count); | ||
86 | 85 | ||
87 | 86 | ||
88 | /** | 87 | /** |
@@ -91,8 +90,7 @@ void GNUNET_PEER_decrement_rcs (const GNUNET_PEER_Id * ids, | |||
91 | * @param id interned PID to convert | 90 | * @param id interned PID to convert |
92 | * @param pid where to write the normal peer identity | 91 | * @param pid where to write the normal peer identity |
93 | */ | 92 | */ |
94 | void GNUNET_PEER_resolve (GNUNET_PEER_Id id, | 93 | void GNUNET_PEER_resolve (GNUNET_PEER_Id id, struct GNUNET_PeerIdentity *pid); |
95 | struct GNUNET_PeerIdentity * pid); | ||
96 | 94 | ||
97 | 95 | ||
98 | /* ifndef GNUNET_PEER_LIB_H */ | 96 | /* ifndef GNUNET_PEER_LIB_H */ |
diff --git a/src/include/gnunet_peerinfo_service.h b/src/include/gnunet_peerinfo_service.h index 1411168c0..04c63cbb1 100644 --- a/src/include/gnunet_peerinfo_service.h +++ b/src/include/gnunet_peerinfo_service.h | |||
@@ -54,9 +54,10 @@ struct GNUNET_PEERINFO_Handle; | |||
54 | * @return NULL on error (configuration related, actual connection | 54 | * @return NULL on error (configuration related, actual connection |
55 | * etablishment may happen asynchronously). | 55 | * etablishment may happen asynchronously). |
56 | */ | 56 | */ |
57 | struct GNUNET_PEERINFO_Handle * | 57 | struct GNUNET_PEERINFO_Handle *GNUNET_PEERINFO_connect (const struct |
58 | GNUNET_PEERINFO_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); | 58 | GNUNET_CONFIGURATION_Handle |
59 | 59 | *cfg); | |
60 | |||
60 | 61 | ||
61 | 62 | ||
62 | /** | 63 | /** |
@@ -68,8 +69,7 @@ GNUNET_PEERINFO_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); | |||
68 | * | 69 | * |
69 | * @param h handle to disconnect | 70 | * @param h handle to disconnect |
70 | */ | 71 | */ |
71 | void | 72 | void GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h); |
72 | GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h); | ||
73 | 73 | ||
74 | 74 | ||
75 | /** | 75 | /** |
@@ -85,7 +85,7 @@ GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h); | |||
85 | */ | 85 | */ |
86 | void | 86 | void |
87 | GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h, | 87 | GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h, |
88 | const struct GNUNET_HELLO_Message *hello); | 88 | const struct GNUNET_HELLO_Message *hello); |
89 | 89 | ||
90 | 90 | ||
91 | /** | 91 | /** |
@@ -98,10 +98,10 @@ GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h, | |||
98 | * @param error message | 98 | * @param error message |
99 | */ | 99 | */ |
100 | typedef void | 100 | typedef void |
101 | (*GNUNET_PEERINFO_Processor) (void *cls, | 101 | (*GNUNET_PEERINFO_Processor) (void *cls, |
102 | const struct GNUNET_PeerIdentity * peer, | 102 | const struct GNUNET_PeerIdentity * peer, |
103 | const struct GNUNET_HELLO_Message * hello, | 103 | const struct GNUNET_HELLO_Message * hello, |
104 | const char * err_msg); | 104 | const char *err_msg); |
105 | 105 | ||
106 | 106 | ||
107 | /** | 107 | /** |
@@ -127,12 +127,19 @@ struct GNUNET_PEERINFO_IteratorContext; | |||
127 | * @return NULL on error (in this case, 'callback' is never called!), | 127 | * @return NULL on error (in this case, 'callback' is never called!), |
128 | * otherwise an iterator context | 128 | * otherwise an iterator context |
129 | */ | 129 | */ |
130 | struct GNUNET_PEERINFO_IteratorContext * | 130 | struct GNUNET_PEERINFO_IteratorContext *GNUNET_PEERINFO_iterate (struct |
131 | GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h, | 131 | GNUNET_PEERINFO_Handle |
132 | const struct GNUNET_PeerIdentity *peer, | 132 | *h, |
133 | struct GNUNET_TIME_Relative timeout, | 133 | const struct |
134 | GNUNET_PEERINFO_Processor callback, | 134 | GNUNET_PeerIdentity |
135 | void *callback_cls); | 135 | *peer, |
136 | struct | ||
137 | GNUNET_TIME_Relative | ||
138 | timeout, | ||
139 | GNUNET_PEERINFO_Processor | ||
140 | callback, | ||
141 | void | ||
142 | *callback_cls); | ||
136 | 143 | ||
137 | 144 | ||
138 | 145 | ||
@@ -164,10 +171,13 @@ struct GNUNET_PEERINFO_NotifyContext; | |||
164 | * @param callback_cls closure for callback | 171 | * @param callback_cls closure for callback |
165 | * @return NULL on error | 172 | * @return NULL on error |
166 | */ | 173 | */ |
167 | struct GNUNET_PEERINFO_NotifyContext * | 174 | struct GNUNET_PEERINFO_NotifyContext *GNUNET_PEERINFO_notify (const struct |
168 | GNUNET_PEERINFO_notify (const struct GNUNET_CONFIGURATION_Handle *cfg, | 175 | GNUNET_CONFIGURATION_Handle |
169 | GNUNET_PEERINFO_Processor callback, | 176 | *cfg, |
170 | void *callback_cls); | 177 | GNUNET_PEERINFO_Processor |
178 | callback, | ||
179 | void | ||
180 | *callback_cls); | ||
171 | 181 | ||
172 | 182 | ||
173 | /** | 183 | /** |
@@ -175,8 +185,7 @@ GNUNET_PEERINFO_notify (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
175 | * | 185 | * |
176 | * @param nc context to stop notifying | 186 | * @param nc context to stop notifying |
177 | */ | 187 | */ |
178 | void | 188 | void GNUNET_PEERINFO_notify_cancel (struct GNUNET_PEERINFO_NotifyContext *nc); |
179 | GNUNET_PEERINFO_notify_cancel (struct GNUNET_PEERINFO_NotifyContext *nc); | ||
180 | 189 | ||
181 | 190 | ||
182 | #if 0 /* keep Emacsens' auto-indent happy */ | 191 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_pseudonym_lib.h b/src/include/gnunet_pseudonym_lib.h index db06d33ee..a0f202a3c 100644 --- a/src/include/gnunet_pseudonym_lib.h +++ b/src/include/gnunet_pseudonym_lib.h | |||
@@ -64,7 +64,7 @@ typedef int (*GNUNET_PSEUDONYM_Iterator) (void *cls, | |||
64 | * @return new rating of the namespace | 64 | * @return new rating of the namespace |
65 | */ | 65 | */ |
66 | int GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg, | 66 | int GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg, |
67 | const GNUNET_HashCode *nsid, int delta); | 67 | const GNUNET_HashCode * nsid, int delta); |
68 | 68 | ||
69 | /** | 69 | /** |
70 | * Add a pseudonym to the set of known pseudonyms. | 70 | * Add a pseudonym to the set of known pseudonyms. |
@@ -76,7 +76,7 @@ int GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
76 | * @param meta metadata for the pseudonym | 76 | * @param meta metadata for the pseudonym |
77 | */ | 77 | */ |
78 | void GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg, | 78 | void GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg, |
79 | const GNUNET_HashCode *id, | 79 | const GNUNET_HashCode * id, |
80 | const struct GNUNET_CONTAINER_MetaData *meta); | 80 | const struct GNUNET_CONTAINER_MetaData *meta); |
81 | 81 | ||
82 | 82 | ||
@@ -114,8 +114,8 @@ GNUNET_PSEUDONYM_discovery_callback_unregister (GNUNET_PSEUDONYM_Iterator | |||
114 | * | 114 | * |
115 | * @return NULL on failure (should never happen) | 115 | * @return NULL on failure (should never happen) |
116 | */ | 116 | */ |
117 | char *GNUNET_PSEUDONYM_id_to_name (const struct GNUNET_CONFIGURATION_Handle *cfg, | 117 | char *GNUNET_PSEUDONYM_id_to_name (const struct GNUNET_CONFIGURATION_Handle |
118 | const GNUNET_HashCode * pseudo); | 118 | *cfg, const GNUNET_HashCode * pseudo); |
119 | 119 | ||
120 | /** | 120 | /** |
121 | * Get the pseudonym ID belonging to the given human readable name. | 121 | * Get the pseudonym ID belonging to the given human readable name. |
diff --git a/src/include/gnunet_resolver_service.h b/src/include/gnunet_resolver_service.h index 86269d9dd..f24bf5c5e 100644 --- a/src/include/gnunet_resolver_service.h +++ b/src/include/gnunet_resolver_service.h | |||
@@ -48,7 +48,7 @@ extern "C" | |||
48 | * @param addrlen length of the address | 48 | * @param addrlen length of the address |
49 | */ | 49 | */ |
50 | typedef void (*GNUNET_RESOLVER_AddressCallback) (void *cls, | 50 | typedef void (*GNUNET_RESOLVER_AddressCallback) (void *cls, |
51 | const struct sockaddr *addr, | 51 | const struct sockaddr * addr, |
52 | socklen_t addrlen); | 52 | socklen_t addrlen); |
53 | 53 | ||
54 | 54 | ||
@@ -63,15 +63,13 @@ struct GNUNET_RESOLVER_RequestHandle; | |||
63 | * | 63 | * |
64 | * @param cfg configuration to use | 64 | * @param cfg configuration to use |
65 | */ | 65 | */ |
66 | void | 66 | void GNUNET_RESOLVER_connect (const struct GNUNET_CONFIGURATION_Handle *c); |
67 | GNUNET_RESOLVER_connect (const struct GNUNET_CONFIGURATION_Handle *c); | ||
68 | 67 | ||
69 | 68 | ||
70 | /** | 69 | /** |
71 | * Destroy the connection to the resolver service. | 70 | * Destroy the connection to the resolver service. |
72 | */ | 71 | */ |
73 | void | 72 | void GNUNET_RESOLVER_disconnect (void); |
74 | GNUNET_RESOLVER_disconnect (void); | ||
75 | 73 | ||
76 | 74 | ||
77 | /** | 75 | /** |
@@ -84,12 +82,16 @@ GNUNET_RESOLVER_disconnect (void); | |||
84 | * @param timeout how long to try resolving | 82 | * @param timeout how long to try resolving |
85 | * @return handle that can be used to cancel the request, NULL on error | 83 | * @return handle that can be used to cancel the request, NULL on error |
86 | */ | 84 | */ |
87 | struct GNUNET_RESOLVER_RequestHandle * | 85 | struct GNUNET_RESOLVER_RequestHandle *GNUNET_RESOLVER_ip_get (const char |
88 | GNUNET_RESOLVER_ip_get (const char *hostname, | 86 | *hostname, |
89 | int domain, | 87 | int domain, |
90 | struct GNUNET_TIME_Relative timeout, | 88 | struct |
91 | GNUNET_RESOLVER_AddressCallback callback, | 89 | GNUNET_TIME_Relative |
92 | void *callback_cls); | 90 | timeout, |
91 | GNUNET_RESOLVER_AddressCallback | ||
92 | callback, | ||
93 | void | ||
94 | *callback_cls); | ||
93 | 95 | ||
94 | 96 | ||
95 | /** | 97 | /** |
@@ -102,11 +104,15 @@ GNUNET_RESOLVER_ip_get (const char *hostname, | |||
102 | * @param timeout how long to try resolving | 104 | * @param timeout how long to try resolving |
103 | * @return handle that can be used to cancel the request, NULL on error | 105 | * @return handle that can be used to cancel the request, NULL on error |
104 | */ | 106 | */ |
105 | struct GNUNET_RESOLVER_RequestHandle * | 107 | struct GNUNET_RESOLVER_RequestHandle *GNUNET_RESOLVER_hostname_resolve (int |
106 | GNUNET_RESOLVER_hostname_resolve (int domain, | 108 | domain, |
107 | struct GNUNET_TIME_Relative timeout, | 109 | struct |
108 | GNUNET_RESOLVER_AddressCallback callback, | 110 | GNUNET_TIME_Relative |
109 | void *cls); | 111 | timeout, |
112 | GNUNET_RESOLVER_AddressCallback | ||
113 | callback, | ||
114 | void | ||
115 | *cls); | ||
110 | 116 | ||
111 | 117 | ||
112 | /** | 118 | /** |
@@ -124,8 +130,7 @@ typedef void (*GNUNET_RESOLVER_HostnameCallback) (void *cls, | |||
124 | * | 130 | * |
125 | * @return local hostname, caller must free | 131 | * @return local hostname, caller must free |
126 | */ | 132 | */ |
127 | char * | 133 | char *GNUNET_RESOLVER_local_fqdn_get (void); |
128 | GNUNET_RESOLVER_local_fqdn_get (void); | ||
129 | 134 | ||
130 | 135 | ||
131 | /** | 136 | /** |
@@ -140,13 +145,19 @@ GNUNET_RESOLVER_local_fqdn_get (void); | |||
140 | * @param cls closure for callback | 145 | * @param cls closure for callback |
141 | * @return handle that can be used to cancel the request, NULL on error | 146 | * @return handle that can be used to cancel the request, NULL on error |
142 | */ | 147 | */ |
143 | struct GNUNET_RESOLVER_RequestHandle * | 148 | struct GNUNET_RESOLVER_RequestHandle *GNUNET_RESOLVER_hostname_get (const struct |
144 | GNUNET_RESOLVER_hostname_get (const struct sockaddr *sa, | 149 | sockaddr |
145 | socklen_t salen, | 150 | *sa, |
146 | int do_resolve, | 151 | socklen_t |
147 | struct GNUNET_TIME_Relative timeout, | 152 | salen, |
148 | GNUNET_RESOLVER_HostnameCallback callback, | 153 | int |
149 | void *cls); | 154 | do_resolve, |
155 | struct | ||
156 | GNUNET_TIME_Relative | ||
157 | timeout, | ||
158 | GNUNET_RESOLVER_HostnameCallback | ||
159 | callback, | ||
160 | void *cls); | ||
150 | 161 | ||
151 | 162 | ||
152 | /** | 163 | /** |
@@ -157,8 +168,7 @@ GNUNET_RESOLVER_hostname_get (const struct sockaddr *sa, | |||
157 | * | 168 | * |
158 | * @param rh handle of request to cancel | 169 | * @param rh handle of request to cancel |
159 | */ | 170 | */ |
160 | void | 171 | void GNUNET_RESOLVER_request_cancel (struct GNUNET_RESOLVER_RequestHandle *rh); |
161 | GNUNET_RESOLVER_request_cancel (struct GNUNET_RESOLVER_RequestHandle *rh); | ||
162 | 172 | ||
163 | 173 | ||
164 | #if 0 /* keep Emacsens' auto-indent happy */ | 174 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_scheduler_lib.h b/src/include/gnunet_scheduler_lib.h index 723f8ca91..c09153e31 100644 --- a/src/include/gnunet_scheduler_lib.h +++ b/src/include/gnunet_scheduler_lib.h | |||
@@ -206,10 +206,10 @@ typedef void (*GNUNET_SCHEDULER_Task) (void *cls, | |||
206 | * @return number of selected sockets, GNUNET_SYSERR on error | 206 | * @return number of selected sockets, GNUNET_SYSERR on error |
207 | */ | 207 | */ |
208 | typedef int (*GNUNET_SCHEDULER_select) (void *cls, | 208 | typedef int (*GNUNET_SCHEDULER_select) (void *cls, |
209 | struct GNUNET_NETWORK_FDSet *rfds, | 209 | struct GNUNET_NETWORK_FDSet * rfds, |
210 | struct GNUNET_NETWORK_FDSet *wfds, | 210 | struct GNUNET_NETWORK_FDSet * wfds, |
211 | struct GNUNET_NETWORK_FDSet *efds, | 211 | struct GNUNET_NETWORK_FDSet * efds, |
212 | struct GNUNET_TIME_Relative timeout); | 212 | struct GNUNET_TIME_Relative timeout); |
213 | /** | 213 | /** |
214 | * Initialize and run scheduler. This function will return when all | 214 | * Initialize and run scheduler. This function will return when all |
215 | * tasks have completed. On systems with signals, receiving a SIGTERM | 215 | * tasks have completed. On systems with signals, receiving a SIGTERM |
@@ -258,8 +258,7 @@ unsigned int GNUNET_SCHEDULER_get_load (enum GNUNET_SCHEDULER_Priority p); | |||
258 | * | 258 | * |
259 | * * @return reason(s) why the current task is run | 259 | * * @return reason(s) why the current task is run |
260 | */ | 260 | */ |
261 | enum GNUNET_SCHEDULER_Reason | 261 | enum GNUNET_SCHEDULER_Reason GNUNET_SCHEDULER_get_reason (); |
262 | GNUNET_SCHEDULER_get_reason (); | ||
263 | 262 | ||
264 | 263 | ||
265 | /** | 264 | /** |
@@ -305,8 +304,7 @@ GNUNET_SCHEDULER_add_continuation (GNUNET_SCHEDULER_Task task, | |||
305 | */ | 304 | */ |
306 | GNUNET_SCHEDULER_TaskIdentifier | 305 | GNUNET_SCHEDULER_TaskIdentifier |
307 | GNUNET_SCHEDULER_add_after (GNUNET_SCHEDULER_TaskIdentifier prerequisite_task, | 306 | GNUNET_SCHEDULER_add_after (GNUNET_SCHEDULER_TaskIdentifier prerequisite_task, |
308 | GNUNET_SCHEDULER_Task task, | 307 | GNUNET_SCHEDULER_Task task, void *task_cls); |
309 | void *task_cls); | ||
310 | 308 | ||
311 | 309 | ||
312 | /** | 310 | /** |
@@ -320,8 +318,7 @@ GNUNET_SCHEDULER_add_after (GNUNET_SCHEDULER_TaskIdentifier prerequisite_task, | |||
320 | */ | 318 | */ |
321 | GNUNET_SCHEDULER_TaskIdentifier | 319 | GNUNET_SCHEDULER_TaskIdentifier |
322 | GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, | 320 | GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, |
323 | GNUNET_SCHEDULER_Task task, | 321 | GNUNET_SCHEDULER_Task task, void *task_cls); |
324 | void *task_cls); | ||
325 | 322 | ||
326 | 323 | ||
327 | /** | 324 | /** |
@@ -334,8 +331,7 @@ GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, | |||
334 | * only valid until "task" is started! | 331 | * only valid until "task" is started! |
335 | */ | 332 | */ |
336 | GNUNET_SCHEDULER_TaskIdentifier | 333 | GNUNET_SCHEDULER_TaskIdentifier |
337 | GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_Task task, | 334 | GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_Task task, void *task_cls); |
338 | void *task_cls); | ||
339 | 335 | ||
340 | 336 | ||
341 | /** | 337 | /** |
@@ -354,8 +350,8 @@ GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_Task task, | |||
354 | */ | 350 | */ |
355 | GNUNET_SCHEDULER_TaskIdentifier | 351 | GNUNET_SCHEDULER_TaskIdentifier |
356 | GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, | 352 | GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, |
357 | GNUNET_SCHEDULER_Task task, | 353 | GNUNET_SCHEDULER_Task task, |
358 | void *task_cls); | 354 | void *task_cls); |
359 | 355 | ||
360 | 356 | ||
361 | /** | 357 | /** |
@@ -372,8 +368,7 @@ GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, | |||
372 | */ | 368 | */ |
373 | GNUNET_SCHEDULER_TaskIdentifier | 369 | GNUNET_SCHEDULER_TaskIdentifier |
374 | GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay, | 370 | GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay, |
375 | GNUNET_SCHEDULER_Task task, | 371 | GNUNET_SCHEDULER_Task task, void *task_cls); |
376 | void *task_cls); | ||
377 | 372 | ||
378 | 373 | ||
379 | /** | 374 | /** |
@@ -394,9 +389,8 @@ GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay, | |||
394 | */ | 389 | */ |
395 | GNUNET_SCHEDULER_TaskIdentifier | 390 | GNUNET_SCHEDULER_TaskIdentifier |
396 | GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, | 391 | GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, |
397 | struct GNUNET_NETWORK_Handle *rfd, | 392 | struct GNUNET_NETWORK_Handle *rfd, |
398 | GNUNET_SCHEDULER_Task task, | 393 | GNUNET_SCHEDULER_Task task, void *task_cls); |
399 | void *task_cls); | ||
400 | 394 | ||
401 | 395 | ||
402 | /** | 396 | /** |
@@ -417,9 +411,8 @@ GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, | |||
417 | */ | 411 | */ |
418 | GNUNET_SCHEDULER_TaskIdentifier | 412 | GNUNET_SCHEDULER_TaskIdentifier |
419 | GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay, | 413 | GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay, |
420 | struct GNUNET_NETWORK_Handle *wfd, | 414 | struct GNUNET_NETWORK_Handle *wfd, |
421 | GNUNET_SCHEDULER_Task task, | 415 | GNUNET_SCHEDULER_Task task, void *task_cls); |
422 | void *task_cls); | ||
423 | 416 | ||
424 | 417 | ||
425 | /** | 418 | /** |
@@ -440,9 +433,8 @@ GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay, | |||
440 | */ | 433 | */ |
441 | GNUNET_SCHEDULER_TaskIdentifier | 434 | GNUNET_SCHEDULER_TaskIdentifier |
442 | GNUNET_SCHEDULER_add_read_file (struct GNUNET_TIME_Relative delay, | 435 | GNUNET_SCHEDULER_add_read_file (struct GNUNET_TIME_Relative delay, |
443 | const struct GNUNET_DISK_FileHandle *rfd, | 436 | const struct GNUNET_DISK_FileHandle *rfd, |
444 | GNUNET_SCHEDULER_Task task, | 437 | GNUNET_SCHEDULER_Task task, void *task_cls); |
445 | void *task_cls); | ||
446 | 438 | ||
447 | 439 | ||
448 | /** | 440 | /** |
@@ -463,9 +455,8 @@ GNUNET_SCHEDULER_add_read_file (struct GNUNET_TIME_Relative delay, | |||
463 | */ | 455 | */ |
464 | GNUNET_SCHEDULER_TaskIdentifier | 456 | GNUNET_SCHEDULER_TaskIdentifier |
465 | GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay, | 457 | GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay, |
466 | const struct GNUNET_DISK_FileHandle *wfd, | 458 | const struct GNUNET_DISK_FileHandle *wfd, |
467 | GNUNET_SCHEDULER_Task task, | 459 | GNUNET_SCHEDULER_Task task, void *task_cls); |
468 | void *task_cls); | ||
469 | 460 | ||
470 | 461 | ||
471 | /** | 462 | /** |
@@ -505,10 +496,9 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, | |||
505 | GNUNET_SCHEDULER_TaskIdentifier | 496 | GNUNET_SCHEDULER_TaskIdentifier |
506 | prerequisite_task, | 497 | prerequisite_task, |
507 | struct GNUNET_TIME_Relative delay, | 498 | struct GNUNET_TIME_Relative delay, |
508 | const struct GNUNET_NETWORK_FDSet * rs, | 499 | const struct GNUNET_NETWORK_FDSet *rs, |
509 | const struct GNUNET_NETWORK_FDSet * ws, | 500 | const struct GNUNET_NETWORK_FDSet *ws, |
510 | GNUNET_SCHEDULER_Task task, | 501 | GNUNET_SCHEDULER_Task task, void *task_cls); |
511 | void *task_cls); | ||
512 | 502 | ||
513 | /** | 503 | /** |
514 | * Sets the select function to use in the scheduler (scheduler_select). | 504 | * Sets the select function to use in the scheduler (scheduler_select). |
@@ -518,7 +508,7 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, | |||
518 | */ | 508 | */ |
519 | void | 509 | void |
520 | GNUNET_SCHEDULER_set_select (GNUNET_SCHEDULER_select new_select, | 510 | GNUNET_SCHEDULER_set_select (GNUNET_SCHEDULER_select new_select, |
521 | void *new_select_cls); | 511 | void *new_select_cls); |
522 | 512 | ||
523 | 513 | ||
524 | #if 0 /* keep Emacsens' auto-indent happy */ | 514 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_server_lib.h b/src/include/gnunet_server_lib.h index 3ada838b6..e4b856db0 100644 --- a/src/include/gnunet_server_lib.h +++ b/src/include/gnunet_server_lib.h | |||
@@ -74,8 +74,7 @@ typedef void (*GNUNET_SERVER_MessageCallback) (void *cls, | |||
74 | struct GNUNET_SERVER_Client * | 74 | struct GNUNET_SERVER_Client * |
75 | client, | 75 | client, |
76 | const struct | 76 | const struct |
77 | GNUNET_MessageHeader * | 77 | GNUNET_MessageHeader * message); |
78 | message); | ||
79 | 78 | ||
80 | 79 | ||
81 | 80 | ||
@@ -123,12 +122,12 @@ struct GNUNET_SERVER_MessageHandler | |||
123 | * @return handle for the new server, NULL on error | 122 | * @return handle for the new server, NULL on error |
124 | * (typically, "port" already in use) | 123 | * (typically, "port" already in use) |
125 | */ | 124 | */ |
126 | struct GNUNET_SERVER_Handle * | 125 | struct GNUNET_SERVER_Handle |
127 | GNUNET_SERVER_create_with_sockets (GNUNET_CONNECTION_AccessCheck access, void *access_cls, | 126 | *GNUNET_SERVER_create_with_sockets (GNUNET_CONNECTION_AccessCheck access, |
128 | struct GNUNET_NETWORK_Handle **lsocks, | 127 | void *access_cls, |
129 | struct GNUNET_TIME_Relative | 128 | struct GNUNET_NETWORK_Handle **lsocks, |
130 | idle_timeout, | 129 | struct GNUNET_TIME_Relative |
131 | int require_found); | 130 | idle_timeout, int require_found); |
132 | 131 | ||
133 | /** | 132 | /** |
134 | * Create a new server. | 133 | * Create a new server. |
@@ -145,8 +144,9 @@ GNUNET_SERVER_create_with_sockets (GNUNET_CONNECTION_AccessCheck access, void *a | |||
145 | */ | 144 | */ |
146 | struct GNUNET_SERVER_Handle *GNUNET_SERVER_create (GNUNET_CONNECTION_AccessCheck | 145 | struct GNUNET_SERVER_Handle *GNUNET_SERVER_create (GNUNET_CONNECTION_AccessCheck |
147 | access, void *access_cls, | 146 | access, void *access_cls, |
148 | struct sockaddr *const*serverAddr, | 147 | struct sockaddr *const |
149 | const socklen_t *socklen, | 148 | *serverAddr, |
149 | const socklen_t * socklen, | ||
150 | struct GNUNET_TIME_Relative | 150 | struct GNUNET_TIME_Relative |
151 | idle_timeout, | 151 | idle_timeout, |
152 | int require_found); | 152 | int require_found); |
@@ -195,11 +195,11 @@ GNUNET_SERVER_add_handlers (struct GNUNET_SERVER_Handle *server, | |||
195 | * NULL if we are already going to notify someone else (busy) | 195 | * NULL if we are already going to notify someone else (busy) |
196 | */ | 196 | */ |
197 | struct GNUNET_CONNECTION_TransmitHandle | 197 | struct GNUNET_CONNECTION_TransmitHandle |
198 | *GNUNET_SERVER_notify_transmit_ready (struct GNUNET_SERVER_Client *client, | 198 | *GNUNET_SERVER_notify_transmit_ready (struct GNUNET_SERVER_Client *client, |
199 | size_t size, | 199 | size_t size, |
200 | struct GNUNET_TIME_Relative timeout, | 200 | struct GNUNET_TIME_Relative timeout, |
201 | GNUNET_CONNECTION_TransmitReadyNotify | 201 | GNUNET_CONNECTION_TransmitReadyNotify |
202 | callback, void *callback_cls); | 202 | callback, void *callback_cls); |
203 | 203 | ||
204 | 204 | ||
205 | /** | 205 | /** |
@@ -208,8 +208,7 @@ struct GNUNET_CONNECTION_TransmitHandle | |||
208 | * | 208 | * |
209 | * @param client the client to set the persistent flag on | 209 | * @param client the client to set the persistent flag on |
210 | */ | 210 | */ |
211 | void | 211 | void GNUNET_SERVER_client_persist_ (struct GNUNET_SERVER_Client *client); |
212 | GNUNET_SERVER_client_persist_ (struct GNUNET_SERVER_Client *client); | ||
213 | 212 | ||
214 | /** | 213 | /** |
215 | * Resume receiving from this client, we are done processing the | 214 | * Resume receiving from this client, we are done processing the |
@@ -237,7 +236,7 @@ GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client, int success); | |||
237 | */ | 236 | */ |
238 | void | 237 | void |
239 | GNUNET_SERVER_client_set_timeout (struct GNUNET_SERVER_Client *client, | 238 | GNUNET_SERVER_client_set_timeout (struct GNUNET_SERVER_Client *client, |
240 | struct GNUNET_TIME_Relative timeout); | 239 | struct GNUNET_TIME_Relative timeout); |
241 | 240 | ||
242 | 241 | ||
243 | /** | 242 | /** |
@@ -248,7 +247,8 @@ GNUNET_SERVER_client_set_timeout (struct GNUNET_SERVER_Client *client, | |||
248 | * @param client client for which to disable the warning | 247 | * @param client client for which to disable the warning |
249 | */ | 248 | */ |
250 | void | 249 | void |
251 | GNUNET_SERVER_disable_receive_done_warning (struct GNUNET_SERVER_Client *client); | 250 | GNUNET_SERVER_disable_receive_done_warning (struct GNUNET_SERVER_Client |
251 | *client); | ||
252 | 252 | ||
253 | 253 | ||
254 | /** | 254 | /** |
@@ -364,9 +364,10 @@ void GNUNET_SERVER_disconnect_notify (struct GNUNET_SERVER_Handle *server, | |||
364 | * @param callback function to call on disconnect | 364 | * @param callback function to call on disconnect |
365 | * @param callback_cls closure for callback | 365 | * @param callback_cls closure for callback |
366 | */ | 366 | */ |
367 | void GNUNET_SERVER_disconnect_notify_cancel (struct GNUNET_SERVER_Handle *server, | 367 | void GNUNET_SERVER_disconnect_notify_cancel (struct GNUNET_SERVER_Handle |
368 | GNUNET_SERVER_DisconnectCallback | 368 | *server, |
369 | callback, void *callback_cls); | 369 | GNUNET_SERVER_DisconnectCallback |
370 | callback, void *callback_cls); | ||
370 | 371 | ||
371 | 372 | ||
372 | /** | 373 | /** |
@@ -392,8 +393,7 @@ void GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client); | |||
392 | * @param do_ignore GNUNET_YES to ignore, GNUNET_NO to restore default | 393 | * @param do_ignore GNUNET_YES to ignore, GNUNET_NO to restore default |
393 | */ | 394 | */ |
394 | void | 395 | void |
395 | GNUNET_SERVER_ignore_shutdown (struct GNUNET_SERVER_Handle *h, | 396 | GNUNET_SERVER_ignore_shutdown (struct GNUNET_SERVER_Handle *h, int do_ignore); |
396 | int do_ignore); | ||
397 | 397 | ||
398 | 398 | ||
399 | 399 | ||
@@ -405,8 +405,7 @@ GNUNET_SERVER_ignore_shutdown (struct GNUNET_SERVER_Handle *h, | |||
405 | * @param client handle to the client | 405 | * @param client handle to the client |
406 | * @return GNUNET_OK on success | 406 | * @return GNUNET_OK on success |
407 | */ | 407 | */ |
408 | int | 408 | int GNUNET_SERVER_client_disable_corking (struct GNUNET_SERVER_Client *client); |
409 | GNUNET_SERVER_client_disable_corking (struct GNUNET_SERVER_Client *client); | ||
410 | 409 | ||
411 | 410 | ||
412 | /** | 411 | /** |
@@ -425,8 +424,8 @@ struct GNUNET_SERVER_TransmitContext; | |||
425 | * @return NULL on error | 424 | * @return NULL on error |
426 | */ | 425 | */ |
427 | struct GNUNET_SERVER_TransmitContext | 426 | struct GNUNET_SERVER_TransmitContext |
428 | *GNUNET_SERVER_transmit_context_create (struct GNUNET_SERVER_Client | 427 | *GNUNET_SERVER_transmit_context_create (struct GNUNET_SERVER_Client |
429 | *client); | 428 | *client); |
430 | 429 | ||
431 | 430 | ||
432 | /** | 431 | /** |
@@ -441,8 +440,8 @@ struct GNUNET_SERVER_TransmitContext | |||
441 | */ | 440 | */ |
442 | void | 441 | void |
443 | GNUNET_SERVER_transmit_context_append_data (struct GNUNET_SERVER_TransmitContext | 442 | GNUNET_SERVER_transmit_context_append_data (struct GNUNET_SERVER_TransmitContext |
444 | *tc, const void *data, size_t length, | 443 | *tc, const void *data, |
445 | uint16_t type); | 444 | size_t length, uint16_t type); |
446 | 445 | ||
447 | 446 | ||
448 | /** | 447 | /** |
@@ -454,8 +453,11 @@ GNUNET_SERVER_transmit_context_append_data (struct GNUNET_SERVER_TransmitContext | |||
454 | * @param msg message to append | 453 | * @param msg message to append |
455 | */ | 454 | */ |
456 | void | 455 | void |
457 | GNUNET_SERVER_transmit_context_append_message (struct GNUNET_SERVER_TransmitContext | 456 | GNUNET_SERVER_transmit_context_append_message (struct |
458 | *tc, const struct GNUNET_MessageHeader *msg); | 457 | GNUNET_SERVER_TransmitContext |
458 | *tc, | ||
459 | const struct GNUNET_MessageHeader | ||
460 | *msg); | ||
459 | 461 | ||
460 | 462 | ||
461 | /** | 463 | /** |
@@ -493,9 +495,10 @@ struct GNUNET_SERVER_NotificationContext; | |||
493 | * if the queue gets longer than this number of messages | 495 | * if the queue gets longer than this number of messages |
494 | * @return handle to the notification context | 496 | * @return handle to the notification context |
495 | */ | 497 | */ |
496 | struct GNUNET_SERVER_NotificationContext * | 498 | struct GNUNET_SERVER_NotificationContext |
497 | GNUNET_SERVER_notification_context_create (struct GNUNET_SERVER_Handle *server, | 499 | *GNUNET_SERVER_notification_context_create (struct GNUNET_SERVER_Handle |
498 | unsigned int queue_length); | 500 | *server, |
501 | unsigned int queue_length); | ||
499 | 502 | ||
500 | 503 | ||
501 | /** | 504 | /** |
@@ -504,7 +507,9 @@ GNUNET_SERVER_notification_context_create (struct GNUNET_SERVER_Handle *server, | |||
504 | * @param nc context to destroy. | 507 | * @param nc context to destroy. |
505 | */ | 508 | */ |
506 | void | 509 | void |
507 | GNUNET_SERVER_notification_context_destroy (struct GNUNET_SERVER_NotificationContext *nc); | 510 | GNUNET_SERVER_notification_context_destroy (struct |
511 | GNUNET_SERVER_NotificationContext | ||
512 | *nc); | ||
508 | 513 | ||
509 | 514 | ||
510 | /** | 515 | /** |
@@ -514,8 +519,9 @@ GNUNET_SERVER_notification_context_destroy (struct GNUNET_SERVER_NotificationCon | |||
514 | * @param client client to add | 519 | * @param client client to add |
515 | */ | 520 | */ |
516 | void | 521 | void |
517 | GNUNET_SERVER_notification_context_add (struct GNUNET_SERVER_NotificationContext *nc, | 522 | GNUNET_SERVER_notification_context_add (struct GNUNET_SERVER_NotificationContext |
518 | struct GNUNET_SERVER_Client *client); | 523 | *nc, |
524 | struct GNUNET_SERVER_Client *client); | ||
519 | 525 | ||
520 | 526 | ||
521 | /** | 527 | /** |
@@ -528,10 +534,12 @@ GNUNET_SERVER_notification_context_add (struct GNUNET_SERVER_NotificationContext | |||
528 | * @param can_drop can this message be dropped due to queue length limitations | 534 | * @param can_drop can this message be dropped due to queue length limitations |
529 | */ | 535 | */ |
530 | void | 536 | void |
531 | GNUNET_SERVER_notification_context_unicast (struct GNUNET_SERVER_NotificationContext *nc, | 537 | GNUNET_SERVER_notification_context_unicast (struct |
532 | struct GNUNET_SERVER_Client *client, | 538 | GNUNET_SERVER_NotificationContext |
533 | const struct GNUNET_MessageHeader *msg, | 539 | *nc, |
534 | int can_drop); | 540 | struct GNUNET_SERVER_Client *client, |
541 | const struct GNUNET_MessageHeader | ||
542 | *msg, int can_drop); | ||
535 | 543 | ||
536 | 544 | ||
537 | /** | 545 | /** |
@@ -542,9 +550,11 @@ GNUNET_SERVER_notification_context_unicast (struct GNUNET_SERVER_NotificationCon | |||
542 | * @param can_drop can this message be dropped due to queue length limitations | 550 | * @param can_drop can this message be dropped due to queue length limitations |
543 | */ | 551 | */ |
544 | void | 552 | void |
545 | GNUNET_SERVER_notification_context_broadcast (struct GNUNET_SERVER_NotificationContext *nc, | 553 | GNUNET_SERVER_notification_context_broadcast (struct |
546 | const struct GNUNET_MessageHeader *msg, | 554 | GNUNET_SERVER_NotificationContext |
547 | int can_drop); | 555 | *nc, |
556 | const struct GNUNET_MessageHeader | ||
557 | *msg, int can_drop); | ||
548 | 558 | ||
549 | 559 | ||
550 | 560 | ||
@@ -562,10 +572,10 @@ struct GNUNET_SERVER_MessageStreamTokenizer; | |||
562 | * @param message the actual message | 572 | * @param message the actual message |
563 | */ | 573 | */ |
564 | typedef void (*GNUNET_SERVER_MessageTokenizerCallback) (void *cls, | 574 | typedef void (*GNUNET_SERVER_MessageTokenizerCallback) (void *cls, |
565 | void *client, | 575 | void *client, |
566 | const struct | 576 | const struct |
567 | GNUNET_MessageHeader * | 577 | GNUNET_MessageHeader * |
568 | message); | 578 | message); |
569 | 579 | ||
570 | 580 | ||
571 | /** | 581 | /** |
@@ -575,9 +585,9 @@ typedef void (*GNUNET_SERVER_MessageTokenizerCallback) (void *cls, | |||
575 | * @param cb_cls closure for cb | 585 | * @param cb_cls closure for cb |
576 | * @return handle to tokenizer | 586 | * @return handle to tokenizer |
577 | */ | 587 | */ |
578 | struct GNUNET_SERVER_MessageStreamTokenizer * | 588 | struct GNUNET_SERVER_MessageStreamTokenizer |
579 | GNUNET_SERVER_mst_create (GNUNET_SERVER_MessageTokenizerCallback cb, | 589 | *GNUNET_SERVER_mst_create (GNUNET_SERVER_MessageTokenizerCallback cb, |
580 | void *cb_cls); | 590 | void *cb_cls); |
581 | 591 | ||
582 | 592 | ||
583 | /** | 593 | /** |
@@ -598,11 +608,9 @@ GNUNET_SERVER_mst_create (GNUNET_SERVER_MessageTokenizerCallback cb, | |||
598 | */ | 608 | */ |
599 | int | 609 | int |
600 | GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst, | 610 | GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst, |
601 | void *client_identity, | 611 | void *client_identity, |
602 | const char *buf, | 612 | const char *buf, |
603 | size_t size, | 613 | size_t size, int purge, int one_shot); |
604 | int purge, | ||
605 | int one_shot); | ||
606 | 614 | ||
607 | 615 | ||
608 | /** | 616 | /** |
diff --git a/src/include/gnunet_service_lib.h b/src/include/gnunet_service_lib.h index 883ad462f..fca2ff329 100644 --- a/src/include/gnunet_service_lib.h +++ b/src/include/gnunet_service_lib.h | |||
@@ -61,9 +61,9 @@ extern "C" | |||
61 | */ | 61 | */ |
62 | int | 62 | int |
63 | GNUNET_SERVICE_get_server_addresses (const char *serviceName, | 63 | GNUNET_SERVICE_get_server_addresses (const char *serviceName, |
64 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 64 | const struct GNUNET_CONFIGURATION_Handle |
65 | struct sockaddr ***addrs, | 65 | *cfg, struct sockaddr ***addrs, |
66 | socklen_t **addr_lens); | 66 | socklen_t ** addr_lens); |
67 | 67 | ||
68 | 68 | ||
69 | /** | 69 | /** |
@@ -84,18 +84,18 @@ typedef void (*GNUNET_SERVICE_Main) (void *cls, | |||
84 | * Options for the service (bitmask). | 84 | * Options for the service (bitmask). |
85 | */ | 85 | */ |
86 | enum GNUNET_SERVICE_Options | 86 | enum GNUNET_SERVICE_Options |
87 | { | 87 | { |
88 | /** | 88 | /** |
89 | * Use defaults. | 89 | * Use defaults. |
90 | */ | 90 | */ |
91 | GNUNET_SERVICE_OPTION_NONE = 0, | 91 | GNUNET_SERVICE_OPTION_NONE = 0, |
92 | 92 | ||
93 | /** | 93 | /** |
94 | * Do not trigger server shutdown on signals, allow for the user | 94 | * Do not trigger server shutdown on signals, allow for the user |
95 | * to terminate the server explicitly when needed. | 95 | * to terminate the server explicitly when needed. |
96 | */ | 96 | */ |
97 | GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN = 1 | 97 | GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN = 1 |
98 | }; | 98 | }; |
99 | 99 | ||
100 | 100 | ||
101 | /** | 101 | /** |
@@ -111,12 +111,12 @@ enum GNUNET_SERVICE_Options | |||
111 | * @return GNUNET_SYSERR on error, GNUNET_OK | 111 | * @return GNUNET_SYSERR on error, GNUNET_OK |
112 | * if we shutdown nicely | 112 | * if we shutdown nicely |
113 | */ | 113 | */ |
114 | int GNUNET_SERVICE_run (int argc, | 114 | int |
115 | char *const *argv, | 115 | GNUNET_SERVICE_run (int argc, |
116 | const char *serviceName, | 116 | char *const *argv, |
117 | enum GNUNET_SERVICE_Options opt, | 117 | const char *serviceName, |
118 | GNUNET_SERVICE_Main task, | 118 | enum GNUNET_SERVICE_Options opt, |
119 | void *task_cls); | 119 | GNUNET_SERVICE_Main task, void *task_cls); |
120 | 120 | ||
121 | 121 | ||
122 | struct GNUNET_SERVICE_Context; | 122 | struct GNUNET_SERVICE_Context; |
diff --git a/src/include/gnunet_statistics_service.h b/src/include/gnunet_statistics_service.h index e22fe16d4..1807d3de0 100644 --- a/src/include/gnunet_statistics_service.h +++ b/src/include/gnunet_statistics_service.h | |||
@@ -64,8 +64,7 @@ struct GNUNET_STATISTICS_Handle; | |||
64 | typedef int (*GNUNET_STATISTICS_Iterator) (void *cls, | 64 | typedef int (*GNUNET_STATISTICS_Iterator) (void *cls, |
65 | const char *subsystem, | 65 | const char *subsystem, |
66 | const char *name, | 66 | const char *name, |
67 | uint64_t value, | 67 | uint64_t value, int is_persistent); |
68 | int is_persistent); | ||
69 | 68 | ||
70 | /** | 69 | /** |
71 | * Get handle for the statistics service. | 70 | * Get handle for the statistics service. |
@@ -75,8 +74,8 @@ typedef int (*GNUNET_STATISTICS_Iterator) (void *cls, | |||
75 | * @return handle to use | 74 | * @return handle to use |
76 | */ | 75 | */ |
77 | struct GNUNET_STATISTICS_Handle | 76 | struct GNUNET_STATISTICS_Handle |
78 | *GNUNET_STATISTICS_create (const char *subsystem, | 77 | *GNUNET_STATISTICS_create (const char *subsystem, |
79 | const struct GNUNET_CONFIGURATION_Handle *cfg); | 78 | const struct GNUNET_CONFIGURATION_Handle *cfg); |
80 | 79 | ||
81 | 80 | ||
82 | /** | 81 | /** |
@@ -88,7 +87,7 @@ struct GNUNET_STATISTICS_Handle | |||
88 | * be completed | 87 | * be completed |
89 | */ | 88 | */ |
90 | void GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, | 89 | void GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, |
91 | int sync_first); | 90 | int sync_first); |
92 | 91 | ||
93 | 92 | ||
94 | /** | 93 | /** |
@@ -105,10 +104,9 @@ void GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, | |||
105 | */ | 104 | */ |
106 | int | 105 | int |
107 | GNUNET_STATISTICS_watch (struct GNUNET_STATISTICS_Handle *handle, | 106 | GNUNET_STATISTICS_watch (struct GNUNET_STATISTICS_Handle *handle, |
108 | const char *subsystem, | 107 | const char *subsystem, |
109 | const char *name, | 108 | const char *name, |
110 | GNUNET_STATISTICS_Iterator proc, | 109 | GNUNET_STATISTICS_Iterator proc, void *proc_cls); |
111 | void *proc_cls); | ||
112 | 110 | ||
113 | 111 | ||
114 | /** | 112 | /** |
@@ -138,13 +136,19 @@ struct GNUNET_STATISTICS_GetHandle; | |||
138 | * @param cls closure for proc and cont | 136 | * @param cls closure for proc and cont |
139 | * @return NULL on error | 137 | * @return NULL on error |
140 | */ | 138 | */ |
141 | struct GNUNET_STATISTICS_GetHandle * | 139 | struct GNUNET_STATISTICS_GetHandle *GNUNET_STATISTICS_get (struct |
142 | GNUNET_STATISTICS_get (struct GNUNET_STATISTICS_Handle *handle, | 140 | GNUNET_STATISTICS_Handle |
143 | const char *subsystem, | 141 | *handle, |
144 | const char *name, | 142 | const char |
145 | struct GNUNET_TIME_Relative timeout, | 143 | *subsystem, |
146 | GNUNET_STATISTICS_Callback cont, | 144 | const char *name, |
147 | GNUNET_STATISTICS_Iterator proc, void *cls); | 145 | struct |
146 | GNUNET_TIME_Relative | ||
147 | timeout, | ||
148 | GNUNET_STATISTICS_Callback | ||
149 | cont, | ||
150 | GNUNET_STATISTICS_Iterator | ||
151 | proc, void *cls); | ||
148 | 152 | ||
149 | 153 | ||
150 | /** | 154 | /** |
@@ -153,8 +157,7 @@ GNUNET_STATISTICS_get (struct GNUNET_STATISTICS_Handle *handle, | |||
153 | * | 157 | * |
154 | * @param gh handle of the request to cancel | 158 | * @param gh handle of the request to cancel |
155 | */ | 159 | */ |
156 | void | 160 | void GNUNET_STATISTICS_get_cancel (struct GNUNET_STATISTICS_GetHandle *gh); |
157 | GNUNET_STATISTICS_get_cancel (struct GNUNET_STATISTICS_GetHandle *gh); | ||
158 | 161 | ||
159 | 162 | ||
160 | /** | 163 | /** |
@@ -168,8 +171,7 @@ GNUNET_STATISTICS_get_cancel (struct GNUNET_STATISTICS_GetHandle *gh); | |||
168 | */ | 171 | */ |
169 | void | 172 | void |
170 | GNUNET_STATISTICS_set (struct GNUNET_STATISTICS_Handle *handle, | 173 | GNUNET_STATISTICS_set (struct GNUNET_STATISTICS_Handle *handle, |
171 | const char *name, | 174 | const char *name, uint64_t value, int make_persistent); |
172 | uint64_t value, int make_persistent); | ||
173 | 175 | ||
174 | /** | 176 | /** |
175 | * Set statistic value for the peer. Will always use our | 177 | * Set statistic value for the peer. Will always use our |
@@ -182,8 +184,7 @@ GNUNET_STATISTICS_set (struct GNUNET_STATISTICS_Handle *handle, | |||
182 | */ | 184 | */ |
183 | void | 185 | void |
184 | GNUNET_STATISTICS_update (struct GNUNET_STATISTICS_Handle *handle, | 186 | GNUNET_STATISTICS_update (struct GNUNET_STATISTICS_Handle *handle, |
185 | const char *name, | 187 | const char *name, int64_t delta, int make_persistent); |
186 | int64_t delta, int make_persistent); | ||
187 | 188 | ||
188 | 189 | ||
189 | 190 | ||
diff --git a/src/include/gnunet_strings_lib.h b/src/include/gnunet_strings_lib.h index a466074a3..3e15a24c8 100644 --- a/src/include/gnunet_strings_lib.h +++ b/src/include/gnunet_strings_lib.h | |||
@@ -105,8 +105,7 @@ char *GNUNET_STRINGS_filename_expand (const char *fil); | |||
105 | * (or number of bytes that would have been written) | 105 | * (or number of bytes that would have been written) |
106 | */ | 106 | */ |
107 | size_t GNUNET_STRINGS_buffer_fill (char *buffer, | 107 | size_t GNUNET_STRINGS_buffer_fill (char *buffer, |
108 | size_t size, | 108 | size_t size, unsigned int count, ...); |
109 | unsigned int count, ...); | ||
110 | 109 | ||
111 | 110 | ||
112 | /** | 111 | /** |
diff --git a/src/include/gnunet_testing_lib.h b/src/include/gnunet_testing_lib.h index 9d85f3af9..1111f576c 100644 --- a/src/include/gnunet_testing_lib.h +++ b/src/include/gnunet_testing_lib.h | |||
@@ -88,10 +88,12 @@ struct GNUNET_TESTING_Host | |||
88 | * @param d handle for the daemon | 88 | * @param d handle for the daemon |
89 | * @param emsg error message (NULL on success) | 89 | * @param emsg error message (NULL on success) |
90 | */ | 90 | */ |
91 | typedef void (*GNUNET_TESTING_NotifyHostkeyCreated)(void *cls, | 91 | typedef void (*GNUNET_TESTING_NotifyHostkeyCreated) (void *cls, |
92 | const struct GNUNET_PeerIdentity *id, | 92 | const struct |
93 | struct GNUNET_TESTING_Daemon *d, | 93 | GNUNET_PeerIdentity * id, |
94 | const char *emsg); | 94 | struct |
95 | GNUNET_TESTING_Daemon * d, | ||
96 | const char *emsg); | ||
95 | 97 | ||
96 | /** | 98 | /** |
97 | * Prototype of a function that will be called whenever | 99 | * Prototype of a function that will be called whenever |
@@ -103,11 +105,14 @@ typedef void (*GNUNET_TESTING_NotifyHostkeyCreated)(void *cls, | |||
103 | * @param d handle for the daemon | 105 | * @param d handle for the daemon |
104 | * @param emsg error message (NULL on success) | 106 | * @param emsg error message (NULL on success) |
105 | */ | 107 | */ |
106 | typedef void (*GNUNET_TESTING_NotifyDaemonRunning)(void *cls, | 108 | typedef void (*GNUNET_TESTING_NotifyDaemonRunning) (void *cls, |
107 | const struct GNUNET_PeerIdentity *id, | 109 | const struct |
108 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 110 | GNUNET_PeerIdentity * id, |
109 | struct GNUNET_TESTING_Daemon *d, | 111 | const struct |
110 | const char *emsg); | 112 | GNUNET_CONFIGURATION_Handle |
113 | * cfg, | ||
114 | struct GNUNET_TESTING_Daemon | ||
115 | * d, const char *emsg); | ||
111 | 116 | ||
112 | 117 | ||
113 | /** | 118 | /** |
@@ -203,8 +208,7 @@ enum GNUNET_TESTING_StartPhase | |||
203 | * @param cls closure | 208 | * @param cls closure |
204 | * @param emsg NULL on success | 209 | * @param emsg NULL on success |
205 | */ | 210 | */ |
206 | typedef void (*GNUNET_TESTING_NotifyCompletion)(void *cls, | 211 | typedef void (*GNUNET_TESTING_NotifyCompletion) (void *cls, const char *emsg); |
207 | const char *emsg); | ||
208 | 212 | ||
209 | /** | 213 | /** |
210 | * Prototype of a function that will be called with the | 214 | * Prototype of a function that will be called with the |
@@ -213,8 +217,8 @@ typedef void (*GNUNET_TESTING_NotifyCompletion)(void *cls, | |||
213 | * @param cls closure | 217 | * @param cls closure |
214 | * @param num_connections the number of connections created | 218 | * @param num_connections the number of connections created |
215 | */ | 219 | */ |
216 | typedef void (*GNUNET_TESTING_NotifyConnections)(void *cls, | 220 | typedef void (*GNUNET_TESTING_NotifyConnections) (void *cls, |
217 | unsigned int num_connections); | 221 | unsigned int num_connections); |
218 | 222 | ||
219 | /** | 223 | /** |
220 | * Handle for a GNUnet daemon (technically a set of | 224 | * Handle for a GNUnet daemon (technically a set of |
@@ -405,15 +409,23 @@ struct GNUNET_TESTING_PeerGroup; | |||
405 | * @param second_daemon handle for the second daemon | 409 | * @param second_daemon handle for the second daemon |
406 | * @param emsg error message (NULL on success) | 410 | * @param emsg error message (NULL on success) |
407 | */ | 411 | */ |
408 | typedef void (*GNUNET_TESTING_NotifyConnection)(void *cls, | 412 | typedef void (*GNUNET_TESTING_NotifyConnection) (void *cls, |
409 | const struct GNUNET_PeerIdentity *first, | 413 | const struct |
410 | const struct GNUNET_PeerIdentity *second, | 414 | GNUNET_PeerIdentity * first, |
411 | uint32_t distance, | 415 | const struct |
412 | const struct GNUNET_CONFIGURATION_Handle *first_cfg, | 416 | GNUNET_PeerIdentity * second, |
413 | const struct GNUNET_CONFIGURATION_Handle *second_cfg, | 417 | uint32_t distance, |
414 | struct GNUNET_TESTING_Daemon *first_daemon, | 418 | const struct |
415 | struct GNUNET_TESTING_Daemon *second_daemon, | 419 | GNUNET_CONFIGURATION_Handle * |
416 | const char *emsg); | 420 | first_cfg, |
421 | const struct | ||
422 | GNUNET_CONFIGURATION_Handle * | ||
423 | second_cfg, | ||
424 | struct GNUNET_TESTING_Daemon * | ||
425 | first_daemon, | ||
426 | struct GNUNET_TESTING_Daemon * | ||
427 | second_daemon, | ||
428 | const char *emsg); | ||
417 | 429 | ||
418 | /** | 430 | /** |
419 | * Prototype of a callback function indicating that two peers | 431 | * Prototype of a callback function indicating that two peers |
@@ -425,10 +437,11 @@ typedef void (*GNUNET_TESTING_NotifyConnection)(void *cls, | |||
425 | * @param distance distance between the connected peers | 437 | * @param distance distance between the connected peers |
426 | * @param emsg error message (NULL on success) | 438 | * @param emsg error message (NULL on success) |
427 | */ | 439 | */ |
428 | typedef void (*GNUNET_TESTING_NotifyTopology)(void *cls, | 440 | typedef void (*GNUNET_TESTING_NotifyTopology) (void *cls, |
429 | const struct GNUNET_PeerIdentity *first, | 441 | const struct GNUNET_PeerIdentity |
430 | const struct GNUNET_PeerIdentity *second, | 442 | * first, |
431 | const char *emsg); | 443 | const struct GNUNET_PeerIdentity |
444 | * second, const char *emsg); | ||
432 | 445 | ||
433 | /** | 446 | /** |
434 | * Starts a GNUnet daemon. GNUnet must be installed on the target | 447 | * Starts a GNUnet daemon. GNUnet must be installed on the target |
@@ -453,18 +466,22 @@ typedef void (*GNUNET_TESTING_NotifyTopology)(void *cls, | |||
453 | * @param cb_cls closure for cb | 466 | * @param cb_cls closure for cb |
454 | * @return handle to the daemon (actual start will be completed asynchronously) | 467 | * @return handle to the daemon (actual start will be completed asynchronously) |
455 | */ | 468 | */ |
456 | struct GNUNET_TESTING_Daemon * | 469 | struct GNUNET_TESTING_Daemon *GNUNET_TESTING_daemon_start (const struct |
457 | GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | 470 | GNUNET_CONFIGURATION_Handle |
458 | struct GNUNET_TIME_Relative timeout, | 471 | *cfg, |
459 | int pretend, | 472 | struct |
460 | const char *hostname, | 473 | GNUNET_TIME_Relative |
461 | const char *ssh_username, | 474 | timeout, int pretend, |
462 | uint16_t sshport, | 475 | const char *hostname, |
463 | const char *hostkey, | 476 | const char |
464 | GNUNET_TESTING_NotifyHostkeyCreated | 477 | *ssh_username, |
465 | hostkey_callback, void *hostkey_cls, | 478 | uint16_t sshport, |
466 | GNUNET_TESTING_NotifyDaemonRunning cb, | 479 | const char *hostkey, |
467 | void *cb_cls); | 480 | GNUNET_TESTING_NotifyHostkeyCreated |
481 | hostkey_callback, | ||
482 | void *hostkey_cls, | ||
483 | GNUNET_TESTING_NotifyDaemonRunning | ||
484 | cb, void *cb_cls); | ||
468 | 485 | ||
469 | /** | 486 | /** |
470 | * Continues GNUnet daemon startup when user wanted to be notified | 487 | * Continues GNUnet daemon startup when user wanted to be notified |
@@ -474,7 +491,7 @@ GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
474 | * @param daemon the daemon to finish starting | 491 | * @param daemon the daemon to finish starting |
475 | */ | 492 | */ |
476 | void | 493 | void |
477 | GNUNET_TESTING_daemon_continue_startup(struct GNUNET_TESTING_Daemon *daemon); | 494 | GNUNET_TESTING_daemon_continue_startup (struct GNUNET_TESTING_Daemon *daemon); |
478 | 495 | ||
479 | /** | 496 | /** |
480 | * Check whether the given daemon is running. | 497 | * Check whether the given daemon is running. |
@@ -484,8 +501,7 @@ GNUNET_TESTING_daemon_continue_startup(struct GNUNET_TESTING_Daemon *daemon); | |||
484 | * @return GNUNET_YES if the daemon is up, GNUNET_NO if the | 501 | * @return GNUNET_YES if the daemon is up, GNUNET_NO if the |
485 | * daemon is down, GNUNET_SYSERR on error. | 502 | * daemon is down, GNUNET_SYSERR on error. |
486 | */ | 503 | */ |
487 | int | 504 | int GNUNET_TESTING_daemon_running (struct GNUNET_TESTING_Daemon *daemon); |
488 | GNUNET_TESTING_daemon_running (struct GNUNET_TESTING_Daemon *daemon); | ||
489 | 505 | ||
490 | /** | 506 | /** |
491 | * Restart (stop and start) a GNUnet daemon. | 507 | * Restart (stop and start) a GNUnet daemon. |
@@ -496,7 +512,8 @@ GNUNET_TESTING_daemon_running (struct GNUNET_TESTING_Daemon *daemon); | |||
496 | */ | 512 | */ |
497 | void | 513 | void |
498 | GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d, | 514 | GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d, |
499 | GNUNET_TESTING_NotifyDaemonRunning cb, void *cb_cls); | 515 | GNUNET_TESTING_NotifyDaemonRunning cb, |
516 | void *cb_cls); | ||
500 | 517 | ||
501 | /** | 518 | /** |
502 | * Start a peer that has previously been stopped using the daemon_stop | 519 | * Start a peer that has previously been stopped using the daemon_stop |
@@ -526,7 +543,8 @@ void | |||
526 | GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d, | 543 | GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d, |
527 | char *service, | 544 | char *service, |
528 | struct GNUNET_TIME_Relative timeout, | 545 | struct GNUNET_TIME_Relative timeout, |
529 | GNUNET_TESTING_NotifyDaemonRunning cb, void *cb_cls); | 546 | GNUNET_TESTING_NotifyDaemonRunning cb, |
547 | void *cb_cls); | ||
530 | 548 | ||
531 | /** | 549 | /** |
532 | * Starts a GNUnet daemon's service which has been previously turned off. | 550 | * Starts a GNUnet daemon's service which has been previously turned off. |
@@ -540,8 +558,10 @@ GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d, | |||
540 | void | 558 | void |
541 | GNUNET_TESTING_daemon_start_stopped_service (struct GNUNET_TESTING_Daemon *d, | 559 | GNUNET_TESTING_daemon_start_stopped_service (struct GNUNET_TESTING_Daemon *d, |
542 | char *service, | 560 | char *service, |
543 | struct GNUNET_TIME_Relative timeout, | 561 | struct GNUNET_TIME_Relative |
544 | GNUNET_TESTING_NotifyDaemonRunning cb, void *cb_cls); | 562 | timeout, |
563 | GNUNET_TESTING_NotifyDaemonRunning | ||
564 | cb, void *cb_cls); | ||
545 | 565 | ||
546 | /** | 566 | /** |
547 | * Get a certain testing daemon handle. | 567 | * Get a certain testing daemon handle. |
@@ -549,9 +569,10 @@ GNUNET_TESTING_daemon_start_stopped_service (struct GNUNET_TESTING_Daemon *d, | |||
549 | * @param pg handle to the set of running peers | 569 | * @param pg handle to the set of running peers |
550 | * @param position the number of the peer to return | 570 | * @param position the number of the peer to return |
551 | */ | 571 | */ |
552 | struct GNUNET_TESTING_Daemon * | 572 | struct GNUNET_TESTING_Daemon *GNUNET_TESTING_daemon_get (struct |
553 | GNUNET_TESTING_daemon_get (struct GNUNET_TESTING_PeerGroup *pg, | 573 | GNUNET_TESTING_PeerGroup |
554 | unsigned int position); | 574 | *pg, |
575 | unsigned int position); | ||
555 | 576 | ||
556 | /* | 577 | /* |
557 | * Get a daemon by peer identity, so callers can | 578 | * Get a daemon by peer identity, so callers can |
@@ -562,9 +583,12 @@ GNUNET_TESTING_daemon_get (struct GNUNET_TESTING_PeerGroup *pg, | |||
562 | * | 583 | * |
563 | * @return the daemon on success, or NULL if no such peer identity is found | 584 | * @return the daemon on success, or NULL if no such peer identity is found |
564 | */ | 585 | */ |
565 | struct GNUNET_TESTING_Daemon * | 586 | struct GNUNET_TESTING_Daemon *GNUNET_TESTING_daemon_get_by_id (struct |
566 | GNUNET_TESTING_daemon_get_by_id (struct GNUNET_TESTING_PeerGroup *pg, | 587 | GNUNET_TESTING_PeerGroup |
567 | struct GNUNET_PeerIdentity *peer_id); | 588 | *pg, |
589 | struct | ||
590 | GNUNET_PeerIdentity | ||
591 | *peer_id); | ||
568 | 592 | ||
569 | /** | 593 | /** |
570 | * Stops a GNUnet daemon. | 594 | * Stops a GNUnet daemon. |
@@ -595,9 +619,9 @@ GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, | |||
595 | * @param cb_cls closure for cb | 619 | * @param cb_cls closure for cb |
596 | */ | 620 | */ |
597 | void GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d, | 621 | void GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d, |
598 | struct GNUNET_CONFIGURATION_Handle *cfg, | 622 | struct GNUNET_CONFIGURATION_Handle *cfg, |
599 | GNUNET_TESTING_NotifyCompletion cb, | 623 | GNUNET_TESTING_NotifyCompletion cb, |
600 | void * cb_cls); | 624 | void *cb_cls); |
601 | 625 | ||
602 | /** | 626 | /** |
603 | * Stops a single service of a GNUnet daemon. Used like daemon_stop, | 627 | * Stops a single service of a GNUnet daemon. Used like daemon_stop, |
@@ -615,7 +639,8 @@ void | |||
615 | GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d, | 639 | GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d, |
616 | char *service, | 640 | char *service, |
617 | struct GNUNET_TIME_Relative timeout, | 641 | struct GNUNET_TIME_Relative timeout, |
618 | GNUNET_TESTING_NotifyCompletion cb, void *cb_cls); | 642 | GNUNET_TESTING_NotifyCompletion cb, |
643 | void *cb_cls); | ||
619 | 644 | ||
620 | /** | 645 | /** |
621 | * Read a testing hosts file based on a configuration. | 646 | * Read a testing hosts file based on a configuration. |
@@ -626,8 +651,9 @@ GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d, | |||
626 | * | 651 | * |
627 | * @return DLL of hosts on success, NULL on failure | 652 | * @return DLL of hosts on success, NULL on failure |
628 | */ | 653 | */ |
629 | struct GNUNET_TESTING_Host * | 654 | struct GNUNET_TESTING_Host *GNUNET_TESTING_hosts_load (const struct |
630 | GNUNET_TESTING_hosts_load (const struct GNUNET_CONFIGURATION_Handle *cfg); | 655 | GNUNET_CONFIGURATION_Handle |
656 | *cfg); | ||
631 | 657 | ||
632 | 658 | ||
633 | /** | 659 | /** |
@@ -657,19 +683,31 @@ GNUNET_TESTING_hosts_load (const struct GNUNET_CONFIGURATION_Handle *cfg); | |||
657 | * | 683 | * |
658 | * @return NULL on error, otherwise handle to control peer group | 684 | * @return NULL on error, otherwise handle to control peer group |
659 | */ | 685 | */ |
660 | struct GNUNET_TESTING_PeerGroup * | 686 | struct GNUNET_TESTING_PeerGroup *GNUNET_TESTING_daemons_start (const struct |
661 | GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | 687 | GNUNET_CONFIGURATION_Handle |
662 | unsigned int total, | 688 | *cfg, |
663 | unsigned int max_concurrent_connections, | 689 | unsigned int |
664 | unsigned int max_concurrent_ssh, | 690 | total, |
665 | struct GNUNET_TIME_Relative timeout, | 691 | unsigned int |
666 | GNUNET_TESTING_NotifyHostkeyCreated | 692 | max_concurrent_connections, |
667 | hostkey_callback, void *hostkey_cls, | 693 | unsigned int |
668 | GNUNET_TESTING_NotifyDaemonRunning cb, | 694 | max_concurrent_ssh, |
669 | void *cb_cls, | 695 | struct |
670 | GNUNET_TESTING_NotifyConnection | 696 | GNUNET_TIME_Relative |
671 | connect_callback, void *connect_callback_cls, | 697 | timeout, |
672 | const struct GNUNET_TESTING_Host *hostnames); | 698 | GNUNET_TESTING_NotifyHostkeyCreated |
699 | hostkey_callback, | ||
700 | void | ||
701 | *hostkey_cls, | ||
702 | GNUNET_TESTING_NotifyDaemonRunning | ||
703 | cb, void *cb_cls, | ||
704 | GNUNET_TESTING_NotifyConnection | ||
705 | connect_callback, | ||
706 | void | ||
707 | *connect_callback_cls, | ||
708 | const struct | ||
709 | GNUNET_TESTING_Host | ||
710 | *hostnames); | ||
673 | 711 | ||
674 | /** | 712 | /** |
675 | * Function which continues a peer group starting up | 713 | * Function which continues a peer group starting up |
@@ -678,7 +716,7 @@ GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
678 | * @param pg the peer group to continue starting | 716 | * @param pg the peer group to continue starting |
679 | */ | 717 | */ |
680 | void | 718 | void |
681 | GNUNET_TESTING_daemons_continue_startup(struct GNUNET_TESTING_PeerGroup *pg); | 719 | GNUNET_TESTING_daemons_continue_startup (struct GNUNET_TESTING_PeerGroup *pg); |
682 | 720 | ||
683 | 721 | ||
684 | /** | 722 | /** |
@@ -727,10 +765,9 @@ GNUNET_TESTING_daemons_restart (struct GNUNET_TESTING_PeerGroup *pg, | |||
727 | * @param cb_cls closure for cb | 765 | * @param cb_cls closure for cb |
728 | */ | 766 | */ |
729 | void | 767 | void |
730 | GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg, | 768 | GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg, |
731 | struct GNUNET_TIME_Relative timeout, | 769 | struct GNUNET_TIME_Relative timeout, |
732 | GNUNET_TESTING_NotifyCompletion cb, | 770 | GNUNET_TESTING_NotifyCompletion cb, void *cb_cls); |
733 | void *cb_cls); | ||
734 | 771 | ||
735 | 772 | ||
736 | /** | 773 | /** |
@@ -772,8 +809,7 @@ GNUNET_TESTING_daemons_churn (struct GNUNET_TESTING_PeerGroup *pg, | |||
772 | unsigned int voff, | 809 | unsigned int voff, |
773 | unsigned int von, | 810 | unsigned int von, |
774 | struct GNUNET_TIME_Relative timeout, | 811 | struct GNUNET_TIME_Relative timeout, |
775 | GNUNET_TESTING_NotifyCompletion cb, | 812 | GNUNET_TESTING_NotifyCompletion cb, void *cb_cls); |
776 | void *cb_cls); | ||
777 | /* | 813 | /* |
778 | * Start a given service for each of the peers in the peer group. | 814 | * Start a given service for each of the peers in the peer group. |
779 | * | 815 | * |
@@ -804,7 +840,8 @@ GNUNET_TESTING_daemons_start_service (struct GNUNET_TESTING_PeerGroup *pg, | |||
804 | * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration | 840 | * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration |
805 | */ | 841 | */ |
806 | typedef int (*GNUNET_TESTING_STATISTICS_Iterator) (void *cls, | 842 | typedef int (*GNUNET_TESTING_STATISTICS_Iterator) (void *cls, |
807 | const struct GNUNET_PeerIdentity *peer, | 843 | const struct |
844 | GNUNET_PeerIdentity * peer, | ||
808 | const char *subsystem, | 845 | const char *subsystem, |
809 | const char *name, | 846 | const char *name, |
810 | uint64_t value, | 847 | uint64_t value, |
@@ -822,7 +859,8 @@ typedef int (*GNUNET_TESTING_STATISTICS_Iterator) (void *cls, | |||
822 | void | 859 | void |
823 | GNUNET_TESTING_get_statistics (struct GNUNET_TESTING_PeerGroup *pg, | 860 | GNUNET_TESTING_get_statistics (struct GNUNET_TESTING_PeerGroup *pg, |
824 | GNUNET_STATISTICS_Callback cont, | 861 | GNUNET_STATISTICS_Callback cont, |
825 | GNUNET_TESTING_STATISTICS_Iterator proc, void *cls); | 862 | GNUNET_TESTING_STATISTICS_Iterator proc, |
863 | void *cls); | ||
826 | 864 | ||
827 | /** | 865 | /** |
828 | * Topologies supported for testbeds. | 866 | * Topologies supported for testbeds. |
@@ -938,8 +976,8 @@ enum GNUNET_TESTING_TopologyOption | |||
938 | * known topology, GNUNET_NO if not | 976 | * known topology, GNUNET_NO if not |
939 | */ | 977 | */ |
940 | int | 978 | int |
941 | GNUNET_TESTING_topology_get(enum GNUNET_TESTING_Topology *topology, | 979 | GNUNET_TESTING_topology_get (enum GNUNET_TESTING_Topology *topology, |
942 | const char * topology_string); | 980 | const char *topology_string); |
943 | 981 | ||
944 | /** | 982 | /** |
945 | * Get connect topology option from string input. | 983 | * Get connect topology option from string input. |
@@ -951,8 +989,9 @@ GNUNET_TESTING_topology_get(enum GNUNET_TESTING_Topology *topology, | |||
951 | * known topology, GNUNET_NO if not | 989 | * known topology, GNUNET_NO if not |
952 | */ | 990 | */ |
953 | int | 991 | int |
954 | GNUNET_TESTING_topology_option_get(enum GNUNET_TESTING_TopologyOption *topology_option, | 992 | GNUNET_TESTING_topology_option_get (enum GNUNET_TESTING_TopologyOption |
955 | const char * topology_string); | 993 | *topology_option, |
994 | const char *topology_string); | ||
956 | 995 | ||
957 | 996 | ||
958 | /** | 997 | /** |
@@ -1007,21 +1046,21 @@ GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg, | |||
1007 | */ | 1046 | */ |
1008 | void | 1047 | void |
1009 | GNUNET_TESTING_get_topology (struct GNUNET_TESTING_PeerGroup *pg, | 1048 | GNUNET_TESTING_get_topology (struct GNUNET_TESTING_PeerGroup *pg, |
1010 | GNUNET_TESTING_NotifyTopology cb, void *cls); | 1049 | GNUNET_TESTING_NotifyTopology cb, void *cls); |
1011 | 1050 | ||
1012 | /** | 1051 | /** |
1013 | * Stop the connection process temporarily. | 1052 | * Stop the connection process temporarily. |
1014 | * | 1053 | * |
1015 | * @param pg the peer group to stop connecting | 1054 | * @param pg the peer group to stop connecting |
1016 | */ | 1055 | */ |
1017 | void GNUNET_TESTING_stop_connections(struct GNUNET_TESTING_PeerGroup *pg); | 1056 | void GNUNET_TESTING_stop_connections (struct GNUNET_TESTING_PeerGroup *pg); |
1018 | 1057 | ||
1019 | /** | 1058 | /** |
1020 | * Resume the connection process. | 1059 | * Resume the connection process. |
1021 | * | 1060 | * |
1022 | * @param pg the peer group to resume connecting | 1061 | * @param pg the peer group to resume connecting |
1023 | */ | 1062 | */ |
1024 | void GNUNET_TESTING_resume_connections(struct GNUNET_TESTING_PeerGroup *pg); | 1063 | void GNUNET_TESTING_resume_connections (struct GNUNET_TESTING_PeerGroup *pg); |
1025 | 1064 | ||
1026 | /** | 1065 | /** |
1027 | * There are many ways to connect peers that are supported by this function. | 1066 | * There are many ways to connect peers that are supported by this function. |
@@ -1066,12 +1105,11 @@ GNUNET_TESTING_connect_topology (struct GNUNET_TESTING_PeerGroup *pg, | |||
1066 | * @param cb_cls closure for cb | 1105 | * @param cb_cls closure for cb |
1067 | */ | 1106 | */ |
1068 | void | 1107 | void |
1069 | GNUNET_TESTING_daemons_vary (struct GNUNET_TESTING_PeerGroup *pg, | 1108 | GNUNET_TESTING_daemons_vary (struct GNUNET_TESTING_PeerGroup *pg, |
1070 | unsigned int offset, | 1109 | unsigned int offset, |
1071 | int desired_status, | 1110 | int desired_status, |
1072 | struct GNUNET_TIME_Relative timeout, | 1111 | struct GNUNET_TIME_Relative timeout, |
1073 | GNUNET_TESTING_NotifyCompletion cb, | 1112 | GNUNET_TESTING_NotifyCompletion cb, void *cb_cls); |
1074 | void *cb_cls); | ||
1075 | 1113 | ||
1076 | /** | 1114 | /** |
1077 | * Start a peer group with a given number of peers. Notify | 1115 | * Start a peer group with a given number of peers. Notify |
@@ -1090,15 +1128,23 @@ GNUNET_TESTING_daemons_vary (struct GNUNET_TESTING_PeerGroup *pg, | |||
1090 | * | 1128 | * |
1091 | * @return NULL on error, otherwise handle to control peer group | 1129 | * @return NULL on error, otherwise handle to control peer group |
1092 | */ | 1130 | */ |
1093 | struct GNUNET_TESTING_PeerGroup * | 1131 | struct GNUNET_TESTING_PeerGroup *GNUNET_TESTING_peergroup_start (const struct |
1094 | GNUNET_TESTING_peergroup_start( | 1132 | GNUNET_CONFIGURATION_Handle |
1095 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 1133 | *cfg, |
1096 | unsigned int total, | 1134 | unsigned int |
1097 | struct GNUNET_TIME_Relative timeout, | 1135 | total, |
1098 | GNUNET_TESTING_NotifyConnection connect_cb, | 1136 | struct |
1099 | GNUNET_TESTING_NotifyCompletion peergroup_cb, | 1137 | GNUNET_TIME_Relative |
1100 | void *peergroup_cls, | 1138 | timeout, |
1101 | const struct GNUNET_TESTING_Host *hostnames); | 1139 | GNUNET_TESTING_NotifyConnection |
1140 | connect_cb, | ||
1141 | GNUNET_TESTING_NotifyCompletion | ||
1142 | peergroup_cb, | ||
1143 | void | ||
1144 | *peergroup_cls, | ||
1145 | const struct | ||
1146 | GNUNET_TESTING_Host | ||
1147 | *hostnames); | ||
1102 | 1148 | ||
1103 | /** | 1149 | /** |
1104 | * Print current topology to a graphviz readable file. | 1150 | * Print current topology to a graphviz readable file. |
@@ -1110,10 +1156,10 @@ GNUNET_TESTING_peergroup_start( | |||
1110 | * | 1156 | * |
1111 | */ | 1157 | */ |
1112 | void | 1158 | void |
1113 | GNUNET_TESTING_peergroup_topology_to_file(struct GNUNET_TESTING_PeerGroup *pg, | 1159 | GNUNET_TESTING_peergroup_topology_to_file (struct GNUNET_TESTING_PeerGroup *pg, |
1114 | const char *output_filename, | 1160 | const char *output_filename, |
1115 | GNUNET_TESTING_NotifyCompletion notify_cb, | 1161 | GNUNET_TESTING_NotifyCompletion |
1116 | void *notify_cb_cls); | 1162 | notify_cb, void *notify_cb_cls); |
1117 | 1163 | ||
1118 | 1164 | ||
1119 | #if 0 /* keep Emacsens' auto-indent happy */ | 1165 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_time_lib.h b/src/include/gnunet_time_lib.h index 386f6d609..be35ff131 100644 --- a/src/include/gnunet_time_lib.h +++ b/src/include/gnunet_time_lib.h | |||
@@ -199,10 +199,10 @@ struct GNUNET_TIME_Absolute GNUNET_TIME_relative_to_absolute (struct | |||
199 | * @return timestamp that is smaller | 199 | * @return timestamp that is smaller |
200 | */ | 200 | */ |
201 | struct GNUNET_TIME_Relative GNUNET_TIME_relative_min (struct | 201 | struct GNUNET_TIME_Relative GNUNET_TIME_relative_min (struct |
202 | GNUNET_TIME_Relative | 202 | GNUNET_TIME_Relative |
203 | t1, | 203 | t1, |
204 | struct | 204 | struct |
205 | GNUNET_TIME_Relative t2); | 205 | GNUNET_TIME_Relative t2); |
206 | 206 | ||
207 | 207 | ||
208 | /** | 208 | /** |
@@ -213,10 +213,10 @@ struct GNUNET_TIME_Relative GNUNET_TIME_relative_min (struct | |||
213 | * @return timestamp that is larger | 213 | * @return timestamp that is larger |
214 | */ | 214 | */ |
215 | struct GNUNET_TIME_Relative GNUNET_TIME_relative_max (struct | 215 | struct GNUNET_TIME_Relative GNUNET_TIME_relative_max (struct |
216 | GNUNET_TIME_Relative | 216 | GNUNET_TIME_Relative |
217 | t1, | 217 | t1, |
218 | struct | 218 | struct |
219 | GNUNET_TIME_Relative t2); | 219 | GNUNET_TIME_Relative t2); |
220 | 220 | ||
221 | /** | 221 | /** |
222 | * Return the minimum of two absolute time values. | 222 | * Return the minimum of two absolute time values. |
@@ -226,10 +226,10 @@ struct GNUNET_TIME_Relative GNUNET_TIME_relative_max (struct | |||
226 | * @return timestamp that is smaller | 226 | * @return timestamp that is smaller |
227 | */ | 227 | */ |
228 | struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_min (struct | 228 | struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_min (struct |
229 | GNUNET_TIME_Absolute | 229 | GNUNET_TIME_Absolute |
230 | t1, | 230 | t1, |
231 | struct | 231 | struct |
232 | GNUNET_TIME_Absolute t2); | 232 | GNUNET_TIME_Absolute t2); |
233 | 233 | ||
234 | /** | 234 | /** |
235 | * Return the maximum of two absolute time values. | 235 | * Return the maximum of two absolute time values. |
@@ -239,10 +239,10 @@ struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_min (struct | |||
239 | * @return timestamp that is smaller | 239 | * @return timestamp that is smaller |
240 | */ | 240 | */ |
241 | struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_max (struct | 241 | struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_max (struct |
242 | GNUNET_TIME_Absolute | 242 | GNUNET_TIME_Absolute |
243 | t1, | 243 | t1, |
244 | struct | 244 | struct |
245 | GNUNET_TIME_Absolute t2); | 245 | GNUNET_TIME_Absolute t2); |
246 | 246 | ||
247 | /** | 247 | /** |
248 | * Given a timestamp in the future, how much time | 248 | * Given a timestamp in the future, how much time |
@@ -266,9 +266,10 @@ struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining (struct | |||
266 | * @return remaining duration for the operation, | 266 | * @return remaining duration for the operation, |
267 | * assuming it continues at the same speed | 267 | * assuming it continues at the same speed |
268 | */ | 268 | */ |
269 | struct GNUNET_TIME_Relative GNUNET_TIME_calculate_eta (struct GNUNET_TIME_Absolute start, | 269 | struct GNUNET_TIME_Relative GNUNET_TIME_calculate_eta (struct |
270 | uint64_t finished, | 270 | GNUNET_TIME_Absolute |
271 | uint64_t total); | 271 | start, uint64_t finished, |
272 | uint64_t total); | ||
272 | 273 | ||
273 | 274 | ||
274 | /** | 275 | /** |
@@ -324,11 +325,11 @@ struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_add (struct | |||
324 | * @return ZERO if start <= duration, or FOREVER if start time is FOREVER; start-duration otherwise | 325 | * @return ZERO if start <= duration, or FOREVER if start time is FOREVER; start-duration otherwise |
325 | */ | 326 | */ |
326 | struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_subtract (struct | 327 | struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_subtract (struct |
327 | GNUNET_TIME_Absolute | 328 | GNUNET_TIME_Absolute |
328 | start, | 329 | start, |
329 | struct | 330 | struct |
330 | GNUNET_TIME_Relative | 331 | GNUNET_TIME_Relative |
331 | duration); | 332 | duration); |
332 | 333 | ||
333 | /** | 334 | /** |
334 | * Multiply relative time by a given factor. | 335 | * Multiply relative time by a given factor. |
@@ -340,8 +341,7 @@ struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_subtract (struct | |||
340 | struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply (struct | 341 | struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply (struct |
341 | GNUNET_TIME_Relative | 342 | GNUNET_TIME_Relative |
342 | rel, | 343 | rel, |
343 | unsigned int | 344 | unsigned int factor); |
344 | factor); | ||
345 | 345 | ||
346 | /** | 346 | /** |
347 | * Divide relative time by a given factor. | 347 | * Divide relative time by a given factor. |
@@ -351,10 +351,9 @@ struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply (struct | |||
351 | * @return FOREVER if rel=FOREVER or factor==0; otherwise rel/factor | 351 | * @return FOREVER if rel=FOREVER or factor==0; otherwise rel/factor |
352 | */ | 352 | */ |
353 | struct GNUNET_TIME_Relative GNUNET_TIME_relative_divide (struct | 353 | struct GNUNET_TIME_Relative GNUNET_TIME_relative_divide (struct |
354 | GNUNET_TIME_Relative | 354 | GNUNET_TIME_Relative |
355 | rel, | 355 | rel, |
356 | unsigned int | 356 | unsigned int factor); |
357 | factor); | ||
358 | 357 | ||
359 | /** | 358 | /** |
360 | * Add relative times together. | 359 | * Add relative times together. |
@@ -366,8 +365,7 @@ struct GNUNET_TIME_Relative GNUNET_TIME_relative_divide (struct | |||
366 | struct GNUNET_TIME_Relative GNUNET_TIME_relative_add (struct | 365 | struct GNUNET_TIME_Relative GNUNET_TIME_relative_add (struct |
367 | GNUNET_TIME_Relative a1, | 366 | GNUNET_TIME_Relative a1, |
368 | struct | 367 | struct |
369 | GNUNET_TIME_Relative | 368 | GNUNET_TIME_Relative a2); |
370 | a2); | ||
371 | 369 | ||
372 | /** | 370 | /** |
373 | * Subtract relative timestamp from the other. | 371 | * Subtract relative timestamp from the other. |
@@ -378,7 +376,7 @@ struct GNUNET_TIME_Relative GNUNET_TIME_relative_add (struct | |||
378 | */ | 376 | */ |
379 | struct GNUNET_TIME_Relative | 377 | struct GNUNET_TIME_Relative |
380 | GNUNET_TIME_relative_subtract (struct GNUNET_TIME_Relative a1, | 378 | GNUNET_TIME_relative_subtract (struct GNUNET_TIME_Relative a1, |
381 | struct GNUNET_TIME_Relative a2); | 379 | struct GNUNET_TIME_Relative a2); |
382 | 380 | ||
383 | 381 | ||
384 | /** | 382 | /** |
@@ -429,16 +427,14 @@ struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_ntoh (struct | |||
429 | * | 427 | * |
430 | * @return string form of the time (as milliseconds) | 428 | * @return string form of the time (as milliseconds) |
431 | */ | 429 | */ |
432 | const char * | 430 | const char *GNUNET_TIME_relative_to_string (struct GNUNET_TIME_Relative time); |
433 | GNUNET_TIME_relative_to_string (struct GNUNET_TIME_Relative time); | ||
434 | 431 | ||
435 | /** | 432 | /** |
436 | * Set the timestamp offset for this instance. | 433 | * Set the timestamp offset for this instance. |
437 | * | 434 | * |
438 | * @param offset the offset to skew the locale time by | 435 | * @param offset the offset to skew the locale time by |
439 | */ | 436 | */ |
440 | void | 437 | void GNUNET_TIME_set_offset (long long offset); |
441 | GNUNET_TIME_set_offset(long long offset); | ||
442 | 438 | ||
443 | #if 0 /* keep Emacsens' auto-indent happy */ | 439 | #if 0 /* keep Emacsens' auto-indent happy */ |
444 | { | 440 | { |
diff --git a/src/include/gnunet_transport_plugin.h b/src/include/gnunet_transport_plugin.h index 37eef9427..b90f3f1cf 100644 --- a/src/include/gnunet_transport_plugin.h +++ b/src/include/gnunet_transport_plugin.h | |||
@@ -63,7 +63,7 @@ struct SessionHeader | |||
63 | * Expiration time for signature. Do not use in the plugin! | 63 | * Expiration time for signature. Do not use in the plugin! |
64 | */ | 64 | */ |
65 | struct GNUNET_TIME_Absolute pong_sig_expires; | 65 | struct GNUNET_TIME_Absolute pong_sig_expires; |
66 | 66 | ||
67 | }; | 67 | }; |
68 | 68 | ||
69 | /** | 69 | /** |
@@ -80,8 +80,8 @@ struct SessionHeader | |||
80 | * @param session which session is being destoyed | 80 | * @param session which session is being destoyed |
81 | */ | 81 | */ |
82 | typedef void (*GNUNET_TRANSPORT_SessionEnd) (void *cls, | 82 | typedef void (*GNUNET_TRANSPORT_SessionEnd) (void *cls, |
83 | const struct GNUNET_PeerIdentity *peer, | 83 | const struct GNUNET_PeerIdentity * |
84 | struct Session *session); | 84 | peer, struct Session * session); |
85 | 85 | ||
86 | 86 | ||
87 | /** | 87 | /** |
@@ -105,18 +105,26 @@ typedef void (*GNUNET_TRANSPORT_SessionEnd) (void *cls, | |||
105 | * @return how long the plugin should wait until receiving more data | 105 | * @return how long the plugin should wait until receiving more data |
106 | * (plugins that do not support this, can ignore the return value) | 106 | * (plugins that do not support this, can ignore the return value) |
107 | */ | 107 | */ |
108 | typedef struct GNUNET_TIME_Relative (*GNUNET_TRANSPORT_PluginReceiveCallback) (void *cls, | 108 | typedef struct |
109 | const struct | 109 | GNUNET_TIME_Relative (*GNUNET_TRANSPORT_PluginReceiveCallback) (void *cls, |
110 | GNUNET_PeerIdentity * | 110 | const struct |
111 | peer, | 111 | GNUNET_PeerIdentity |
112 | const struct | 112 | * peer, |
113 | GNUNET_MessageHeader * | 113 | const struct |
114 | message, | 114 | GNUNET_MessageHeader |
115 | const struct GNUNET_TRANSPORT_ATS_Information *ats, | 115 | * message, |
116 | uint32_t ats_count, | 116 | const struct |
117 | struct Session *session, | 117 | GNUNET_TRANSPORT_ATS_Information |
118 | const char *sender_address, | 118 | * ats, |
119 | uint16_t sender_address_len); | 119 | uint32_t |
120 | ats_count, | ||
121 | struct | ||
122 | Session * | ||
123 | session, | ||
124 | const char | ||
125 | *sender_address, | ||
126 | uint16_t | ||
127 | sender_address_len); | ||
120 | 128 | ||
121 | 129 | ||
122 | /** | 130 | /** |
@@ -131,7 +139,7 @@ typedef struct GNUNET_TIME_Relative (*GNUNET_TRANSPORT_PluginReceiveCallback) (v | |||
131 | * @param addrlen length of the address | 139 | * @param addrlen length of the address |
132 | */ | 140 | */ |
133 | typedef void (*GNUNET_TRANSPORT_AddressNotification) (void *cls, | 141 | typedef void (*GNUNET_TRANSPORT_AddressNotification) (void *cls, |
134 | int add_remove, | 142 | int add_remove, |
135 | const void *addr, | 143 | const void *addr, |
136 | size_t addrlen); | 144 | size_t addrlen); |
137 | 145 | ||
@@ -151,16 +159,21 @@ typedef void (*GNUNET_TRANSPORT_AddressNotification) (void *cls, | |||
151 | * @return how long to wait until reading more from this peer | 159 | * @return how long to wait until reading more from this peer |
152 | * (to enforce inbound quotas) | 160 | * (to enforce inbound quotas) |
153 | */ | 161 | */ |
154 | typedef struct GNUNET_TIME_Relative (*GNUNET_TRANSPORT_TrafficReport) (void *cls, | 162 | typedef struct GNUNET_TIME_Relative (*GNUNET_TRANSPORT_TrafficReport) (void |
155 | const struct | 163 | *cls, |
156 | GNUNET_PeerIdentity *peer, | 164 | const |
157 | size_t amount_recved); | 165 | struct |
166 | GNUNET_PeerIdentity | ||
167 | * peer, | ||
168 | size_t | ||
169 | amount_recved); | ||
158 | 170 | ||
159 | 171 | ||
160 | /** | 172 | /** |
161 | * Function that returns a HELLO message. | 173 | * Function that returns a HELLO message. |
162 | */ | 174 | */ |
163 | typedef const struct GNUNET_MessageHeader * (*GNUNET_TRANSPORT_GetHelloCallback)(void); | 175 | typedef const struct GNUNET_MessageHeader |
176 | *(*GNUNET_TRANSPORT_GetHelloCallback) (void); | ||
164 | 177 | ||
165 | 178 | ||
166 | /** | 179 | /** |
@@ -242,9 +255,9 @@ struct GNUNET_TRANSPORT_PluginEnvironment | |||
242 | * the ReceiveCallback. | 255 | * the ReceiveCallback. |
243 | */ | 256 | */ |
244 | typedef void | 257 | typedef void |
245 | (*GNUNET_TRANSPORT_TransmitContinuation) (void *cls, | 258 | (*GNUNET_TRANSPORT_TransmitContinuation) (void *cls, |
246 | const struct GNUNET_PeerIdentity * | 259 | const struct GNUNET_PeerIdentity * |
247 | target, int result); | 260 | target, int result); |
248 | 261 | ||
249 | 262 | ||
250 | /** | 263 | /** |
@@ -284,19 +297,19 @@ typedef void | |||
284 | * and does NOT mean that the message was not transmitted (DV) | 297 | * and does NOT mean that the message was not transmitted (DV) |
285 | */ | 298 | */ |
286 | typedef ssize_t | 299 | typedef ssize_t |
287 | (*GNUNET_TRANSPORT_TransmitFunction) (void *cls, | 300 | (*GNUNET_TRANSPORT_TransmitFunction) (void *cls, |
288 | const struct GNUNET_PeerIdentity * | 301 | const struct GNUNET_PeerIdentity * |
289 | target, | 302 | target, |
290 | const char *msgbuf, | 303 | const char *msgbuf, |
291 | size_t msgbuf_size, | 304 | size_t msgbuf_size, |
292 | uint32_t priority, | 305 | uint32_t priority, |
293 | struct GNUNET_TIME_Relative timeout, | 306 | struct GNUNET_TIME_Relative timeout, |
294 | struct Session *session, | 307 | struct Session * session, |
295 | const void *addr, | 308 | const void *addr, |
296 | size_t addrlen, | 309 | size_t addrlen, |
297 | int force_address, | 310 | int force_address, |
298 | GNUNET_TRANSPORT_TransmitContinuation | 311 | GNUNET_TRANSPORT_TransmitContinuation |
299 | cont, void *cont_cls); | 312 | cont, void *cont_cls); |
300 | 313 | ||
301 | 314 | ||
302 | /** | 315 | /** |
@@ -316,9 +329,9 @@ typedef ssize_t | |||
316 | * to be cancelled | 329 | * to be cancelled |
317 | */ | 330 | */ |
318 | typedef void | 331 | typedef void |
319 | (*GNUNET_TRANSPORT_DisconnectFunction) (void *cls, | 332 | (*GNUNET_TRANSPORT_DisconnectFunction) (void *cls, |
320 | const struct GNUNET_PeerIdentity * | 333 | const struct GNUNET_PeerIdentity * |
321 | target); | 334 | target); |
322 | 335 | ||
323 | 336 | ||
324 | /** | 337 | /** |
@@ -348,15 +361,15 @@ typedef void (*GNUNET_TRANSPORT_AddressStringCallback) (void *cls, | |||
348 | * @param asc_cls closure for asc | 361 | * @param asc_cls closure for asc |
349 | */ | 362 | */ |
350 | typedef void | 363 | typedef void |
351 | (*GNUNET_TRANSPORT_AddressPrettyPrinter) (void *cls, | 364 | (*GNUNET_TRANSPORT_AddressPrettyPrinter) (void *cls, |
352 | const char *type, | 365 | const char *type, |
353 | const void *addr, | 366 | const void *addr, |
354 | size_t addrlen, | 367 | size_t addrlen, |
355 | int numeric, | 368 | int numeric, |
356 | struct GNUNET_TIME_Relative | 369 | struct GNUNET_TIME_Relative |
357 | timeout, | 370 | timeout, |
358 | GNUNET_TRANSPORT_AddressStringCallback | 371 | GNUNET_TRANSPORT_AddressStringCallback |
359 | asc, void *asc_cls); | 372 | asc, void *asc_cls); |
360 | 373 | ||
361 | 374 | ||
362 | /** | 375 | /** |
@@ -374,8 +387,8 @@ typedef void | |||
374 | * and transport, GNUNET_SYSERR if not | 387 | * and transport, GNUNET_SYSERR if not |
375 | */ | 388 | */ |
376 | typedef int | 389 | typedef int |
377 | (*GNUNET_TRANSPORT_CheckAddress) (void *cls, | 390 | (*GNUNET_TRANSPORT_CheckAddress) (void *cls, |
378 | const void *addr, size_t addrlen); | 391 | const void *addr, size_t addrlen); |
379 | 392 | ||
380 | 393 | ||
381 | /** | 394 | /** |
@@ -389,9 +402,9 @@ typedef int | |||
389 | * @param addr_len length of the address | 402 | * @param addr_len length of the address |
390 | * @return string representing the same address | 403 | * @return string representing the same address |
391 | */ | 404 | */ |
392 | typedef const char* (*GNUNET_TRANSPORT_AddressToString) (void *cls, | 405 | typedef const char *(*GNUNET_TRANSPORT_AddressToString) (void *cls, |
393 | const void *addr, | 406 | const void *addr, |
394 | size_t addrlen); | 407 | size_t addrlen); |
395 | 408 | ||
396 | 409 | ||
397 | /** | 410 | /** |
diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h index 0e17a0135..f4cc88e55 100644 --- a/src/include/gnunet_transport_service.h +++ b/src/include/gnunet_transport_service.h | |||
@@ -90,7 +90,7 @@ enum GNUNET_TRANSPORT_ATS_Property | |||
90 | * 2G : 10 [cent/MB] | 90 | * 2G : 10 [cent/MB] |
91 | */ | 91 | */ |
92 | GNUNET_TRANSPORT_ATS_COST_FINANCIAL_PER_VOLUME = 1, | 92 | GNUNET_TRANSPORT_ATS_COST_FINANCIAL_PER_VOLUME = 1, |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * Time based cost in financial units to transmit data | 95 | * Time based cost in financial units to transmit data |
96 | * | 96 | * |
@@ -108,7 +108,7 @@ enum GNUNET_TRANSPORT_ATS_Property | |||
108 | * Dialup: 10 [cent/h] | 108 | * Dialup: 10 [cent/h] |
109 | */ | 109 | */ |
110 | GNUNET_TRANSPORT_ATS_COST_FINANCIAL_PER_TIME = 2, | 110 | GNUNET_TRANSPORT_ATS_COST_FINANCIAL_PER_TIME = 2, |
111 | 111 | ||
112 | /** | 112 | /** |
113 | * Computational costs | 113 | * Computational costs |
114 | * | 114 | * |
@@ -128,7 +128,7 @@ enum GNUNET_TRANSPORT_ATS_Property | |||
128 | * HTTPS with RC4-1024: 2,652 | 128 | * HTTPS with RC4-1024: 2,652 |
129 | */ | 129 | */ |
130 | GNUNET_TRANSPORT_ATS_COST_COMPUTATIONAL = 3, | 130 | GNUNET_TRANSPORT_ATS_COST_COMPUTATIONAL = 3, |
131 | 131 | ||
132 | /** | 132 | /** |
133 | * Energy consumption | 133 | * Energy consumption |
134 | * | 134 | * |
@@ -157,7 +157,7 @@ enum GNUNET_TRANSPORT_ATS_Property | |||
157 | * Bluetooth: 267 (100 mW @ BT2.0 EDR /w 3 MBit/s) | 157 | * Bluetooth: 267 (100 mW @ BT2.0 EDR /w 3 MBit/s) |
158 | */ | 158 | */ |
159 | GNUNET_TRANSPORT_ATS_COST_ENERGY_CONSUMPTION = 4, | 159 | GNUNET_TRANSPORT_ATS_COST_ENERGY_CONSUMPTION = 4, |
160 | 160 | ||
161 | /** | 161 | /** |
162 | * Connect cost | 162 | * Connect cost |
163 | * How many bytes are transmitted to initiate a new connection using | 163 | * How many bytes are transmitted to initiate a new connection using |
@@ -180,7 +180,7 @@ enum GNUNET_TRANSPORT_ATS_Property | |||
180 | * | 180 | * |
181 | * */ | 181 | * */ |
182 | GNUNET_TRANSPORT_ATS_COST_CONNECT = 5, | 182 | GNUNET_TRANSPORT_ATS_COST_CONNECT = 5, |
183 | 183 | ||
184 | /** | 184 | /** |
185 | * Bandwidth cost | 185 | * Bandwidth cost |
186 | * | 186 | * |
@@ -198,7 +198,7 @@ enum GNUNET_TRANSPORT_ATS_Property | |||
198 | * | 198 | * |
199 | */ | 199 | */ |
200 | GNUNET_TRANSPORT_ATS_COST_BANDWITH_AVAILABLE = 6, | 200 | GNUNET_TRANSPORT_ATS_COST_BANDWITH_AVAILABLE = 6, |
201 | 201 | ||
202 | /** | 202 | /** |
203 | * Network overhead | 203 | * Network overhead |
204 | * | 204 | * |
@@ -219,36 +219,36 @@ enum GNUNET_TRANSPORT_ATS_Property | |||
219 | * UDP/IPv6 over Ethernet: 1024 + 38 + 40 + 8 = 1110 [bytes/kb] | 219 | * UDP/IPv6 over Ethernet: 1024 + 38 + 40 + 8 = 1110 [bytes/kb] |
220 | */ | 220 | */ |
221 | GNUNET_TRANSPORT_ATS_COST_NETWORK_OVERHEAD = 7, | 221 | GNUNET_TRANSPORT_ATS_COST_NETWORK_OVERHEAD = 7, |
222 | 222 | ||
223 | 223 | ||
224 | /* Quality related values */ | 224 | /* Quality related values */ |
225 | /* ====================== */ | 225 | /* ====================== */ |
226 | 226 | ||
227 | /* Physical layer quality properties */ | 227 | /* Physical layer quality properties */ |
228 | 228 | ||
229 | /** | 229 | /** |
230 | * Signal strength on physical layer | 230 | * Signal strength on physical layer |
231 | * | 231 | * |
232 | * Unit: [dBm] | 232 | * Unit: [dBm] |
233 | */ | 233 | */ |
234 | GNUNET_TRANSPORT_ATS_QUALITY_PHY_SIGNAL_STRENGTH = 1025, | 234 | GNUNET_TRANSPORT_ATS_QUALITY_PHY_SIGNAL_STRENGTH = 1025, |
235 | 235 | ||
236 | /** | 236 | /** |
237 | * Collision rate on physical layer | 237 | * Collision rate on physical layer |
238 | * | 238 | * |
239 | * Unit: [B/s] | 239 | * Unit: [B/s] |
240 | */ | 240 | */ |
241 | GNUNET_TRANSPORT_ATS_QUALITY_PHY_COLLISION_RATE = 1026, | 241 | GNUNET_TRANSPORT_ATS_QUALITY_PHY_COLLISION_RATE = 1026, |
242 | 242 | ||
243 | /** | 243 | /** |
244 | * Error rate on physical layer | 244 | * Error rate on physical layer |
245 | * | 245 | * |
246 | * Unit: [B/s] | 246 | * Unit: [B/s] |
247 | */ | 247 | */ |
248 | GNUNET_TRANSPORT_ATS_QUALITY_PHY_ERROR_RATE = 1027, | 248 | GNUNET_TRANSPORT_ATS_QUALITY_PHY_ERROR_RATE = 1027, |
249 | 249 | ||
250 | /* Network layer quality properties */ | 250 | /* Network layer quality properties */ |
251 | 251 | ||
252 | /** | 252 | /** |
253 | * Delay | 253 | * Delay |
254 | * Time between when the time packet is sent and the packet arrives | 254 | * Time between when the time packet is sent and the packet arrives |
@@ -262,7 +262,7 @@ enum GNUNET_TRANSPORT_ATS_Property | |||
262 | * Dialup: 500 | 262 | * Dialup: 500 |
263 | */ | 263 | */ |
264 | GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY = 1028, | 264 | GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY = 1028, |
265 | 265 | ||
266 | /** | 266 | /** |
267 | * Jitter | 267 | * Jitter |
268 | * Time variations of the delay | 268 | * Time variations of the delay |
@@ -271,7 +271,7 @@ enum GNUNET_TRANSPORT_ATS_Property | |||
271 | * Unit: [ms] | 271 | * Unit: [ms] |
272 | */ | 272 | */ |
273 | GNUNET_TRANSPORT_ATS_QUALITY_NET_JITTER = 1029, | 273 | GNUNET_TRANSPORT_ATS_QUALITY_NET_JITTER = 1029, |
274 | 274 | ||
275 | /** | 275 | /** |
276 | * Error rate on network layer | 276 | * Error rate on network layer |
277 | * | 277 | * |
@@ -286,7 +286,7 @@ enum GNUNET_TRANSPORT_ATS_Property | |||
286 | * measured or somehow determined | 286 | * measured or somehow determined |
287 | */ | 287 | */ |
288 | GNUNET_TRANSPORT_ATS_QUALITY_NET_ERRORRATE = 1030, | 288 | GNUNET_TRANSPORT_ATS_QUALITY_NET_ERRORRATE = 1030, |
289 | 289 | ||
290 | /** | 290 | /** |
291 | * Drop rate on network layer | 291 | * Drop rate on network layer |
292 | * Bytes actively dismissed by a network component during transmission | 292 | * Bytes actively dismissed by a network component during transmission |
@@ -303,7 +303,7 @@ enum GNUNET_TRANSPORT_ATS_Property | |||
303 | * measured or somehow determined | 303 | * measured or somehow determined |
304 | */ | 304 | */ |
305 | GNUNET_TRANSPORT_ATS_QUALITY_NET_DROPRATE = 1031, | 305 | GNUNET_TRANSPORT_ATS_QUALITY_NET_DROPRATE = 1031, |
306 | 306 | ||
307 | /** | 307 | /** |
308 | * Loss rate on network layer | 308 | * Loss rate on network layer |
309 | * Bytes lost during transmission | 309 | * Bytes lost during transmission |
@@ -320,7 +320,7 @@ enum GNUNET_TRANSPORT_ATS_Property | |||
320 | * or somehow determined | 320 | * or somehow determined |
321 | */ | 321 | */ |
322 | GNUNET_TRANSPORT_ATS_QUALITY_NET_LOSSRATE = 1032, | 322 | GNUNET_TRANSPORT_ATS_QUALITY_NET_LOSSRATE = 1032, |
323 | 323 | ||
324 | /** | 324 | /** |
325 | * Throughput on network layer | 325 | * Throughput on network layer |
326 | * | 326 | * |
@@ -334,7 +334,7 @@ enum GNUNET_TRANSPORT_ATS_Property | |||
334 | * | 334 | * |
335 | */ | 335 | */ |
336 | GNUNET_TRANSPORT_ATS_QUALITY_NET_THROUGHPUT = 1033, | 336 | GNUNET_TRANSPORT_ATS_QUALITY_NET_THROUGHPUT = 1033, |
337 | 337 | ||
338 | /** | 338 | /** |
339 | * Distance on network layer | 339 | * Distance on network layer |
340 | * | 340 | * |
@@ -345,17 +345,16 @@ enum GNUNET_TRANSPORT_ATS_Property | |||
345 | 345 | ||
346 | /* Availability related values */ | 346 | /* Availability related values */ |
347 | /* =========================== */ | 347 | /* =========================== */ |
348 | 348 | ||
349 | /** | 349 | /** |
350 | * Is a peer reachable? | 350 | * Is a peer reachable? |
351 | */ | 351 | */ |
352 | GNUNET_TRANSPORT_ATS_AVAILABILITY_REACHABLE = 2048, | 352 | GNUNET_TRANSPORT_ATS_AVAILABILITY_REACHABLE = 2048, |
353 | 353 | ||
354 | /** | 354 | /** |
355 | * Is there a connection established to a peer using this transport | 355 | * Is there a connection established to a peer using this transport |
356 | */ | 356 | */ |
357 | GNUNET_TRANSPORT_ATS_AVAILABILITY_CONNECTED = 2049 | 357 | GNUNET_TRANSPORT_ATS_AVAILABILITY_CONNECTED = 2049 |
358 | |||
359 | }; | 358 | }; |
360 | 359 | ||
361 | 360 | ||
@@ -383,7 +382,7 @@ struct GNUNET_TRANSPORT_ATS_Information | |||
383 | * ATS property type, in network byte order. | 382 | * ATS property type, in network byte order. |
384 | */ | 383 | */ |
385 | uint32_t type; | 384 | uint32_t type; |
386 | 385 | ||
387 | /** | 386 | /** |
388 | * ATS property value, in network byte order. | 387 | * ATS property value, in network byte order. |
389 | */ | 388 | */ |
@@ -407,8 +406,9 @@ typedef void (*GNUNET_TRANSPORT_ReceiveCallback) (void *cls, | |||
407 | const struct | 406 | const struct |
408 | GNUNET_MessageHeader * | 407 | GNUNET_MessageHeader * |
409 | message, | 408 | message, |
410 | const struct GNUNET_TRANSPORT_ATS_Information *ats, | 409 | const struct |
411 | uint32_t ats_count); | 410 | GNUNET_TRANSPORT_ATS_Information |
411 | * ats, uint32_t ats_count); | ||
412 | 412 | ||
413 | 413 | ||
414 | /** | 414 | /** |
@@ -427,10 +427,11 @@ struct GNUNET_TRANSPORT_Handle; | |||
427 | * @param ats_count number of entries in ats (excluding 0-termination) | 427 | * @param ats_count number of entries in ats (excluding 0-termination) |
428 | */ | 428 | */ |
429 | typedef void | 429 | typedef void |
430 | (*GNUNET_TRANSPORT_NotifyConnect) (void *cls, | 430 | (*GNUNET_TRANSPORT_NotifyConnect) (void *cls, |
431 | const struct GNUNET_PeerIdentity * peer, | 431 | const struct GNUNET_PeerIdentity * peer, |
432 | const struct GNUNET_TRANSPORT_ATS_Information *ats, | 432 | const struct |
433 | uint32_t ats_count); | 433 | GNUNET_TRANSPORT_ATS_Information * ats, |
434 | uint32_t ats_count); | ||
434 | 435 | ||
435 | /** | 436 | /** |
436 | * Function called to notify transport users that another | 437 | * Function called to notify transport users that another |
@@ -440,9 +441,9 @@ typedef void | |||
440 | * @param peer the peer that disconnected | 441 | * @param peer the peer that disconnected |
441 | */ | 442 | */ |
442 | typedef void | 443 | typedef void |
443 | (*GNUNET_TRANSPORT_NotifyDisconnect) (void *cls, | 444 | (*GNUNET_TRANSPORT_NotifyDisconnect) (void *cls, |
444 | const struct GNUNET_PeerIdentity * | 445 | const struct GNUNET_PeerIdentity * |
445 | peer); | 446 | peer); |
446 | 447 | ||
447 | 448 | ||
448 | /** | 449 | /** |
@@ -452,8 +453,7 @@ typedef void | |||
452 | * @param address NULL on error, otherwise 0-terminated printable UTF-8 string | 453 | * @param address NULL on error, otherwise 0-terminated printable UTF-8 string |
453 | */ | 454 | */ |
454 | typedef void | 455 | typedef void |
455 | (*GNUNET_TRANSPORT_AddressLookUpCallback) (void *cls, | 456 | (*GNUNET_TRANSPORT_AddressLookUpCallback) (void *cls, const char *address); |
456 | const char *address); | ||
457 | 457 | ||
458 | 458 | ||
459 | /** | 459 | /** |
@@ -471,9 +471,10 @@ typedef void | |||
471 | */ | 471 | */ |
472 | struct GNUNET_TRANSPORT_Handle *GNUNET_TRANSPORT_connect (const struct | 472 | struct GNUNET_TRANSPORT_Handle *GNUNET_TRANSPORT_connect (const struct |
473 | GNUNET_CONFIGURATION_Handle | 473 | GNUNET_CONFIGURATION_Handle |
474 | *cfg, | 474 | *cfg, |
475 | const struct GNUNET_PeerIdentity *self, | 475 | const struct |
476 | void *cls, | 476 | GNUNET_PeerIdentity |
477 | *self, void *cls, | ||
477 | GNUNET_TRANSPORT_ReceiveCallback | 478 | GNUNET_TRANSPORT_ReceiveCallback |
478 | rec, | 479 | rec, |
479 | GNUNET_TRANSPORT_NotifyConnect | 480 | GNUNET_TRANSPORT_NotifyConnect |
@@ -499,7 +500,7 @@ void GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle); | |||
499 | */ | 500 | */ |
500 | void | 501 | void |
501 | GNUNET_TRANSPORT_try_connect (struct GNUNET_TRANSPORT_Handle *handle, | 502 | GNUNET_TRANSPORT_try_connect (struct GNUNET_TRANSPORT_Handle *handle, |
502 | const struct GNUNET_PeerIdentity *target); | 503 | const struct GNUNET_PeerIdentity *target); |
503 | 504 | ||
504 | 505 | ||
505 | /** | 506 | /** |
@@ -544,15 +545,15 @@ struct GNUNET_TRANSPORT_TransmitHandle; | |||
544 | * using GNUNET_TRANSPORT_notify_transmit_ready_cancel) | 545 | * using GNUNET_TRANSPORT_notify_transmit_ready_cancel) |
545 | */ | 546 | */ |
546 | struct GNUNET_TRANSPORT_TransmitHandle | 547 | struct GNUNET_TRANSPORT_TransmitHandle |
547 | *GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle | 548 | *GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle |
548 | *handle, | 549 | *handle, |
549 | const struct GNUNET_PeerIdentity | 550 | const struct GNUNET_PeerIdentity |
550 | *target, size_t size, | 551 | *target, size_t size, |
551 | uint32_t priority, | 552 | uint32_t priority, |
552 | struct GNUNET_TIME_Relative | 553 | struct GNUNET_TIME_Relative |
553 | timeout, | 554 | timeout, |
554 | GNUNET_CONNECTION_TransmitReadyNotify | 555 | GNUNET_CONNECTION_TransmitReadyNotify |
555 | notify, void *notify_cls); | 556 | notify, void *notify_cls); |
556 | 557 | ||
557 | 558 | ||
558 | /** | 559 | /** |
@@ -574,8 +575,10 @@ GNUNET_TRANSPORT_notify_transmit_ready_cancel (struct | |||
574 | * @param cls closure | 575 | * @param cls closure |
575 | * @param hello our updated HELLO | 576 | * @param hello our updated HELLO |
576 | */ | 577 | */ |
577 | typedef void (*GNUNET_TRANSPORT_HelloUpdateCallback)(void *cls, | 578 | typedef void (*GNUNET_TRANSPORT_HelloUpdateCallback) (void *cls, |
578 | const struct GNUNET_MessageHeader *hello); | 579 | const struct |
580 | GNUNET_MessageHeader * | ||
581 | hello); | ||
579 | 582 | ||
580 | 583 | ||
581 | /** | 584 | /** |
@@ -600,8 +603,8 @@ GNUNET_TRANSPORT_get_hello (struct GNUNET_TRANSPORT_Handle *handle, | |||
600 | */ | 603 | */ |
601 | void | 604 | void |
602 | GNUNET_TRANSPORT_get_hello_cancel (struct GNUNET_TRANSPORT_Handle *handle, | 605 | GNUNET_TRANSPORT_get_hello_cancel (struct GNUNET_TRANSPORT_Handle *handle, |
603 | GNUNET_TRANSPORT_HelloUpdateCallback rec, | 606 | GNUNET_TRANSPORT_HelloUpdateCallback rec, |
604 | void *rec_cls); | 607 | void *rec_cls); |
605 | 608 | ||
606 | 609 | ||
607 | /** | 610 | /** |
@@ -618,8 +621,7 @@ GNUNET_TRANSPORT_get_hello_cancel (struct GNUNET_TRANSPORT_Handle *handle, | |||
618 | void | 621 | void |
619 | GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle, | 622 | GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle, |
620 | const struct GNUNET_MessageHeader *hello, | 623 | const struct GNUNET_MessageHeader *hello, |
621 | GNUNET_SCHEDULER_Task cont, | 624 | GNUNET_SCHEDULER_Task cont, void *cls); |
622 | void *cls); | ||
623 | 625 | ||
624 | 626 | ||
625 | /** | 627 | /** |
@@ -637,13 +639,13 @@ GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle, | |||
637 | */ | 639 | */ |
638 | void | 640 | void |
639 | GNUNET_TRANSPORT_address_lookup (const struct GNUNET_CONFIGURATION_Handle *cfg, | 641 | GNUNET_TRANSPORT_address_lookup (const struct GNUNET_CONFIGURATION_Handle *cfg, |
640 | const char * address, | 642 | const char *address, |
641 | size_t addressLen, | 643 | size_t addressLen, |
642 | int numeric, | 644 | int numeric, |
643 | const char *nameTrans, | 645 | const char *nameTrans, |
644 | struct GNUNET_TIME_Relative timeout, | 646 | struct GNUNET_TIME_Relative timeout, |
645 | GNUNET_TRANSPORT_AddressLookUpCallback aluc, | 647 | GNUNET_TRANSPORT_AddressLookUpCallback aluc, |
646 | void *aluc_cls); | 648 | void *aluc_cls); |
647 | 649 | ||
648 | 650 | ||
649 | /** | 651 | /** |
@@ -657,10 +659,12 @@ GNUNET_TRANSPORT_address_lookup (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
657 | * @param peer_address_callback_cls closure for peer_address_callback | 659 | * @param peer_address_callback_cls closure for peer_address_callback |
658 | */ | 660 | */ |
659 | void | 661 | void |
660 | GNUNET_TRANSPORT_peer_address_lookup (const struct GNUNET_CONFIGURATION_Handle *cfg, | 662 | GNUNET_TRANSPORT_peer_address_lookup (const struct GNUNET_CONFIGURATION_Handle |
663 | *cfg, | ||
661 | const struct GNUNET_PeerIdentity *peer, | 664 | const struct GNUNET_PeerIdentity *peer, |
662 | struct GNUNET_TIME_Relative timeout, | 665 | struct GNUNET_TIME_Relative timeout, |
663 | GNUNET_TRANSPORT_AddressLookUpCallback peer_address_callback, | 666 | GNUNET_TRANSPORT_AddressLookUpCallback |
667 | peer_address_callback, | ||
664 | void *peer_address_callback_cls); | 668 | void *peer_address_callback_cls); |
665 | 669 | ||
666 | 670 | ||
@@ -676,7 +680,8 @@ GNUNET_TRANSPORT_peer_address_lookup (const struct GNUNET_CONFIGURATION_Handle * | |||
676 | void | 680 | void |
677 | GNUNET_TRANSPORT_address_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg, | 681 | GNUNET_TRANSPORT_address_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg, |
678 | struct GNUNET_TIME_Relative timeout, | 682 | struct GNUNET_TIME_Relative timeout, |
679 | GNUNET_TRANSPORT_AddressLookUpCallback peer_address_callback, | 683 | GNUNET_TRANSPORT_AddressLookUpCallback |
684 | peer_address_callback, | ||
680 | void *peer_address_callback_cls); | 685 | void *peer_address_callback_cls); |
681 | 686 | ||
682 | 687 | ||
@@ -693,8 +698,9 @@ struct GNUNET_TRANSPORT_Blacklist; | |||
693 | * @param pid peer to approve or disapproave | 698 | * @param pid peer to approve or disapproave |
694 | * @return GNUNET_OK if the connection is allowed | 699 | * @return GNUNET_OK if the connection is allowed |
695 | */ | 700 | */ |
696 | typedef int (*GNUNET_TRANSPORT_BlacklistCallback)(void *cls, | 701 | typedef int (*GNUNET_TRANSPORT_BlacklistCallback) (void *cls, |
697 | const struct GNUNET_PeerIdentity *pid); | 702 | const struct |
703 | GNUNET_PeerIdentity * pid); | ||
698 | 704 | ||
699 | 705 | ||
700 | /** | 706 | /** |
@@ -711,10 +717,12 @@ typedef int (*GNUNET_TRANSPORT_BlacklistCallback)(void *cls, | |||
711 | * @param cb_cls closure for cb | 717 | * @param cb_cls closure for cb |
712 | * @return NULL on error, otherwise handle for cancellation | 718 | * @return NULL on error, otherwise handle for cancellation |
713 | */ | 719 | */ |
714 | struct GNUNET_TRANSPORT_Blacklist * | 720 | struct GNUNET_TRANSPORT_Blacklist *GNUNET_TRANSPORT_blacklist (const struct |
715 | GNUNET_TRANSPORT_blacklist (const struct GNUNET_CONFIGURATION_Handle *cfg, | 721 | GNUNET_CONFIGURATION_Handle |
716 | GNUNET_TRANSPORT_BlacklistCallback cb, | 722 | *cfg, |
717 | void *cb_cls); | 723 | GNUNET_TRANSPORT_BlacklistCallback |
724 | cb, | ||
725 | void *cb_cls); | ||
718 | 726 | ||
719 | 727 | ||
720 | /** | 728 | /** |
@@ -723,8 +731,7 @@ GNUNET_TRANSPORT_blacklist (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
723 | * | 731 | * |
724 | * @param br handle of the request that is to be cancelled | 732 | * @param br handle of the request that is to be cancelled |
725 | */ | 733 | */ |
726 | void | 734 | void GNUNET_TRANSPORT_blacklist_cancel (struct GNUNET_TRANSPORT_Blacklist *br); |
727 | GNUNET_TRANSPORT_blacklist_cancel (struct GNUNET_TRANSPORT_Blacklist *br); | ||
728 | 735 | ||
729 | 736 | ||
730 | 737 | ||
diff --git a/src/include/platform.h b/src/include/platform.h index 4bdebf90f..4f9eb5eda 100644 --- a/src/include/platform.h +++ b/src/include/platform.h | |||
@@ -90,7 +90,7 @@ | |||
90 | #if HAVE_NETINET_IN_SYSTM_H | 90 | #if HAVE_NETINET_IN_SYSTM_H |
91 | #include <netinet/in_systm.h> | 91 | #include <netinet/in_systm.h> |
92 | #endif | 92 | #endif |
93 | #include <netinet/ip.h> /* superset of previous */ | 93 | #include <netinet/ip.h> /* superset of previous */ |
94 | #include <arpa/inet.h> | 94 | #include <arpa/inet.h> |
95 | #include <netinet/tcp.h> | 95 | #include <netinet/tcp.h> |
96 | #include <pwd.h> | 96 | #include <pwd.h> |
@@ -110,7 +110,7 @@ | |||
110 | #include <errno.h> | 110 | #include <errno.h> |
111 | #include <signal.h> | 111 | #include <signal.h> |
112 | #ifdef WINDOWS | 112 | #ifdef WINDOWS |
113 | #include <malloc.h> /* for alloca(), on other OSes it's in stdlib.h */ | 113 | #include <malloc.h> /* for alloca(), on other OSes it's in stdlib.h */ |
114 | #endif | 114 | #endif |
115 | #ifndef _MSC_VER | 115 | #ifndef _MSC_VER |
116 | #include <unistd.h> /* KLB_FIX */ | 116 | #include <unistd.h> /* KLB_FIX */ |
diff --git a/src/include/plibc.h b/src/include/plibc.h index a59e53de9..82079faf1 100644 --- a/src/include/plibc.h +++ b/src/include/plibc.h | |||
@@ -29,17 +29,18 @@ | |||
29 | #define _PLIBC_H_ | 29 | #define _PLIBC_H_ |
30 | 30 | ||
31 | #ifndef SIGALRM | 31 | #ifndef SIGALRM |
32 | #define SIGALRM 14 | 32 | #define SIGALRM 14 |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #ifdef __cplusplus | 35 | #ifdef __cplusplus |
36 | extern "C" { | 36 | extern "C" |
37 | { | ||
37 | #endif | 38 | #endif |
38 | 39 | ||
39 | #include <stddef.h> | 40 | #include <stddef.h> |
40 | 41 | ||
41 | #ifdef Q_OS_WIN32 | 42 | #ifdef Q_OS_WIN32 |
42 | #define WINDOWS 1 | 43 | #define WINDOWS 1 |
43 | #endif | 44 | #endif |
44 | 45 | ||
45 | #define HAVE_PLIBC_FD 0 | 46 | #define HAVE_PLIBC_FD 0 |
@@ -47,7 +48,7 @@ extern "C" { | |||
47 | #ifdef WINDOWS | 48 | #ifdef WINDOWS |
48 | 49 | ||
49 | #if ENABLE_NLS | 50 | #if ENABLE_NLS |
50 | #include "langinfo.h" | 51 | #include "langinfo.h" |
51 | #endif | 52 | #endif |
52 | 53 | ||
53 | #include <winsock2.h> | 54 | #include <winsock2.h> |
@@ -72,8 +73,8 @@ extern "C" { | |||
72 | #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \ | 73 | #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \ |
73 | (double)((x).LowPart)) | 74 | (double)((x).LowPart)) |
74 | 75 | ||
75 | struct stat64 | 76 | struct stat64 |
76 | { | 77 | { |
77 | _dev_t st_dev; | 78 | _dev_t st_dev; |
78 | _ino_t st_ino; | 79 | _ino_t st_ino; |
79 | _mode_t st_mode; | 80 | _mode_t st_mode; |
@@ -85,133 +86,134 @@ struct stat64 | |||
85 | __time64_t st_atime; | 86 | __time64_t st_atime; |
86 | __time64_t st_mtime; | 87 | __time64_t st_mtime; |
87 | __time64_t st_ctime; | 88 | __time64_t st_ctime; |
88 | }; | 89 | }; |
89 | 90 | ||
90 | typedef unsigned int sa_family_t; | 91 | typedef unsigned int sa_family_t; |
91 | 92 | ||
92 | struct sockaddr_un { | 93 | struct sockaddr_un |
93 | short sun_family; /*AF_UNIX*/ | 94 | { |
94 | char sun_path[108]; /*path name */ | 95 | short sun_family; /*AF_UNIX */ |
95 | }; | 96 | char sun_path[108]; /*path name */ |
97 | }; | ||
96 | 98 | ||
97 | #ifndef pid_t | 99 | #ifndef pid_t |
98 | #define pid_t DWORD | 100 | #define pid_t DWORD |
99 | #endif | 101 | #endif |
100 | 102 | ||
101 | #ifndef error_t | 103 | #ifndef error_t |
102 | #define error_t int | 104 | #define error_t int |
103 | #endif | 105 | #endif |
104 | 106 | ||
105 | #ifndef WEXITSTATUS | 107 | #ifndef WEXITSTATUS |
106 | #define WEXITSTATUS(status) (((status) & 0xff00) >> 8) | 108 | #define WEXITSTATUS(status) (((status) & 0xff00) >> 8) |
107 | #endif | 109 | #endif |
108 | 110 | ||
109 | #ifndef MSG_DONTWAIT | 111 | #ifndef MSG_DONTWAIT |
110 | #define MSG_DONTWAIT 0 | 112 | #define MSG_DONTWAIT 0 |
111 | #endif | 113 | #endif |
112 | 114 | ||
113 | enum | 115 | enum |
114 | { | 116 | { |
115 | _SC_PAGESIZE = 30, | 117 | _SC_PAGESIZE = 30, |
116 | _SC_PAGE_SIZE = 30 | 118 | _SC_PAGE_SIZE = 30 |
117 | }; | 119 | }; |
118 | 120 | ||
119 | /* Thanks to the Cygwin project */ | 121 | /* Thanks to the Cygwin project */ |
120 | #define ENOCSI 43 /* No CSI structure available */ | 122 | #define ENOCSI 43 /* No CSI structure available */ |
121 | #define EL2HLT 44 /* Level 2 halted */ | 123 | #define EL2HLT 44 /* Level 2 halted */ |
122 | #ifndef EDEADLK | 124 | #ifndef EDEADLK |
123 | #define EDEADLK 45 /* Deadlock condition */ | 125 | #define EDEADLK 45 /* Deadlock condition */ |
124 | #endif | 126 | #endif |
125 | #ifndef ENOLCK | 127 | #ifndef ENOLCK |
126 | #define ENOLCK 46 /* No record locks available */ | 128 | #define ENOLCK 46 /* No record locks available */ |
127 | #endif | 129 | #endif |
128 | #define EBADE 50 /* Invalid exchange */ | 130 | #define EBADE 50 /* Invalid exchange */ |
129 | #define EBADR 51 /* Invalid request descriptor */ | 131 | #define EBADR 51 /* Invalid request descriptor */ |
130 | #define EXFULL 52 /* Exchange full */ | 132 | #define EXFULL 52 /* Exchange full */ |
131 | #define ENOANO 53 /* No anode */ | 133 | #define ENOANO 53 /* No anode */ |
132 | #define EBADRQC 54 /* Invalid request code */ | 134 | #define EBADRQC 54 /* Invalid request code */ |
133 | #define EBADSLT 55 /* Invalid slot */ | 135 | #define EBADSLT 55 /* Invalid slot */ |
134 | #ifndef EDEADLOCK | 136 | #ifndef EDEADLOCK |
135 | #define EDEADLOCK EDEADLK /* File locking deadlock error */ | 137 | #define EDEADLOCK EDEADLK /* File locking deadlock error */ |
136 | #endif | 138 | #endif |
137 | #define EBFONT 57 /* Bad font file fmt */ | 139 | #define EBFONT 57 /* Bad font file fmt */ |
138 | #define ENOSTR 60 /* Device not a stream */ | 140 | #define ENOSTR 60 /* Device not a stream */ |
139 | #define ENODATA 61 /* No data (for no delay io) */ | 141 | #define ENODATA 61 /* No data (for no delay io) */ |
140 | #define ETIME 62 /* Timer expired */ | 142 | #define ETIME 62 /* Timer expired */ |
141 | #define ENOSR 63 /* Out of streams resources */ | 143 | #define ENOSR 63 /* Out of streams resources */ |
142 | #define ENONET 64 /* Machine is not on the network */ | 144 | #define ENONET 64 /* Machine is not on the network */ |
143 | #define ENOPKG 65 /* Package not installed */ | 145 | #define ENOPKG 65 /* Package not installed */ |
144 | #define EREMOTE 66 /* The object is remote */ | 146 | #define EREMOTE 66 /* The object is remote */ |
145 | #define ENOLINK 67 /* The link has been severed */ | 147 | #define ENOLINK 67 /* The link has been severed */ |
146 | #define EADV 68 /* Advertise error */ | 148 | #define EADV 68 /* Advertise error */ |
147 | #define ESRMNT 69 /* Srmount error */ | 149 | #define ESRMNT 69 /* Srmount error */ |
148 | #define ECOMM 70 /* Communication error on send */ | 150 | #define ECOMM 70 /* Communication error on send */ |
149 | #define EPROTO 71 /* Protocol error */ | 151 | #define EPROTO 71 /* Protocol error */ |
150 | #define EMULTIHOP 74 /* Multihop attempted */ | 152 | #define EMULTIHOP 74 /* Multihop attempted */ |
151 | #define ELBIN 75 /* Inode is remote (not really error) */ | 153 | #define ELBIN 75 /* Inode is remote (not really error) */ |
152 | #define EDOTDOT 76 /* Cross mount point (not really error) */ | 154 | #define EDOTDOT 76 /* Cross mount point (not really error) */ |
153 | #define EBADMSG 77 /* Trying to read unreadable message */ | 155 | #define EBADMSG 77 /* Trying to read unreadable message */ |
154 | #define ENOTUNIQ 80 /* Given log. name not unique */ | 156 | #define ENOTUNIQ 80 /* Given log. name not unique */ |
155 | #define EBADFD 81 /* f.d. invalid for this operation */ | 157 | #define EBADFD 81 /* f.d. invalid for this operation */ |
156 | #define EREMCHG 82 /* Remote address changed */ | 158 | #define EREMCHG 82 /* Remote address changed */ |
157 | #define ELIBACC 83 /* Can't access a needed shared lib */ | 159 | #define ELIBACC 83 /* Can't access a needed shared lib */ |
158 | #define ELIBBAD 84 /* Accessing a corrupted shared lib */ | 160 | #define ELIBBAD 84 /* Accessing a corrupted shared lib */ |
159 | #define ELIBSCN 85 /* .lib section in a.out corrupted */ | 161 | #define ELIBSCN 85 /* .lib section in a.out corrupted */ |
160 | #define ELIBMAX 86 /* Attempting to link in too many libs */ | 162 | #define ELIBMAX 86 /* Attempting to link in too many libs */ |
161 | #define ELIBEXEC 87 /* Attempting to exec a shared library */ | 163 | #define ELIBEXEC 87 /* Attempting to exec a shared library */ |
162 | #ifndef ENOSYS | 164 | #ifndef ENOSYS |
163 | #define ENOSYS 88 /* Function not implemented */ | 165 | #define ENOSYS 88 /* Function not implemented */ |
164 | #endif | 166 | #endif |
165 | #define ENMFILE 89 /* No more files */ | 167 | #define ENMFILE 89 /* No more files */ |
166 | #ifndef ENOTEMPTY | 168 | #ifndef ENOTEMPTY |
167 | #define ENOTEMPTY 90 /* Directory not empty */ | 169 | #define ENOTEMPTY 90 /* Directory not empty */ |
168 | #endif | 170 | #endif |
169 | #ifndef ENAMETOOLONG | 171 | #ifndef ENAMETOOLONG |
170 | #define ENAMETOOLONG 91 /* File or path name too long */ | 172 | #define ENAMETOOLONG 91 /* File or path name too long */ |
171 | #endif | 173 | #endif |
172 | #define ELOOP 92 /* Too many symbolic links */ | 174 | #define ELOOP 92 /* Too many symbolic links */ |
173 | #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ | 175 | #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ |
174 | #define EPFNOSUPPORT 96 /* Protocol family not supported */ | 176 | #define EPFNOSUPPORT 96 /* Protocol family not supported */ |
175 | #define ECONNRESET 104 /* Connection reset by peer */ | 177 | #define ECONNRESET 104 /* Connection reset by peer */ |
176 | #define ENOBUFS 105 /* No buffer space available */ | 178 | #define ENOBUFS 105 /* No buffer space available */ |
177 | #define EAFNOSUPPORT 106 /* Address family not supported by protocol family */ | 179 | #define EAFNOSUPPORT 106 /* Address family not supported by protocol family */ |
178 | #define EPROTOTYPE 107 /* Protocol wrong type for socket */ | 180 | #define EPROTOTYPE 107 /* Protocol wrong type for socket */ |
179 | #define ENOTSOCK 108 /* Socket operation on non-socket */ | 181 | #define ENOTSOCK 108 /* Socket operation on non-socket */ |
180 | #define ENOPROTOOPT 109 /* Protocol not available */ | 182 | #define ENOPROTOOPT 109 /* Protocol not available */ |
181 | #define ESHUTDOWN 110 /* Can't send after socket shutdown */ | 183 | #define ESHUTDOWN 110 /* Can't send after socket shutdown */ |
182 | #define ECONNREFUSED 111 /* Connection refused */ | 184 | #define ECONNREFUSED 111 /* Connection refused */ |
183 | #define EADDRINUSE 112 /* Address already in use */ | 185 | #define EADDRINUSE 112 /* Address already in use */ |
184 | #define ECONNABORTED 113 /* Connection aborted */ | 186 | #define ECONNABORTED 113 /* Connection aborted */ |
185 | #define ENETUNREACH 114 /* Network is unreachable */ | 187 | #define ENETUNREACH 114 /* Network is unreachable */ |
186 | #define ENETDOWN 115 /* Network interface is not configured */ | 188 | #define ENETDOWN 115 /* Network interface is not configured */ |
187 | #ifndef ETIMEDOUT | 189 | #ifndef ETIMEDOUT |
188 | #define ETIMEDOUT 116 /* Connection timed out */ | 190 | #define ETIMEDOUT 116 /* Connection timed out */ |
189 | #endif | 191 | #endif |
190 | #define EHOSTDOWN 117 /* Host is down */ | 192 | #define EHOSTDOWN 117 /* Host is down */ |
191 | #define EHOSTUNREACH 118 /* Host is unreachable */ | 193 | #define EHOSTUNREACH 118 /* Host is unreachable */ |
192 | #define EINPROGRESS 119 /* Connection already in progress */ | 194 | #define EINPROGRESS 119 /* Connection already in progress */ |
193 | #define EALREADY 120 /* Socket already connected */ | 195 | #define EALREADY 120 /* Socket already connected */ |
194 | #define EDESTADDRREQ 121 /* Destination address required */ | 196 | #define EDESTADDRREQ 121 /* Destination address required */ |
195 | #define EMSGSIZE 122 /* Message too long */ | 197 | #define EMSGSIZE 122 /* Message too long */ |
196 | #define EPROTONOSUPPORT 123 /* Unknown protocol */ | 198 | #define EPROTONOSUPPORT 123 /* Unknown protocol */ |
197 | #define ESOCKTNOSUPPORT 124 /* Socket type not supported */ | 199 | #define ESOCKTNOSUPPORT 124 /* Socket type not supported */ |
198 | #define EADDRNOTAVAIL 125 /* Address not available */ | 200 | #define EADDRNOTAVAIL 125 /* Address not available */ |
199 | #define ENETRESET 126 /* Connection aborted by network */ | 201 | #define ENETRESET 126 /* Connection aborted by network */ |
200 | #define EISCONN 127 /* Socket is already connected */ | 202 | #define EISCONN 127 /* Socket is already connected */ |
201 | #define ENOTCONN 128 /* Socket is not connected */ | 203 | #define ENOTCONN 128 /* Socket is not connected */ |
202 | #define ETOOMANYREFS 129 /* Too many references: cannot splice */ | 204 | #define ETOOMANYREFS 129 /* Too many references: cannot splice */ |
203 | #define EPROCLIM 130 /* Too many processes */ | 205 | #define EPROCLIM 130 /* Too many processes */ |
204 | #define EUSERS 131 /* Too many users */ | 206 | #define EUSERS 131 /* Too many users */ |
205 | #define EDQUOT 132 /* Disk quota exceeded */ | 207 | #define EDQUOT 132 /* Disk quota exceeded */ |
206 | #define ESTALE 133 /* Unknown error */ | 208 | #define ESTALE 133 /* Unknown error */ |
207 | #ifndef ENOTSUP | 209 | #ifndef ENOTSUP |
208 | #define ENOTSUP 134 /* Not supported */ | 210 | #define ENOTSUP 134 /* Not supported */ |
209 | #endif | 211 | #endif |
210 | #define ENOMEDIUM 135 /* No medium (in tape drive) */ | 212 | #define ENOMEDIUM 135 /* No medium (in tape drive) */ |
211 | #define ENOSHARE 136 /* No such host or network path */ | 213 | #define ENOSHARE 136 /* No such host or network path */ |
212 | #define ECASECLASH 137 /* Filename exists with different case */ | 214 | #define ECASECLASH 137 /* Filename exists with different case */ |
213 | #define EWOULDBLOCK EAGAIN /* Operation would block */ | 215 | #define EWOULDBLOCK EAGAIN /* Operation would block */ |
214 | #define EOVERFLOW 139 /* Value too large for defined data type */ | 216 | #define EOVERFLOW 139 /* Value too large for defined data type */ |
215 | 217 | ||
216 | #undef HOST_NOT_FOUND | 218 | #undef HOST_NOT_FOUND |
217 | #define HOST_NOT_FOUND 1 | 219 | #define HOST_NOT_FOUND 1 |
@@ -225,68 +227,68 @@ enum | |||
225 | #define PROT_READ 0x1 | 227 | #define PROT_READ 0x1 |
226 | #define PROT_WRITE 0x2 | 228 | #define PROT_WRITE 0x2 |
227 | #define MAP_SHARED 0x1 | 229 | #define MAP_SHARED 0x1 |
228 | #define MAP_PRIVATE 0x2 /* unsupported */ | 230 | #define MAP_PRIVATE 0x2 /* unsupported */ |
229 | #define MAP_FIXED 0x10 | 231 | #define MAP_FIXED 0x10 |
230 | #define MAP_FAILED ((void *)-1) | 232 | #define MAP_FAILED ((void *)-1) |
231 | 233 | ||
232 | struct statfs | 234 | struct statfs |
233 | { | 235 | { |
234 | long f_type; /* type of filesystem (see below) */ | 236 | long f_type; /* type of filesystem (see below) */ |
235 | long f_bsize; /* optimal transfer block size */ | 237 | long f_bsize; /* optimal transfer block size */ |
236 | long f_blocks; /* total data blocks in file system */ | 238 | long f_blocks; /* total data blocks in file system */ |
237 | long f_bfree; /* free blocks in fs */ | 239 | long f_bfree; /* free blocks in fs */ |
238 | long f_bavail; /* free blocks avail to non-superuser */ | 240 | long f_bavail; /* free blocks avail to non-superuser */ |
239 | long f_files; /* total file nodes in file system */ | 241 | long f_files; /* total file nodes in file system */ |
240 | long f_ffree; /* free file nodes in fs */ | 242 | long f_ffree; /* free file nodes in fs */ |
241 | long f_fsid; /* file system id */ | 243 | long f_fsid; /* file system id */ |
242 | long f_namelen; /* maximum length of filenames */ | 244 | long f_namelen; /* maximum length of filenames */ |
243 | long f_spare[6]; /* spare for later */ | 245 | long f_spare[6]; /* spare for later */ |
244 | }; | 246 | }; |
245 | 247 | ||
246 | extern const struct in6_addr in6addr_any; /* :: */ | 248 | extern const struct in6_addr in6addr_any; /* :: */ |
247 | extern const struct in6_addr in6addr_loopback; /* ::1 */ | 249 | extern const struct in6_addr in6addr_loopback; /* ::1 */ |
248 | 250 | ||
249 | /* Taken from the Wine project <http://www.winehq.org> | 251 | /* Taken from the Wine project <http://www.winehq.org> |
250 | /wine/include/winternl.h */ | 252 | /wine/include/winternl.h */ |
251 | enum SYSTEM_INFORMATION_CLASS | 253 | enum SYSTEM_INFORMATION_CLASS |
252 | { | 254 | { |
253 | SystemBasicInformation = 0, | 255 | SystemBasicInformation = 0, |
254 | Unknown1, | 256 | Unknown1, |
255 | SystemPerformanceInformation = 2, | 257 | SystemPerformanceInformation = 2, |
256 | SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */ | 258 | SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */ |
257 | Unknown4, | 259 | Unknown4, |
258 | SystemProcessInformation = 5, | 260 | SystemProcessInformation = 5, |
259 | Unknown6, | 261 | Unknown6, |
260 | Unknown7, | 262 | Unknown7, |
261 | SystemProcessorPerformanceInformation = 8, | 263 | SystemProcessorPerformanceInformation = 8, |
262 | Unknown9, | 264 | Unknown9, |
263 | Unknown10, | 265 | Unknown10, |
264 | SystemDriverInformation, | 266 | SystemDriverInformation, |
265 | Unknown12, | 267 | Unknown12, |
266 | Unknown13, | 268 | Unknown13, |
267 | Unknown14, | 269 | Unknown14, |
268 | Unknown15, | 270 | Unknown15, |
269 | SystemHandleList, | 271 | SystemHandleList, |
270 | Unknown17, | 272 | Unknown17, |
271 | Unknown18, | 273 | Unknown18, |
272 | Unknown19, | 274 | Unknown19, |
273 | Unknown20, | 275 | Unknown20, |
274 | SystemCacheInformation, | 276 | SystemCacheInformation, |
275 | Unknown22, | 277 | Unknown22, |
276 | SystemInterruptInformation = 23, | 278 | SystemInterruptInformation = 23, |
277 | SystemExceptionInformation = 33, | 279 | SystemExceptionInformation = 33, |
278 | SystemRegistryQuotaInformation = 37, | 280 | SystemRegistryQuotaInformation = 37, |
279 | SystemLookasideInformation = 45 | 281 | SystemLookasideInformation = 45 |
280 | }; | 282 | }; |
281 | 283 | ||
282 | typedef struct | 284 | typedef struct |
283 | { | 285 | { |
284 | LARGE_INTEGER IdleTime; | 286 | LARGE_INTEGER IdleTime; |
285 | LARGE_INTEGER KernelTime; | 287 | LARGE_INTEGER KernelTime; |
286 | LARGE_INTEGER UserTime; | 288 | LARGE_INTEGER UserTime; |
287 | LARGE_INTEGER Reserved1[2]; | 289 | LARGE_INTEGER Reserved1[2]; |
288 | ULONG Reserved2; | 290 | ULONG Reserved2; |
289 | } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; | 291 | } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; |
290 | 292 | ||
291 | #define sleep(secs) (Sleep(secs * 1000)) | 293 | #define sleep(secs) (Sleep(secs * 1000)) |
292 | 294 | ||
@@ -303,11 +305,11 @@ typedef struct | |||
303 | #define SHUT_RDWR SD_BOTH | 305 | #define SHUT_RDWR SD_BOTH |
304 | 306 | ||
305 | /* Operations for flock() */ | 307 | /* Operations for flock() */ |
306 | #define LOCK_SH 1 /* shared lock */ | 308 | #define LOCK_SH 1 /* shared lock */ |
307 | #define LOCK_EX 2 /* exclusive lock */ | 309 | #define LOCK_EX 2 /* exclusive lock */ |
308 | #define LOCK_NB 4 /* or'd with one of the above to prevent | 310 | #define LOCK_NB 4 /* or'd with one of the above to prevent |
309 | blocking */ | 311 | * blocking */ |
310 | #define LOCK_UN 8 /* remove lock */ | 312 | #define LOCK_UN 8 /* remove lock */ |
311 | 313 | ||
312 | /* Not supported under MinGW */ | 314 | /* Not supported under MinGW */ |
313 | #define S_IRGRP 0 | 315 | #define S_IRGRP 0 |
@@ -331,330 +333,331 @@ typedef struct | |||
331 | 333 | ||
332 | #define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__) | 334 | #define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__) |
333 | 335 | ||
334 | BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest); | 336 | BOOL _plibc_CreateShortcut (const char *pszSrc, const char *pszDest); |
335 | BOOL _plibc_DereferenceShortcut(char *pszShortcut); | 337 | BOOL _plibc_DereferenceShortcut (char *pszShortcut); |
336 | char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags); | 338 | char *plibc_ChooseDir (char *pszTitle, unsigned long ulFlags); |
337 | char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags); | 339 | char *plibc_ChooseFile (char *pszTitle, unsigned long ulFlags); |
338 | long QueryRegistry(HKEY hMainKey, const char *pszKey, const char *pszSubKey, | 340 | long QueryRegistry (HKEY hMainKey, const char *pszKey, const char *pszSubKey, |
339 | char *pszBuffer, long *pdLength); | 341 | char *pszBuffer, long *pdLength); |
340 | 342 | ||
341 | BOOL __win_IsHandleMarkedAsBlocking(int hHandle); | 343 | BOOL __win_IsHandleMarkedAsBlocking (int hHandle); |
342 | void __win_SetHandleBlockingMode(int s, BOOL bBlocking); | 344 | void __win_SetHandleBlockingMode (int s, BOOL bBlocking); |
343 | void __win_DiscardHandleBlockingMode(int s); | 345 | void __win_DiscardHandleBlockingMode (int s); |
344 | int _win_isSocketValid(int s); | 346 | int _win_isSocketValid (int s); |
345 | int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows); | 347 | int plibc_conv_to_win_path (const char *pszUnix, char *pszWindows); |
346 | unsigned plibc_get_handle_count(); | 348 | unsigned plibc_get_handle_count (); |
347 | 349 | ||
348 | typedef void (*TPanicProc) (int, char *); | 350 | typedef void (*TPanicProc) (int, char *); |
349 | void plibc_set_panic_proc(TPanicProc proc); | 351 | void plibc_set_panic_proc (TPanicProc proc); |
350 | 352 | ||
351 | int flock(int fd, int operation); | 353 | int flock (int fd, int operation); |
352 | int fsync(int fildes); | 354 | int fsync (int fildes); |
353 | int inet_pton(int af, const char *src, void *dst); | 355 | int inet_pton (int af, const char *src, void *dst); |
354 | int inet_pton4(const char *src, u_char *dst, int pton); | 356 | int inet_pton4 (const char *src, u_char * dst, int pton); |
355 | #if USE_IPV6 | 357 | #if USE_IPV6 |
356 | int inet_pton6(const char *src, u_char *dst); | 358 | int inet_pton6 (const char *src, u_char * dst); |
357 | #endif | 359 | #endif |
358 | int truncate(const char *fname, int distance); | 360 | int truncate (const char *fname, int distance); |
359 | int statfs(const char *path, struct statfs *buf); | 361 | int statfs (const char *path, struct statfs *buf); |
360 | const char *hstrerror(int err); | 362 | const char *hstrerror (int err); |
361 | int mkstemp(char *tmplate); | 363 | int mkstemp (char *tmplate); |
362 | char *strptime (const char *buf, const char *format, struct tm *tm); | 364 | char *strptime (const char *buf, const char *format, struct tm *tm); |
363 | const char *inet_ntop(int af, const void *src, char *dst, size_t size); | 365 | const char *inet_ntop (int af, const void *src, char *dst, size_t size); |
364 | 366 | ||
365 | int plibc_init(char *pszOrg, char *pszApp); | 367 | int plibc_init (char *pszOrg, char *pszApp); |
366 | void plibc_shutdown(); | 368 | void plibc_shutdown (); |
367 | int plibc_initialized(); | 369 | int plibc_initialized (); |
368 | int plibc_conv_to_win_path_ex(const char *pszUnix, char *pszWindows, int derefLinks); | 370 | int plibc_conv_to_win_path_ex (const char *pszUnix, char *pszWindows, |
369 | void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine); | 371 | int derefLinks); |
370 | void SetErrnoFromWinsockError(long lWinError); | 372 | void _SetErrnoFromWinError (long lWinError, char *pszCaller, int iLine); |
371 | void SetHErrnoFromWinError(long lWinError); | 373 | void SetErrnoFromWinsockError (long lWinError); |
372 | void SetErrnoFromHRESULT(HRESULT hRes); | 374 | void SetHErrnoFromWinError (long lWinError); |
373 | int GetErrnoFromWinsockError(long lWinError); | 375 | void SetErrnoFromHRESULT (HRESULT hRes); |
374 | FILE *_win_fopen(const char *filename, const char *mode); | 376 | int GetErrnoFromWinsockError (long lWinError); |
375 | DIR *_win_opendir(const char *dirname); | 377 | FILE *_win_fopen (const char *filename, const char *mode); |
376 | int _win_open(const char *filename, int oflag, ...); | 378 | DIR *_win_opendir (const char *dirname); |
379 | int _win_open (const char *filename, int oflag, ...); | ||
377 | #ifdef ENABLE_NLS | 380 | #ifdef ENABLE_NLS |
378 | char *_win_bindtextdomain(const char *domainname, const char *dirname); | 381 | char *_win_bindtextdomain (const char *domainname, const char *dirname); |
379 | #endif | 382 | #endif |
380 | int _win_chdir(const char *path); | 383 | int _win_chdir (const char *path); |
381 | int _win_close(int fd); | 384 | int _win_close (int fd); |
382 | int _win_creat(const char *path, mode_t mode); | 385 | int _win_creat (const char *path, mode_t mode); |
383 | char *_win_ctime(const time_t *clock); | 386 | char *_win_ctime (const time_t * clock); |
384 | char *_win_ctime_r(const time_t *clock, char *buf); | 387 | char *_win_ctime_r (const time_t * clock, char *buf); |
385 | int _win_fstat(int handle, struct stat *buffer); | 388 | int _win_fstat (int handle, struct stat *buffer); |
386 | int _win_ftruncate(int fildes, off_t length); | 389 | int _win_ftruncate (int fildes, off_t length); |
387 | void _win_gettimeofday(struct timeval *tp, void *tzp); | 390 | void _win_gettimeofday (struct timeval *tp, void *tzp); |
388 | int _win_kill(pid_t pid, int sig); | 391 | int _win_kill (pid_t pid, int sig); |
389 | int _win_pipe(int *phandles); | 392 | int _win_pipe (int *phandles); |
390 | int _win_rmdir(const char *path); | 393 | int _win_rmdir (const char *path); |
391 | int _win_access( const char *path, int mode ); | 394 | int _win_access (const char *path, int mode); |
392 | int _win_chmod(const char *filename, int pmode); | 395 | int _win_chmod (const char *filename, int pmode); |
393 | char *realpath(const char *file_name, char *resolved_name); | 396 | char *realpath (const char *file_name, char *resolved_name); |
394 | long _win_random(void); | 397 | long _win_random (void); |
395 | void _win_srandom(unsigned int seed); | 398 | void _win_srandom (unsigned int seed); |
396 | int _win_remove(const char *path); | 399 | int _win_remove (const char *path); |
397 | int _win_rename(const char *oldname, const char *newname); | 400 | int _win_rename (const char *oldname, const char *newname); |
398 | int _win_stat(const char *path, struct stat *buffer); | 401 | int _win_stat (const char *path, struct stat *buffer); |
399 | int _win_stat64(const char *path, struct stat64 *buffer); | 402 | int _win_stat64 (const char *path, struct stat64 *buffer); |
400 | long _win_sysconf(int name); | 403 | long _win_sysconf (int name); |
401 | int _win_unlink(const char *filename); | 404 | int _win_unlink (const char *filename); |
402 | int _win_write(int fildes, const void *buf, size_t nbyte); | 405 | int _win_write (int fildes, const void *buf, size_t nbyte); |
403 | int _win_read(int fildes, void *buf, size_t nbyte); | 406 | int _win_read (int fildes, void *buf, size_t nbyte); |
404 | size_t _win_fwrite(const void *buffer, size_t size, size_t count, FILE *stream); | 407 | size_t _win_fwrite (const void *buffer, size_t size, size_t count, |
405 | size_t _win_fread( void *buffer, size_t size, size_t count, FILE *stream ); | 408 | FILE * stream); |
406 | int _win_symlink(const char *path1, const char *path2); | 409 | size_t _win_fread (void *buffer, size_t size, size_t count, FILE * stream); |
407 | void *_win_mmap(void *start, size_t len, int access, int flags, int fd, | 410 | int _win_symlink (const char *path1, const char *path2); |
408 | unsigned long long offset); | 411 | void *_win_mmap (void *start, size_t len, int access, int flags, int fd, |
409 | int _win_munmap(void *start, size_t length); | 412 | unsigned long long offset); |
410 | int _win_lstat(const char *path, struct stat *buf); | 413 | int _win_munmap (void *start, size_t length); |
411 | int _win_lstat64(const char *path, struct stat64 *buf); | 414 | int _win_lstat (const char *path, struct stat *buf); |
412 | int _win_readlink(const char *path, char *buf, size_t bufsize); | 415 | int _win_lstat64 (const char *path, struct stat64 *buf); |
413 | int _win_accept(int s, struct sockaddr *addr, int *addrlen); | 416 | int _win_readlink (const char *path, char *buf, size_t bufsize); |
414 | int _win_printf(const char *format,...); | 417 | int _win_accept (int s, struct sockaddr *addr, int *addrlen); |
415 | int _win_fprintf(FILE *f,const char *format,...); | 418 | int _win_printf (const char *format, ...); |
416 | int _win_vprintf(const char *format, va_list ap); | 419 | int _win_fprintf (FILE * f, const char *format, ...); |
417 | int _win_vfprintf(FILE *stream, const char *format, va_list arg_ptr); | 420 | int _win_vprintf (const char *format, va_list ap); |
418 | int _win_vsprintf(char *dest,const char *format, va_list arg_ptr); | 421 | int _win_vfprintf (FILE * stream, const char *format, va_list arg_ptr); |
419 | int _win_vsnprintf(char* str, size_t size, const char *format, va_list arg_ptr); | 422 | int _win_vsprintf (char *dest, const char *format, va_list arg_ptr); |
420 | int _win_snprintf(char *str,size_t size,const char *format,...); | 423 | int _win_vsnprintf (char *str, size_t size, const char *format, |
421 | int _win_sprintf(char *dest,const char *format,...); | 424 | va_list arg_ptr); |
422 | int _win_vsscanf(const char* str, const char* format, va_list arg_ptr); | 425 | int _win_snprintf (char *str, size_t size, const char *format, ...); |
423 | int _win_sscanf(const char *str, const char *format, ...); | 426 | int _win_sprintf (char *dest, const char *format, ...); |
424 | int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr); | 427 | int _win_vsscanf (const char *str, const char *format, va_list arg_ptr); |
425 | int _win_vscanf(const char *format, va_list arg_ptr); | 428 | int _win_sscanf (const char *str, const char *format, ...); |
426 | int _win_scanf(const char *format, ...); | 429 | int _win_vfscanf (FILE * stream, const char *format, va_list arg_ptr); |
427 | int _win_fscanf(FILE *stream, const char *format, ...); | 430 | int _win_vscanf (const char *format, va_list arg_ptr); |
428 | pid_t _win_waitpid(pid_t pid, int *stat_loc, int options); | 431 | int _win_scanf (const char *format, ...); |
429 | int _win_bind(int s, const struct sockaddr *name, int namelen); | 432 | int _win_fscanf (FILE * stream, const char *format, ...); |
430 | int _win_connect(int s,const struct sockaddr *name, int namelen); | 433 | pid_t _win_waitpid (pid_t pid, int *stat_loc, int options); |
431 | int _win_getpeername(int s, struct sockaddr *name, | 434 | int _win_bind (int s, const struct sockaddr *name, int namelen); |
432 | int *namelen); | 435 | int _win_connect (int s, const struct sockaddr *name, int namelen); |
433 | int _win_getsockname(int s, struct sockaddr *name, | 436 | int _win_getpeername (int s, struct sockaddr *name, int *namelen); |
434 | int *namelen); | 437 | int _win_getsockname (int s, struct sockaddr *name, int *namelen); |
435 | int _win_getsockopt(int s, int level, int optname, char *optval, | 438 | int _win_getsockopt (int s, int level, int optname, char *optval, |
436 | int *optlen); | 439 | int *optlen); |
437 | int _win_listen(int s, int backlog); | 440 | int _win_listen (int s, int backlog); |
438 | int _win_recv(int s, char *buf, int len, int flags); | 441 | int _win_recv (int s, char *buf, int len, int flags); |
439 | int _win_recvfrom(int s, void *buf, int len, int flags, | 442 | int _win_recvfrom (int s, void *buf, int len, int flags, |
440 | struct sockaddr *from, int *fromlen); | 443 | struct sockaddr *from, int *fromlen); |
441 | int _win_select(int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds, | 444 | int _win_select (int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds, |
442 | const struct timeval *tv); | 445 | const struct timeval *tv); |
443 | int _win_send(int s, const char *buf, int len, int flags); | 446 | int _win_send (int s, const char *buf, int len, int flags); |
444 | int _win_sendto(int s, const char *buf, int len, int flags, | 447 | int _win_sendto (int s, const char *buf, int len, int flags, |
445 | const struct sockaddr *to, int tolen); | 448 | const struct sockaddr *to, int tolen); |
446 | int _win_setsockopt(int s, int level, int optname, const void *optval, | 449 | int _win_setsockopt (int s, int level, int optname, const void *optval, |
447 | int optlen); | 450 | int optlen); |
448 | int _win_shutdown(int s, int how); | 451 | int _win_shutdown (int s, int how); |
449 | int _win_socket(int af, int type, int protocol); | 452 | int _win_socket (int af, int type, int protocol); |
450 | struct hostent *_win_gethostbyaddr(const char *addr, int len, int type); | 453 | struct hostent *_win_gethostbyaddr (const char *addr, int len, int type); |
451 | struct hostent *_win_gethostbyname(const char *name); | 454 | struct hostent *_win_gethostbyname (const char *name); |
452 | struct hostent *gethostbyname2(const char *name, int af); | 455 | struct hostent *gethostbyname2 (const char *name, int af); |
453 | char *_win_strerror(int errnum); | 456 | char *_win_strerror (int errnum); |
454 | int IsWinNT(); | 457 | int IsWinNT (); |
455 | char *index(const char *s, int c); | 458 | char *index (const char *s, int c); |
456 | 459 | ||
457 | #if !HAVE_STRNDUP | 460 | #if !HAVE_STRNDUP |
458 | char *strndup (const char *s, size_t n); | 461 | char *strndup (const char *s, size_t n); |
459 | #endif | 462 | #endif |
460 | #if !HAVE_STRNLEN | 463 | #if !HAVE_STRNLEN |
461 | size_t strnlen (const char *str, size_t maxlen); | 464 | size_t strnlen (const char *str, size_t maxlen); |
462 | #endif | 465 | #endif |
463 | char *stpcpy(char *dest, const char *src); | 466 | char *stpcpy (char *dest, const char *src); |
464 | char *strcasestr(const char *haystack_start, const char *needle_start); | 467 | char *strcasestr (const char *haystack_start, const char *needle_start); |
465 | 468 | ||
466 | #define strcasecmp(a, b) stricmp(a, b) | 469 | #define strcasecmp(a, b) stricmp(a, b) |
467 | #define strncasecmp(a, b, c) strnicmp(a, b, c) | 470 | #define strncasecmp(a, b, c) strnicmp(a, b, c) |
468 | 471 | ||
469 | #endif /* WINDOWS */ | 472 | #endif /* WINDOWS */ |
470 | 473 | ||
471 | #ifndef WINDOWS | 474 | #ifndef WINDOWS |
472 | #define DIR_SEPARATOR '/' | 475 | #define DIR_SEPARATOR '/' |
473 | #define DIR_SEPARATOR_STR "/" | 476 | #define DIR_SEPARATOR_STR "/" |
474 | #define PATH_SEPARATOR ':' | 477 | #define PATH_SEPARATOR ':' |
475 | #define PATH_SEPARATOR_STR ":" | 478 | #define PATH_SEPARATOR_STR ":" |
476 | #define NEWLINE "\n" | 479 | #define NEWLINE "\n" |
477 | 480 | ||
478 | #ifdef ENABLE_NLS | 481 | #ifdef ENABLE_NLS |
479 | #define BINDTEXTDOMAIN(d, n) bindtextdomain(d, n) | 482 | #define BINDTEXTDOMAIN(d, n) bindtextdomain(d, n) |
480 | #endif | 483 | #endif |
481 | #define CREAT(p, m) creat(p, m) | 484 | #define CREAT(p, m) creat(p, m) |
482 | #define PLIBC_CTIME(c) ctime(c) | 485 | #define PLIBC_CTIME(c) ctime(c) |
483 | #define CTIME_R(c, b) ctime_r(c, b) | 486 | #define CTIME_R(c, b) ctime_r(c, b) |
484 | #undef FOPEN | 487 | #undef FOPEN |
485 | #define FOPEN(f, m) fopen(f, m) | 488 | #define FOPEN(f, m) fopen(f, m) |
486 | #define FTRUNCATE(f, l) ftruncate(f, l) | 489 | #define FTRUNCATE(f, l) ftruncate(f, l) |
487 | #define OPENDIR(d) opendir(d) | 490 | #define OPENDIR(d) opendir(d) |
488 | #define OPEN open | 491 | #define OPEN open |
489 | #define CHDIR(d) chdir(d) | 492 | #define CHDIR(d) chdir(d) |
490 | #define CLOSE(f) close(f) | 493 | #define CLOSE(f) close(f) |
491 | #define LSEEK(f, o, w) lseek(f, o, w) | 494 | #define LSEEK(f, o, w) lseek(f, o, w) |
492 | #define RMDIR(f) rmdir(f) | 495 | #define RMDIR(f) rmdir(f) |
493 | #define ACCESS(p, m) access(p, m) | 496 | #define ACCESS(p, m) access(p, m) |
494 | #define CHMOD(f, p) chmod(f, p) | 497 | #define CHMOD(f, p) chmod(f, p) |
495 | #define FSTAT(h, b) fstat(h, b) | 498 | #define FSTAT(h, b) fstat(h, b) |
496 | #define PLIBC_KILL(p, s) kill(p, s) | 499 | #define PLIBC_KILL(p, s) kill(p, s) |
497 | #define PIPE(h) pipe(h) | 500 | #define PIPE(h) pipe(h) |
498 | #define REMOVE(p) remove(p) | 501 | #define REMOVE(p) remove(p) |
499 | #define RENAME(o, n) rename(o, n) | 502 | #define RENAME(o, n) rename(o, n) |
500 | #define STAT(p, b) stat(p, b) | 503 | #define STAT(p, b) stat(p, b) |
501 | #define STAT64(p, b) stat64(p, b) | 504 | #define STAT64(p, b) stat64(p, b) |
502 | #define SYSCONF(n) sysconf(n) | 505 | #define SYSCONF(n) sysconf(n) |
503 | #define UNLINK(f) unlink(f) | 506 | #define UNLINK(f) unlink(f) |
504 | #define WRITE(f, b, n) write(f, b, n) | 507 | #define WRITE(f, b, n) write(f, b, n) |
505 | #define READ(f, b, n) read(f, b, n) | 508 | #define READ(f, b, n) read(f, b, n) |
506 | #define GN_FREAD(b, s, c, f) fread(b, s, c, f) | 509 | #define GN_FREAD(b, s, c, f) fread(b, s, c, f) |
507 | #define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f) | 510 | #define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f) |
508 | #define SYMLINK(a, b) symlink(a, b) | 511 | #define SYMLINK(a, b) symlink(a, b) |
509 | #define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o) | 512 | #define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o) |
510 | #define MUNMAP(s, l) munmap(s, l) | 513 | #define MUNMAP(s, l) munmap(s, l) |
511 | #define STRERROR(i) strerror(i) | 514 | #define STRERROR(i) strerror(i) |
512 | #define RANDOM() random() | 515 | #define RANDOM() random() |
513 | #define SRANDOM(s) srandom(s) | 516 | #define SRANDOM(s) srandom(s) |
514 | #define READLINK(p, b, s) readlink(p, b, s) | 517 | #define READLINK(p, b, s) readlink(p, b, s) |
515 | #define LSTAT(p, b) lstat(p, b) | 518 | #define LSTAT(p, b) lstat(p, b) |
516 | #define LSTAT64(p, b) lstat64(p, b) | 519 | #define LSTAT64(p, b) lstat64(p, b) |
517 | #define PRINTF printf | 520 | #define PRINTF printf |
518 | #define FPRINTF fprintf | 521 | #define FPRINTF fprintf |
519 | #define VPRINTF(f, a) vprintf(f, a) | 522 | #define VPRINTF(f, a) vprintf(f, a) |
520 | #define VFPRINTF(s, f, a) vfprintf(s, f, a) | 523 | #define VFPRINTF(s, f, a) vfprintf(s, f, a) |
521 | #define VSPRINTF(d, f, a) vsprintf(d, f, a) | 524 | #define VSPRINTF(d, f, a) vsprintf(d, f, a) |
522 | #define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a) | 525 | #define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a) |
523 | #define _REAL_SNPRINTF snprintf | 526 | #define _REAL_SNPRINTF snprintf |
524 | #define SPRINTF sprintf | 527 | #define SPRINTF sprintf |
525 | #define VSSCANF(s, f, a) vsscanf(s, f, a) | 528 | #define VSSCANF(s, f, a) vsscanf(s, f, a) |
526 | #define SSCANF sscanf | 529 | #define SSCANF sscanf |
527 | #define VFSCANF(s, f, a) vfscanf(s, f, a) | 530 | #define VFSCANF(s, f, a) vfscanf(s, f, a) |
528 | #define VSCANF(f, a) vscanf(f, a) | 531 | #define VSCANF(f, a) vscanf(f, a) |
529 | #define SCANF scanf | 532 | #define SCANF scanf |
530 | #define FSCANF fscanf | 533 | #define FSCANF fscanf |
531 | #define WAITPID(p, s, o) waitpid(p, s, o) | 534 | #define WAITPID(p, s, o) waitpid(p, s, o) |
532 | #define ACCEPT(s, a, l) accept(s, a, l) | 535 | #define ACCEPT(s, a, l) accept(s, a, l) |
533 | #define BIND(s, n, l) bind(s, n, l) | 536 | #define BIND(s, n, l) bind(s, n, l) |
534 | #define CONNECT(s, n, l) connect(s, n, l) | 537 | #define CONNECT(s, n, l) connect(s, n, l) |
535 | #define GETPEERNAME(s, n, l) getpeername(s, n, l) | 538 | #define GETPEERNAME(s, n, l) getpeername(s, n, l) |
536 | #define GETSOCKNAME(s, n, l) getsockname(s, n, l) | 539 | #define GETSOCKNAME(s, n, l) getsockname(s, n, l) |
537 | #define GETSOCKOPT(s, l, o, v, p) getsockopt(s, l, o, v, p) | 540 | #define GETSOCKOPT(s, l, o, v, p) getsockopt(s, l, o, v, p) |
538 | #define LISTEN(s, b) listen(s, b) | 541 | #define LISTEN(s, b) listen(s, b) |
539 | #define RECV(s, b, l, f) recv(s, b, l, f) | 542 | #define RECV(s, b, l, f) recv(s, b, l, f) |
540 | #define RECVFROM(s, b, l, f, r, o) recvfrom(s, b, l, f, r, o) | 543 | #define RECVFROM(s, b, l, f, r, o) recvfrom(s, b, l, f, r, o) |
541 | #define SELECT(n, r, w, e, t) select(n, r, w, e, t) | 544 | #define SELECT(n, r, w, e, t) select(n, r, w, e, t) |
542 | #define SEND(s, b, l, f) send(s, b, l, f) | 545 | #define SEND(s, b, l, f) send(s, b, l, f) |
543 | #define SENDTO(s, b, l, f, o, n) sendto(s, b, l, f, o, n) | 546 | #define SENDTO(s, b, l, f, o, n) sendto(s, b, l, f, o, n) |
544 | #define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n) | 547 | #define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n) |
545 | #define SHUTDOWN(s, h) shutdown(s, h) | 548 | #define SHUTDOWN(s, h) shutdown(s, h) |
546 | #define SOCKET(a, t, p) socket(a, t, p) | 549 | #define SOCKET(a, t, p) socket(a, t, p) |
547 | #define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t) | 550 | #define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t) |
548 | #define GETHOSTBYNAME(n) gethostbyname(n) | 551 | #define GETHOSTBYNAME(n) gethostbyname(n) |
549 | #define GETTIMEOFDAY(t, n) gettimeofday(t, n) | 552 | #define GETTIMEOFDAY(t, n) gettimeofday(t, n) |
550 | #define INSQUE(e, p) insque(e, p) | 553 | #define INSQUE(e, p) insque(e, p) |
551 | #define REMQUE(e) remque(e) | 554 | #define REMQUE(e) remque(e) |
552 | #define HSEARCH(i, a) hsearch(i, a) | 555 | #define HSEARCH(i, a) hsearch(i, a) |
553 | #define HCREATE(n) hcreate(n) | 556 | #define HCREATE(n) hcreate(n) |
554 | #define HDESTROY() hdestroy() | 557 | #define HDESTROY() hdestroy() |
555 | #define HSEARCH_R(i, a, r, h) hsearch_r(i, a, r, h) | 558 | #define HSEARCH_R(i, a, r, h) hsearch_r(i, a, r, h) |
556 | #define HCREATE_R(n, h) hcreate_r(n, h) | 559 | #define HCREATE_R(n, h) hcreate_r(n, h) |
557 | #define HDESTROY_R(h) hdestroy_r(h) | 560 | #define HDESTROY_R(h) hdestroy_r(h) |
558 | #define TSEARCH(k, r, c) tsearch(k, r, c) | 561 | #define TSEARCH(k, r, c) tsearch(k, r, c) |
559 | #define TFIND(k, r, c) tfind(k, r, c) | 562 | #define TFIND(k, r, c) tfind(k, r, c) |
560 | #define TDELETE(k, r, c) tdelete(k, r, c) | 563 | #define TDELETE(k, r, c) tdelete(k, r, c) |
561 | #define TWALK(r, a) twalk(r, a) | 564 | #define TWALK(r, a) twalk(r, a) |
562 | #define TDESTROY(r, f) tdestroy(r, f) | 565 | #define TDESTROY(r, f) tdestroy(r, f) |
563 | #define LFIND(k, b, n, s, c) lfind(k, b, n, s, c) | 566 | #define LFIND(k, b, n, s, c) lfind(k, b, n, s, c) |
564 | #define LSEARCH(k, b, n, s, c) lsearch(k, b, n, s, c) | 567 | #define LSEARCH(k, b, n, s, c) lsearch(k, b, n, s, c) |
565 | #else | 568 | #else |
566 | #define DIR_SEPARATOR '\\' | 569 | #define DIR_SEPARATOR '\\' |
567 | #define DIR_SEPARATOR_STR "\\" | 570 | #define DIR_SEPARATOR_STR "\\" |
568 | #define PATH_SEPARATOR ';' | 571 | #define PATH_SEPARATOR ';' |
569 | #define PATH_SEPARATOR_STR ";" | 572 | #define PATH_SEPARATOR_STR ";" |
570 | #define NEWLINE "\r\n" | 573 | #define NEWLINE "\r\n" |
571 | 574 | ||
572 | #ifdef ENABLE_NLS | 575 | #ifdef ENABLE_NLS |
573 | #define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n) | 576 | #define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n) |
574 | #endif | 577 | #endif |
575 | #define CREAT(p, m) _win_creat(p, m) | 578 | #define CREAT(p, m) _win_creat(p, m) |
576 | #define PLIBC_CTIME(c) _win_ctime(c) | 579 | #define PLIBC_CTIME(c) _win_ctime(c) |
577 | #define CTIME_R(c, b) _win_ctime_r(c, b) | 580 | #define CTIME_R(c, b) _win_ctime_r(c, b) |
578 | #define FOPEN(f, m) _win_fopen(f, m) | 581 | #define FOPEN(f, m) _win_fopen(f, m) |
579 | #define FTRUNCATE(f, l) _win_ftruncate(f, l) | 582 | #define FTRUNCATE(f, l) _win_ftruncate(f, l) |
580 | #define OPENDIR(d) _win_opendir(d) | 583 | #define OPENDIR(d) _win_opendir(d) |
581 | #define OPEN _win_open | 584 | #define OPEN _win_open |
582 | #define CHDIR(d) _win_chdir(d) | 585 | #define CHDIR(d) _win_chdir(d) |
583 | #define CLOSE(f) _win_close(f) | 586 | #define CLOSE(f) _win_close(f) |
584 | #define PLIBC_KILL(p, s) _win_kill(p, s) | 587 | #define PLIBC_KILL(p, s) _win_kill(p, s) |
585 | #define LSEEK(f, o, w) _win_lseek(f, o, w) | 588 | #define LSEEK(f, o, w) _win_lseek(f, o, w) |
586 | #define FSTAT(h, b) _win_fstat(h, b) | 589 | #define FSTAT(h, b) _win_fstat(h, b) |
587 | #define RMDIR(f) _win_rmdir(f) | 590 | #define RMDIR(f) _win_rmdir(f) |
588 | #define ACCESS(p, m) _win_access(p, m) | 591 | #define ACCESS(p, m) _win_access(p, m) |
589 | #define CHMOD(f, p) _win_chmod(f, p) | 592 | #define CHMOD(f, p) _win_chmod(f, p) |
590 | #define PIPE(h) _win_pipe(h) | 593 | #define PIPE(h) _win_pipe(h) |
591 | #define RANDOM() _win_random() | 594 | #define RANDOM() _win_random() |
592 | #define SRANDOM(s) _win_srandom(s) | 595 | #define SRANDOM(s) _win_srandom(s) |
593 | #define REMOVE(p) _win_remove(p) | 596 | #define REMOVE(p) _win_remove(p) |
594 | #define RENAME(o, n) _win_rename(o, n) | 597 | #define RENAME(o, n) _win_rename(o, n) |
595 | #define STAT(p, b) _win_stat(p, b) | 598 | #define STAT(p, b) _win_stat(p, b) |
596 | #define STAT64(p, b) _win_stat64(p, b) | 599 | #define STAT64(p, b) _win_stat64(p, b) |
597 | #define SYSCONF(n) _win_sysconf(n) | 600 | #define SYSCONF(n) _win_sysconf(n) |
598 | #define UNLINK(f) _win_unlink(f) | 601 | #define UNLINK(f) _win_unlink(f) |
599 | #define WRITE(f, b, n) _win_write(f, b, n) | 602 | #define WRITE(f, b, n) _win_write(f, b, n) |
600 | #define READ(f, b, n) _win_read(f, b, n) | 603 | #define READ(f, b, n) _win_read(f, b, n) |
601 | #define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f) | 604 | #define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f) |
602 | #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f) | 605 | #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f) |
603 | #define SYMLINK(a, b) _win_symlink(a, b) | 606 | #define SYMLINK(a, b) _win_symlink(a, b) |
604 | #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o) | 607 | #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o) |
605 | #define MUNMAP(s, l) _win_munmap(s, l) | 608 | #define MUNMAP(s, l) _win_munmap(s, l) |
606 | #define STRERROR(i) _win_strerror(i) | 609 | #define STRERROR(i) _win_strerror(i) |
607 | #define READLINK(p, b, s) _win_readlink(p, b, s) | 610 | #define READLINK(p, b, s) _win_readlink(p, b, s) |
608 | #define LSTAT(p, b) _win_lstat(p, b) | 611 | #define LSTAT(p, b) _win_lstat(p, b) |
609 | #define LSTAT64(p, b) _win_lstat64(p, b) | 612 | #define LSTAT64(p, b) _win_lstat64(p, b) |
610 | #define PRINTF(f, ...) _win_printf(f , __VA_ARGS__) | 613 | #define PRINTF(f, ...) _win_printf(f , __VA_ARGS__) |
611 | #define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__) | 614 | #define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__) |
612 | #define VPRINTF(f, a) _win_vprintf(f, a) | 615 | #define VPRINTF(f, a) _win_vprintf(f, a) |
613 | #define VFPRINTF(s, f, a) _win_vfprintf(s, f, a) | 616 | #define VFPRINTF(s, f, a) _win_vfprintf(s, f, a) |
614 | #define VSPRINTF(d, f, a) _win_vsprintf(d, f, a) | 617 | #define VSPRINTF(d, f, a) _win_vsprintf(d, f, a) |
615 | #define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a) | 618 | #define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a) |
616 | #define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, __VA_ARGS__) | 619 | #define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, __VA_ARGS__) |
617 | #define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__) | 620 | #define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__) |
618 | #define VSSCANF(s, f, a) _win_vsscanf(s, f, a) | 621 | #define VSSCANF(s, f, a) _win_vsscanf(s, f, a) |
619 | #define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__) | 622 | #define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__) |
620 | #define VFSCANF(s, f, a) _win_vfscanf(s, f, a) | 623 | #define VFSCANF(s, f, a) _win_vfscanf(s, f, a) |
621 | #define VSCANF(f, a) _win_vscanf(f, a) | 624 | #define VSCANF(f, a) _win_vscanf(f, a) |
622 | #define SCANF(f, ...) _win_scanf(f, __VA_ARGS__) | 625 | #define SCANF(f, ...) _win_scanf(f, __VA_ARGS__) |
623 | #define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__) | 626 | #define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__) |
624 | #define WAITPID(p, s, o) _win_waitpid(p, s, o) | 627 | #define WAITPID(p, s, o) _win_waitpid(p, s, o) |
625 | #define ACCEPT(s, a, l) _win_accept(s, a, l) | 628 | #define ACCEPT(s, a, l) _win_accept(s, a, l) |
626 | #define BIND(s, n, l) _win_bind(s, n, l) | 629 | #define BIND(s, n, l) _win_bind(s, n, l) |
627 | #define CONNECT(s, n, l) _win_connect(s, n, l) | 630 | #define CONNECT(s, n, l) _win_connect(s, n, l) |
628 | #define GETPEERNAME(s, n, l) _win_getpeername(s, n, l) | 631 | #define GETPEERNAME(s, n, l) _win_getpeername(s, n, l) |
629 | #define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l) | 632 | #define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l) |
630 | #define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p) | 633 | #define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p) |
631 | #define LISTEN(s, b) _win_listen(s, b) | 634 | #define LISTEN(s, b) _win_listen(s, b) |
632 | #define RECV(s, b, l, f) _win_recv(s, b, l, f) | 635 | #define RECV(s, b, l, f) _win_recv(s, b, l, f) |
633 | #define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o) | 636 | #define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o) |
634 | #define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t) | 637 | #define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t) |
635 | #define SEND(s, b, l, f) _win_send(s, b, l, f) | 638 | #define SEND(s, b, l, f) _win_send(s, b, l, f) |
636 | #define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n) | 639 | #define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n) |
637 | #define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n) | 640 | #define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n) |
638 | #define SHUTDOWN(s, h) _win_shutdown(s, h) | 641 | #define SHUTDOWN(s, h) _win_shutdown(s, h) |
639 | #define SOCKET(a, t, p) _win_socket(a, t, p) | 642 | #define SOCKET(a, t, p) _win_socket(a, t, p) |
640 | #define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t) | 643 | #define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t) |
641 | #define GETHOSTBYNAME(n) _win_gethostbyname(n) | 644 | #define GETHOSTBYNAME(n) _win_gethostbyname(n) |
642 | #define GETTIMEOFDAY(t, n) _win_gettimeofday(t, n) | 645 | #define GETTIMEOFDAY(t, n) _win_gettimeofday(t, n) |
643 | #define INSQUE(e, p) _win_insque(e, p) | 646 | #define INSQUE(e, p) _win_insque(e, p) |
644 | #define REMQUE(e) _win_remque(e) | 647 | #define REMQUE(e) _win_remque(e) |
645 | #define HSEARCH(i, a) _win_hsearch(i, a) | 648 | #define HSEARCH(i, a) _win_hsearch(i, a) |
646 | #define HCREATE(n) _win_hcreate(n) | 649 | #define HCREATE(n) _win_hcreate(n) |
647 | #define HDESTROY() _win_hdestroy() | 650 | #define HDESTROY() _win_hdestroy() |
648 | #define HSEARCH_R(i, a, r, h) _win_hsearch_r(i, a, r, h) | 651 | #define HSEARCH_R(i, a, r, h) _win_hsearch_r(i, a, r, h) |
649 | #define HCREATE_R(n, h) _win_hcreate_r(n, h) | 652 | #define HCREATE_R(n, h) _win_hcreate_r(n, h) |
650 | #define HDESTROY_R(h) _win_hdestroy_r(h) | 653 | #define HDESTROY_R(h) _win_hdestroy_r(h) |
651 | #define TSEARCH(k, r, c) _win_tsearch(k, r, c) | 654 | #define TSEARCH(k, r, c) _win_tsearch(k, r, c) |
652 | #define TFIND(k, r, c) _win_tfind(k, r, c) | 655 | #define TFIND(k, r, c) _win_tfind(k, r, c) |
653 | #define TDELETE(k, r, c) _win_tdelete(k, r, c) | 656 | #define TDELETE(k, r, c) _win_tdelete(k, r, c) |
654 | #define TWALK(r, a) _win_twalk(r, a) | 657 | #define TWALK(r, a) _win_twalk(r, a) |
655 | #define TDESTROY(r, f) _win_tdestroy(r, f) | 658 | #define TDESTROY(r, f) _win_tdestroy(r, f) |
656 | #define LFIND(k, b, n, s, c) _win_lfind(k, b, n, s, c) | 659 | #define LFIND(k, b, n, s, c) _win_lfind(k, b, n, s, c) |
657 | #define LSEARCH(k, b, n, s, c) _win_lsearch(k, b, n, s, c) | 660 | #define LSEARCH(k, b, n, s, c) _win_lsearch(k, b, n, s, c) |
658 | #endif | 661 | #endif |
659 | 662 | ||
660 | /* search.h */ | 663 | /* search.h */ |
@@ -662,7 +665,7 @@ char *strcasestr(const char *haystack_start, const char *needle_start); | |||
662 | /* Prototype structure for a linked-list data structure. | 665 | /* Prototype structure for a linked-list data structure. |
663 | This is the type used by the `insque' and `remque' functions. */ | 666 | This is the type used by the `insque' and `remque' functions. */ |
664 | 667 | ||
665 | struct PLIBC_SEARCH_QELEM | 668 | struct PLIBC_SEARCH_QELEM |
666 | { | 669 | { |
667 | struct qelem *q_forw; | 670 | struct qelem *q_forw; |
668 | struct qelem *q_back; | 671 | struct qelem *q_back; |
@@ -671,41 +674,41 @@ struct PLIBC_SEARCH_QELEM | |||
671 | 674 | ||
672 | 675 | ||
673 | /* Insert ELEM into a doubly-linked list, after PREV. */ | 676 | /* Insert ELEM into a doubly-linked list, after PREV. */ |
674 | void _win_insque (void *__elem, void *__prev); | 677 | void _win_insque (void *__elem, void *__prev); |
675 | 678 | ||
676 | /* Unlink ELEM from the doubly-linked list that it is in. */ | 679 | /* Unlink ELEM from the doubly-linked list that it is in. */ |
677 | void _win_remque (void *__elem); | 680 | void _win_remque (void *__elem); |
678 | 681 | ||
679 | 682 | ||
680 | /* For use with hsearch(3). */ | 683 | /* For use with hsearch(3). */ |
681 | typedef int (*PLIBC_SEARCH__compar_fn_t) (__const void *, __const void *); | 684 | typedef int (*PLIBC_SEARCH__compar_fn_t) (__const void *, __const void *); |
682 | 685 | ||
683 | typedef PLIBC_SEARCH__compar_fn_t _win_comparison_fn_t; | 686 | typedef PLIBC_SEARCH__compar_fn_t _win_comparison_fn_t; |
684 | 687 | ||
685 | /* Action which shall be performed in the call the hsearch. */ | 688 | /* Action which shall be performed in the call the hsearch. */ |
686 | typedef enum | 689 | typedef enum |
687 | { | 690 | { |
688 | PLIBC_SEARCH_FIND, | 691 | PLIBC_SEARCH_FIND, |
689 | PLIBC_SEARCH_ENTER | 692 | PLIBC_SEARCH_ENTER |
690 | } | 693 | } |
691 | PLIBC_SEARCH_ACTION; | 694 | PLIBC_SEARCH_ACTION; |
692 | 695 | ||
693 | typedef struct PLIBC_SEARCH_entry | 696 | typedef struct PLIBC_SEARCH_entry |
694 | { | 697 | { |
695 | char *key; | 698 | char *key; |
696 | void *data; | 699 | void *data; |
697 | } | 700 | } |
698 | PLIBC_SEARCH_ENTRY; | 701 | PLIBC_SEARCH_ENTRY; |
699 | 702 | ||
700 | /* The reentrant version has no static variables to maintain the state. | 703 | /* The reentrant version has no static variables to maintain the state. |
701 | Instead the interface of all functions is extended to take an argument | 704 | Instead the interface of all functions is extended to take an argument |
702 | which describes the current status. */ | 705 | which describes the current status. */ |
703 | typedef struct _PLIBC_SEARCH_ENTRY | 706 | typedef struct _PLIBC_SEARCH_ENTRY |
704 | { | 707 | { |
705 | unsigned int used; | 708 | unsigned int used; |
706 | PLIBC_SEARCH_ENTRY entry; | 709 | PLIBC_SEARCH_ENTRY entry; |
707 | } | 710 | } |
708 | _PLIBC_SEARCH_ENTRY; | 711 | _PLIBC_SEARCH_ENTRY; |
709 | 712 | ||
710 | 713 | ||
711 | /* Family of hash table handling functions. The functions also | 714 | /* Family of hash table handling functions. The functions also |
@@ -716,16 +719,17 @@ _PLIBC_SEARCH_ENTRY; | |||
716 | ACTION is `FIND' return found entry or signal error by returning | 719 | ACTION is `FIND' return found entry or signal error by returning |
717 | NULL. If ACTION is `ENTER' replace existing data (if any) with | 720 | NULL. If ACTION is `ENTER' replace existing data (if any) with |
718 | ITEM.data. */ | 721 | ITEM.data. */ |
719 | PLIBC_SEARCH_ENTRY *_win_hsearch (PLIBC_SEARCH_ENTRY __item, PLIBC_SEARCH_ACTION __action); | 722 | PLIBC_SEARCH_ENTRY *_win_hsearch (PLIBC_SEARCH_ENTRY __item, |
723 | PLIBC_SEARCH_ACTION __action); | ||
720 | 724 | ||
721 | /* Create a new hashing table which will at most contain NEL elements. */ | 725 | /* Create a new hashing table which will at most contain NEL elements. */ |
722 | int _win_hcreate (size_t __nel); | 726 | int _win_hcreate (size_t __nel); |
723 | 727 | ||
724 | /* Destroy current internal hashing table. */ | 728 | /* Destroy current internal hashing table. */ |
725 | void _win_hdestroy (void); | 729 | void _win_hdestroy (void); |
726 | 730 | ||
727 | /* Data type for reentrant functions. */ | 731 | /* Data type for reentrant functions. */ |
728 | struct PLIBC_SEARCH_hsearch_data | 732 | struct PLIBC_SEARCH_hsearch_data |
729 | { | 733 | { |
730 | struct _PLIBC_SEARCH_ENTRY *table; | 734 | struct _PLIBC_SEARCH_ENTRY *table; |
731 | unsigned int size; | 735 | unsigned int size; |
@@ -734,10 +738,11 @@ struct PLIBC_SEARCH_hsearch_data | |||
734 | 738 | ||
735 | /* Reentrant versions which can handle multiple hashing tables at the | 739 | /* Reentrant versions which can handle multiple hashing tables at the |
736 | same time. */ | 740 | same time. */ |
737 | int _win_hsearch_r (PLIBC_SEARCH_ENTRY __item, PLIBC_SEARCH_ACTION __action, PLIBC_SEARCH_ENTRY **__retval, | 741 | int _win_hsearch_r (PLIBC_SEARCH_ENTRY __item, PLIBC_SEARCH_ACTION __action, |
738 | struct PLIBC_SEARCH_hsearch_data *__htab); | 742 | PLIBC_SEARCH_ENTRY ** __retval, |
739 | int _win_hcreate_r (size_t __nel, struct PLIBC_SEARCH_hsearch_data *__htab); | 743 | struct PLIBC_SEARCH_hsearch_data *__htab); |
740 | void _win_hdestroy_r (struct PLIBC_SEARCH_hsearch_data *__htab); | 744 | int _win_hcreate_r (size_t __nel, struct PLIBC_SEARCH_hsearch_data *__htab); |
745 | void _win_hdestroy_r (struct PLIBC_SEARCH_hsearch_data *__htab); | ||
741 | 746 | ||
742 | 747 | ||
743 | /* The tsearch routines are very interesting. They make many | 748 | /* The tsearch routines are very interesting. They make many |
@@ -745,54 +750,57 @@ void _win_hdestroy_r (struct PLIBC_SEARCH_hsearch_data *__htab); | |||
745 | in node must be the "key" field, which points to the datum. | 750 | in node must be the "key" field, which points to the datum. |
746 | Everything depends on that. */ | 751 | Everything depends on that. */ |
747 | /* For tsearch */ | 752 | /* For tsearch */ |
748 | typedef enum | 753 | typedef enum |
749 | { | 754 | { |
750 | PLIBC_SEARCH_preorder, | 755 | PLIBC_SEARCH_preorder, |
751 | PLIBC_SEARCH_postorder, | 756 | PLIBC_SEARCH_postorder, |
752 | PLIBC_SEARCH_endorder, | 757 | PLIBC_SEARCH_endorder, |
753 | PLIBC_SEARCH_leaf | 758 | PLIBC_SEARCH_leaf |
754 | } | 759 | } |
755 | PLIBC_SEARCH_VISIT; | 760 | PLIBC_SEARCH_VISIT; |
756 | 761 | ||
757 | /* Search for an entry matching the given KEY in the tree pointed to | 762 | /* Search for an entry matching the given KEY in the tree pointed to |
758 | by *ROOTP and insert a new element if not found. */ | 763 | by *ROOTP and insert a new element if not found. */ |
759 | void *_win_tsearch (__const void *__key, void **__rootp, | 764 | void *_win_tsearch (__const void *__key, void **__rootp, |
760 | PLIBC_SEARCH__compar_fn_t __compar); | 765 | PLIBC_SEARCH__compar_fn_t __compar); |
761 | 766 | ||
762 | /* Search for an entry matching the given KEY in the tree pointed to | 767 | /* Search for an entry matching the given KEY in the tree pointed to |
763 | by *ROOTP. If no matching entry is available return NULL. */ | 768 | by *ROOTP. If no matching entry is available return NULL. */ |
764 | void *_win_tfind (__const void *__key, void *__const *__rootp, | 769 | void *_win_tfind (__const void *__key, void *__const * __rootp, |
765 | PLIBC_SEARCH__compar_fn_t __compar); | 770 | PLIBC_SEARCH__compar_fn_t __compar); |
766 | 771 | ||
767 | /* Remove the element matching KEY from the tree pointed to by *ROOTP. */ | 772 | /* Remove the element matching KEY from the tree pointed to by *ROOTP. */ |
768 | void *_win_tdelete (__const void *__restrict __key, | 773 | void *_win_tdelete (__const void *__restrict __key, |
769 | void **__restrict __rootp, | 774 | void **__restrict __rootp, |
770 | PLIBC_SEARCH__compar_fn_t __compar); | 775 | PLIBC_SEARCH__compar_fn_t __compar); |
771 | 776 | ||
772 | typedef void (*PLIBC_SEARCH__action_fn_t) (__const void *__nodep, PLIBC_SEARCH_VISIT __value, | 777 | typedef void (*PLIBC_SEARCH__action_fn_t) (__const void *__nodep, |
773 | int __level); | 778 | PLIBC_SEARCH_VISIT __value, |
779 | int __level); | ||
774 | 780 | ||
775 | /* Walk through the whole tree and call the ACTION callback for every node | 781 | /* Walk through the whole tree and call the ACTION callback for every node |
776 | or leaf. */ | 782 | or leaf. */ |
777 | void _win_twalk (__const void *__root, PLIBC_SEARCH__action_fn_t __action); | 783 | void _win_twalk (__const void *__root, PLIBC_SEARCH__action_fn_t __action); |
778 | 784 | ||
779 | /* Callback type for function to free a tree node. If the keys are atomic | 785 | /* Callback type for function to free a tree node. If the keys are atomic |
780 | data this function should do nothing. */ | 786 | data this function should do nothing. */ |
781 | typedef void (*PLIBC_SEARCH__free_fn_t) (void *__nodep); | 787 | typedef void (*PLIBC_SEARCH__free_fn_t) (void *__nodep); |
782 | 788 | ||
783 | /* Destroy the whole tree, call FREEFCT for each node or leaf. */ | 789 | /* Destroy the whole tree, call FREEFCT for each node or leaf. */ |
784 | void _win_tdestroy (void *__root, PLIBC_SEARCH__free_fn_t __freefct); | 790 | void _win_tdestroy (void *__root, PLIBC_SEARCH__free_fn_t __freefct); |
785 | 791 | ||
786 | 792 | ||
787 | /* Perform linear search for KEY by comparing by COMPAR in an array | 793 | /* Perform linear search for KEY by comparing by COMPAR in an array |
788 | [BASE,BASE+NMEMB*SIZE). */ | 794 | [BASE,BASE+NMEMB*SIZE). */ |
789 | void *_win_lfind (__const void *__key, __const void *__base, | 795 | void *_win_lfind (__const void *__key, __const void *__base, |
790 | size_t *__nmemb, size_t __size, PLIBC_SEARCH__compar_fn_t __compar); | 796 | size_t * __nmemb, size_t __size, |
797 | PLIBC_SEARCH__compar_fn_t __compar); | ||
791 | 798 | ||
792 | /* Perform linear search for KEY by comparing by COMPAR function in | 799 | /* Perform linear search for KEY by comparing by COMPAR function in |
793 | array [BASE,BASE+NMEMB*SIZE) and insert entry if not found. */ | 800 | array [BASE,BASE+NMEMB*SIZE) and insert entry if not found. */ |
794 | void *_win_lsearch (__const void *__key, void *__base, | 801 | void *_win_lsearch (__const void *__key, void *__base, |
795 | size_t *__nmemb, size_t __size, PLIBC_SEARCH__compar_fn_t __compar); | 802 | size_t * __nmemb, size_t __size, |
803 | PLIBC_SEARCH__compar_fn_t __compar); | ||
796 | 804 | ||
797 | 805 | ||
798 | #ifdef __cplusplus | 806 | #ifdef __cplusplus |
@@ -800,6 +808,6 @@ void *_win_lsearch (__const void *__key, void *__base, | |||
800 | #endif | 808 | #endif |
801 | 809 | ||
802 | 810 | ||
803 | #endif //_PLIBC_H_ | 811 | #endif //_PLIBC_H_ |
804 | 812 | ||
805 | /* end of plibc.h */ | 813 | /* end of plibc.h */ |
diff --git a/src/include/winproc.h b/src/include/winproc.h index a29130e66..1c7703799 100644 --- a/src/include/winproc.h +++ b/src/include/winproc.h | |||
@@ -56,8 +56,7 @@ extern "C" | |||
56 | #define MAX_NAME_LENGTH 25 | 56 | #define MAX_NAME_LENGTH 25 |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | typedef DWORD WINAPI (*TNtQuerySystemInformation) (int, PVOID, ULONG, | 59 | typedef DWORD WINAPI (*TNtQuerySystemInformation) (int, PVOID, ULONG, PULONG); |
60 | PULONG); | ||
61 | typedef DWORD WINAPI (*TGetIfEntry) (PMIB_IFROW pIfRow); | 60 | typedef DWORD WINAPI (*TGetIfEntry) (PMIB_IFROW pIfRow); |
62 | typedef DWORD WINAPI (*TGetIpAddrTable) (PMIB_IPADDRTABLE pIpAddrTable, | 61 | typedef DWORD WINAPI (*TGetIpAddrTable) (PMIB_IPADDRTABLE pIpAddrTable, |
63 | PULONG pdwSize, BOOL bOrder); | 62 | PULONG pdwSize, BOOL bOrder); |
@@ -104,8 +103,7 @@ extern "C" | |||
104 | PDWORD pdwBestIfIndex); | 103 | PDWORD pdwBestIfIndex); |
105 | typedef DWORD WINAPI (*TGetAdaptersInfo) (PIP_ADAPTER_INFO pAdapterInfo, | 104 | typedef DWORD WINAPI (*TGetAdaptersInfo) (PIP_ADAPTER_INFO pAdapterInfo, |
106 | PULONG pOutBufLen); | 105 | PULONG pOutBufLen); |
107 | typedef NET_API_STATUS WINAPI (*TNetUserAdd) (LPCWSTR, DWORD, PBYTE, | 106 | typedef NET_API_STATUS WINAPI (*TNetUserAdd) (LPCWSTR, DWORD, PBYTE, PDWORD); |
108 | PDWORD); | ||
109 | typedef NET_API_STATUS WINAPI (*TNetUserSetInfo) (LPCWSTR servername, | 107 | typedef NET_API_STATUS WINAPI (*TNetUserSetInfo) (LPCWSTR servername, |
110 | LPCWSTR username, | 108 | LPCWSTR username, |
111 | DWORD level, LPBYTE buf, | 109 | DWORD level, LPBYTE buf, |
@@ -205,7 +203,7 @@ extern "C" | |||
205 | BOOL AddPathAccessRights (char *lpszFileName, char *lpszAccountName, | 203 | BOOL AddPathAccessRights (char *lpszFileName, char *lpszAccountName, |
206 | DWORD dwAccessMask); | 204 | DWORD dwAccessMask); |
207 | char *winErrorStr (const char *prefix, int dwErr); | 205 | char *winErrorStr (const char *prefix, int dwErr); |
208 | void EnumNICs(PMIB_IFTABLE *pIfTable, PMIB_IPADDRTABLE *pAddrTable); | 206 | void EnumNICs (PMIB_IFTABLE * pIfTable, PMIB_IPADDRTABLE * pAddrTable); |
209 | int GNInitWinEnv (); | 207 | int GNInitWinEnv (); |
210 | void GNShutdownWinEnv (); | 208 | void GNShutdownWinEnv (); |
211 | 209 | ||