Next: Manual configuration, Previous: Installing, Up: Top [Contents]
LibHideIP comes with a development package. You can use the following public functions and constants:
void libhideip_enable(void)
- enables LibHideIP for the program
that calls this function
const char * libhideip_version(void)
- returns the runtime version
of the library the program is using
LHIP_VERSION
is the compile-time preprocessor string constant
containing the version of the library the program is compiled against
LHIP_BANNING_ENV
is the name of the environment variable that
can point to an additional banning file
LHIP_BANNING_USERFILE
is the name of the additional banning
file that can be located in the users’ home directories.
If you’re using C or C++ (or any language that can parse C header files), you can use the header file directly. Simply type:
#include <libhideip.h>
and compile the program with the library, e.g.:
‘gcc -o your_prog your_prog.c -lhideip -ldl’
If needed, LibHideIP should be first in link order.
If you want to use LibHideIP with some other programming language, you can generate bindings to LibHideIP for that language. You can use SWIG for this purpose. The header file is compatible with SWIG, so you can simply run:
‘swig -<your_lang> [<other options>] /path/to/libhideip.h’
e.g.
‘swig -php -o lhip_wrap_php.c /usr/include/libhideip.h’
You can then compile the generated wrapper files:
‘gcc -fpic -c lhip_wrap_*.c’
and link them into one or separate shared libraries:
‘gcc -shared lhip_wrap_*.o -lhideip -o lhip_wrapper.so’
After this, you can link your program with the wrapper library and LibHideIP:
‘gcc -o your_prog your_prog.c lhip_wrapper.so -lhideip -ldl’
or use the library in other languages, as shown in the SWIG examples.
LibHideIP will not contain the interfaces compiled-in, because there may be incompatibilities between languages or even between different versions of the same language, causing compile-time or other conflicts and unnecessary dependencies.
By using SWIG yourself, you can be sure that such problems will not occur.
Next: Manual configuration, Previous: Installing, Up: Top [Contents]