*
* \sa getnameinfo(3).
*/
-char *host_and_port(struct sockaddr *sa, socklen_t len)
+static char *host_and_port(struct sockaddr *sa, socklen_t len)
{
static char output[NI_MAXHOST + NI_MAXSERV + 2];
char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
ret = getnameinfo(sa, len, hbuf, sizeof(hbuf), sbuf, sizeof(sbuf),
NI_NUMERICHOST | NI_NUMERICSERV);
- if (ret) {
- PARA_WARNING_LOG("hostname lookup error (%s).\n", gai_strerror(ret));
+ if (ret) {
+ PARA_WARNING_LOG("hostname lookup error (%s).\n",
+ gai_strerror(ret));
sprintf(output, "(unknown)");
- } else {
+ } else
sprintf(output, "%s#%s", hbuf, sbuf);
- }
return output;
}
return host_and_port((struct sockaddr *)&ss, sslen);
}
-char *local_name(int sockfd)
+char *local_name(int sockfd)
{
return __get_sock_name(sockfd, getsockname);
}
extern int para_listen(unsigned l3type, unsigned l4type, unsigned short port);
/** Pretty-printing of IPv4/6 socket addresses */
-extern char *host_and_port(struct sockaddr *sa, socklen_t len);
extern char *local_name(int sockfd);
extern char *remote_name(int sockfd);