Logo Search packages:      
Sourcecode: libnl version File versions  Download package

int nl_addr_resolve ( struct nl_addr *  addr,
char *  host,
size_t  hostlen 

Resolve abstract address object to a name using getnameinfo().

  • addr Abstract address object.
  • host Destination buffer for host name.
  • hostlen Length of destination buffer.
Resolves the abstract address to a name and writes the looked up result into the host buffer. getnameinfo() is used to perform the lookup and is put into NI_NAMEREQD mode so the function will fail if the lookup couldn't be performed.

0 on success or a negative error code.

Definition at line 673 of file addr.c.

References nl_addr_fill_sockaddr().

      int err;
      struct sockaddr_in6 buf;
      socklen_t salen = sizeof(buf);

      err = nl_addr_fill_sockaddr(addr, (struct sockaddr *) &buf, &salen);
      if (err < 0)
            return err;

      return getnameinfo((struct sockaddr *) &buf, salen,
                     host, hostlen, NULL, 0, NI_NAMEREQD);

Generated by  Doxygen 1.6.0   Back to index