2 * Copyright (C) 2012 Reto Buerki
3 * Copyright (C) 2012 Adrian-Ken Rueegsegger
4 * Hochschule fuer Technik Rapperswil
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 #include <tkm/client.h>
18 #include <tkm/constants.h>
22 #define IKE_SOCKET "/tmp/tkm.rpc.ike"
24 typedef struct private_tkm_t private_tkm_t
;
27 * Private additions to tkm_t.
29 struct private_tkm_t
{
32 * Public members of tkm_t.
38 * Single instance of tkm_t.
43 * Described in header.
49 active_requests_type max_requests
;
57 /* initialize TKM client library */
59 if (ike_init(IKE_SOCKET
) != TKM_OK
)
65 if (ike_tkm_reset() != TKM_OK
)
71 /* get limits from tkm */
72 if (ike_tkm_limits(&max_requests
, &nc
, &dh
, &cc
, &ae
, &isa
, &esa
) != TKM_OK
)
78 /* only nonce and DH context limits are currently needed */
79 const tkm_limits_t limits
= {nc
, dh
};
83 .idmgr
= tkm_id_manager_create(limits
),
84 .chunk_map
= tkm_chunk_map_create(),
93 * Described in header.
101 private_tkm_t
*this = (private_tkm_t
*)tkm
;
102 this->public.idmgr
->destroy(this->public.idmgr
);
103 this->public.chunk_map
->destroy(this->public.chunk_map
);