frododot
frododot

Reputation: 127

inet_pton inet_ntop roll your own

Our code has to run on both SLES9 (old) and an even older version HPUX. We're implementing IPv6 now, but inet_pton and inet_ntop do not exist on our HPUX, so have to roll our own.

S/W is in C++. If I have an IPv6 address string, can someone provide the C/C++ equivalent of the above 2 methods?

Many Thanks!

Upvotes: 1

Views: 1898

Answers (2)

pevik
pevik

Reputation: 4801

Musl's implementation: inet_ntop, inet_pton (simpler than implementation from glibc).

Upvotes: 0

jørgensen
jørgensen

Reputation: 10549

Just look in your favorite libc source (preferably not HPUX's).

http://repo.or.cz/w/glibc.git/blob/HEAD:/resolv/inet_ntop.c, http://repo.or.cz/w/glibc.git/blob/HEAD:/resolv/inet_pton.c.

Upvotes: 1

Related Questions