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:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user