1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

Move set_sockaddr_port to libutil.

This commit is contained in:
Jelmer Vernooij 2008-10-23 21:08:13 +02:00
parent 7577d9ebf0
commit 22f566c39b
2 changed files with 14 additions and 12 deletions

View File

@ -408,3 +408,17 @@ bool is_address_any(const struct sockaddr *psa)
}
return false;
}
void set_sockaddr_port(struct sockaddr *psa, uint16_t port)
{
#if defined(HAVE_IPV6)
if (psa->sa_family == AF_INET6) {
((struct sockaddr_in6 *)psa)->sin6_port = htons(port);
}
#endif
if (psa->sa_family == AF_INET) {
((struct sockaddr_in *)psa)->sin_port = htons(port);
}
}

View File

@ -241,18 +241,6 @@ static int get_socket_port(int fd)
}
#endif
void set_sockaddr_port(struct sockaddr_storage *psa, uint16 port)
{
#if defined(HAVE_IPV6)
if (psa->ss_family == AF_INET6) {
((struct sockaddr_in6 *)psa)->sin6_port = htons(port);
}
#endif
if (psa->ss_family == AF_INET) {
((struct sockaddr_in *)psa)->sin_port = htons(port);
}
}
const char *client_name(int fd)
{
return get_peer_name(fd,false);