Friday, January 21, 2011

External DAQ module has been released

Have you ever wanted to maintain your own DAQ module outside of the official LibDAQ distribution? Concerned about the official release cycle in relation to your own development? Tired of keeping a source patch for the official distribution up-to-date?

The example-daq-module tarball demonstrates the suggested process for externalizing the DAQ module build process, providing a bare bones example DAQ module and the autotools to support it.

Here is a quick description of the autoconf macros provided in sf.m4:

AC_ENABLE_VISIBILITY() - Default to hidden symbol visibility if the compiler supports it.
AC_SF_COMPILER_SETUP() - Add all of the wonderful compiler and linker flags we'd like to have with GCC or ICC.
AC_CHECK_DAQ_API() - Check for the presence of the DAQ API headers and provide a configuration option to specify their location (--with-libdaq-includes).
AC_CHECK_SFBPF() - Check for the presence of the SFBPF headers and library and provide configuration options to specify their locations (--with-libsfbpf-includes and --with-libsfbpf-libraries respectively).

The basic steps involved in taking example-daq-module and making it your own 
1. Unpack example-daq-module-0.1.tar.gz
2. Rename daq_example.c to daq_<your module name>.c
3. Implement all of the function stubs in the C file (see the daq_api.h for descriptions)
4. Update and to reflect your name change (%s/example/<your module name>/g)
5. Add any additional autoconf-foo you want to (arguments, header checks, library checks, etc)
6. Regenerate the autoconf files with 'autoreconf -ivf'
7. Configure, make, and make install!

The only caveat with this process is that you CANNOT include your DAQ module with the static DAQ modules when building externally. This should not be an issue for the majority of users. Please check it out if you want to, if you have any questions please feel free to post them to the Snort-devel mailing list.