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

Jochen Schäfer

  • Jr. Member
  • **
  • Thank You
  • -Given: 5
  • -Receive: 6
  • Posts: 54
    • 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

  • Sr. Member
  • ****
  • Thank You
  • -Given: 11
  • -Receive: 46
  • Posts: 355
    • 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

  • Jr. Member
  • **
  • Thank You
  • -Given: 5
  • -Receive: 6
  • Posts: 54
    • 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

  • Jr. Member
  • **
  • Thank You
  • -Given: 5
  • -Receive: 6
  • Posts: 54
    • 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

  • Sr. Member
  • ****
  • Thank You
  • -Given: 11
  • -Receive: 46
  • Posts: 355
    • 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

  • Jr. Member
  • **
  • Thank You
  • -Given: 5
  • -Receive: 6
  • Posts: 54
    • 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.