Changeset 2094 for Whitix/branches
- Timestamp:
- 05/27/10 12:20:46 (21 months ago)
- Files:
-
- 1 modified
-
Whitix/branches/netchannel/user/sdk/network/dns.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Whitix/branches/netchannel/user/sdk/network/dns.c
r2086 r2094 6 6 #include <types.h> 7 7 #include <string.h> 8 #include <stdio.h> 9 10 #include "udp.h" 8 11 9 12 /* Protocol structures. */ … … 48 51 } 49 52 50 int DnsPutName(char* buf, c har* name)53 int DnsPutName(char* buf, const char* name) 51 54 { 52 55 int total = 0; … … 74 77 } 75 78 76 void DnsAddQuery(struct DnsState* state, c har* name, int type)79 void DnsAddQuery(struct DnsState* state, const char* name, int type) 77 80 { 78 81 struct DnsQuestionEnd* end; … … 179 182 } 180 183 184 int DnsSkipRecord(struct DnsState* state, struct DnsAnswer* answer) 185 { 186 return sizeof(struct DnsAnswer) + NetToHostShort(answer->length); 187 } 188 181 189 int DnsGetCanonicalName(struct DnsState* state, char* name, int length, int 182 190 start) … … 204 212 } 205 213 206 int DnsSkipRecord(struct DnsState* state, struct DnsAnswer* answer)207 {208 ushort type = NetToHostShort(answer->type);209 210 return sizeof(struct DnsAnswer) + NetToHostShort(answer->length);211 }212 213 214 int DnsGetIpAddresses(struct DnsState* state, ulong* address, int 214 215 start) 215 216 { 216 int i, length; 217 char* p; 217 int i; 218 218 struct DnsAnswer* answer = (struct DnsAnswer*)(state->buf+state->offset); 219 219 … … 226 226 for (i = start; i < state->answers; i++) 227 227 { 228 ushort class = NetToHostShort(answer->class); 228 229 ushort type = NetToHostShort(answer->type); 229 ushort class = NetToHostShort(answer->class);230 ushort len = NetToHostShort(answer->length);231 230 232 231 if (class != DNS_CLASS_IN) … … 282 281 length = DnsFinishHeader(&state); 283 282 284 if (SocketSendTo(dnsSocket, buf, length, 0, &dnsAddr) < length)283 if (SocketSendTo(dnsSocket, buf, length, 0, (struct SockAddr*)&dnsAddr) < length) 285 284 return 1; 286 285 287 286 length = 1024; 288 287 289 if ((length = SocketRecvFrom(dnsSocket, buf, length, dnsAddr)) <= 0)288 if ((length = SocketRecvFrom(dnsSocket, buf, length, 0, (struct SockAddr*)&dnsAddr)) <= 0) 290 289 return 1; 291 290
