Annotation of embedaddon/strongswan/src/libcharon/attributes/attribute_provider.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2008 Martin Willi
                      3:  * HSR 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 <sa/ike_sa.h>
                     25: #include <networking/host.h>
                     26: #include <collections/linked_list.h>
                     27: 
                     28: typedef struct attribute_provider_t attribute_provider_t;
                     29: 
                     30: /**
                     31:  * Interface to provide attributes to peers through attribute manager.
                     32:  */
                     33: struct attribute_provider_t {
                     34: 
                     35:        /**
                     36:         * Acquire a virtual IP address to assign to a peer.
                     37:         *
                     38:         * @param pools                 list of pool names (char*) to acquire from
                     39:         * @param ike_sa                associated IKE_SA to assign address over
                     40:         * @param requested             IP in configuration request
                     41:         * @return                              allocated address, NULL to serve none
                     42:         */
                     43:        host_t* (*acquire_address)(attribute_provider_t *this,
                     44:                                                           linked_list_t *pools, ike_sa_t *ike_sa,
                     45:                                                           host_t *requested);
                     46:        /**
                     47:         * Release a previously acquired address.
                     48:         *
                     49:         * @param pools                 list of pool names (char*) to release to
                     50:         * @param address               address to release
                     51:         * @param ike_sa                IKE_SA to release address for
                     52:         * @return                              TRUE if the address has been released by the provider
                     53:         */
                     54:        bool (*release_address)(attribute_provider_t *this,
                     55:                                                        linked_list_t *pools, host_t *address,
                     56:                                                        ike_sa_t *ike_sa);
                     57: 
                     58:        /**
                     59:         * Create an enumerator over attributes to hand out to a peer.
                     60:         *
                     61:         * @param pool                  list of pools names (char*) to query attributes from
                     62:         * @param ike_sa                IKE_SA to request attributes for
                     63:         * @param vip                   list of virtual IPs (host_t*) to assign to peer
                     64:         * @return                              enumerator (configuration_attribute_type_t, chunk_t)
                     65:         */
                     66:        enumerator_t* (*create_attribute_enumerator)(attribute_provider_t *this,
                     67:                                                                        linked_list_t *pools, ike_sa_t *ike_sa,
                     68:                                                                        linked_list_t *vips);
                     69: };
                     70: 
                     71: #endif /** ATTRIBUTE_PROVIDER_H_ @}*/

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>