diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-02-16 14:21:22 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-02-16 14:21:22 +0000 |
commit | bd742f26f08fed45b48eeb1567447acd7a77d350 (patch) | |
tree | 4f526d6824b91946d3ec52b8e2d95292b75adea0 /src/gns/gnunet-service-gns.c | |
parent | 758f38a2171dadd20328c7db93164bbcd46b72dc (diff) | |
download | gnunet-bd742f26f08fed45b48eeb1567447acd7a77d350.tar.gz gnunet-bd742f26f08fed45b48eeb1567447acd7a77d350.zip |
- added makefile, borrowed lots of code from dht for client handling
Diffstat (limited to 'src/gns/gnunet-service-gns.c')
-rw-r--r-- | src/gns/gnunet-service-gns.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index ba368122c..25e066d00 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c | |||
@@ -39,7 +39,7 @@ struct GNUNET_DNS_Handle *dns_handler; | |||
39 | /** | 39 | /** |
40 | * The configuration the GNS service is running with | 40 | * The configuration the GNS service is running with |
41 | */ | 41 | */ |
42 | const struct GNUNET_CONFIGURATION_Handle *GDS_cfg; | 42 | const struct GNUNET_CONFIGURATION_Handle *GNS_cfg; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Task run during shutdown. | 45 | * Task run during shutdown. |
@@ -76,7 +76,6 @@ handle_dns_request(void *cls, | |||
76 | * Maybe provide both, useful for cli app | 76 | * Maybe provide both, useful for cli app |
77 | **/ | 77 | **/ |
78 | struct GNUNET_DNSPARSER_Packet *p; | 78 | struct GNUNET_DNSPARSER_Packet *p; |
79 | char buf[INET6_ADDRSTRLEN]; | ||
80 | int namelen; | 79 | int namelen; |
81 | 80 | ||
82 | p = GNUNET_DNSPARSER_parse (request, request_length); | 81 | p = GNUNET_DNSPARSER_parse (request, request_length); |
@@ -86,13 +85,22 @@ handle_dns_request(void *cls, | |||
86 | GNUNET_DNS_request_forward (rh); | 85 | GNUNET_DNS_request_forward (rh); |
87 | return; | 86 | return; |
88 | } | 87 | } |
89 | /* TODO factor out */ | 88 | /** |
89 | * TODO factor out | ||
90 | * Check tld and decide if we or | ||
91 | * legacy dns is responsible | ||
92 | **/ | ||
90 | for (i=0;i<p->num_queries;i++) | 93 | for (i=0;i<p->num_queries;i++) |
91 | { | 94 | { |
92 | namelen = strlen(&p->queries[i]->name); | 95 | namelen = strlen(&p->queries[i]->name); |
93 | if (namelen >= 7) | 96 | if (namelen >= 7) |
94 | { | 97 | { |
95 | if (0 == strcmp(&p->queries[i]->name, ".gnunet")) | 98 | /** |
99 | * TODO off by 1? | ||
100 | * Move our tld/root to config file | ||
101 | * Generate fake DNS reply that replaces .gnunet with .org | ||
102 | **/ | ||
103 | if (0 == strcmp((&p->queries[i]->name)+(namelen-7), ".gnunet")) | ||
96 | { | 104 | { |
97 | GNUNET_DNS_request_answer(rh, 0 /*length*/, NULL/*reply*/); | 105 | GNUNET_DNS_request_answer(rh, 0 /*length*/, NULL/*reply*/); |
98 | } | 106 | } |
@@ -119,9 +127,9 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
119 | /* The IPC message types */ | 127 | /* The IPC message types */ |
120 | static const struct GNUNET_SERVER_MessageHandler handlers[] = { | 128 | static const struct GNUNET_SERVER_MessageHandler handlers[] = { |
121 | /* callback, cls, type, size */ | 129 | /* callback, cls, type, size */ |
122 | {&handle_record_lookup, NULL, GNUNET_MESSAGE_TYPE_GNS_RECORD_LOOKUP, | 130 | {&handle_client_record_lookup, NULL, GNUNET_MESSAGE_TYPE_GNS_RECORD_LOOKUP, |
123 | sizeof (struct GNUNET_GNS_Lookup)}, | 131 | sizeof (struct GNUNET_GNS_Lookup)}, |
124 | {&handle_record_add, NULL, GNUNET_MESSAGE_TYPE_GNS_RECORD_ADD, | 132 | {&handle_client_record_add, NULL, GNUNET_MESSAGE_TYPE_GNS_RECORD_ADD, |
125 | sizeof (struct GNUNET_GNS_Record)}, | 133 | sizeof (struct GNUNET_GNS_Record)}, |
126 | {NULL, NULL, 0, 0} | 134 | {NULL, NULL, 0, 0} |
127 | }; | 135 | }; |
@@ -144,7 +152,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
144 | * Esp the lookup would require to keep track of the clients' context | 152 | * Esp the lookup would require to keep track of the clients' context |
145 | * See dht. | 153 | * See dht. |
146 | * GNUNET_SERVER_disconnect_notify (server, &client_disconnect, NULL); | 154 | * GNUNET_SERVER_disconnect_notify (server, &client_disconnect, NULL); |
147 | * */ | 155 | **/ |
148 | } | 156 | } |
149 | 157 | ||
150 | 158 | ||