From b36a9e43ed06be6298ae5d7e3d1403010d4e7678 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Wed, 15 Feb 2006 11:07:43 +0000 Subject: Libdnsres provides a non-blocking thread-safe API for resolving DNS names. It requires that your main application is built on top of libevent. Libdnsres' API essentially mirrors the traditional gethostbyname and getaddrinfo interfaces. All return values have been replaced by callbacks instead. The code borrows heavily from the BSD resolver library. In fact, it is an extremely ugly hack to make the BSD resolver library non-blocking and thread-safe without changing the API too much. WWW: http://www.monkey.org/~provos/libdnsres/ PR: ports/93365 Submitted by: Phil Oleson --- devel/libdnsres/Makefile | 38 ++++++++++++++++++++++++++ devel/libdnsres/distinfo | 3 ++ devel/libdnsres/files/patch-dnsres.3 | 38 ++++++++++++++++++++++++++ devel/libdnsres/files/patch-test-simple_test.c | 11 ++++++++ devel/libdnsres/pkg-descr | 10 +++++++ devel/libdnsres/pkg-plist | 4 +++ 6 files changed, 104 insertions(+) create mode 100644 devel/libdnsres/Makefile create mode 100644 devel/libdnsres/distinfo create mode 100644 devel/libdnsres/files/patch-dnsres.3 create mode 100644 devel/libdnsres/files/patch-test-simple_test.c create mode 100644 devel/libdnsres/pkg-descr create mode 100644 devel/libdnsres/pkg-plist (limited to 'devel/libdnsres') diff --git a/devel/libdnsres/Makefile b/devel/libdnsres/Makefile new file mode 100644 index 000000000000..a3640974def5 --- /dev/null +++ b/devel/libdnsres/Makefile @@ -0,0 +1,38 @@ +# New ports collection makefile for: libdnsres +# Date created: Fri Feb 3 18:15:51 MST 2006 +# Whom: Phil Oleson +# +# $FreeBSD$ +# + +PORTNAME= libdnsres +PORTVERSION= 0.1a +CATEGORIES= devel +MASTER_SITES= http://monkey.org/~provos/ + +MAINTAINER= oz@nixil.net +COMMENT= Provides a non-blocking thread-safe API for resolving DNS names + +BUILD_DEPENDS= ${LOCALBASE}/lib/libevent.a:${PORTSDIR}/devel/libevent + +GNU_CONFIGURE= yes +USE_AUTOTOOLS= libtool:15 +INSTALLS_SHLIB= yes + +PLIST_SUB+= PORTVERSION="${PORTVERSION}" + +MAN3= dnsres.3 +MLINKS= dnsres.3 dnsres_init.3 dnsres.3 dnsres_gethostbyname.3 \ + dnsres.3 dnsres_gethostbyname2.3 dnsres.3 dnsres_gethostbyaddr.3 \ + dnsres.3 dnsres_getaddrinfo.3 + +.include + +.if ${OSVERSION} >= 700014 +BROKEN= Does not compile on FreeBSD >= 7.0 +.endif + +post-patch: + @${REINPLACE_CMD} -e 's,CFLAGS =,CFLAGS +=,' ${WRKSRC}/Makefile.in + +.include diff --git a/devel/libdnsres/distinfo b/devel/libdnsres/distinfo new file mode 100644 index 000000000000..fb48ed0dea77 --- /dev/null +++ b/devel/libdnsres/distinfo @@ -0,0 +1,3 @@ +MD5 (libdnsres-0.1a.tar.gz) = 069cc39d7ddf85c9be9ada679d5363c2 +SHA256 (libdnsres-0.1a.tar.gz) = c0b94f27cb537eed42bc32ca9771f0955f717c66d34d1361e0a75600c6589307 +SIZE (libdnsres-0.1a.tar.gz) = 360583 diff --git a/devel/libdnsres/files/patch-dnsres.3 b/devel/libdnsres/files/patch-dnsres.3 new file mode 100644 index 000000000000..aef449c6c67a --- /dev/null +++ b/devel/libdnsres/files/patch-dnsres.3 @@ -0,0 +1,38 @@ +--- dnsres.3.orig Tue Feb 14 15:17:58 2006 ++++ dnsres.3 Tue Feb 14 16:15:58 2006 +@@ -38,17 +38,20 @@ + .Nm dnsres_getaddrinfo + .Nd non blocking DNS resolving library + .Sh SYNOPSIS ++.Fd #include ++.Fd #include ++.Fd #include + .Fd #include + .Ft int + .Fn dnsres_init "struct dnsres *_resp" + .Ft void +-.Fn dnsres_gethostbyname "struct dnsres* res" "const char *name" "void (*cb)(struct hostent *hp, int error, void *arg" "void *arg" ++.Fn dnsres_gethostbyname "struct dnsres *res" "const char *name" "void (*cb)(struct hostent *hp, int error, void *arg)" "void *arg" + .Ft void +-.Fn dnsres_gethostbyname2 "const char *name" "int af" "void (*cb)(struct hostent *hp, int error, void *arg" "void *arg" ++.Fn dnsres_gethostbyname2 "struct dnsres *res" "const char *name" "int af" "void (*cb)(struct hostent *hp, int error, void *arg)" "void *arg" + .Ft void +-.Fn dnsres_gethostbyaddr "const char *addr" "int len" "int af" "void (*cb)(struct hostent *hp, int error, void *arg" "void *arg" ++.Fn dnsres_gethostbyaddr "struct dnsres *res" "const char *addr" "int len" "int af" "void (*cb)(struct hostent *hp, int error, void *arg)" "void *arg" + .Ft void +-.Fn dnsres_getaddrinfo "struct dnsres *" "const char *" "const char *" "const struct addrinfo *" "void (*)(struct addrinfo *, int, void *)" "void *"; ++.Fn dnsres_getaddrinfo "struct dnsres *res" "const char *hostname" "const char *servname" "const struct addrinfo *hints" "void (*cb)(struct addrinfo *ai, int res, void *arg)" "void *arg" + .Sh DESCRIPTION + The + .Fn dnsres_init +@@ -134,6 +137,10 @@ + The only address family currently supported is + .Dv AF_INET . + .Pp ++The ++.Fn dnsres_getaddrinfo ++function is used to get a list of IP addresses and port ++numbers for host hostname and service servname. + .Sh ENVIRONMENT + .Bl -tag -width HOSTALIASES + .It HOSTALIASES diff --git a/devel/libdnsres/files/patch-test-simple_test.c b/devel/libdnsres/files/patch-test-simple_test.c new file mode 100644 index 000000000000..096c370654f8 --- /dev/null +++ b/devel/libdnsres/files/patch-test-simple_test.c @@ -0,0 +1,11 @@ +--- test/simple_test.c.old Fri Feb 3 19:18:27 2006 ++++ test/simple_test.c Fri Feb 3 19:18:48 2006 +@@ -47,7 +47,7 @@ + #include + #include + #include +- ++#include + #include + + #include "dnsres.h" diff --git a/devel/libdnsres/pkg-descr b/devel/libdnsres/pkg-descr new file mode 100644 index 000000000000..266750b05051 --- /dev/null +++ b/devel/libdnsres/pkg-descr @@ -0,0 +1,10 @@ +Libdnsres provides a non-blocking thread-safe API for resolving DNS names. It +requires that your main application is built on top of libevent. Libdnsres' API +essentially mirrors the traditional gethostbyname and getaddrinfo interfaces. +All return values have been replaced by callbacks instead. + +The code borrows heavily from the BSD resolver library. In fact, it is an +extremely ugly hack to make the BSD resolver library non-blocking and +thread-safe without changing the API too much. + +WWW: http://www.monkey.org/~provos/libdnsres/ diff --git a/devel/libdnsres/pkg-plist b/devel/libdnsres/pkg-plist new file mode 100644 index 000000000000..cb91325bb378 --- /dev/null +++ b/devel/libdnsres/pkg-plist @@ -0,0 +1,4 @@ +include/dnsres.h +lib/libdnsres.a +lib/libdnsres.so +lib/libdnsres.so.0 -- cgit v1.2.3