Annotation of embedaddon/strongswan/src/libcharon/config/backend_manager.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2018 Tobias Brunner
                      3:  * Copyright (C) 2007 Martin Willi
                      4:  * HSR Hochschule fuer Technik Rapperswil
                      5:  *
                      6:  * This program is free software; you can redistribute it and/or modify it
                      7:  * under the terms of the GNU General Public License as published by the
                      8:  * Free Software Foundation; either version 2 of the License, or (at your
                      9:  * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
                     10:  *
                     11:  * This program is distributed in the hope that it will be useful, but
                     12:  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
                     13:  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
                     14:  * for more details.
                     15:  */
                     16: 
                     17: /**
                     18:  * @defgroup backend_manager backend_manager
                     19:  * @{ @ingroup config
                     20:  */
                     21: 
                     22: #ifndef BACKEND_MANAGER_H_
                     23: #define BACKEND_MANAGER_H_
                     24: 
                     25: typedef struct backend_manager_t backend_manager_t;
                     26: 
                     27: #include <library.h>
                     28: #include <networking/host.h>
                     29: #include <utils/identification.h>
                     30: #include <config/ike_cfg.h>
                     31: #include <config/peer_cfg.h>
                     32: #include <config/backend.h>
                     33: 
                     34: 
                     35: /**
                     36:  * A loader and multiplexer to use multiple backends.
                     37:  *
                     38:  * Charon allows the use of multiple configuration backends simultaneously. To
                     39:  * access all this backends by a single call, this class wraps multiple
                     40:  * backends behind a single object.
                     41:  * @verbatim
                     42: 
                     43:    +---------+      +-----------+         +--------------+     |
                     44:    |         |      |           |       +--------------+ |     |
                     45:    | daemon  |----->| backend_- |     +--------------+ |-+  <==|==> IPC
                     46:    |  core   |      | manager   |---->|   backends   |-+       |
                     47:    |         |----->|           |     +--------------+         |
                     48:    |         |      |           |                              |
                     49:    +---------+      +-----------+                              |
                     50: 
                     51:    @endverbatim
                     52:  */
                     53: struct backend_manager_t {
                     54: 
                     55:        /**
                     56:         * Get an ike_config identified by two hosts.
                     57:         *
                     58:         * @param my_host                       address of own host
                     59:         * @param other_host            address of remote host
                     60:         * @param version                       IKE version to get a config for
                     61:         * @return                                      matching ike_config, or NULL if none found
                     62:         */
                     63:        ike_cfg_t* (*get_ike_cfg)(backend_manager_t *this,
                     64:                                                          host_t *my_host, host_t *other_host,
                     65:                                                          ike_version_t version);
                     66: 
                     67:        /**
                     68:         * Create an enumerator over all matching IKE configs.
                     69:         *
                     70:         * Pass NULL as parameters to match any. The enumerator enumerates over
                     71:         * ike_cfgs, ordered by priority (best match first).
                     72:         *
                     73:         * @param me                            local address
                     74:         * @param other                         remote address
                     75:         * @param version                       IKE version to get a config for
                     76:         * @return                                      enumerator over ike_cfg
                     77:         */
                     78:        enumerator_t* (*create_ike_cfg_enumerator)(backend_manager_t *this,
                     79:                                                        host_t *me, host_t *other, ike_version_t version);
                     80: 
                     81:        /**
                     82:         * Get a peer_config identified by it's name.
                     83:         *
                     84:         * @param name                          name of the peer_config
                     85:         * @return                                      matching peer_config, or NULL if none found
                     86:         */
                     87:        peer_cfg_t* (*get_peer_cfg_by_name)(backend_manager_t *this, char *name);
                     88: 
                     89:        /**
                     90:         * Create an enumerator over all matching peer configs.
                     91:         *
                     92:         * Pass NULL as parameters to match any. The enumerator enumerates over
                     93:         * peer_cfgs, ordered by priority (best match first).
                     94:         *
                     95:         * @param me                            local address
                     96:         * @param other                         remote address
                     97:         * @param my_id                         IDr in first authentication round
                     98:         * @param other_id                      IDi in first authentication round
                     99:         * @param version                       IKE version to get a config for
                    100:         * @return                                      enumerator over peer_cfg_t
                    101:         */
                    102:        enumerator_t* (*create_peer_cfg_enumerator)(backend_manager_t *this,
                    103:                                                        host_t *me, host_t *other, identification_t *my_id,
                    104:                                                        identification_t *other_id, ike_version_t version);
                    105:        /**
                    106:         * Register a backend on the manager.
                    107:         *
                    108:         * @param backend                       backend to register
                    109:         */
                    110:        void (*add_backend)(backend_manager_t *this, backend_t *backend);
                    111: 
                    112:        /**
                    113:         * Unregister a backend.
                    114:         *
                    115:         * @param backend                       backend to unregister
                    116:         */
                    117:        void (*remove_backend)(backend_manager_t *this, backend_t *backend);
                    118: 
                    119:        /**
                    120:         * Destroys a backend_manager_t object.
                    121:         */
                    122:        void (*destroy) (backend_manager_t *this);
                    123: };
                    124: 
                    125: /**
                    126:  * Create an instance of the backend manager
                    127:  *
                    128:  * @return             backend_manager instance
                    129:  */
                    130: backend_manager_t* backend_manager_create(void);
                    131: 
                    132: #endif /** BACKEND_MANAGER_H_ @}*/

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