Annotation of embedaddon/strongswan/src/libstrongswan/crypto/hashers/hash_algorithm_set.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2015 Tobias Brunner
                      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 hash_algorithm_set hash_algorithm_set
                     18:  * @{ @ingroup crypto
                     19:  */
                     20: 
                     21: #ifndef HASH_ALGORITHM_SET_H_
                     22: #define HASH_ALGORITHM_SET_H_
                     23: 
                     24: typedef struct hash_algorithm_set_t hash_algorithm_set_t;
                     25: 
                     26: #include <library.h>
                     27: #include <crypto/hashers/hasher.h>
                     28: 
                     29: /**
                     30:  * A set of hash algorithms
                     31:  */
                     32: struct hash_algorithm_set_t {
                     33: 
                     34:        /**
                     35:         * Add the given algorithm to the set.
                     36:         *
                     37:         * @param alg           hash algorithm
                     38:         */
                     39:        void (*add)(hash_algorithm_set_t *this, hash_algorithm_t alg);
                     40: 
                     41:        /**
                     42:         * Check if the given algorithm is contained in the set.
                     43:         *
                     44:         * @param alg           hash algorithm
                     45:         * @return                      TRUE if contained in set
                     46:         */
                     47:        bool (*contains)(hash_algorithm_set_t *this, hash_algorithm_t alg);
                     48: 
                     49:        /**
                     50:         * Number of hash algorithms contained in the set.
                     51:         *
                     52:         * @return                      number of algorithms
                     53:         */
                     54:        int (*count)(hash_algorithm_set_t *this);
                     55: 
                     56:        /**
                     57:         * Enumerate the algorithms contained in the set.
                     58:         *
                     59:         * @return                      enumerator over hash_algorithm_t (sorted by identifier)
                     60:         */
                     61:        enumerator_t *(*create_enumerator)(hash_algorithm_set_t *this);
                     62: 
                     63:        /**
                     64:         * Destroy a hash_algorithm_set_t instance
                     65:         */
                     66:        void (*destroy)(hash_algorithm_set_t *this);
                     67: };
                     68: 
                     69: /**
                     70:  * Create a set of hash algorithms.
                     71:  *
                     72:  * @return                             hash_algorithm_set_t instance
                     73:  */
                     74: hash_algorithm_set_t *hash_algorithm_set_create();
                     75: 
                     76: #endif /** HASH_ALGORITHM_SET_H_ @}*/

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