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 <oz@nixil.net>
This commit is contained in:
parent
37d3425f25
commit
b36a9e43ed
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=156112
7 changed files with 105 additions and 0 deletions
|
@ -460,6 +460,7 @@
|
|||
SUBDIR += libdaemon
|
||||
SUBDIR += libdict
|
||||
SUBDIR += libdlmalloc
|
||||
SUBDIR += libdnsres
|
||||
SUBDIR += libds
|
||||
SUBDIR += libdsp
|
||||
SUBDIR += libdwarf
|
||||
|
|
38
devel/libdnsres/Makefile
Normal file
38
devel/libdnsres/Makefile
Normal file
|
@ -0,0 +1,38 @@
|
|||
# New ports collection makefile for: libdnsres
|
||||
# Date created: Fri Feb 3 18:15:51 MST 2006
|
||||
# Whom: Phil Oleson <oz@nixil.net>
|
||||
#
|
||||
# $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 <bsd.port.pre.mk>
|
||||
|
||||
.if ${OSVERSION} >= 700014
|
||||
BROKEN= Does not compile on FreeBSD >= 7.0
|
||||
.endif
|
||||
|
||||
post-patch:
|
||||
@${REINPLACE_CMD} -e 's,CFLAGS =,CFLAGS +=,' ${WRKSRC}/Makefile.in
|
||||
|
||||
.include <bsd.port.post.mk>
|
3
devel/libdnsres/distinfo
Normal file
3
devel/libdnsres/distinfo
Normal file
|
@ -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
|
38
devel/libdnsres/files/patch-dnsres.3
Normal file
38
devel/libdnsres/files/patch-dnsres.3
Normal file
|
@ -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 <sys/types.h>
|
||||
+.Fd #include <sys/socket.h>
|
||||
+.Fd #include <netdb.h>
|
||||
.Fd #include <dnsres.h>
|
||||
.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
|
11
devel/libdnsres/files/patch-test-simple_test.c
Normal file
11
devel/libdnsres/files/patch-test-simple_test.c
Normal file
|
@ -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 <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
-
|
||||
+#include <sys/time.h>
|
||||
#include <event.h>
|
||||
|
||||
#include "dnsres.h"
|
10
devel/libdnsres/pkg-descr
Normal file
10
devel/libdnsres/pkg-descr
Normal file
|
@ -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/
|
4
devel/libdnsres/pkg-plist
Normal file
4
devel/libdnsres/pkg-plist
Normal file
|
@ -0,0 +1,4 @@
|
|||
include/dnsres.h
|
||||
lib/libdnsres.a
|
||||
lib/libdnsres.so
|
||||
lib/libdnsres.so.0
|
Loading…
Reference in a new issue