root / src / libstrongswan / attributes / attribute_provider.h @ b5a2055fb1b88ea4abb97334d89e311c9ceaa7d4
History | View | Annotate | Download (2.1 KB)
| 1 | /*
|
|---|---|
| 2 | * Copyright (C) 2008 Martin Willi |
| 3 | * Hochschule fuer Technik Rapperswil |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License as published by the |
| 7 | * Free Software Foundation; either version 2 of the License, or (at your |
| 8 | * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 13 | * for more details. |
| 14 | */ |
| 15 | |
| 16 | /**
|
| 17 | * @defgroup attribute_provider attribute_provider |
| 18 | * @{ @ingroup attributes
|
| 19 | */ |
| 20 | |
| 21 | #ifndef ATTRIBUTE_PROVIDER_H_
|
| 22 | #define ATTRIBUTE_PROVIDER_H_
|
| 23 | |
| 24 | #include <utils/host.h> |
| 25 | #include <utils/identification.h> |
| 26 | |
| 27 | typedef struct attribute_provider_t attribute_provider_t; |
| 28 | |
| 29 | /**
|
| 30 | * Interface to provide attributes to peers through attribute manager. |
| 31 | */ |
| 32 | struct attribute_provider_t {
|
| 33 | |
| 34 | /**
|
| 35 | * Acquire a virtual IP address to assign to a peer. |
| 36 | * |
| 37 | * @param pool name of the pool to acquire address from |
| 38 | * @param id peer ID |
| 39 | * @param requested IP in configuration request |
| 40 | * @return allocated address, NULL to serve none |
| 41 | */ |
| 42 | host_t* (*acquire_address)(attribute_provider_t *this, |
| 43 | char *pool, identification_t *id,
|
| 44 | host_t *requested); |
| 45 | /**
|
| 46 | * Release a previously acquired address. |
| 47 | * |
| 48 | * @param pool name of the pool this address was acquired from |
| 49 | * @param address address to release |
| 50 | * @param id peer ID |
| 51 | * @return TRUE if the address has been released by the provider |
| 52 | */ |
| 53 | bool (*release_address)(attribute_provider_t *this,
|
| 54 | char *pool, host_t *address, identification_t *id);
|
| 55 | |
| 56 | /**
|
| 57 | * Create an enumerator over attributes to hand out to a peer. |
| 58 | * |
| 59 | * @param id peer ID |
| 60 | * @param vip virtual IP to assign to peer, if any |
| 61 | * @return enumerator (configuration_attribute_type_t, chunk_t) |
| 62 | */ |
| 63 | enumerator_t* (*create_attribute_enumerator)(attribute_provider_t *this, |
| 64 | identification_t *id, host_t *vip); |
| 65 | }; |
| 66 | |
| 67 | #endif /** ATTRIBUTE_PROVIDER_H_ @}*/ |