extern const char *ast_inet_ntoa(char *buf, int bufsiz, struct in_addr ia);
extern int ast_utils_init(void);
+#ifdef inet_ntoa
+#undef inet_ntoa
+#endif
#define inet_ntoa __dont__use__inet_ntoa__use__ast_inet_ntoa__instead__
#endif
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <netinet/in.h>
#include <arpa/inet.h>
#include <asterisk/lock.h>
#include <asterisk/utils.h>
AST_MUTEX_DEFINE_STATIC(__mutex);
+/* Recursive replacement for gethostbyname for BSD-based systems */
static int gethostbyname_r (const char *name, struct hostent *ret, char *buf,
size_t buflen, struct hostent **result,
int *h_errnop)
#endif
+/* Recursive thread safe version of gethostbyname that replaces the
+ standard gethostbyname (which is not recursive)
+*/
struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp)
{
int res;
#endif
}
+/* Recursive thread safe replacement of inet_ntoa */
const char *ast_inet_ntoa(char *buf, int bufsiz, struct in_addr ia)
{
return inet_ntop(AF_INET, &ia, buf, bufsiz);