use the regular libstrongswan library initialization
This commit is contained in:
@@ -34,7 +34,6 @@ kernel_noklips.c kernel_noklips.h \
|
|||||||
kernel_pfkey.c kernel_pfkey.h \
|
kernel_pfkey.c kernel_pfkey.h \
|
||||||
keys.c keys.h \
|
keys.c keys.h \
|
||||||
lex.c lex.h \
|
lex.c lex.h \
|
||||||
library.c library.h \
|
|
||||||
log.c log.h \
|
log.c log.h \
|
||||||
md2.c md2.h \
|
md2.c md2.h \
|
||||||
md5.c md5.h \
|
md5.c md5.h \
|
||||||
@@ -84,6 +83,7 @@ AM_CFLAGS = \
|
|||||||
-DIPSEC_CONFDIR=\"${confdir}\" \
|
-DIPSEC_CONFDIR=\"${confdir}\" \
|
||||||
-DIPSEC_PIDDIR=\"${piddir}\" \
|
-DIPSEC_PIDDIR=\"${piddir}\" \
|
||||||
-DSHARED_SECRETS_FILE=\"${confdir}/ipsec.secrets\" \
|
-DSHARED_SECRETS_FILE=\"${confdir}/ipsec.secrets\" \
|
||||||
|
-DIPSEC_PLUGINDIR=\"${plugindir}\" \
|
||||||
-DSTRONGSWAN_CONF=\"${strongswan_conf}\" \
|
-DSTRONGSWAN_CONF=\"${strongswan_conf}\" \
|
||||||
-DKERNEL26_SUPPORT -DKERNEL26_HAS_KAME_DUPLICATES \
|
-DKERNEL26_SUPPORT -DKERNEL26_HAS_KAME_DUPLICATES \
|
||||||
-DPLUTO -DKLIPS -DDEBUG \
|
-DPLUTO -DKLIPS -DDEBUG \
|
||||||
|
|||||||
@@ -1,109 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2009 Tobias Brunner
|
|
||||||
* Copyright (C) 2008 Martin Willi
|
|
||||||
* Hochschule fuer Technik Rapperswil
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* $Id: library.c 4936 2009-03-12 18:07:32Z tobias $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "library.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <utils.h>
|
|
||||||
#include <chunk.h>
|
|
||||||
#ifdef LEAK_DETECTIVE
|
|
||||||
#include <utils/leak_detective.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct private_library_t private_library_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* private data of library
|
|
||||||
*/
|
|
||||||
struct private_library_t {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* public functions
|
|
||||||
*/
|
|
||||||
library_t public;
|
|
||||||
|
|
||||||
#ifdef LEAK_DETECTIVE
|
|
||||||
/**
|
|
||||||
* Memory leak detective, if enabled
|
|
||||||
*/
|
|
||||||
leak_detective_t *detective;
|
|
||||||
#endif /* LEAK_DETECTIVE */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* library instance
|
|
||||||
*/
|
|
||||||
library_t *lib;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of library_t.destroy
|
|
||||||
*/
|
|
||||||
void library_deinit()
|
|
||||||
{
|
|
||||||
private_library_t *this = (private_library_t*)lib;
|
|
||||||
|
|
||||||
this->public.settings->destroy(this->public.settings);
|
|
||||||
this->public.printf_hook->destroy(this->public.printf_hook);
|
|
||||||
|
|
||||||
#ifdef LEAK_DETECTIVE
|
|
||||||
if (this->detective)
|
|
||||||
{
|
|
||||||
this->detective->destroy(this->detective);
|
|
||||||
}
|
|
||||||
#endif /* LEAK_DETECTIVE */
|
|
||||||
free(this);
|
|
||||||
lib = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* see header file
|
|
||||||
*/
|
|
||||||
void library_init(char *settings)
|
|
||||||
{
|
|
||||||
printf_hook_t *pfh;
|
|
||||||
private_library_t *this = malloc_thing(private_library_t);
|
|
||||||
lib = &this->public;
|
|
||||||
|
|
||||||
lib->leak_detective = FALSE;
|
|
||||||
|
|
||||||
#ifdef LEAK_DETECTIVE
|
|
||||||
this->detective = leak_detective_create();
|
|
||||||
#endif /* LEAK_DETECTIVE */
|
|
||||||
|
|
||||||
pfh = printf_hook_create();
|
|
||||||
this->public.printf_hook = pfh;
|
|
||||||
|
|
||||||
pfh->add_handler(pfh, 'b', mem_printf_hook,
|
|
||||||
PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_INT,
|
|
||||||
PRINTF_HOOK_ARGTYPE_END);
|
|
||||||
pfh->add_handler(pfh, 'B', chunk_printf_hook,
|
|
||||||
PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_END);
|
|
||||||
pfh->add_handler(pfh, 'N', enum_printf_hook,
|
|
||||||
PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_INT,
|
|
||||||
PRINTF_HOOK_ARGTYPE_END);
|
|
||||||
pfh->add_handler(pfh, 'T', time_printf_hook,
|
|
||||||
PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_INT,
|
|
||||||
PRINTF_HOOK_ARGTYPE_END);
|
|
||||||
pfh->add_handler(pfh, 'V', time_delta_printf_hook,
|
|
||||||
PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_POINTER,
|
|
||||||
PRINTF_HOOK_ARGTYPE_END);
|
|
||||||
|
|
||||||
this->public.settings = settings_create(settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2008 Martin Willi
|
|
||||||
* Hochschule fuer Technik Rapperswil
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* $Id: library.h 5003 2009-03-24 17:43:01Z martin $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef LIBRARY_H_
|
|
||||||
#define LIBRARY_H_
|
|
||||||
|
|
||||||
#include <utils.h>
|
|
||||||
#include <settings.h>
|
|
||||||
|
|
||||||
typedef struct library_t library_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Libstrongswan library context, contains library relevant globals.
|
|
||||||
*/
|
|
||||||
struct library_t {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Printf hook registering facility
|
|
||||||
*/
|
|
||||||
printf_hook_t *printf_hook;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* various settings loaded from settings file
|
|
||||||
*/
|
|
||||||
settings_t *settings;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* is leak detective running?
|
|
||||||
*/
|
|
||||||
bool leak_detective;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize library, creates "lib" instance.
|
|
||||||
*
|
|
||||||
* @param settings file to read settings from, may be NULL for none
|
|
||||||
*/
|
|
||||||
void library_init(char *settings);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deinitialize library, destroys "lib" instance.
|
|
||||||
*/
|
|
||||||
void library_deinit();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Library instance, set after between library_init() and library_deinit() calls.
|
|
||||||
*/
|
|
||||||
extern library_t *lib;
|
|
||||||
|
|
||||||
#endif /** LIBRARY_H_ @}*/
|
|
||||||
@@ -17,6 +17,7 @@ INCLUDES = \
|
|||||||
|
|
||||||
AM_CFLAGS = \
|
AM_CFLAGS = \
|
||||||
-DIPSEC_CONFDIR=\"${confdir}\" \
|
-DIPSEC_CONFDIR=\"${confdir}\" \
|
||||||
|
-DIPSEC_PLUGINDIR=\"${plugindir}\" \
|
||||||
-DSTRONGSWAN_CONF=\"${strongswan_conf}\" \
|
-DSTRONGSWAN_CONF=\"${strongswan_conf}\" \
|
||||||
-DDEBUG -DNO_PLUTO \
|
-DDEBUG -DNO_PLUTO \
|
||||||
-Wformat=0
|
-Wformat=0
|
||||||
@@ -26,7 +27,7 @@ LIBFREESWANBUILDDIR=$(top_builddir)/src/libfreeswan
|
|||||||
LIBCRYPTOBUILDDIR=$(top_builddir)/src/libcrypto
|
LIBCRYPTOBUILDDIR=$(top_builddir)/src/libcrypto
|
||||||
|
|
||||||
scepclient_LDADD = \
|
scepclient_LDADD = \
|
||||||
ca.o crl.o certs.o constants.o defs.o fetch.o id.o keys.o lex.o library.o \
|
ca.o crl.o certs.o constants.o defs.o fetch.o id.o keys.o lex.o \
|
||||||
md2.o md5.o mp_defs.o ocsp.o pem.o pgp.o pkcs1.o pkcs7.o rnd.o sha1.o \
|
md2.o md5.o mp_defs.o ocsp.o pem.o pgp.o pkcs1.o pkcs7.o rnd.o sha1.o \
|
||||||
smartcard.o x509.o \
|
smartcard.o x509.o \
|
||||||
$(LIBSTRONGSWANBUILDDIR)/libstrongswan.la \
|
$(LIBSTRONGSWANBUILDDIR)/libstrongswan.la \
|
||||||
@@ -83,9 +84,6 @@ keys.o : $(PLUTODIR)/keys.c $(PLUTODIR)/keys.h
|
|||||||
lex.o : $(PLUTODIR)/lex.c $(PLUTODIR)/lex.h
|
lex.o : $(PLUTODIR)/lex.c $(PLUTODIR)/lex.h
|
||||||
$(COMPILE) $(INCLUDES) -c -o $@ $<
|
$(COMPILE) $(INCLUDES) -c -o $@ $<
|
||||||
|
|
||||||
library.o : $(PLUTODIR)/library.c $(PLUTODIR)/library.h
|
|
||||||
$(COMPILE) $(INCLUDES) -c -o $@ $<
|
|
||||||
|
|
||||||
md2.o : $(PLUTODIR)/md2.c $(PLUTODIR)/md2.h
|
md2.o : $(PLUTODIR)/md2.c $(PLUTODIR)/md2.h
|
||||||
$(COMPILE) $(INCLUDES) -c -o $@ $<
|
$(COMPILE) $(INCLUDES) -c -o $@ $<
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user