diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-10-05 15:40:55 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-10-05 15:40:55 +0000 |
commit | 95b51ca1ee2a3d75a9570934dfcf1862cf830b7e (patch) | |
tree | b9784d7a5669524f4b28a08218a2cc95e420766a /src | |
parent | d710c7df91151dde63d3304e4fdb27dc5fa8c781 (diff) | |
download | gnunet-95b51ca1ee2a3d75a9570934dfcf1862cf830b7e.tar.gz gnunet-95b51ca1ee2a3d75a9570934dfcf1862cf830b7e.zip |
-enable printing and parsing of conversation's PHONE records
Diffstat (limited to 'src')
-rw-r--r-- | src/conversation/conversation.h | 350 | ||||
-rw-r--r-- | src/conversation/conversation_api.c | 36 | ||||
-rw-r--r-- | src/include/gnunet_conversation_service.h | 28 | ||||
-rw-r--r-- | src/include/gnunet_namestore_service.h | 2 | ||||
-rw-r--r-- | src/include/gnunet_regex_service.h | 20 | ||||
-rw-r--r-- | src/namestore/namestore_api_common.c | 47 | ||||
-rw-r--r-- | src/util/common_logging.c | 1 |
7 files changed, 91 insertions, 393 deletions
diff --git a/src/conversation/conversation.h b/src/conversation/conversation.h index dceb9b9e4..685d98d16 100644 --- a/src/conversation/conversation.h +++ b/src/conversation/conversation.h | |||
@@ -39,356 +39,6 @@ extern "C" | |||
39 | #define MAX_TRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) | 39 | #define MAX_TRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) |
40 | 40 | ||
41 | 41 | ||
42 | /************************************************************************************************************************ | ||
43 | * Messages for the Client <-> Server communication | ||
44 | */ | ||
45 | |||
46 | |||
47 | /** | ||
48 | * VoipClient. | ||
49 | */ | ||
50 | struct VoipClient | ||
51 | { | ||
52 | /** | ||
53 | * Handle for a conversation client. | ||
54 | */ | ||
55 | struct GNUNET_SERVER_Client *client; | ||
56 | }; | ||
57 | |||
58 | |||
59 | /** | ||
60 | * The connection status of the service | ||
61 | */ | ||
62 | struct ConnectionStatus | ||
63 | { | ||
64 | /** | ||
65 | * The client which is in interaction | ||
66 | */ | ||
67 | struct GNUNET_SERVER_Client *client; | ||
68 | |||
69 | /** | ||
70 | * The PeerIdentity of the peer | ||
71 | */ | ||
72 | struct GNUNET_PeerIdentity peer; | ||
73 | |||
74 | /** | ||
75 | * The status (see enum) | ||
76 | */ | ||
77 | int status; | ||
78 | }; | ||
79 | |||
80 | /** | ||
81 | * Information about a missed call | ||
82 | */ | ||
83 | struct MissedCall | ||
84 | { | ||
85 | /** | ||
86 | * The PeerIdentity of the peer | ||
87 | */ | ||
88 | struct GNUNET_PeerIdentity peer; | ||
89 | |||
90 | /** | ||
91 | * The time the call was | ||
92 | */ | ||
93 | struct GNUNET_TIME_Absolute time; | ||
94 | |||
95 | }; | ||
96 | |||
97 | |||
98 | |||
99 | |||
100 | /** | ||
101 | * Client <-> Server message to initiate a new call | ||
102 | */ | ||
103 | struct ClientServerSessionInitiateMessage | ||
104 | { | ||
105 | /** | ||
106 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_INITIATE | ||
107 | */ | ||
108 | struct GNUNET_MessageHeader header; | ||
109 | struct GNUNET_PeerIdentity peer; | ||
110 | }; | ||
111 | |||
112 | |||
113 | /** | ||
114 | * Client <-> Server meessage to accept an incoming call | ||
115 | */ | ||
116 | struct ClientServerSessionAcceptMessage | ||
117 | { | ||
118 | /** | ||
119 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_ACCEPT | ||
120 | */ | ||
121 | struct GNUNET_MessageHeader header; | ||
122 | }; | ||
123 | |||
124 | |||
125 | /** | ||
126 | * Client <-> Server message to reject an incoming call | ||
127 | */ | ||
128 | struct ClientServerSessionRejectMessage | ||
129 | { | ||
130 | /** | ||
131 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_REJECT | ||
132 | */ | ||
133 | struct GNUNET_MessageHeader header; | ||
134 | int reason; | ||
135 | }; | ||
136 | |||
137 | |||
138 | /** | ||
139 | * Client <-> Server message to terminat a call | ||
140 | */ | ||
141 | struct ClientServerSessionTerminateMessage | ||
142 | { | ||
143 | /** | ||
144 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_TERMINATE | ||
145 | */ | ||
146 | struct GNUNET_MessageHeader header; | ||
147 | }; | ||
148 | |||
149 | |||
150 | /** | ||
151 | * Client <-> Server message to initiate a new call | ||
152 | */ | ||
153 | struct ClientServerTestMessage | ||
154 | { | ||
155 | /** | ||
156 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_TEST | ||
157 | */ | ||
158 | struct GNUNET_MessageHeader header; | ||
159 | struct GNUNET_PeerIdentity peer; | ||
160 | }; | ||
161 | |||
162 | /************************************************************************************************************************ | ||
163 | * Messages for the Server <-> Client communication | ||
164 | */ | ||
165 | |||
166 | /** | ||
167 | * Server <-> Client message to initiate a new call | ||
168 | */ | ||
169 | struct ServerClientSessionInitiateMessage | ||
170 | { | ||
171 | /** | ||
172 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_INITIATE | ||
173 | */ | ||
174 | struct GNUNET_MessageHeader header; | ||
175 | struct GNUNET_PeerIdentity peer; | ||
176 | }; | ||
177 | |||
178 | |||
179 | /** | ||
180 | * Server <-> Client meessage to accept an incoming call | ||
181 | */ | ||
182 | struct ServerClientSessionAcceptMessage | ||
183 | { | ||
184 | /** | ||
185 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_ACCEPT | ||
186 | */ | ||
187 | struct GNUNET_MessageHeader header; | ||
188 | }; | ||
189 | |||
190 | |||
191 | /** | ||
192 | * Server <-> Client message to reject an incoming call | ||
193 | */ | ||
194 | struct ServerClientSessionRejectMessage | ||
195 | { | ||
196 | /** | ||
197 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_REJECT | ||
198 | */ | ||
199 | struct GNUNET_MessageHeader header; | ||
200 | int reason; | ||
201 | int notify; | ||
202 | }; | ||
203 | |||
204 | |||
205 | /** | ||
206 | * Server <-> Client message to terminat a call | ||
207 | */ | ||
208 | struct ServerClientSessionTerminateMessage | ||
209 | { | ||
210 | /** | ||
211 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_TERMINATE | ||
212 | */ | ||
213 | struct GNUNET_MessageHeader header; | ||
214 | }; | ||
215 | |||
216 | |||
217 | /** | ||
218 | * Server <-> Client message to signalize the client that the service is already in use | ||
219 | */ | ||
220 | struct ServerClientServiceBlockedMessage | ||
221 | { | ||
222 | /** | ||
223 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SERVICE_BLOCKED | ||
224 | */ | ||
225 | struct GNUNET_MessageHeader header; | ||
226 | }; | ||
227 | |||
228 | /** | ||
229 | * Server <-> Client message to signalize the client that the called peer is not connected | ||
230 | */ | ||
231 | struct ServerClientPeerNotConnectedMessage | ||
232 | { | ||
233 | /** | ||
234 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_NOT_CONNECTED | ||
235 | */ | ||
236 | struct GNUNET_MessageHeader header; | ||
237 | }; | ||
238 | |||
239 | |||
240 | /** | ||
241 | * Server <-> Client message to signalize the client that called peer does not answer | ||
242 | */ | ||
243 | struct ServerClientNoAnswerMessage | ||
244 | { | ||
245 | /** | ||
246 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_NO_ANSWER | ||
247 | */ | ||
248 | struct GNUNET_MessageHeader header; | ||
249 | }; | ||
250 | |||
251 | /** | ||
252 | * Server <-> Client message to notify client of missed call | ||
253 | */ | ||
254 | struct ServerClientMissedCallMessage | ||
255 | { | ||
256 | /** | ||
257 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_MISSED_CALL | ||
258 | */ | ||
259 | struct GNUNET_MessageHeader header; | ||
260 | int number; | ||
261 | struct MissedCall *missed_call; | ||
262 | }; | ||
263 | |||
264 | |||
265 | /** | ||
266 | * Server <-> Client message to signalize the client that there occured an error | ||
267 | */ | ||
268 | struct ServerClientErrorMessage | ||
269 | { | ||
270 | /** | ||
271 | * Type is: #define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_ERROR | ||
272 | */ | ||
273 | struct GNUNET_MessageHeader header; | ||
274 | }; | ||
275 | |||
276 | |||
277 | /** | ||
278 | * Server <-> Client message to notify client of peer being available | ||
279 | */ | ||
280 | struct ServerClientPeerAvailableMessage | ||
281 | { | ||
282 | /** | ||
283 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_AVAILABLE | ||
284 | */ | ||
285 | struct GNUNET_MessageHeader header; | ||
286 | struct GNUNET_PeerIdentity peer; | ||
287 | struct GNUNET_TIME_Absolute time; | ||
288 | }; | ||
289 | |||
290 | /************************************************************************************************************************ | ||
291 | * Messages for the Mesh communication | ||
292 | */ | ||
293 | |||
294 | struct VoIPMeshMessageHeader | ||
295 | { | ||
296 | /** | ||
297 | * Type is: | ||
298 | */ | ||
299 | struct GNUNET_MessageHeader header; | ||
300 | int SequenceNumber; | ||
301 | struct GNUNET_TIME_Absolute time; | ||
302 | }; | ||
303 | |||
304 | |||
305 | /** | ||
306 | * Mesh message to sinal the remote peer the wish to initiate a new call | ||
307 | */ | ||
308 | struct MeshSessionInitiateMessage | ||
309 | { | ||
310 | /** | ||
311 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_INITIATE | ||
312 | */ | ||
313 | struct GNUNET_MessageHeader header; | ||
314 | int SequenceNumber; | ||
315 | struct GNUNET_TIME_Absolute time; | ||
316 | struct GNUNET_PeerIdentity peer; | ||
317 | }; | ||
318 | |||
319 | /** | ||
320 | * Mesh message to signal the remote peer the acceptance of an initiated call | ||
321 | */ | ||
322 | struct MeshSessionAcceptMessage | ||
323 | { | ||
324 | /** | ||
325 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_ACCEPT | ||
326 | */ | ||
327 | struct GNUNET_MessageHeader header; | ||
328 | int SequenceNumber; | ||
329 | struct GNUNET_TIME_Absolute time; | ||
330 | }; | ||
331 | |||
332 | |||
333 | /** | ||
334 | * Mesh message to reject an a wish to initiate a new call | ||
335 | */ | ||
336 | struct MeshSessionRejectMessage | ||
337 | { | ||
338 | /** | ||
339 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_REJECT | ||
340 | */ | ||
341 | struct GNUNET_MessageHeader header; | ||
342 | int SequenceNumber; | ||
343 | struct GNUNET_TIME_Absolute time; | ||
344 | int reason; | ||
345 | int notify; | ||
346 | }; | ||
347 | |||
348 | |||
349 | /** | ||
350 | * Mesh message to signal a remote peer the terminatation of a call | ||
351 | */ | ||
352 | struct MeshSessionTerminateMessage | ||
353 | { | ||
354 | /** | ||
355 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_TERMINATE | ||
356 | */ | ||
357 | struct GNUNET_MessageHeader header; | ||
358 | int SequenceNumber; | ||
359 | struct GNUNET_TIME_Absolute time; | ||
360 | }; | ||
361 | |||
362 | |||
363 | /** | ||
364 | * Server <-> Client message to notify client of peer being available | ||
365 | */ | ||
366 | struct MeshPeerAvailableMessage | ||
367 | { | ||
368 | /** | ||
369 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PEER_AVAILABLE | ||
370 | */ | ||
371 | struct GNUNET_MessageHeader header; | ||
372 | int SequenceNumber; | ||
373 | struct GNUNET_TIME_Absolute time; | ||
374 | struct GNUNET_PeerIdentity peer; | ||
375 | struct GNUNET_TIME_Absolute call; | ||
376 | }; | ||
377 | |||
378 | |||
379 | /** | ||
380 | * Messages for the audio communication | ||
381 | */ | ||
382 | struct TestMessage | ||
383 | { | ||
384 | /** | ||
385 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_TEST | ||
386 | */ | ||
387 | struct GNUNET_MessageHeader header; | ||
388 | }; | ||
389 | |||
390 | //////////////////////////////////////////////////////////// | ||
391 | |||
392 | /** | 42 | /** |
393 | * Message to transmit the audio (between client and helpers). | 43 | * Message to transmit the audio (between client and helpers). |
394 | */ | 44 | */ |
diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c index 6ce198e64..130358613 100644 --- a/src/conversation/conversation_api.c +++ b/src/conversation/conversation_api.c | |||
@@ -32,34 +32,6 @@ | |||
32 | 32 | ||
33 | 33 | ||
34 | /** | 34 | /** |
35 | * A phone record specifies which peer is hosting a given user and | ||
36 | * may also specify the phone line that is used (typically zero). | ||
37 | * The version is also right now always zero. | ||
38 | */ | ||
39 | struct PhoneRecord | ||
40 | { | ||
41 | |||
42 | /** | ||
43 | * Version of the phone record, for now always zero. We may | ||
44 | * use other versions for anonymously hosted phone lines in | ||
45 | * the future. | ||
46 | */ | ||
47 | uint32_t version GNUNET_PACKED; | ||
48 | |||
49 | /** | ||
50 | * Phone line to use at the peer. | ||
51 | */ | ||
52 | uint32_t line GNUNET_PACKED; | ||
53 | |||
54 | /** | ||
55 | * Identity of the peer hosting the phone service. | ||
56 | */ | ||
57 | struct GNUNET_PeerIdentity peer; | ||
58 | |||
59 | }; | ||
60 | |||
61 | |||
62 | /** | ||
63 | * Possible states of the phone. | 35 | * Possible states of the phone. |
64 | */ | 36 | */ |
65 | enum PhoneState | 37 | enum PhoneState |
@@ -147,7 +119,7 @@ struct GNUNET_CONVERSATION_Phone | |||
147 | /** | 119 | /** |
148 | * This phone's record. | 120 | * This phone's record. |
149 | */ | 121 | */ |
150 | struct PhoneRecord my_record; | 122 | struct GNUNET_CONVERSATION_PhoneRecord my_record; |
151 | 123 | ||
152 | /** | 124 | /** |
153 | * My GNS zone. | 125 | * My GNS zone. |
@@ -473,7 +445,7 @@ GNUNET_CONVERSATION_phone_get_record (struct GNUNET_CONVERSATION_Phone *phone, | |||
473 | { | 445 | { |
474 | rd->data = &phone->my_record; | 446 | rd->data = &phone->my_record; |
475 | rd->expiration_time = 0; | 447 | rd->expiration_time = 0; |
476 | rd->data_size = sizeof (struct PhoneRecord); | 448 | rd->data_size = sizeof (struct GNUNET_CONVERSATION_PhoneRecord); |
477 | rd->record_type = GNUNET_NAMESTORE_TYPE_PHONE; | 449 | rd->record_type = GNUNET_NAMESTORE_TYPE_PHONE; |
478 | rd->flags = GNUNET_NAMESTORE_RF_NONE; | 450 | rd->flags = GNUNET_NAMESTORE_RF_NONE; |
479 | } | 451 | } |
@@ -702,7 +674,7 @@ struct GNUNET_CONVERSATION_Call | |||
702 | /** | 674 | /** |
703 | * Target phone record, only valid after the lookup is done. | 675 | * Target phone record, only valid after the lookup is done. |
704 | */ | 676 | */ |
705 | struct PhoneRecord phone_record; | 677 | struct GNUNET_CONVERSATION_PhoneRecord phone_record; |
706 | 678 | ||
707 | /** | 679 | /** |
708 | * State machine for the call. | 680 | * State machine for the call. |
@@ -932,7 +904,7 @@ handle_gns_response (void *cls, | |||
932 | { | 904 | { |
933 | if (GNUNET_NAMESTORE_TYPE_PHONE == rd[i].record_type) | 905 | if (GNUNET_NAMESTORE_TYPE_PHONE == rd[i].record_type) |
934 | { | 906 | { |
935 | if (rd[i].data_size != sizeof (struct PhoneRecord)) | 907 | if (rd[i].data_size != sizeof (struct GNUNET_CONVERSATION_PhoneRecord)) |
936 | { | 908 | { |
937 | GNUNET_break_op (0); | 909 | GNUNET_break_op (0); |
938 | continue; | 910 | continue; |
diff --git a/src/include/gnunet_conversation_service.h b/src/include/gnunet_conversation_service.h index 3c3112745..848643f95 100644 --- a/src/include/gnunet_conversation_service.h +++ b/src/include/gnunet_conversation_service.h | |||
@@ -74,6 +74,34 @@ extern "C" | |||
74 | 74 | ||
75 | 75 | ||
76 | /** | 76 | /** |
77 | * A phone record specifies which peer is hosting a given user and | ||
78 | * may also specify the phone line that is used (typically zero). | ||
79 | * The version is also right now always zero. | ||
80 | */ | ||
81 | struct GNUNET_CONVERSATION_PhoneRecord | ||
82 | { | ||
83 | |||
84 | /** | ||
85 | * Version of the phone record, for now always zero. We may | ||
86 | * use other versions for anonymously hosted phone lines in | ||
87 | * the future. | ||
88 | */ | ||
89 | uint32_t version GNUNET_PACKED; | ||
90 | |||
91 | /** | ||
92 | * Phone line to use at the peer. | ||
93 | */ | ||
94 | uint32_t line GNUNET_PACKED; | ||
95 | |||
96 | /** | ||
97 | * Identity of the peer hosting the phone service. | ||
98 | */ | ||
99 | struct GNUNET_PeerIdentity peer; | ||
100 | |||
101 | }; | ||
102 | |||
103 | |||
104 | /** | ||
77 | * Information about the current status of a call. Each call | 105 | * Information about the current status of a call. Each call |
78 | * progresses from ring over ready to terminated. Steps may | 106 | * progresses from ring over ready to terminated. Steps may |
79 | * be skipped. | 107 | * be skipped. |
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h index 6763c05fc..c296d5eec 100644 --- a/src/include/gnunet_namestore_service.h +++ b/src/include/gnunet_namestore_service.h | |||
@@ -260,6 +260,8 @@ struct GNUNET_NAMESTORE_Block | |||
260 | /* followed by encrypted data */ | 260 | /* followed by encrypted data */ |
261 | }; | 261 | }; |
262 | 262 | ||
263 | |||
264 | |||
263 | GNUNET_NETWORK_STRUCT_END | 265 | GNUNET_NETWORK_STRUCT_END |
264 | 266 | ||
265 | /** | 267 | /** |
diff --git a/src/include/gnunet_regex_service.h b/src/include/gnunet_regex_service.h index d1d7c03f6..a3652be50 100644 --- a/src/include/gnunet_regex_service.h +++ b/src/include/gnunet_regex_service.h | |||
@@ -57,7 +57,7 @@ struct GNUNET_REGEX_Search; | |||
57 | 57 | ||
58 | /** | 58 | /** |
59 | * Announce this peer under the given regular expression. Does | 59 | * Announce this peer under the given regular expression. Does |
60 | * not free resources, must call GNUNET_REGEX_announce_cancel for | 60 | * not free resources, must call #GNUNET_REGEX_announce_cancel for |
61 | * that. | 61 | * that. |
62 | * | 62 | * |
63 | * @param cfg configuration to use | 63 | * @param cfg configuration to use |
@@ -65,7 +65,7 @@ struct GNUNET_REGEX_Search; | |||
65 | * @param refresh_delay after what delay should the announcement be repeated? | 65 | * @param refresh_delay after what delay should the announcement be repeated? |
66 | * @param compression How many characters per edge can we squeeze? | 66 | * @param compression How many characters per edge can we squeeze? |
67 | * @return Handle to reuse o free cached resources. | 67 | * @return Handle to reuse o free cached resources. |
68 | * Must be freed by calling GNUNET_REGEX_announce_cancel. | 68 | * Must be freed by calling #GNUNET_REGEX_announce_cancel. |
69 | */ | 69 | */ |
70 | struct GNUNET_REGEX_Announcement * | 70 | struct GNUNET_REGEX_Announcement * |
71 | GNUNET_REGEX_announce (const struct GNUNET_CONFIGURATION_Handle *cfg, | 71 | GNUNET_REGEX_announce (const struct GNUNET_CONFIGURATION_Handle *cfg, |
@@ -77,7 +77,7 @@ GNUNET_REGEX_announce (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
77 | /** | 77 | /** |
78 | * Stop announcing the regex specified by the given handle. | 78 | * Stop announcing the regex specified by the given handle. |
79 | * | 79 | * |
80 | * @param a handle returned by a previous GNUNET_REGEX_announce call. | 80 | * @param a handle returned by a previous #GNUNET_REGEX_announce call. |
81 | */ | 81 | */ |
82 | void | 82 | void |
83 | GNUNET_REGEX_announce_cancel (struct GNUNET_REGEX_Announcement *a); | 83 | GNUNET_REGEX_announce_cancel (struct GNUNET_REGEX_Announcement *a); |
@@ -86,12 +86,12 @@ GNUNET_REGEX_announce_cancel (struct GNUNET_REGEX_Announcement *a); | |||
86 | /** | 86 | /** |
87 | * Search callback function, invoked for every result that was found. | 87 | * Search callback function, invoked for every result that was found. |
88 | * | 88 | * |
89 | * @param cls Closure provided in GNUNET_REGEX_search. | 89 | * @param cls Closure provided in #GNUNET_REGEX_search. |
90 | * @param id Peer providing a regex that matches the string. | 90 | * @param id Peer providing a regex that matches the string. |
91 | * @param get_path Path of the get request. | 91 | * @param get_path Path of the get request. |
92 | * @param get_path_length Lenght of get_path. | 92 | * @param get_path_length Lenght of @a get_path. |
93 | * @param put_path Path of the put request. | 93 | * @param put_path Path of the put request. |
94 | * @param put_path_length Length of the put_path. | 94 | * @param put_path_length Length of the @a put_path. |
95 | */ | 95 | */ |
96 | typedef void (*GNUNET_REGEX_Found)(void *cls, | 96 | typedef void (*GNUNET_REGEX_Found)(void *cls, |
97 | const struct GNUNET_PeerIdentity *id, | 97 | const struct GNUNET_PeerIdentity *id, |
@@ -103,7 +103,7 @@ typedef void (*GNUNET_REGEX_Found)(void *cls, | |||
103 | 103 | ||
104 | /** | 104 | /** |
105 | * Search for a peer offering a regex matching certain string in the DHT. | 105 | * Search for a peer offering a regex matching certain string in the DHT. |
106 | * The search runs until GNUNET_REGEX_search_cancel is called, even if results | 106 | * The search runs until #GNUNET_REGEX_search_cancel is called, even if results |
107 | * are returned. | 107 | * are returned. |
108 | * | 108 | * |
109 | * @param cfg configuration to use | 109 | * @param cfg configuration to use |
@@ -111,7 +111,7 @@ typedef void (*GNUNET_REGEX_Found)(void *cls, | |||
111 | * @param callback Callback for found peers. | 111 | * @param callback Callback for found peers. |
112 | * @param callback_cls Closure for @c callback. | 112 | * @param callback_cls Closure for @c callback. |
113 | * @return Handle to stop search and free resources. | 113 | * @return Handle to stop search and free resources. |
114 | * Must be freed by calling GNUNET_REGEX_search_cancel. | 114 | * Must be freed by calling #GNUNET_REGEX_search_cancel. |
115 | */ | 115 | */ |
116 | struct GNUNET_REGEX_Search * | 116 | struct GNUNET_REGEX_Search * |
117 | GNUNET_REGEX_search (const struct GNUNET_CONFIGURATION_Handle *cfg, | 117 | GNUNET_REGEX_search (const struct GNUNET_CONFIGURATION_Handle *cfg, |
@@ -121,9 +121,9 @@ GNUNET_REGEX_search (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
121 | 121 | ||
122 | 122 | ||
123 | /** | 123 | /** |
124 | * Stop search and free all data used by a GNUNET_REGEX_search call. | 124 | * Stop search and free all data used by a #GNUNET_REGEX_search call. |
125 | * | 125 | * |
126 | * @param s Handle returned by a previous GNUNET_REGEX_search call. | 126 | * @param s Handle returned by a previous #GNUNET_REGEX_search call. |
127 | */ | 127 | */ |
128 | void | 128 | void |
129 | GNUNET_REGEX_search_cancel (struct GNUNET_REGEX_Search *s); | 129 | GNUNET_REGEX_search_cancel (struct GNUNET_REGEX_Search *s); |
diff --git a/src/namestore/namestore_api_common.c b/src/namestore/namestore_api_common.c index 5ba8e6f37..c965b528e 100644 --- a/src/namestore/namestore_api_common.c +++ b/src/namestore/namestore_api_common.c | |||
@@ -652,6 +652,25 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, | |||
652 | if (data_size != sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) | 652 | if (data_size != sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) |
653 | return NULL; | 653 | return NULL; |
654 | return GNUNET_CRYPTO_ecc_public_sign_key_to_string (data); | 654 | return GNUNET_CRYPTO_ecc_public_sign_key_to_string (data); |
655 | case GNUNET_NAMESTORE_TYPE_PKEY: | ||
656 | { | ||
657 | const struct GNUNET_CONVERSATION_PhoneRecord *pr; | ||
658 | char *ret; | ||
659 | char *pkey; | ||
660 | |||
661 | if (data_size != sizeof (struct GNUNET_CONVERSATION_PhoneRecord)) | ||
662 | return NULL; | ||
663 | pr = data; | ||
664 | if (0 != ntohl (pr->version)) | ||
665 | return NULL; | ||
666 | pkey = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pr->peer.public_key); | ||
667 | GNUNET_asprintf (&ret, | ||
668 | "%u-%s", | ||
669 | ntohl (pr->line), | ||
670 | pkey); | ||
671 | GNUNET_free (pkey); | ||
672 | return ret; | ||
673 | } | ||
655 | case GNUNET_NAMESTORE_TYPE_PSEU: | 674 | case GNUNET_NAMESTORE_TYPE_PSEU: |
656 | return GNUNET_strndup (data, data_size); | 675 | return GNUNET_strndup (data, data_size); |
657 | case GNUNET_NAMESTORE_TYPE_LEHO: | 676 | case GNUNET_NAMESTORE_TYPE_LEHO: |
@@ -974,6 +993,33 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, | |||
974 | memcpy (*data, &pkey, sizeof (pkey)); | 993 | memcpy (*data, &pkey, sizeof (pkey)); |
975 | *data_size = sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); | 994 | *data_size = sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); |
976 | return GNUNET_OK; | 995 | return GNUNET_OK; |
996 | case GNUNET_NAMESTORE_TYPE_PHONE: | ||
997 | { | ||
998 | struct GNUNET_CONVERSATION_PhoneRecord *pr; | ||
999 | unsigned int line; | ||
1000 | const char *dash; | ||
1001 | struct GNUNET_PeerIdentity peer; | ||
1002 | |||
1003 | if ( (NULL == (dash = strchr (s, "-"))) || | ||
1004 | (1 != sscanf (s, "%u-", &line)) || | ||
1005 | (GNUNET_OK != | ||
1006 | GNUNET_CRYPTO_ecc_public_sign_key_from_string (dash + 1, | ||
1007 | strlen (dash + 1), | ||
1008 | &peer.public_key)) ) | ||
1009 | { | ||
1010 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1011 | _("Unable to parse PHONE record `%s'\n"), | ||
1012 | s); | ||
1013 | return GNUNET_SYSERR; | ||
1014 | } | ||
1015 | pr = GNUNET_new (struct GNUNET_CONVERSATION_PhoneRecord); | ||
1016 | pr->version = htonl (0); | ||
1017 | pr->line = htonl ((uint32_t) line); | ||
1018 | pr->peer = peer; | ||
1019 | *data = pr; | ||
1020 | *data_size = sizeof (struct GNUNET_CONVERSATION_PhoneRecord); | ||
1021 | return GNUNET_OK; | ||
1022 | } | ||
977 | case GNUNET_NAMESTORE_TYPE_PSEU: | 1023 | case GNUNET_NAMESTORE_TYPE_PSEU: |
978 | *data = GNUNET_strdup (s); | 1024 | *data = GNUNET_strdup (s); |
979 | *data_size = strlen (s); | 1025 | *data_size = strlen (s); |
@@ -1073,6 +1119,7 @@ static struct { | |||
1073 | { "LEHO", GNUNET_NAMESTORE_TYPE_LEHO }, | 1119 | { "LEHO", GNUNET_NAMESTORE_TYPE_LEHO }, |
1074 | { "VPN", GNUNET_NAMESTORE_TYPE_VPN }, | 1120 | { "VPN", GNUNET_NAMESTORE_TYPE_VPN }, |
1075 | { "GNS2DNS", GNUNET_NAMESTORE_TYPE_GNS2DNS }, | 1121 | { "GNS2DNS", GNUNET_NAMESTORE_TYPE_GNS2DNS }, |
1122 | { "PHONE", GNUNET_NAMESTORE_TYPE_PHONE }, | ||
1076 | { "TLSA", GNUNET_DNSPARSER_TYPE_TLSA }, | 1123 | { "TLSA", GNUNET_DNSPARSER_TYPE_TLSA }, |
1077 | { NULL, UINT32_MAX } | 1124 | { NULL, UINT32_MAX } |
1078 | }; | 1125 | }; |
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 80819276e..59a2eeb29 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -21,7 +21,6 @@ | |||
21 | /** | 21 | /** |
22 | * @file util/common_logging.c | 22 | * @file util/common_logging.c |
23 | * @brief error handling API | 23 | * @brief error handling API |
24 | * | ||
25 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
26 | */ | 25 | */ |
27 | #include "platform.h" | 26 | #include "platform.h" |