00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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