CVS commit: src/lib/libevent
Module Name:src Committed By: tls Date: Wed Aug 19 15:18:05 UTC 2009 Modified Files: src/lib/libevent: Makefile event.h Log Message: Oops. As Matthias pointed out, I swapped '-' for '_' in the previous commit. Fix that. Also, some applications written for newer libevent want event.h to pull in event_config.h by magic. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/libevent/Makefile cvs rdiff -u -r1.6 -r1.7 src/lib/libevent/event.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libevent/Makefile diff -u src/lib/libevent/Makefile:1.7 src/lib/libevent/Makefile:1.8 --- src/lib/libevent/Makefile:1.7 Wed Aug 19 01:38:39 2009 +++ src/lib/libevent/Makefile Wed Aug 19 15:18:05 2009 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.7 2009/08/19 01:38:39 tls Exp $ +# $NetBSD: Makefile,v 1.8 2009/08/19 15:18:05 tls Exp $ # @(#)Makefile 8.1 (Berkeley) 6/4/93 NOLINT= # Until someone explains to me how to avoid lint stupidity @@ -11,7 +11,7 @@ SRCS= buffer.c evbuffer.c evdns.c event.c event_tagging.c evrpc.c evutil.c \ http.c kqueue.c log.c poll.c signal.c -INCS= evdns.h event.h evhttp.h evrpc.h evutil.h event_config.h +INCS= evdns.h event.h evhttp.h evrpc.h evutil.h event-config.h INCSDIR=/usr/include MAN= evdns.3 event.3 @@ -89,7 +89,7 @@ MLINKS+=evdns.3 evdns_search_ndots_set.3 MLINKS+=evdns.3 evdns_set_log_fn.3 -event_config.h: config.h +event-config.h: config.h sed -e 's/#define /#define _EVENT_/' ${.ALLSRC} > ${.OBJDIR}/${.TARGET} .include Index: src/lib/libevent/event.h diff -u src/lib/libevent/event.h:1.6 src/lib/libevent/event.h:1.7 --- src/lib/libevent/event.h:1.6 Wed Jul 8 21:23:53 2009 +++ src/lib/libevent/event.h Wed Aug 19 15:18:05 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: event.h,v 1.6 2009/07/08 21:23:53 tls Exp $ */ +/* $NetBSD: event.h,v 1.7 2009/08/19 15:18:05 tls Exp $ */ /* $OpenBSD: event.h,v 1.4 2002/07/12 18:50:48 provos Exp $ */ /* @@ -165,6 +165,7 @@ extern "C" { #endif +#include #include #include #include
CVS commit: src/lib/libevent
Module Name:src Committed By: tls Date: Wed Aug 19 01:38:39 UTC 2009 Modified Files: src/lib/libevent: Makefile Log Message: Matthias Drochner pointed out that I lost the _EVENT_ prefix from all the autoconf defines in the installed event_config.h. Of course, the libevent documentation basically says not to use event_config.h, so it is a little hard to see why the right fix isn't to just not install it... ...in any event, fix this approximately as the stock libevent Makefile does. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/lib/libevent/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libevent/Makefile diff -u src/lib/libevent/Makefile:1.6 src/lib/libevent/Makefile:1.7 --- src/lib/libevent/Makefile:1.6 Sun Jul 26 21:33:46 2009 +++ src/lib/libevent/Makefile Wed Aug 19 01:38:39 2009 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.6 2009/07/26 21:33:46 tls Exp $ +# $NetBSD: Makefile,v 1.7 2009/08/19 01:38:39 tls Exp $ # @(#)Makefile 8.1 (Berkeley) 6/4/93 NOLINT= # Until someone explains to me how to avoid lint stupidity @@ -11,12 +11,9 @@ SRCS= buffer.c evbuffer.c evdns.c event.c event_tagging.c evrpc.c evutil.c \ http.c kqueue.c log.c poll.c signal.c -INCS= evdns.h event.h evhttp.h evrpc.h evutil.h +INCS= evdns.h event.h evhttp.h evrpc.h evutil.h event_config.h INCSDIR=/usr/include -INCS+= config.h -INCSNAME_config.h= event-config.h - MAN= evdns.3 event.3 MLINKS+=event.3 event_init.3 @@ -92,4 +89,7 @@ MLINKS+=evdns.3 evdns_search_ndots_set.3 MLINKS+=evdns.3 evdns_set_log_fn.3 +event_config.h: config.h + sed -e 's/#define /#define _EVENT_/' ${.ALLSRC} > ${.OBJDIR}/${.TARGET} + .include
CVS commit: src/lib/libevent
Module Name:src Committed By: tls Date: Sun Jul 26 21:33:46 UTC 2009 Modified Files: src/lib/libevent: Makefile Log Message: According to the libevent 1.4.12 change announcement, problems have been observed with GCC 4 and strict-aliasing in the libevent code. Add -fno-strict-aliasing to work around this (same thing libevent did upstream). To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libevent/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libevent/Makefile diff -u src/lib/libevent/Makefile:1.5 src/lib/libevent/Makefile:1.6 --- src/lib/libevent/Makefile:1.5 Wed Jul 8 21:23:53 2009 +++ src/lib/libevent/Makefile Sun Jul 26 21:33:46 2009 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.5 2009/07/08 21:23:53 tls Exp $ +# $NetBSD: Makefile,v 1.6 2009/07/26 21:33:46 tls Exp $ # @(#)Makefile 8.1 (Berkeley) 6/4/93 NOLINT= # Until someone explains to me how to avoid lint stupidity USE_SHLIBDIR= yes -CPPFLAGS+=-I${.CURDIR} +CPPFLAGS+=-I${.CURDIR} -fno-strict-aliasing .include LIB= event
CVS commit: src/lib/libevent
Module Name:src Committed By: tron Date: Mon Jun 22 08:31:13 UTC 2009 Modified Files: src/lib/libevent: evdns.3 Log Message: Fix typo. Patch supplied by Marc Balmer in private e-mail. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libevent/evdns.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libevent/evdns.3 diff -u src/lib/libevent/evdns.3:1.5 src/lib/libevent/evdns.3:1.6 --- src/lib/libevent/evdns.3:1.5 Tue Apr 28 07:51:59 2009 +++ src/lib/libevent/evdns.3 Mon Jun 22 08:31:13 2009 @@ -1,4 +1,4 @@ -.\" $NetBSD: evdns.3,v 1.5 2009/04/28 07:51:59 wiz Exp $ +.\" $NetBSD: evdns.3,v 1.6 2009/06/22 08:31:13 tron Exp $ .\" .\" Copyright (c) 2006 Niels Provos .\" All rights reserved. @@ -349,7 +349,7 @@ API was developed by Adam Langley on top of the .Nm libevent API. -The code was integrate into +The code was integrated into .Nm Tor by Nick Mathewson and finally put into .Nm libevent
CVS commit: src/lib/libevent
Module Name:src Committed By: wiz Date: Tue Apr 28 07:52:00 UTC 2009 Modified Files: src/lib/libevent: evdns.3 Log Message: Use Xr for strtok_r reference. Remove trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/libevent/evdns.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libevent/evdns.3 diff -u src/lib/libevent/evdns.3:1.4 src/lib/libevent/evdns.3:1.5 --- src/lib/libevent/evdns.3:1.4 Tue Apr 28 03:11:45 2009 +++ src/lib/libevent/evdns.3 Tue Apr 28 07:51:59 2009 @@ -1,4 +1,4 @@ -.\" $NetBSD: evdns.3,v 1.4 2009/04/28 03:11:45 reed Exp $ +.\" $NetBSD: evdns.3,v 1.5 2009/04/28 07:51:59 wiz Exp $ .\" .\" Copyright (c) 2006 Niels Provos .\" All rights reserved. @@ -102,7 +102,7 @@ code. You statically link with it. You should also test for the existence of -.Dv strtok_r +.Xr strtok_r 3 and define .Dv HAVE_STRTOK_R if you have it. @@ -146,7 +146,7 @@ .Pp When the lookup is complete the callback function is called. The first argument will be one of the DNS_ERR_* defines in evdns.h. -Hopefully it will be +Hopefully it will be .Dv DNS_ERR_NONE , in which case type will be .Dv DNS_IPv4_A ,
CVS commit: src/lib/libevent
Module Name:src Committed By: reed Date: Tue Apr 28 03:11:45 UTC 2009 Modified Files: src/lib/libevent: evdns.3 Log Message: Add some mdoc macros and spell out an abbreviation. (I shared some of my fixes upstream a few days ago.) To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libevent/evdns.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libevent/evdns.3 diff -u src/lib/libevent/evdns.3:1.3 src/lib/libevent/evdns.3:1.4 --- src/lib/libevent/evdns.3:1.3 Sat Apr 11 16:55:04 2009 +++ src/lib/libevent/evdns.3 Tue Apr 28 03:11:45 2009 @@ -1,4 +1,4 @@ -.\" $NetBSD: evdns.3,v 1.3 2009/04/11 16:55:04 wiz Exp $ +.\" $NetBSD: evdns.3,v 1.4 2009/04/28 03:11:45 reed Exp $ .\" .\" Copyright (c) 2006 Niels Provos .\" All rights reserved. @@ -91,7 +91,9 @@ (see http://www.imperialviolet.org/page25.html#e498). Otherwise, please continue. .Pp -This code is based on libevent and you must call event_init before +This code is based on libevent and you must call +.Fn event_init +before any of the APIs in this file. You must also seed the OpenSSL random source if you are using OpenSSL for ids (see below). @@ -99,8 +101,11 @@ This library is designed to be included and shipped with your source code. You statically link with it. -You should also test for the existence of strtok_r and define -HAVE_STRTOK_R if you have it. +You should also test for the existence of +.Dv strtok_r +and define +.Dv HAVE_STRTOK_R +if you have it. .Pp The DNS protocol requires a good source of id numbers and these numbers should be unpredictable for spoofing reasons. @@ -109,16 +114,17 @@ In increasing order of preference: .Pp .Bl -tag -width "DNS_USE_GETTIMEOFDAY_FOR_ID" -compact -offset indent -.It DNS_USE_GETTIMEOFDAY_FOR_ID +.It Dv DNS_USE_GETTIMEOFDAY_FOR_ID Using the bottom 16 bits of the usec result from gettimeofday. This is a pretty poor solution but should work anywhere. -.It DNS_USE_CPU_CLOCK_FOR_ID +.It Dv DNS_USE_CPU_CLOCK_FOR_ID Using the bottom 16 bits of the nsec result from the CPU's time counter. This is better, but may not work everywhere. Requires POSIX realtime support and you'll need to link against --lrt on glibc systems at least. -.It DNS_USE_OPENSSL_FOR_ID +.Lb librt +on glibc systems at least. +.It Dv DNS_USE_OPENSSL_FOR_ID Uses the OpenSSL RAND_bytes call to generate the data. You must have seeded the pool before making any calls to this library. @@ -140,11 +146,14 @@ .Pp When the lookup is complete the callback function is called. The first argument will be one of the DNS_ERR_* defines in evdns.h. -Hopefully it will be DNS_ERR_NONE, in which case type will be -DNS_IPv4_A, count will be the number of IP addresses, ttl is the time +Hopefully it will be +.Dv DNS_ERR_NONE , +in which case type will be +.Dv DNS_IPv4_A , +count will be the number of IP addresses, ttl is the time which the data can be cached for (in seconds), addresses will point to an array of uint32_t's and arg will be whatever you passed to -evdns_resolve. +.Fn evdns_resolve . .Pp Searching: .Pp @@ -157,7 +166,7 @@ .Pp Searching appears to be a single lookup from the point of view of the API, although many DNS queries may be generated from a single call to -evdns_resolve. +.Fn evdns_resolve . Searching can also drastically slow down the resolution of names. .Pp To disable searching: @@ -174,27 +183,34 @@ If you do call .Fn evdns_resolv_conf_parse then don't pass -.Va DNS_OPTION_SEARCH +.Dv DNS_OPTION_SEARCH (or -.Va DNS_OPTIONS_ALL , +.Dv DNS_OPTIONS_ALL , which implies it). .It When calling .Fn evdns_resolve , pass the -.Va DNS_QUERY_NO_SEARCH +.Dv DNS_QUERY_NO_SEARCH flag. .El .Pp The order of searches depends on the number of dots in the name. -If the number is greater than the ndots setting then the names is -first tried globally. +If the number is greater than the +.Sy ndots +setting then the names is first tried globally. Otherwise each search domain is appended in turn. .Pp -The ndots setting can either be set from a resolv.conf, or by calling -evdns_search_ndots_set. -.Pp -For example, with ndots set to 1 (the default) and a search domain list of +The +.Sy ndots +setting can either be set from a +.Pa resolv.conf , +or by calling +.Fn evdns_search_ndots_set . +.Pp +For example, with +.Sy ndots +set to 1 (the default) and a search domain list of ["myhome.net"]: Query: www Order: www.myhome.net, www. @@ -208,7 +224,9 @@ .Fn evdns_resolv_conf_parse . .It Ft int Fn evdns_nameserver_add "unsigned long int address" Add a nameserver. -The address should be an IP address in network byte order. +The +.Ar address +should be an IP address in network byte order. The type of address is chosen so that it matches in_addr.s_addr. Returns non-zero on error. .It Ft int Fn evdns_nameserver_ip_add "const char *ip_as_string" @@ -217,14 +235,22 @@ Returns non-zero
CVS commit: src/lib/libevent
Module Name:src Committed By: wiz Date: Sat Apr 11 16:55:04 UTC 2009 Modified Files: src/lib/libevent: evdns.3 Log Message: New sentence, new line. This page could use more markup. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libevent/evdns.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libevent/evdns.3 diff -u src/lib/libevent/evdns.3:1.2 src/lib/libevent/evdns.3:1.3 --- src/lib/libevent/evdns.3:1.2 Sat Apr 11 15:29:50 2009 +++ src/lib/libevent/evdns.3 Sat Apr 11 16:55:04 2009 @@ -1,4 +1,4 @@ -.\" $NetBSD: evdns.3,v 1.2 2009/04/11 15:29:50 joerg Exp $ +.\" $NetBSD: evdns.3,v 1.3 2009/04/11 16:55:04 wiz Exp $ .\" .\" Copyright (c) 2006 Niels Provos .\" All rights reserved. @@ -85,40 +85,48 @@ .Pp Async DNS lookups are really a whole lot harder than they should be, mostly stemming from the fact that the libc resolver has never been -very good at them. Before you use this library you should see if libc +very good at them. +Before you use this library you should see if libc can do the job for you with the modern async call getaddrinfo_a -(see http://www.imperialviolet.org/page25.html#e498). Otherwise, -please continue. +(see http://www.imperialviolet.org/page25.html#e498). +Otherwise, please continue. .Pp This code is based on libevent and you must call event_init before -any of the APIs in this file. You must also seed the OpenSSL random +any of the APIs in this file. +You must also seed the OpenSSL random source if you are using OpenSSL for ids (see below). .Pp This library is designed to be included and shipped with your source -code. You statically link with it. You should also test for the -existence of strtok_r and define HAVE_STRTOK_R if you have it. +code. +You statically link with it. +You should also test for the existence of strtok_r and define +HAVE_STRTOK_R if you have it. .Pp The DNS protocol requires a good source of id numbers and these -numbers should be unpredictable for spoofing reasons. There are -three methods for generating them here and you must define exactly -one of them. In increasing order of preference: +numbers should be unpredictable for spoofing reasons. +There are three methods for generating them here and you must define +exactly one of them. +In increasing order of preference: .Pp .Bl -tag -width "DNS_USE_GETTIMEOFDAY_FOR_ID" -compact -offset indent .It DNS_USE_GETTIMEOFDAY_FOR_ID -Using the bottom 16 bits of the usec result from gettimeofday. This -is a pretty poor solution but should work anywhere. +Using the bottom 16 bits of the usec result from gettimeofday. +This is a pretty poor solution but should work anywhere. .It DNS_USE_CPU_CLOCK_FOR_ID Using the bottom 16 bits of the nsec result from the CPU's time -counter. This is better, but may not work everywhere. Requires -POSIX realtime support and you'll need to link against -lrt on -glibc systems at least. +counter. +This is better, but may not work everywhere. +Requires POSIX realtime support and you'll need to link against +-lrt on glibc systems at least. .It DNS_USE_OPENSSL_FOR_ID -Uses the OpenSSL RAND_bytes call to generate the data. You must -have seeded the pool before making any calls to this library. +Uses the OpenSSL RAND_bytes call to generate the data. +You must have seeded the pool before making any calls to this +library. .El .Pp The library keeps track of the state of nameservers and will avoid -them when they go down. Otherwise it will round robin between them. +them when they go down. +Otherwise it will round robin between them. .Pp Quick start guide: .Bd -literal @@ -130,8 +138,8 @@ evdns_resolve("www.hostname.com", 0, callback, NULL); .Ed .Pp -When the lookup is complete the callback function is called. The -first argument will be one of the DNS_ERR_* defines in evdns.h. +When the lookup is complete the callback function is called. +The first argument will be one of the DNS_ERR_* defines in evdns.h. Hopefully it will be DNS_ERR_NONE, in which case type will be DNS_IPv4_A, count will be the number of IP addresses, ttl is the time which the data can be cached for (in seconds), addresses will point @@ -141,19 +149,22 @@ Searching: .Pp In order for this library to be a good replacement for glibc's resolver it -supports searching. This involves setting a list of default domains, in -which names will be queried for. The number of dots in the query name -determines the order in which this list is used. +supports searching. +This involves setting a list of default domains, in which names +will be queried for. +The number of dots in the query name determines the order in which +this list is used. .Pp Searching appears to be a single lookup from the point of view of the API, although many DNS queries may be generated from a single call to -evdns_resolve. Searching can also drastically slow down the resolution -of names. +evd
CVS commit: src/lib/libevent
Module Name:src Committed By: joerg Date: Sat Apr 11 15:29:51 UTC 2009 Modified Files: src/lib/libevent: evdns.3 Log Message: Improve markup. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libevent/evdns.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libevent/evdns.3 diff -u src/lib/libevent/evdns.3:1.1 src/lib/libevent/evdns.3:1.2 --- src/lib/libevent/evdns.3:1.1 Fri May 16 20:24:57 2008 +++ src/lib/libevent/evdns.3 Sat Apr 11 15:29:50 2009 @@ -1,4 +1,4 @@ -.\" $NetBSD: evdns.3,v 1.1 2008/05/16 20:24:57 peter Exp $ +.\" $NetBSD: evdns.3,v 1.2 2009/04/11 15:29:50 joerg Exp $ .\" .\" Copyright (c) 2006 Niels Provos .\" All rights reserved. @@ -121,11 +121,14 @@ them when they go down. Otherwise it will round robin between them. .Pp Quick start guide: - #include "evdns.h" - void callback(int result, char type, int count, int ttl, - void *addresses, void *arg); - evdns_resolv_conf_parse(DNS_OPTIONS_ALL, "/etc/resolv.conf"); - evdns_resolve("www.hostname.com", 0, callback, NULL); +.Bd -literal +#include \*[Lt]evdns.h\*[Gt] +void callback(int result, char type, int count, int ttl, + void *addresses, void *arg); + +evdns_resolv_conf_parse(DNS_OPTIONS_ALL, "/etc/resolv.conf"); +evdns_resolve("www.hostname.com", 0, callback, NULL); +.Ed .Pp When the lookup is complete the callback function is called. The first argument will be one of the DNS_ERR_* defines in evdns.h.