Author Topic: Where is getaddrinfo?  (Read 5689 times)

Jochen Schäfer

  • Sr. Member
  • ****
  • Posts: 306
  • Karma: +27/-0
    • View Profile
Where is getaddrinfo?
« on: June 17, 2017, 11:11:09 am »
Hi.

Does some know whether we have a implementation of getaddrinfo?
It seems to me that it should belong to the C standard library, but I can't find any declaration in /usr/include.

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2092
  • Karma: +159/-0
    • View Profile
Re: Where is getaddrinfo?
« Reply #1 on: June 17, 2017, 11:29:31 am »
Hi Jochen,

There are a few implementations around - for eg from Samba https://trac.netlabs.org/samba/browser/trunk/server/lib/replace/getaddrinfo.c & https://trac.netlabs.org/samba/browser/trunk/server/lib/replace/getaddrinfo.h

I've also opened a ticket for libcx to get this added.

Cheers,

Paul

Jochen Schäfer

  • Sr. Member
  • ****
  • Posts: 306
  • Karma: +27/-0
    • View Profile
Re: Where is getaddrinfo?
« Reply #2 on: June 17, 2017, 02:13:32 pm »
Thank you, I will try the files.

Jochen Schäfer

  • Sr. Member
  • ****
  • Posts: 306
  • Karma: +27/-0
    • View Profile
Re: Where is getaddrinfo?
« Reply #3 on: June 17, 2017, 03:10:21 pm »
Ok, the implementation has a lot depencies.
Then I have to wait until it gets into libcx.

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2092
  • Karma: +159/-0
    • View Profile
Re: Where is getaddrinfo?
« Reply #4 on: June 17, 2017, 11:34:28 pm »
Hey Jochen,

Ok, the implementation has a lot depencies.
Then I have to wait until it gets into libcx.

An alternative is from lwres from bind.

I've bundled up (hopefully) the necessary files in http://smedley.id.au/tmp/lwres.zip

#include <lwres/lwres.h> & maybe
#include <lwres/netdb.h>

and add -llwres to the linking line

Cheers,

Paul

Jochen Schäfer

  • Sr. Member
  • ****
  • Posts: 306
  • Karma: +27/-0
    • View Profile
Re: Where is getaddrinfo?
« Reply #5 on: June 18, 2017, 12:05:37 pm »
The Bind implementation compiles (I couldn't test linking yet, since I'm running into other problems.
For that I installed the bind-devel package via yum and refenced their files.

Thanks again, Paul.