|
Open SCAP Library
|
00001 /* 00002 * Copyright 2009 Red Hat Inc., Durham, North Carolina. 00003 * All Rights Reserved. 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 * 00019 * Authors: 00020 * "Daniel Kopecek" <dkopecek@redhat.com> 00021 */ 00022 00023 #pragma once 00024 #ifndef SEXP_HANDLER_H 00025 #define SEXP_HANDLER_H 00026 00027 #if defined(SEAP_THREAD_SAFE) 00028 # include <pthread.h> 00029 #endif 00030 00031 #include <stdint.h> 00032 #include <stddef.h> 00033 #include "_sexp-datatype.h" 00034 #include "../../../common/util.h" 00035 00036 OSCAP_HIDDEN_START; 00037 00038 typedef struct { 00039 char *typestr; 00040 uint16_t typelen; 00041 00042 SEXP_dtype_op_t *op; 00043 size_t op_cnt; 00044 00045 } SEXP_handler_t; 00046 00047 #include "generic/redblack.h" 00048 DEFRBTREE(handlers, SEXP_handler_t handler); 00049 00050 typedef struct { 00051 #if defined(SEAP_THREAD_SAFE) 00052 pthread_rwlock_t rwlock; 00053 #endif 00054 TREETYPE(handlers) tree; 00055 uint8_t init; 00056 } SEXP_handlertbl_t; 00057 00058 extern SEXP_handlertbl_t gSEXP_handlers; 00059 00060 void SEXP_handlertbl_init (SEXP_handlertbl_t *htbl); 00061 SEXP_handler_t *SEXP_gethandler (SEXP_handlertbl_t *htbl, const char *typestr, size_t typelen); 00062 SEXP_handler_t *SEXP_reghandler (SEXP_handlertbl_t *htbl, SEXP_handler_t *handler); 00063 int SEXP_delhandler (SEXP_handlertbl_t *htbl, const char *typestr, size_t typelen); 00064 00065 #define SEXP_gethandler_g(s, l) SEXP_gethandler (&gSEXP_handlers, s, l) 00066 #define SEXP_reghandler_g(h) SEXP_reghandler (&gSEXP_handlers, h) 00067 #define SEXP_delhandler_g(s, l) SEXP_delhandler (&gSEXP_handlers, s, l) 00068 00069 OSCAP_HIDDEN_END; 00070 00071 #endif /* SEXP_HANDLER_H */
1.7.3