ike-sa-manager: Allow plugins to provide IKE SPIs via a callback

Plugins must depend on `libcharon-sa-managers` to ensure the manager
exists.
This commit is contained in:
Tobias Brunner
2015-11-11 15:39:45 +01:00
parent 301ccbe0a3
commit ee09094899
2 changed files with 54 additions and 11 deletions
+20 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2008 Tobias Brunner
* Copyright (C) 2008-2015 Tobias Brunner
* Copyright (C) 2005-2008 Martin Willi
* Copyright (C) 2005 Jan Hutter
* Hochschule fuer Technik Rapperswil
@@ -30,6 +30,16 @@ typedef struct ike_sa_manager_t ike_sa_manager_t;
#include <encoding/message.h>
#include <config/peer_cfg.h>
/**
* Callback called to generate an IKE SPI.
*
* This may be called from multiple threads concurrently.
*
* @param data data supplied during registration of the callback
* @return allocated SPI, 0 on failure
*/
typedef u_int64_t (*spi_cb_t)(void *data);
/**
* Manages and synchronizes access to all IKE_SAs.
*
@@ -226,6 +236,15 @@ struct ike_sa_manager_t {
u_int (*get_half_open_count)(ike_sa_manager_t *this, host_t *ip,
bool responder_only);
/**
* Set the callback to generate IKE SPIs
*
* @param callback callback to register
* @param data data provided to callback
*/
void (*set_spi_cb)(ike_sa_manager_t *this, spi_cb_t callback,
void *data);
/**
* Delete all existing IKE_SAs and destroy them immediately.
*