2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

add isc_sockaddr_setport()

This commit is contained in:
Bob Halley
2000-01-26 19:22:41 +00:00
parent 44fee66802
commit 043c6c62e6
2 changed files with 20 additions and 0 deletions

View File

@@ -323,3 +323,17 @@ isc_sockaddr_pf(const isc_sockaddr_t *sockaddr) {
}
#endif
}
void
isc_sockaddr_setport(isc_sockaddr_t *sockaddr, in_port_t port) {
switch (sockaddr->type.sa.sa_family) {
case AF_INET:
sockaddr->type.sin.sin_port = htons(port);
break;
case AF_INET6:
sockaddr->type.sin6.sin6_port = htons(port);
break;
default:
FATAL_ERROR(__FILE__, __LINE__, "unknown address family");
}
}