#include <utils/backtrace.h>
#include <threading/thread.h>
-#include <tkm/client.h>
+#include "tkm.h"
/**
* PID file, in which charon-tkm stores its process id
goto deinit;
}
- /* initialize TKM client lib */
- tkmlib_init();
+ /* initialize TKM client */
+ if (!tkm_init())
+ {
+ DBG1(DBG_DMN, "init of TKM client failed - aborting %s", dmn_name);
+ goto deinit;
+ }
/* add handler for SEGV and ILL,
* INT and TERM are handled by sigwait() in run() */
unlink_pidfile();
status = 0;
- tkmlib_final();
deinit:
libcharon_deinit();
libhydra_deinit();
library_deinit();
+ tkm_deinit();
return status;
}
* for more details.
*/
+#include <tkm/client.h>
+#include <tkm/constants.h>
+
#include "tkm.h"
+#define IKE_SOCKET "/tmp/tkm.rpc.ike"
+
typedef struct private_tkm_t private_tkm_t;
/**
{
private_tkm_t *this;
+ /* initialize TKM client library */
+ tkmlib_init();
+ if (ike_init(IKE_SOCKET) != TKM_OK)
+ {
+ tkmlib_final();
+ return FALSE;
+ }
+
+ if (ike_tkm_reset() != TKM_OK)
+ {
+ tkmlib_final();
+ return FALSE;
+ }
+
INIT(this,
.public = {
.idmgr = tkm_id_manager_create(),
}
private_tkm_t *this = (private_tkm_t*)tkm;
this->public.idmgr->destroy(this->public.idmgr);
+
+ tkmlib_final();
free(this);
tkm = NULL;
}
* for more details.
*/
-#include <stdlib.h>
-
+#include "tkm.h"
#include "test_runner.h"
int main(void)
{
+ if (!tkm_init())
+ {
+ fprintf(stderr, "Could not connect to TKM, aborting tests\n");
+ return EXIT_FAILURE;
+ }
+
int number_failed;
Suite *s = suite_create("TKM tests");
suite_add_tcase(s, make_id_manager_tests());
srunner_run_all(sr, CK_NORMAL);
number_failed = srunner_ntests_failed(sr);
+ tkm_deinit();
srunner_free(sr);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;