aboutsummaryrefslogtreecommitdiff
path: root/src/vpn/gnunet-service-dns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vpn/gnunet-service-dns.c')
-rw-r--r--src/vpn/gnunet-service-dns.c73
1 files changed, 26 insertions, 47 deletions
diff --git a/src/vpn/gnunet-service-dns.c b/src/vpn/gnunet-service-dns.c
index e44405a8e..6ef621c26 100644
--- a/src/vpn/gnunet-service-dns.c
+++ b/src/vpn/gnunet-service-dns.c
@@ -167,8 +167,7 @@ client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
167 * Hijack all outgoing DNS-Traffic but for traffic leaving "our" port. 167 * Hijack all outgoing DNS-Traffic but for traffic leaving "our" port.
168 */ 168 */
169static void 169static void
170hijack (void *cls 170hijack (void *cls GNUNET_UNUSED, const struct GNUNET_SCHEDULER_TaskContext *tc)
171 GNUNET_UNUSED, const struct GNUNET_SCHEDULER_TaskContext *tc)
172{ 171{
173 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 172 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
174 return; 173 return;
@@ -207,11 +206,9 @@ hijack (void *cls
207} 206}
208 207
209static void * 208static void *
210new_tunnel (void *cls 209new_tunnel (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
211 GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, 210 const struct GNUNET_PeerIdentity *initiator GNUNET_UNUSED,
212 const struct GNUNET_PeerIdentity *initiator 211 const struct GNUNET_ATS_Information *ats GNUNET_UNUSED)
213 GNUNET_UNUSED, const struct GNUNET_ATS_Information *ats
214 GNUNET_UNUSED)
215{ 212{
216 struct tunnel_state *s = GNUNET_malloc (sizeof *s); 213 struct tunnel_state *s = GNUNET_malloc (sizeof *s);
217 214
@@ -222,8 +219,7 @@ new_tunnel (void *cls
222} 219}
223 220
224static void 221static void
225clean_tunnel (void *cls 222clean_tunnel (void *cls GNUNET_UNUSED, const struct GNUNET_MESH_Tunnel *tunnel,
226 GNUNET_UNUSED, const struct GNUNET_MESH_Tunnel *tunnel,
227 void *tunnel_ctx) 223 void *tunnel_ctx)
228{ 224{
229 GNUNET_free (tunnel_ctx); 225 GNUNET_free (tunnel_ctx);
@@ -386,8 +382,7 @@ mesh_send (void *cls, size_t size, void *buf)
386 382
387void 383void
388mesh_connect (void *cls, const struct GNUNET_PeerIdentity *peer, 384mesh_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
389 const struct GNUNET_ATS_Information *atsi 385 const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
390 GNUNET_UNUSED)
391{ 386{
392 if (NULL == peer) 387 if (NULL == peer)
393 return; 388 return;
@@ -447,15 +442,11 @@ send_mesh_query (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
447} 442}
448 443
449static int 444static int
450receive_mesh_query (void *cls 445receive_mesh_query (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
451 GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, 446 void **ctx GNUNET_UNUSED,
452 void **ctx 447 const struct GNUNET_PeerIdentity *sender GNUNET_UNUSED,
453 GNUNET_UNUSED,
454 const struct GNUNET_PeerIdentity *sender
455 GNUNET_UNUSED,
456 const struct GNUNET_MessageHeader *message, 448 const struct GNUNET_MessageHeader *message,
457 const struct GNUNET_ATS_Information *atsi 449 const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
458 GNUNET_UNUSED)
459{ 450{
460 struct dns_pkt *dns = (struct dns_pkt *) (message + 1); 451 struct dns_pkt *dns = (struct dns_pkt *) (message + 1);
461 452
@@ -500,14 +491,11 @@ receive_mesh_query (void *cls
500} 491}
501 492
502static int 493static int
503receive_mesh_answer (void *cls 494receive_mesh_answer (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
504 GNUNET_UNUSED, 495 void **ctx GNUNET_UNUSED,
505 struct GNUNET_MESH_Tunnel *tunnel, void **ctx
506 GNUNET_UNUSED,
507 const struct GNUNET_PeerIdentity *sender, 496 const struct GNUNET_PeerIdentity *sender,
508 const struct GNUNET_MessageHeader *message, 497 const struct GNUNET_MessageHeader *message,
509 const struct GNUNET_ATS_Information *atsi 498 const struct GNUNET_ATS_Information *atsi GNUNET_UNUSED)
510 GNUNET_UNUSED)
511{ 499{
512 /* TODo: size check */ 500 /* TODo: size check */
513 struct dns_pkt *dns = (struct dns_pkt *) (message + 1); 501 struct dns_pkt *dns = (struct dns_pkt *) (message + 1);
@@ -749,16 +737,13 @@ send_rev_query (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
749 * Receive a block from the dht. 737 * Receive a block from the dht.
750 */ 738 */
751static void 739static void
752receive_dht (void *cls, struct GNUNET_TIME_Absolute exp 740receive_dht (void *cls, struct GNUNET_TIME_Absolute exp GNUNET_UNUSED,
753 GNUNET_UNUSED, const GNUNET_HashCode * key 741 const GNUNET_HashCode * key GNUNET_UNUSED,
754 GNUNET_UNUSED, 742 const struct GNUNET_PeerIdentity *get_path GNUNET_UNUSED,
755 const struct GNUNET_PeerIdentity *get_path 743 unsigned int get_path_length GNUNET_UNUSED,
756 GNUNET_UNUSED, unsigned int get_path_length 744 const struct GNUNET_PeerIdentity *put_path GNUNET_UNUSED,
757 GNUNET_UNUSED, 745 unsigned int put_path_length GNUNET_UNUSED,
758 const struct GNUNET_PeerIdentity *put_path 746 enum GNUNET_BLOCK_Type type, size_t size, const void *data)
759 GNUNET_UNUSED, unsigned int put_path_length
760 GNUNET_UNUSED, enum GNUNET_BLOCK_Type type, size_t size,
761 const void *data)
762{ 747{
763 748
764 unsigned short id = ((struct receive_dht_cls *) cls)->id; 749 unsigned short id = ((struct receive_dht_cls *) cls)->id;
@@ -868,8 +853,7 @@ receive_dht (void *cls, struct GNUNET_TIME_Absolute exp
868 * This receives a GNUNET_MESSAGE_TYPE_REHIJACK and rehijacks the DNS 853 * This receives a GNUNET_MESSAGE_TYPE_REHIJACK and rehijacks the DNS
869 */ 854 */
870static void 855static void
871rehijack (void *cls 856rehijack (void *cls GNUNET_UNUSED, struct GNUNET_SERVER_Client *client,
872 GNUNET_UNUSED, struct GNUNET_SERVER_Client *client,
873 const struct GNUNET_MessageHeader *message GNUNET_UNUSED) 857 const struct GNUNET_MessageHeader *message GNUNET_UNUSED)
874{ 858{
875 unhijack (dnsoutport); 859 unhijack (dnsoutport);
@@ -882,8 +866,7 @@ rehijack (void *cls
882 * This receives the dns-payload from the daemon-vpn and sends it on over the udp-socket 866 * This receives the dns-payload from the daemon-vpn and sends it on over the udp-socket
883 */ 867 */
884static void 868static void
885receive_query (void *cls 869receive_query (void *cls GNUNET_UNUSED, struct GNUNET_SERVER_Client *client,
886 GNUNET_UNUSED, struct GNUNET_SERVER_Client *client,
887 const struct GNUNET_MessageHeader *message) 870 const struct GNUNET_MessageHeader *message)
888{ 871{
889 struct query_packet *pkt = (struct query_packet *) message; 872 struct query_packet *pkt = (struct query_packet *) message;
@@ -1231,8 +1214,7 @@ handle_response (struct dns_pkt *dns, struct sockaddr *addr, socklen_t addrlen,
1231 * Read a response-packet of the UDP-Socket 1214 * Read a response-packet of the UDP-Socket
1232 */ 1215 */
1233static void 1216static void
1234read_response6 (void *cls 1217read_response6 (void *cls GNUNET_UNUSED,
1235 GNUNET_UNUSED,
1236 const struct GNUNET_SCHEDULER_TaskContext *tc) 1218 const struct GNUNET_SCHEDULER_TaskContext *tc)
1237{ 1219{
1238 struct sockaddr_in6 addr; 1220 struct sockaddr_in6 addr;
@@ -1281,8 +1263,7 @@ read_response6 (void *cls
1281 * Read a response-packet of the UDP-Socket 1263 * Read a response-packet of the UDP-Socket
1282 */ 1264 */
1283static void 1265static void
1284read_response (void *cls 1266read_response (void *cls GNUNET_UNUSED,
1285 GNUNET_UNUSED,
1286 const struct GNUNET_SCHEDULER_TaskContext *tc) 1267 const struct GNUNET_SCHEDULER_TaskContext *tc)
1287{ 1268{
1288 struct sockaddr_in addr; 1269 struct sockaddr_in addr;
@@ -1438,8 +1419,7 @@ handle_response (struct dns_pkt *dns, struct sockaddr *addr, socklen_t addrlen,
1438 * @param tc unused 1419 * @param tc unused
1439 */ 1420 */
1440static void 1421static void
1441cleanup_task (void *cls 1422cleanup_task (void *cls GNUNET_UNUSED,
1442 GNUNET_UNUSED,
1443 const struct GNUNET_SCHEDULER_TaskContext *tc) 1423 const struct GNUNET_SCHEDULER_TaskContext *tc)
1444{ 1424{
1445 GNUNET_assert (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)); 1425 GNUNET_assert (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN));
@@ -1665,8 +1645,7 @@ publish_iterate (void *cls GNUNET_UNUSED, const char *section)
1665 * Publish a DNS-record in the DHT. 1645 * Publish a DNS-record in the DHT.
1666 */ 1646 */
1667static void 1647static void
1668publish_names (void *cls 1648publish_names (void *cls GNUNET_UNUSED,
1669 GNUNET_UNUSED,
1670 const struct GNUNET_SCHEDULER_TaskContext *tc) 1649 const struct GNUNET_SCHEDULER_TaskContext *tc)
1671{ 1650{
1672 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1651 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))