39 |
#define ATYP_IPv4 0x01 /* IPv4 */ |
#define ATYP_IPv4 0x01 /* IPv4 */ |
40 |
#define ATYP_DOMAINNAME 0x03 /* DOMAIN NAME */ |
#define ATYP_DOMAINNAME 0x03 /* DOMAIN NAME */ |
41 |
#ifdef IPV6 |
#ifdef IPV6 |
42 |
#define ATYP_IPv6 0x04 /* IPv6 */ |
# define ATYP_IPv6 0x04 /* IPv6 */ |
43 |
#endif /* IPV6 */ |
#endif /* IPV6 */ |
44 |
|
|
45 |
static int connect_through_socks_proxy(int, char *, unsigned int); |
static int connect_through_socks_proxy(int, char *, unsigned int); |
349 |
else |
else |
350 |
ip = 0; /* a domain name */ |
ip = 0; /* a domain name */ |
351 |
|
|
352 |
#ifdef IPV6 |
#ifdef IPV6 |
353 |
if (host[i] == ':') { |
if (host[i] == ':') { |
354 |
ip = 2; |
ip = 2; |
355 |
break; |
break; |
356 |
} |
} |
357 |
#endif /* IPV6 */ |
#endif /* IPV6 */ |
358 |
} |
} |
359 |
|
|
360 |
if (ip == 1) { /* IPv4 */ |
if (ip == 1) { /* IPv4 */ |
383 |
for (i = 0; i < 4; i++) |
for (i = 0; i < 4; i++) |
384 |
request[offset++] = ip[z++]; |
request[offset++] = ip[z++]; |
385 |
|
|
386 |
#ifdef IPV6 |
#ifdef IPV6 |
387 |
} |
} |
388 |
else if (ip == 2) { /* IPv6 */ |
else if (ip == 2) { /* IPv6 */ |
389 |
char tmp[5]; |
char tmp[5]; |
407 |
strncpy(tmp, "0000", 4); |
strncpy(tmp, "0000", 4); |
408 |
} |
} |
409 |
} |
} |
410 |
#endif /* IPV6 */ |
#endif /* IPV6 */ |
411 |
|
|
412 |
} |
} |
413 |
else { /* a domain name */ |
else { /* a domain name */ |
500 |
} |
} |
501 |
break; |
break; |
502 |
|
|
503 |
#ifdef IPV6 |
#ifdef IPV6 |
504 |
case ATYP_IPv6: |
case ATYP_IPv6: |
505 |
memset(reply, 0, sizeof(reply)); |
memset(reply, 0, sizeof(reply)); |
506 |
/* |
/* |
508 |
*/ |
*/ |
509 |
recv(sd, reply, 18, 0); |
recv(sd, reply, 18, 0); |
510 |
break; |
break; |
511 |
#endif /* IPV6 */ |
#endif /* IPV6 */ |
512 |
} |
} |
513 |
} |
} |
514 |
return 0; |
return 0; |