kripken/emscripten — pull request #1545 by inolen (2013-08-21 21:47:47+00:00)
Title: getaddrinfo, freeaddrinfo, getnameinfo support

It's probably helpful to look at both changes separately.

The first commit tweaks the new ipv6 functionality added by https://github.com/kripken/emscripten/pull/1348 so that the internal functions (inet_ntop4, inet_pton4, etc.) are prefixed with a _. Further, inet_ntop6_raw was changed to take in an array of integers as opposed to a pointer to the heap (the idea of the *_raw functions is that they can be used _without_ heap references). `inet_ntoa_raw` was renamed to be `inet_ntop4_raw` to be consistent with `inet_ntop6_raw`. The test_inet* tests were moved into the sockets test suite (I'd spent time writing tests to cover the various address translation functions only to then discover those tests). And finally, `test_sockets_getaddrinfo` was re-enabled and consolidated with `test_getaddrinfo`.

The second commit adds support for `getaddrinfo`, `freeaddrinfo` and `getnameinfo`. Part of that meant moving some of the fake IP generation / resolution code that previously existed in `gethostbyname` into the two new internal functions `_lookup_name` and `_lookup_addr`. Tests were added for all of them.