Annotation of embedaddon/strongswan/src/libcharon/plugins/ha/ha_kernel.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 ha_kernel ha_kernel
                     18:  * @{ @ingroup ha
                     19:  */
                     20: 
                     21: #ifndef HA_KERNEL_H_
                     22: #define HA_KERNEL_H_
                     23: 
                     24: typedef struct ha_kernel_t ha_kernel_t;
                     25: 
                     26: #include "ha_segments.h"
                     27: 
                     28: /**
                     29:  * HA segment kernel configuration interface.
                     30:  */
                     31: struct ha_kernel_t {
                     32: 
                     33:        /**
                     34:         * Get the segment a host is in.
                     35:         *
                     36:         * @param host          host to get segment for
                     37:         * @return                      segment number
                     38:         */
                     39:        u_int (*get_segment)(ha_kernel_t *this, host_t *host);
                     40: 
                     41:        /**
                     42:         * Get the segment a host/SPI is in, as used for CHILD_SA segmentation.
                     43:         *
                     44:         * @param host          host to get segment for
                     45:         * @param spi           SPI to include in hash
                     46:         * @return                      segment number
                     47:         */
                     48:        u_int (*get_segment_spi)(ha_kernel_t *this, host_t *host, uint32_t spi);
                     49: 
                     50:        /**
                     51:         * Get the segment an arbitrary integer is in.
                     52:         *
                     53:         * @param n                     integer to segment
                     54:         */
                     55:        u_int (*get_segment_int)(ha_kernel_t *this, int n);
                     56: 
                     57:        /**
                     58:         * Activate a segment at kernel level for all cluster addresses.
                     59:         *
                     60:         * @param segment       segment to activate
                     61:         */
                     62:        void (*activate)(ha_kernel_t *this, u_int segment);
                     63: 
                     64:        /**
                     65:         * Deactivate a segment at kernel level for all cluster addresses.
                     66:         *
                     67:         * @param segment       segment to deactivate
                     68:         */
                     69:        void (*deactivate)(ha_kernel_t *this, u_int segment);
                     70: 
                     71:        /**
                     72:         * Destroy a ha_kernel_t.
                     73:         */
                     74:        void (*destroy)(ha_kernel_t *this);
                     75: };
                     76: 
                     77: /**
                     78:  * Create a ha_kernel instance.
                     79:  *
                     80:  * @param count                        total number of segments to use
                     81:  */
                     82: ha_kernel_t *ha_kernel_create(u_int count);
                     83: 
                     84: #endif /** HA_KERNEL_ @}*/

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