ANNOUNCEMENT: NSD 1.2.0 released
erik at NLnetLabs.nl
Wed Jul 9 15:47:51 UTC 2003
Colm MacCarthaigh wrote:
> On Wed, Jul 09, 2003 at 05:16:58PM +0200, Erik Rozendaal wrote:
>>Actually, you just need to make sure you compile with -I<nsd-source-dir>
>>-DHAVE_CONFIG_H. Try to use the same CPPFLAGS and CFLAGS for your
>>plugin as you used to compile NSD. Or adapt the "example-plugin" rules
>>in Makefile.in for your own plugins.
>>Or maybe there should be a sample/reference Makefile for plugins...
> Might be an idea, I have autoconf templated and a Makefile.in
> for my acl plugin (their attached) but it's quite messy!
> I've compiled the example plugin using
> gcc -shared -I$nsdsource -DHAVE_CONFIG_H $nsdsource/dname.c \
> example-plugin.c -o example-plugin.so
> and it's working just fine for .nl, but if I create subdomains
> I'm in trouble. What would the equivelant for
> nsd->register_data(nsd, id, "\004\002nl", "hello, world!");
> be for example.com ? I've tried:
> without success.
The first byte contains the total length of the domain name in bytes
(not including the length byte itself). This is how NSD stores names
internally. You can try to use strdname from dname.[hc] and link this
into your plugin. Note that strdname stores the result in a static
buffer, so subsequent calls will overwrite this. But it is usually good
enough for registering data:
nsd->register_data(nsd, id, strdname("example.com", NULL), "data");
Otherwise it should be something like this:
\015\007example\003com (where 15 octal is 13 decimal, 1+7 for the
"example" length+label, 1+3 for the "com" length+label, and 1+0 for the
Hope this helps and works :)
More information about the nsd-users