Annotation of embedaddon/strongswan/src/libcharon/plugins/counters/counters_query.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2017 Tobias Brunner
                      3:  * HSR Hochschule fuer Technik Rapperswil
                      4:  *
                      5:  * Copyright (C) 2012 Martin Willi
                      6:  * Copyright (C) 2012 revosec AG
                      7:  *
                      8:  * This program is free software; you can redistribute it and/or modify it
                      9:  * under the terms of the GNU General Public License as published by the
                     10:  * Free Software Foundation; either version 2 of the License, or (at your
                     11:  * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
                     12:  *
                     13:  * This program is distributed in the hope that it will be useful, but
                     14:  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
                     15:  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
                     16:  * for more details.
                     17:  */
                     18: 
                     19: /**
                     20:  * @defgroup counters_query counters_query
                     21:  * @{ @ingroup counters
                     22:  */
                     23: 
                     24: #ifndef COUNTERS_QUERY_H_
                     25: #define COUNTERS_QUERY_H_
                     26: 
                     27: #include <bus/listeners/listener.h>
                     28: 
                     29: typedef struct counters_query_t counters_query_t;
                     30: typedef enum counter_type_t counter_type_t;
                     31: 
                     32: enum counter_type_t {
                     33:        /** initiated IKE_SA rekeyings */
                     34:        COUNTER_INIT_IKE_SA_REKEY,
                     35:        /** responded IKE_SA rekeyings */
                     36:        COUNTER_RESP_IKE_SA_REKEY,
                     37:        /** completed CHILD_SA rekeyings */
                     38:        COUNTER_CHILD_SA_REKEY,
                     39:        /** messages with invalid types, length, or a value out of range */
                     40:        COUNTER_IN_INVALID,
                     41:        /** messages with an invalid IKE SPI */
                     42:        COUNTER_IN_INVALID_IKE_SPI,
                     43:        /** received IKE_SA_INIT requests */
                     44:        COUNTER_IN_IKE_SA_INIT_REQ,
                     45:        /** received IKE_SA_INIT responses */
                     46:        COUNTER_IN_IKE_SA_INIT_RSP,
                     47:        /** sent IKE_SA_INIT requests */
                     48:        COUNTER_OUT_IKE_SA_INIT_REQ,
                     49:        /** sent IKE_SA_INIT responses */
                     50:        COUNTER_OUT_IKE_SA_INIT_RES,
                     51:        /** received IKE_AUTH requests */
                     52:        COUNTER_IN_IKE_AUTH_REQ,
                     53:        /** received IKE_AUTH responses */
                     54:        COUNTER_IN_IKE_AUTH_RSP,
                     55:        /** sent IKE_AUTH requests */
                     56:        COUNTER_OUT_IKE_AUTH_REQ,
                     57:        /** sent IKE_AUTH responses */
                     58:        COUNTER_OUT_IKE_AUTH_RSP,
                     59:        /** received CREATE_CHILD_SA requests */
                     60:        COUNTER_IN_CREATE_CHILD_SA_REQ,
                     61:        /** received CREATE_CHILD_SA responses */
                     62:        COUNTER_IN_CREATE_CHILD_SA_RSP,
                     63:        /** sent CREATE_CHILD_SA requests */
                     64:        COUNTER_OUT_CREATE_CHILD_SA_REQ,
                     65:        /** sent CREATE_CHILD_SA responses */
                     66:        COUNTER_OUT_CREATE_CHILD_SA_RSP,
                     67:        /** received INFORMATIONAL requests */
                     68:        COUNTER_IN_INFORMATIONAL_REQ,
                     69:        /** received INFORMATIONAL responses */
                     70:        COUNTER_IN_INFORMATIONAL_RSP,
                     71:        /** sent INFORMATIONAL requests */
                     72:        COUNTER_OUT_INFORMATIONAL_REQ,
                     73:        /** sent INFORMATIONAL responses */
                     74:        COUNTER_OUT_INFORMATIONAL_RSP,
                     75:        /** number of counter types */
                     76:        COUNTER_MAX
                     77: };
                     78: 
                     79: /**
                     80:  * Query counter values for different IKE events.
                     81:  */
                     82: struct counters_query_t {
                     83: 
                     84:        /**
                     85:         * Enumerate all connection names for which counters are currently recorded.
                     86:         *
                     87:         * @return                              enumerator over names (char *)
                     88:         */
                     89:        enumerator_t *(*get_names)(counters_query_t *this);
                     90: 
                     91:        /**
                     92:         * Get a current global or connection-specific counter value.
                     93:         *
                     94:         * @param type                  counter to query
                     95:         * @param name                  connection name to get counter for, NULL for global
                     96:         * @param[out] value    counter value
                     97:         * @return                              TRUE if value found and returned
                     98:         */
                     99:        bool (*get)(counters_query_t *this, counter_type_t type, char *name,
                    100:                                uint64_t *value);
                    101: 
                    102:        /**
                    103:         * Get all global or connection-specific counter values.
                    104:         *
                    105:         * @param name                  connection name to get counters for, NULL for global
                    106:         * @return                              array of counters (has to be freed), NULL if named
                    107:         *                                              connection is not found
                    108:         */
                    109:        uint64_t *(*get_all)(counters_query_t *this, char *name);
                    110: 
                    111:        /**
                    112:         * Reset all global or connection-specific counters.
                    113:         *
                    114:         * @param name                  connection name to reset counters, NULL for global
                    115:         */
                    116:        void (*reset)(counters_query_t *this, char *name);
                    117: 
                    118:        /**
                    119:         * Reset counters for all connections, global counters are unaffected.
                    120:         */
                    121:        void (*reset_all)(counters_query_t *this);
                    122: };
                    123: 
                    124: #endif /** COUNTERS_QUERY_H_ @}*/

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