Open SCAP Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sexp-handler.h
1 /*
2  * Copyright 2009 Red Hat Inc., Durham, North Carolina.
3  * All Rights Reserved.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors:
20  * "Daniel Kopecek" <dkopecek@redhat.com>
21  */
22 
23 #pragma once
24 #ifndef SEXP_HANDLER_H
25 #define SEXP_HANDLER_H
26 
27 #if defined(SEAP_THREAD_SAFE)
28 # include <pthread.h>
29 #endif
30 
31 #include <stdint.h>
32 #include <stddef.h>
33 #include "_sexp-datatype.h"
34 #include "../../../common/util.h"
35 
36 OSCAP_HIDDEN_START;
37 
38 typedef struct {
39  char *typestr;
40  uint16_t typelen;
41 
42  SEXP_dtype_op_t *op;
43  size_t op_cnt;
44 
46 
47 #include "generic/redblack.h"
48 DEFRBTREE(handlers, SEXP_handler_t handler);
49 
50 typedef struct {
51 #if defined(SEAP_THREAD_SAFE)
52  pthread_rwlock_t rwlock;
53 #endif
54  TREETYPE(handlers) tree;
55  uint8_t init;
57 
58 extern SEXP_handlertbl_t gSEXP_handlers;
59 
60 void SEXP_handlertbl_init (SEXP_handlertbl_t *htbl);
61 SEXP_handler_t *SEXP_gethandler (SEXP_handlertbl_t *htbl, const char *typestr, size_t typelen);
62 SEXP_handler_t *SEXP_reghandler (SEXP_handlertbl_t *htbl, SEXP_handler_t *handler);
63 int SEXP_delhandler (SEXP_handlertbl_t *htbl, const char *typestr, size_t typelen);
64 
65 #define SEXP_gethandler_g(s, l) SEXP_gethandler (&gSEXP_handlers, s, l)
66 #define SEXP_reghandler_g(h) SEXP_reghandler (&gSEXP_handlers, h)
67 #define SEXP_delhandler_g(s, l) SEXP_delhandler (&gSEXP_handlers, s, l)
68 
69 OSCAP_HIDDEN_END;
70 
71 #endif /* SEXP_HANDLER_H */
Definition: sexp-handler.h:50
Definition: sexp-handler.h:38