Recent changes: implement socket_sendfile and socket_getifidx, work around broken BSD includes.

What is it?

This project aims to make the excellent libraries from Dan Bernstein available to a wider public by extracting them from his packages and providing a minimal Makefile for each library.

So far, I extracted the alloc, buffer, byte, dns, tai, timeoutconn and unix libraries (iopause and timeoutconn are not libraries in djb's software but I made them into libraries for easier use), but since they share some include files (I hardlinked them in the respective directories so you can still use each library completely on its own) and the whole package is below 40k when compressed with bzip2, I chose to distribute them in one package.

The package also comes with a few undocumented perl scripts that will hopefully evolve into a system that allows you to incorporate the libraries into your code easily. You can reach me as felix-djb@fefe.de.

Licensing terms?

The same as the rest of Bernstein's code. See http://cr.yp.to/softwarelaw.html.

Actually, Bernstein explicitly declared parts of his work to be public domain, for example the tai code that is included in libdjb (albeit not documented yet).

What do the libraries do?

Did you add anything?

Yes. See news.html for a list of recent changes.

  1. Every directory now also contains a "make clean" target.
  2. unix also contains IPv6 versions of djb's socket routines, env and iopause.
  3. dns also contains support for resolving IPv6 addresses.
  4. byte also contains implementations for scan_0x and fmt_xlong, and support for parsing and formatting IPv6 numbers.
  5. timeoutconn.o was taken from ucspi-tcp, I added a timeoutconn6.o for IPv6 and called the result timeoutconn.a.
  6. Converted K&R prototypes to ANSI
  7. Changed uint32 and uint64 checks to allow cross compiling
  8. added byte_dup and str_dup functions to create a malloced copy

The IPv6 socket routines in unix.a look and feel like the IPv4 routines except that the IPs are now 16 instead of 4 bytes long. The routines will compile and work even if you don't have IPv6 support in your system, so you can write IPv6 code that is 100% backwards compatible to IPv4 without making your code unreadable with tons of #ifdefs and conversion code all over the place. Or, even easier, use my IPv6 patches to ucspi-tcp and completely get rid of transport protocol dependencies in your code!

Where can I download it?

Just grab djb-0.5.2.tar.bz2.

See also

  1. a GPL reimplementation efford of libdjb.
  2. my diet libc.
  3. my IPv6 patches to djbdns
  4. my IPv6 patches to ucspi-tcp. These two spawned the project
  5. my ncp rewrite using libdjb. This is my first program using libdjb.
  6. superscript djblib appears to be a similar project (without IPv6 though)