18 struct sockaddr_in6 sa;
19 unsigned int dummy =
sizeof(sa);
23 r = recvfrom(s,buf,len,0,(
struct sockaddr *)&sa,&dummy);
24 if (r == -1)
return -1;
26 if (sa.sin6_family == AF_INET) {
27 struct sockaddr_in *sa4 = (
struct sockaddr_in *)&sa;
29 byte_copy(ip + 12,4,(
char *)&sa4->sin_addr);
31 if (scope_id) *scope_id = 0;
35 if (scope_id) *scope_id = sa.sin6_scope_id;
const unsigned char V4mappedprefix[12]
int socket_recv(int s, char *buf, unsigned int len, char ip[16], uint16 *port, uint32 *scope_id)
void uint16_unpack_big(char[16], uint16 *)
void byte_copy(void *, unsigned int, const void *)
void byte_zero(void *, unsigned int)