Next: Manual configuration, Previous: Installing, Up: Top [Contents]
LibSecRm comes with a development package. You can use the following public functions and constants:
void libsecrm_enable(void)
- enables LibSecRm for the program
that calls this function
const char * libsecrm_version(void)
- returns the runtime version
of the library the program is using
LSR_VERSION
is the compile-time preprocessor string constant containing
the version of the library the program is compiled against
LSR_PROG_BANNING_ENV
is the name of the environment variable that can point
to an additional program banning file
LSR_FILE_BANNING_ENV
is the name of the environment variable that can point
to an additional file banning file
LSR_ITERATIONS_ENV
is the name of the environment variable which
tells how many iterations should LibSecRm perform
LSR_PROG_BANNING_USERFILE
is the name of the additional program banning file that
can be located in the users’ home directories.
LSR_FILE_BANNING_USERFILE
is the name of the additional file banning file that
can be located in the users’ home directories.
unsigned long int libsecrm_get_number_of_passes(void)
- returns the number
of passes configured
void libsecrm_fill_buffer(unsigned long int pat_no,
unsigned char * const buffer, const unsigned int buflen,
int * const selected)
- fills the given number of bytes in the given buffer
with pattern number pat_no, setting selected[pat_no] to 1
FILE* lsr_fopen64(const char * const name, const char * const mode)
- LibSecRm’s replacement for the fopen64 function
FILE* lsr_fopen(const char * const name, const char * const mode)
- LibSecRm’s replacement for the fopen function
FILE* lsr_freopen64(const char * const path,
const char * const mode, FILE* stream)
- LibSecRm’s replacement for the freopen64 function
FILE* lsr_freopen(const char * const path,
const char * const mode, FILE* stream)
- LibSecRm’s replacement for the freopen function
int lsr_open64(const char * const path, const int flags, mode_t mode)
,
int lsr_open64(const char * const path, const int flags, ...)
- LibSecRm’s replacement for the open64 function
int lsr_open(const char * const path, const int flags, mode_t mode)
,
int lsr_open(const char * const path, const int flags, ...)
- LibSecRm’s replacement for the open function
int lsr_openat64(const int dirfd, const char * const pathname,
const int flags, mode_t mode)
,
int lsr_openat64(const int dirfd, const char * const pathname,
const int flags, ...)
- LibSecRm’s replacement for the openat64 function
int lsr_openat(const int dirfd, const char * const pathname,
const int flags, mode_t mode)
,
int lsr_openat(const int dirfd, const char * const pathname,
const int flags, ...)
- LibSecRm’s replacement for the openat function
int lsr_truncate(const char * const path, const off_t length)
- LibSecRm’s replacement for the truncate function
int lsr_truncate64(const char * const path, const off64_t length)
- LibSecRm’s replacement for the truncate64 function
int lsr_ftruncate(int fd, const off_t length)
- LibSecRm’s replacement for the ftruncate function
int lsr_ftruncate64(int fd, const off64_t length)
- LibSecRm’s replacement for the ftruncate64 function
int lsr_unlink(const char * const name)
- LibSecRm’s replacement for the unlink function
int lsr_unlinkat(const int dirfd, const char * const name, const int flags)
- LibSecRm’s replacement for the unlinkat function
int lsr_remove(const char * const name)
- LibSecRm’s replacement for the remove function
int lsr_creat64(const char * const path, const mode_t mode)
- LibSecRm’s replacement for the creat64 function
int lsr_creat(const char * const path, const mode_t mode)
- LibSecRm’s replacement for the creat function
int lsr_posix_fallocate(int fd, off_t offset, off_t len)
- LibSecRm’s replacement for the posix_fallocate function
int lsr_posix_fallocate64(int fd, off64_t offset, off64_t len)
- LibSecRm’s replacement for the posix_fallocate64 function
int lsr_fallocate(int fd, int mode, off_t offset, off_t len)
- LibSecRm’s replacement for the fallocate function
void * lsr_malloc(size_t size)
- LibSecRm’s replacement for the malloc function
int lsr_posix_memalign(void **memptr, size_t alignment, size_t size)
- LibSecRm’s replacement for the posix_memalign function
void * lsr_valloc(size_t size)
- LibSecRm’s replacement for the valloc function
void * lsr_pvalloc(size_t size)
- LibSecRm’s replacement for the pvalloc function
void * lsr_memalign(size_t boundary, size_t size)
- LibSecRm’s replacement for the memalign function
void * lsr_aligned_alloc (size_t alignment, size_t size)
- LibSecRm’s replacement for the aligned_alloc function
int lsr_brk(void * end_data_segment)
- LibSecRm’s replacement for the brk function
void * lsr_sbrk(intptr_t increment)
- LibSecRm’s replacement for the sbrk function
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 <libsecrm.h>
and compile the program with the library, e.g.:
‘gcc -o your_prog your_prog.c -lsecrm -ldl’
If you want to use LibSecRm with some other programming language, you can generate bindings to LibSecRm 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/libsecrm.h’
e.g.
‘swig -php -o lsr_wrap_php.c /usr/include/libsecrm.h’
You can then compile the generated wrapper files:
‘gcc -fpic -c lsr_wrap_*.c’
and link them into one or separate shared libraries:
‘gcc -shared lsr_wrap_*.o -lsecrm -o lsr_wrapper.so’
After this, you can link your program with the wrapper library and LibSecRm:
‘gcc -o your_prog your_prog.c lsr_wrapper.so -lsecrm -ldl’
or use the library in other languages, as shown in the SWIG examples.
LibSecRm will not contain any 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]