version 1.1, 2012/02/21 23:32:47
|
version 1.1.1.2, 2013/07/22 08:44:29
|
Line 258 char *u_rangetoa(struct u_range *range, char *dst, s
|
Line 258 char *u_rangetoa(struct u_range *range, char *dst, s
|
return dst; |
return dst; |
} |
} |
|
|
struct u_addr *u_addrcopy(const struct u_addr *src, struct u_addr *dst) | void u_addrcopy(const struct u_addr *src, struct u_addr *dst) |
{ |
{ |
return memcpy(dst,src,sizeof(struct u_addr)); | memcpy(dst,src,sizeof(struct u_addr)); |
} |
} |
|
|
struct u_addr *u_rangecopy(const struct u_range *src, struct u_range *dst) | void u_rangecopy(const struct u_range *src, struct u_range *dst) |
{ |
{ |
return memcpy(dst,src,sizeof(struct u_range)); | memcpy(dst,src,sizeof(struct u_range)); |
} |
} |
|
|
struct u_addr *u_addrclear(struct u_addr *addr) | void u_addrclear(struct u_addr *addr) |
{ |
{ |
memset(addr,0,sizeof(struct u_addr)); |
memset(addr,0,sizeof(struct u_addr)); |
return addr; |
|
} |
} |
|
|
struct u_range *u_rangeclear(struct u_range *range) | void u_rangeclear(struct u_range *range) |
{ |
{ |
memset(range,0,sizeof(struct u_range)); |
memset(range,0,sizeof(struct u_range)); |
return range; |
|
} |
} |
|
|
struct u_addr *in_addrtou_addr(const struct in_addr *src, struct u_addr *dst) | void in_addrtou_addr(const struct in_addr *src, struct u_addr *dst) |
{ |
{ |
u_addrclear(dst); |
u_addrclear(dst); |
dst->family=AF_INET; |
dst->family=AF_INET; |
dst->u.ip4=*src; |
dst->u.ip4=*src; |
return dst; |
|
} |
} |
|
|
struct u_addr *in6_addrtou_addr(const struct in6_addr *src, struct u_addr *dst) | void in6_addrtou_addr(const struct in6_addr *src, struct u_addr *dst) |
{ |
{ |
u_addrclear(dst); |
u_addrclear(dst); |
dst->family=AF_INET6; |
dst->family=AF_INET6; |
dst->u.ip6=*src; |
dst->u.ip6=*src; |
return dst; |
|
} |
} |
|
|
struct in_addr *u_addrtoin_addr(const struct u_addr *src, struct in_addr *dst) | void u_addrtoin_addr(const struct u_addr *src, struct in_addr *dst) |
{ |
{ |
*dst=src->u.ip4; |
*dst=src->u.ip4; |
return dst; |
|
} |
} |
|
|
struct in6_addr *u_addrtoin6_addr(const struct u_addr *src, struct in6_addr *dst) | void u_addrtoin6_addr(const struct u_addr *src, struct in6_addr *dst) |
{ |
{ |
*dst=src->u.ip6; |
*dst=src->u.ip6; |
return dst; |
|
} |
} |
|
|
struct u_range *in_addrtou_range(const struct in_addr *src, u_char width, struct u_range *dst) | void in_addrtou_range(const struct in_addr *src, u_char width, struct u_range *dst) |
{ |
{ |
u_rangeclear(dst); |
u_rangeclear(dst); |
in_addrtou_addr(src, &dst->addr); |
in_addrtou_addr(src, &dst->addr); |
dst->width = width; |
dst->width = width; |
return dst; |
|
} |
} |
|
|
struct u_range *in6_addrtou_range(const struct in6_addr *src, u_char width, struct u_range *dst) | void in6_addrtou_range(const struct in6_addr *src, u_char width, struct u_range *dst) |
{ |
{ |
u_rangeclear(dst); |
u_rangeclear(dst); |
in6_addrtou_addr(src, &dst->addr); |
in6_addrtou_addr(src, &dst->addr); |
dst->width = width; |
dst->width = width; |
return dst; |
|
} |
} |
|
|
int u_addrempty(struct u_addr *addr) |
int u_addrempty(struct u_addr *addr) |
Line 382 bits2mask6(int bits)
|
Line 374 bits2mask6(int bits)
|
return result; |
return result; |
} |
} |
|
|
struct sockaddr_storage *u_rangetosockaddrs(struct u_range *range, struct sockaddr_storage *dst, struct sockaddr_storage *msk) | void u_rangetosockaddrs(struct u_range *range, struct sockaddr_storage *dst, struct sockaddr_storage *msk) |
{ |
{ |
memset(dst,0,sizeof(struct sockaddr_storage)); |
memset(dst,0,sizeof(struct sockaddr_storage)); |
memset(msk,0,sizeof(struct sockaddr_storage)); |
memset(msk,0,sizeof(struct sockaddr_storage)); |
Line 404 struct sockaddr_storage *u_rangetosockaddrs(struct u_r
|
Line 396 struct sockaddr_storage *u_rangetosockaddrs(struct u_r
|
dst->ss_len=sizeof(struct sockaddr_storage); |
dst->ss_len=sizeof(struct sockaddr_storage); |
break; |
break; |
} |
} |
return dst; |
|
} |
} |
|
|
struct sockaddr_storage *u_addrtosockaddr(struct u_addr *addr, in_port_t port, struct sockaddr_storage *dst) | void u_addrtosockaddr(struct u_addr *addr, in_port_t port, struct sockaddr_storage *dst) |
{ |
{ |
memset(dst,0,sizeof(struct sockaddr_storage)); |
memset(dst,0,sizeof(struct sockaddr_storage)); |
dst->ss_family=addr->family; |
dst->ss_family=addr->family; |
Line 426 struct sockaddr_storage *u_addrtosockaddr(struct u_add
|
Line 417 struct sockaddr_storage *u_addrtosockaddr(struct u_add
|
dst->ss_len=sizeof(struct sockaddr_storage); |
dst->ss_len=sizeof(struct sockaddr_storage); |
break; |
break; |
} |
} |
return dst; |
|
} |
} |
|
|
void sockaddrtou_addr(struct sockaddr_storage *src, struct u_addr *addr, in_port_t *port) |
void sockaddrtou_addr(struct sockaddr_storage *src, struct u_addr *addr, in_port_t *port) |