diff options
author | Martin Willi <martin@revosec.ch> | 2012-09-11 11:33:42 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-09-11 16:18:28 +0200 |
commit | 1e04488f3230b42beab1453f12806b574a69ceb0 (patch) | |
tree | 07dc073342df8fcfad460c6bacae5ff710584e72 /src/libhydra/attributes/mem_pool.h | |
parent | 28a3d5bfbde466f71a3f8b692d58b775ff7290ce (diff) | |
download | strongswan-1e04488f3230b42beab1453f12806b574a69ceb0.tar.bz2 strongswan-1e04488f3230b42beab1453f12806b574a69ceb0.tar.xz |
Check for an existing lease in all stroke pools before creating a new one
Diffstat (limited to 'src/libhydra/attributes/mem_pool.h')
-rw-r--r-- | src/libhydra/attributes/mem_pool.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/libhydra/attributes/mem_pool.h b/src/libhydra/attributes/mem_pool.h index 7b7e58af7..fa4e6485c 100644 --- a/src/libhydra/attributes/mem_pool.h +++ b/src/libhydra/attributes/mem_pool.h @@ -22,11 +22,24 @@ #define MEM_POOL_H typedef struct mem_pool_t mem_pool_t; +typedef enum mem_pool_op_t mem_pool_op_t; #include <utils/host.h> #include <utils/identification.h> /** + * In-memory IP pool acquire operation. + */ +enum mem_pool_op_t { + /** Check for an exsiting lease */ + MEM_POOL_EXISTING, + /** Get a new lease */ + MEM_POOL_NEW, + /** Replace an existing offline lease of another ID */ + MEM_POOL_REASSIGN, +}; + +/** * An in-memory IP address pool. */ struct mem_pool_t { @@ -69,12 +82,18 @@ struct mem_pool_t { /** * Acquire an address for the given id from this pool. * + * This call is usually invoked several times: The first time to find an + * existing lease (MEM_POOL_EXISTING), if none found a second time to + * acquire a new lease (MEM_POOL_NEW), and if the pool is full once again + * to assign an existing offline lease (MEM_POOL_REASSIGN). + * * @param id the id to acquire an address for * @param requested acquire this address, if possible + * @param existing TRUE to look for an existing lease, FALSE for a new one * @return the acquired address */ host_t* (*acquire_address)(mem_pool_t *this, identification_t *id, - host_t *requested); + host_t *requested, mem_pool_op_t operation); /** * Release a previously acquired address. |