MCPcopy Create free account
hub / github.com/RsyncProject/rsync / getnameinfo

Function getnameinfo

lib/getaddrinfo.c:476–504  ·  view source on GitHub ↗

* Convert an ipv4 address to a hostname. * * Bugs: - No IPv6 support. */

Source from the content-addressed store, hash-verified

474 * Bugs: - No IPv6 support.
475 */
476int getnameinfo(const struct sockaddr *sa, socklen_t salen,
477 char *node, size_t nodelen,
478 char *service, size_t servicelen, int flags)
479{
480
481 /* Invalid arguments. */
482 if (sa == NULL || (node == NULL && service == NULL)) {
483 return EAI_FAIL;
484 }
485
486 if (sa->sa_family != AF_INET) {
487 return EAI_FAIL;
488 }
489
490 if (salen < (socklen_t)sizeof (struct sockaddr_in)) {
491 return EAI_FAIL;
492 }
493
494 if (node) {
495 int ret = gethostnameinfo(sa, node, nodelen, flags);
496 if (ret)
497 return ret;
498 }
499
500 if (service) {
501 return getservicenameinfo(sa, service, servicelen, flags);
502 }
503 return 0;
504}

Callers 3

open_socket_outFunction · 0.85
client_addrFunction · 0.85
client_nameFunction · 0.85

Calls 2

gethostnameinfoFunction · 0.85
getservicenameinfoFunction · 0.85

Tested by

no test coverage detected