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

1.1       misho       1: /*
                      2:  * Copyright (C) 2009 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_handler attribute_handler
                     18:  * @{ @ingroup attributes
                     19:  */
                     20: 
                     21: #ifndef ATTRIBUTE_HANDLER_H_
                     22: #define ATTRIBUTE_HANDLER_H_
                     23: 
                     24: typedef struct attribute_handler_t attribute_handler_t;
                     25: 
                     26: #include <sa/ike_sa.h>
                     27: #include <utils/chunk.h>
                     28: #include <collections/linked_list.h>
                     29: 
                     30: #include "attributes.h"
                     31: 
                     32: /**
                     33:  * Interface to handle configuration payload attributes.
                     34:  */
                     35: struct attribute_handler_t {
                     36: 
                     37:        /**
                     38:         * Handle a configuration attribute.
                     39:         *
                     40:         * After receiving a configuration attribute, it is passed to each
                     41:         * attribute handler until it is handled.
                     42:         *
                     43:         * @param ike_sa        IKE_SA under which attribute is received
                     44:         * @param type          type of configuration attribute to handle
                     45:         * @param data          associated attribute data
                     46:         * @return                      TRUE if attribute handled
                     47:         */
                     48:        bool (*handle)(attribute_handler_t *this, ike_sa_t *ike_sa,
                     49:                                   configuration_attribute_type_t type, chunk_t data);
                     50: 
                     51:        /**
                     52:         * Release an attribute handled during handle().
                     53:         *
                     54:         * A handler that handle()d an attribute gets a call to release() when the
                     55:         * connection gets closed. Depending on the implementation, this is required
                     56:         * to remove the attribute.
                     57:         *
                     58:         * @param ike_sa        IKE_SA which releases attribute
                     59:         * @param type          type of configuration attribute to release
                     60:         * @param data          associated attribute data
                     61:         */
                     62:        void (*release)(attribute_handler_t *this, ike_sa_t *ike_sa,
                     63:                                        configuration_attribute_type_t type, chunk_t data);
                     64: 
                     65:        /**
                     66:         * Enumerate attributes to request from a server.
                     67:         *
                     68:         * @param ike_sa                IKE_SA to request attributes for
                     69:         * @param vips                  list of virtual IPs (host_t*) we are requesting
                     70:         * @return                              enumerator (configuration_attribute_type_t, chunk_t)
                     71:         */
                     72:        enumerator_t* (*create_attribute_enumerator)(attribute_handler_t *this,
                     73:                                                                                ike_sa_t *ike_sa, linked_list_t *vips);
                     74: };
                     75: 
                     76: #endif /** ATTRIBUTE_HANDLER_H_ @}*/

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