Annotation of embedaddon/strongswan/src/libcharon/plugins/whitelist/whitelist_listener.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2011 Martin Willi
                      3:  * Copyright (C) 2011 revosec AG
                      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 whitelist_listener whitelist_listener
                     18:  * @{ @ingroup whitelist
                     19:  */
                     20: 
                     21: #ifndef WHITELIST_LISTENER_H_
                     22: #define WHITELIST_LISTENER_H_
                     23: 
                     24: #include <bus/listeners/listener.h>
                     25: 
                     26: typedef struct whitelist_listener_t whitelist_listener_t;
                     27: 
                     28: /**
                     29:  * Listener checking connecting peer against a whitelist.
                     30:  */
                     31: struct whitelist_listener_t {
                     32: 
                     33:        /**
                     34:         * Implements listener_t interface.
                     35:         */
                     36:        listener_t listener;
                     37: 
                     38:        /**
                     39:         * Add a peer identity to the whitelist.
                     40:         *
                     41:         * @param id            identity to whitelist
                     42:         */
                     43:        void (*add)(whitelist_listener_t *this, identification_t *id);
                     44: 
                     45:        /**
                     46:         * Remove a peer identity from the whitelist.
                     47:         *
                     48:         * @param id            identity to remove from whitelist
                     49:         */
                     50:        void (*remove)(whitelist_listener_t *this, identification_t *id);
                     51: 
                     52:        /**
                     53:         * Create an enumerator over whitelisted peer identities.
                     54:         *
                     55:         * The enumerator read-locks the whitelist, do not call add/remove while
                     56:         * it is alive.
                     57:         *
                     58:         * @return                      enumerator over identification_t*
                     59:         */
                     60:        enumerator_t* (*create_enumerator)(whitelist_listener_t *this);
                     61: 
                     62:        /**
                     63:         * Flush identities from whitelist matching id.
                     64:         *
                     65:         * @param id            id to match
                     66:         */
                     67:        void (*flush)(whitelist_listener_t *this, identification_t *id);
                     68: 
                     69:        /**
                     70:         * Enable/Disable whitelist checking.
                     71:         *
                     72:         * @param enable        TRUE to enable, FALSE to disable
                     73:         */
                     74:        void (*set_active)(whitelist_listener_t *this, bool enable);
                     75: 
                     76:        /**
                     77:         * Destroy a whitelist_listener_t.
                     78:         */
                     79:        void (*destroy)(whitelist_listener_t *this);
                     80: };
                     81: 
                     82: /**
                     83:  * Create a whitelist_listener instance.
                     84:  */
                     85: whitelist_listener_t *whitelist_listener_create();
                     86: 
                     87: #endif /** WHITELIST_LISTENER_H_ @}*/

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