aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gnunet-dns2gns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gns/gnunet-dns2gns.c')
-rw-r--r--src/gns/gnunet-dns2gns.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c
index a6d57f3a9..4dcec6bdc 100644
--- a/src/gns/gnunet-dns2gns.c
+++ b/src/gns/gnunet-dns2gns.c
@@ -65,7 +65,7 @@ struct Request
65 * converted to the DNS response. 65 * converted to the DNS response.
66 */ 66 */
67 struct GNUNET_DNSPARSER_Packet *packet; 67 struct GNUNET_DNSPARSER_Packet *packet;
68 68
69 /** 69 /**
70 * Our GNS request handle. 70 * Our GNS request handle.
71 */ 71 */
@@ -84,7 +84,7 @@ struct Request
84 84
85 /** 85 /**
86 * Number of bytes in 'addr'. 86 * Number of bytes in 'addr'.
87 */ 87 */
88 size_t addr_len; 88 size_t addr_len;
89 89
90}; 90};
@@ -217,7 +217,7 @@ send_response (struct Request *request)
217{ 217{
218 char *buf; 218 char *buf;
219 size_t size; 219 size_t size;
220 220
221 if (GNUNET_SYSERR == 221 if (GNUNET_SYSERR ==
222 GNUNET_DNSPARSER_pack (request->packet, 222 GNUNET_DNSPARSER_pack (request->packet,
223 UINT16_MAX /* is this not too much? */, 223 UINT16_MAX /* is this not too much? */,
@@ -377,7 +377,7 @@ result_processor (void *cls,
377 * @param addr address to use for sending the reply 377 * @param addr address to use for sending the reply
378 * @param addr_len number of bytes in @a addr 378 * @param addr_len number of bytes in @a addr
379 * @param udp_msg DNS request payload 379 * @param udp_msg DNS request payload
380 * @param udp_msg_size number of bytes in @a udp_msg 380 * @param udp_msg_size number of bytes in @a udp_msg
381 */ 381 */
382static void 382static void
383handle_request (struct GNUNET_NETWORK_Handle *lsock, 383handle_request (struct GNUNET_NETWORK_Handle *lsock,
@@ -408,7 +408,7 @@ handle_request (struct GNUNET_NETWORK_Handle *lsock,
408 (int) packet->num_answers, 408 (int) packet->num_answers,
409 (int) packet->num_authority_records, 409 (int) packet->num_authority_records,
410 (int) packet->num_additional_records); 410 (int) packet->num_additional_records);
411 if ( (0 != packet->flags.query_or_response) || 411 if ( (0 != packet->flags.query_or_response) ||
412 (0 != packet->num_answers) || 412 (0 != packet->num_answers) ||
413 (0 != packet->num_authority_records)) 413 (0 != packet->num_authority_records))
414 { 414 {
@@ -439,7 +439,7 @@ handle_request (struct GNUNET_NETWORK_Handle *lsock,
439 name_len = strlen (name); 439 name_len = strlen (name);
440 use_gns = GNUNET_NO; 440 use_gns = GNUNET_NO;
441 441
442 442
443 if ( (name_len > strlen (fcfs_suffix)) && 443 if ( (name_len > strlen (fcfs_suffix)) &&
444 (0 == strcasecmp (fcfs_suffix, 444 (0 == strcasecmp (fcfs_suffix,
445 &name[name_len - strlen (fcfs_suffix)])) ) 445 &name[name_len - strlen (fcfs_suffix)])) )
@@ -481,7 +481,7 @@ handle_request (struct GNUNET_NETWORK_Handle *lsock,
481 else 481 else
482 { 482 {
483 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 483 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
484 "Using DNS resolver IP `%s' to resolve `%s'\n", 484 "Using DNS resolver IP `%s' to resolve `%s'\n",
485 dns_ip, 485 dns_ip,
486 name); 486 name);
487 GNUNET_DNSPARSER_free_packet (request->packet); 487 GNUNET_DNSPARSER_free_packet (request->packet);
@@ -501,7 +501,7 @@ handle_request (struct GNUNET_NETWORK_Handle *lsock,
501 * 501 *
502 * @param cls the 'listen_socket4' 502 * @param cls the 'listen_socket4'
503 * @param tc scheduler context 503 * @param tc scheduler context
504 */ 504 */
505static void 505static void
506read_dns4 (void *cls, 506read_dns4 (void *cls,
507 const struct GNUNET_SCHEDULER_TaskContext *tc) 507 const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -525,9 +525,9 @@ read_dns4 (void *cls,
525 } 525 }
526 { 526 {
527 char buf[size]; 527 char buf[size];
528 528
529 addrlen = sizeof (v4); 529 addrlen = sizeof (v4);
530 GNUNET_break (size == 530 GNUNET_break (size ==
531 GNUNET_NETWORK_socket_recvfrom (listen_socket4, 531 GNUNET_NETWORK_socket_recvfrom (listen_socket4,
532 buf, 532 buf,
533 size, 533 size,
@@ -544,7 +544,7 @@ read_dns4 (void *cls,
544 * 544 *
545 * @param cls the 'listen_socket6' 545 * @param cls the 'listen_socket6'
546 * @param tc scheduler context 546 * @param tc scheduler context
547 */ 547 */
548static void 548static void
549read_dns6 (void *cls, 549read_dns6 (void *cls,
550 const struct GNUNET_SCHEDULER_TaskContext *tc) 550 const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -568,9 +568,9 @@ read_dns6 (void *cls,
568 } 568 }
569 { 569 {
570 char buf[size]; 570 char buf[size];
571 571
572 addrlen = sizeof (v6); 572 addrlen = sizeof (v6);
573 GNUNET_break (size == 573 GNUNET_break (size ==
574 GNUNET_NETWORK_socket_recvfrom (listen_socket6, 574 GNUNET_NETWORK_socket_recvfrom (listen_socket6,
575 buf, 575 buf,
576 size, 576 size,
@@ -601,7 +601,7 @@ run_dnsd ()
601 return; 601 return;
602 } 602 }
603 listen_socket4 = GNUNET_NETWORK_socket_create (PF_INET, 603 listen_socket4 = GNUNET_NETWORK_socket_create (PF_INET,
604 SOCK_DGRAM, 604 SOCK_DGRAM,
605 IPPROTO_UDP); 605 IPPROTO_UDP);
606 if (NULL != listen_socket4) 606 if (NULL != listen_socket4)
607 { 607 {
@@ -625,7 +625,7 @@ run_dnsd ()
625 } 625 }
626 } 626 }
627 listen_socket6 = GNUNET_NETWORK_socket_create (PF_INET6, 627 listen_socket6 = GNUNET_NETWORK_socket_create (PF_INET6,
628 SOCK_DGRAM, 628 SOCK_DGRAM,
629 IPPROTO_UDP); 629 IPPROTO_UDP);
630 if (NULL != listen_socket6) 630 if (NULL != listen_socket6)
631 { 631 {
@@ -671,7 +671,7 @@ run_dnsd ()
671} 671}
672 672
673 673
674/** 674/**
675 * Method called to inform about the egos of this peer. 675 * Method called to inform about the egos of this peer.
676 * 676 *
677 * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get, 677 * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get,
@@ -679,7 +679,7 @@ run_dnsd ()
679 * @a ego does indicate an error (i.e. name is taken or no default 679 * @a ego does indicate an error (i.e. name is taken or no default
680 * value is known). If @a ego is non-NULL and if '*ctx' 680 * value is known). If @a ego is non-NULL and if '*ctx'
681 * is set in those callbacks, the value WILL be passed to a subsequent 681 * is set in those callbacks, the value WILL be passed to a subsequent
682 * call to the identity callback of #GNUNET_IDENTITY_connect (if 682 * call to the identity callback of #GNUNET_IDENTITY_connect (if
683 * that one was not NULL). 683 * that one was not NULL).
684 * 684 *
685 * @param cls closure, NULL 685 * @param cls closure, NULL
@@ -747,7 +747,7 @@ run (void *cls, char *const *args, const char *cfgfile,
747 strlen (gns_zone_str), 747 strlen (gns_zone_str),
748 &my_zone)) ) 748 &my_zone)) )
749 { 749 {
750 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 750 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
751 _("No valid GNS zone specified!\n")); 751 _("No valid GNS zone specified!\n"));
752 GNUNET_SCHEDULER_shutdown (); 752 GNUNET_SCHEDULER_shutdown ();
753 return; 753 return;
@@ -764,7 +764,7 @@ run (void *cls, char *const *args, const char *cfgfile,
764 * @return 0 ok, 1 on error 764 * @return 0 ok, 1 on error
765 */ 765 */
766int 766int
767main (int argc, 767main (int argc,
768 char *const *argv) 768 char *const *argv)
769{ 769{
770 static const struct GNUNET_GETOPT_CommandLineOption options[] = { 770 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -794,7 +794,7 @@ main (int argc,
794 ret = 794 ret =
795 (GNUNET_OK == 795 (GNUNET_OK ==
796 GNUNET_PROGRAM_run (argc, argv, "gnunet-dns2gns", 796 GNUNET_PROGRAM_run (argc, argv, "gnunet-dns2gns",
797 _("GNUnet DNS-to-GNS proxy (a DNS server)"), 797 _("GNUnet DNS-to-GNS proxy (a DNS server)"),
798 options, 798 options,
799 &run, NULL)) ? 0 : 1; 799 &run, NULL)) ? 0 : 1;
800 GNUNET_free ((void*) argv); 800 GNUNET_free ((void*) argv);