| 1 | /** |
| 2 | * @file _oval_probe_handler.h |
| 3 | * @brief OVAL probe handler private header |
| 4 | * @author "Daniel Kopecek" <[email protected]> |
| 5 | * |
| 6 | * @addtogroup PROBEHANDLERS |
| 7 | * @{ |
| 8 | */ |
| 9 | /* |
| 10 | * Copyright 2010 Red Hat Inc., Durham, North Carolina. |
| 11 | * All Rights Reserved. |
| 12 | * |
| 13 | * This library is free software; you can redistribute it and/or |
| 14 | * modify it under the terms of the GNU Lesser General Public |
| 15 | * License as published by the Free Software Foundation; either |
| 16 | * version 2.1 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * This library is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 21 | * Lesser General Public License for more details. |
| 22 | * |
| 23 | * You should have received a copy of the GNU Lesser General Public |
| 24 | * License along with this library; if not, write to the Free Software |
| 25 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 26 | * |
| 27 | * Authors: |
| 28 | * "Daniel Kopecek" <[email protected]> |
| 29 | */ |
| 30 | #ifndef _OVAL_PROBE_HANDLER |
| 31 | #define _OVAL_PROBE_HANDLER |
| 32 | |
| 33 | #include <stdint.h> |
| 34 | #include "oval_types.h" |
| 35 | |
| 36 | /** |
| 37 | * Type of the handler function. This function takes care of handling |
| 38 | * all the actions defined bellow, that is: initialization, freeing, |
| 39 | * opening, evaluating, reseting and closing (whatever that means in |
| 40 | * your particular case). |
| 41 | */ |
| 42 | typedef int (oval_probe_handler_t)(oval_subtype_t, void *, int, ...); |
| 43 | |
| 44 | #define PROBE_HANDLER_ACT_INIT 0 |
| 45 | #define PROBE_HANDLER_ACT_FREE 1 |
| 46 | #define PROBE_HANDLER_ACT_OPEN 2 |
| 47 | #define PROBE_HANDLER_ACT_EVAL 3 |
| 48 | #define PROBE_HANDLER_ACT_RESET 4 |
| 49 | #define PROBE_HANDLER_ACT_CLOSE 5 |
| 50 | #define PROBE_HANDLER_ACT_ABORT 6 |
| 51 | |
| 52 | #define PROBE_HANDLER_IGNORE NULL |
| 53 | |
| 54 | struct oval_ph { |
| 55 | oval_subtype_t type; |
| 56 | oval_probe_handler_t *func; |
| 57 | void *uptr; |
| 58 | }; |
| 59 | typedef struct oval_ph oval_ph_t; |
| 60 | |
| 61 | struct oval_phtbl { |
| 62 | struct oval_ph **ph; |
| 63 | uint32_t sz; |
| 64 | }; |
| 65 | typedef struct oval_phtbl oval_phtbl_t; |
| 66 | |
| 67 | oval_phtbl_t *oval_phtbl_new(void); |
| 68 | void oval_phtbl_free(oval_phtbl_t *phtbl); |
| 69 | oval_ph_t *oval_probe_handler_get(oval_phtbl_t *phtbl, oval_subtype_t type); |
| 70 | int oval_probe_handler_set(oval_phtbl_t *phtbl, oval_subtype_t type, oval_probe_handler_t *handler, void *uptr); |
| 71 | |
| 72 | /// @} |
| 73 | #endif /* _OVAL_PROBE_HANDLER */ |