| 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | * |
| 19 | * Authors: |
| 20 | * "Daniel Kopecek" <[email protected]> |
| 21 | */ |
| 22 | |
| 23 | #pragma once |
| 24 | #ifndef _SEAP_DESCRIPTOR_H |
| 25 | #define _SEAP_DESCRIPTOR_Hcxx . . $ `src/OVAL/probes/SEAP/seap-descriptor.h:25:9`! |
| 26 | |
| 27 | #include <errno.h> |
| 28 | #include <pthread.h> |
| 29 | #include <stdint.h> |
| 30 | #include "oval_types.h"cxx . . $ `<file>/src/OVAL/public/oval_types.h`/ |
| 31 | #include "generic/bitmap.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/generic/bitmap.h`/ |
| 32 | #include "generic/rbt/rbt.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/generic/rbt/rbt.h`/ |
| 33 | #include "_sexp-types.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/_sexp-types.h`/ |
| 34 | #include "_seap-packetq.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/_seap-packetq.h`/ |
| 35 | #include "_sexp-output.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/_sexp-output.h`/ |
| 36 | #include "_seap-command.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/_seap-command.h`/ |
| 37 | #include "../../../common/util.h"cxx . . $ `<file>/src/common/util.h`/ |
| 38 | |
| 39 | typedef uint8_tcxx . . $ uint8_t# SEAP_scheme_tcxx . . $ SEAP_scheme_t#; |
| 40 | |
| 41 | /* |
| 42 | * Descriptor table + related stuff |
| 43 | */ |
| 44 | typedef structcxx . . $ $anonymous_type_5b6d52305350878e_0# { |
| 45 | SEAP_msgid_tcxx . . $ SEAP_msgid_t# next_idcxx . . $ $anonymous_type_5b6d52305350878e_0#next_id.; |
| 46 | SEAP_scheme_tcxx . . $ SEAP_scheme_t# schemecxx . . $ $anonymous_type_5b6d52305350878e_0#scheme.; /* Protocol/Scheme used for this descriptor */ |
| 47 | void *scheme_datacxx . . $ $anonymous_type_5b6d52305350878e_0#scheme_data.; /* Protocol/Scheme related data */ |
| 48 | |
| 49 | SEXP_tcxx . . $ SEXP_t# *msg_queuecxx . . $ $anonymous_type_5b6d52305350878e_0#msg_queue.; |
| 50 | rbt_tcxx . . $ rbt_t# *err_queuecxx . . $ $anonymous_type_5b6d52305350878e_0#err_queue.; |
| 51 | SEXP_tcxx . . $ SEXP_t# *cmd_queuecxx . . $ $anonymous_type_5b6d52305350878e_0#cmd_queue.; |
| 52 | |
| 53 | SEAP_packetq_tcxx . . $ SEAP_packetq_t# pck_queuecxx . . $ $anonymous_type_5b6d52305350878e_0#pck_queue.; |
| 54 | |
| 55 | pthread_mutex_tcxx . . $ pthread_mutex_t# w_lockcxx . . $ $anonymous_type_5b6d52305350878e_0#w_lock.; |
| 56 | pthread_mutex_tcxx . . $ pthread_mutex_t# r_lockcxx . . $ $anonymous_type_5b6d52305350878e_0#r_lock.; |
| 57 | |
| 58 | SEAP_cmdid_tcxx . . $ SEAP_cmdid_t# next_cidcxx . . $ $anonymous_type_5b6d52305350878e_0#next_cid.; |
| 59 | SEAP_cmdtbl_tcxx . . $ SEAP_cmdtbl_t# *cmd_c_tablecxx . . $ $anonymous_type_5b6d52305350878e_0#cmd_c_table.; /* Local SEAP commands */ |
| 60 | SEAP_cmdtbl_tcxx . . $ SEAP_cmdtbl_t# *cmd_w_tablecxx . . $ $anonymous_type_5b6d52305350878e_0#cmd_w_table.; /* Waiting SEAP commands */ |
| 61 | oval_subtype_tcxx . . $ oval_subtype_t# subtypecxx . . $ $anonymous_type_5b6d52305350878e_0#subtype.; |
| 62 | struct probe_common_main_argumentcxx . . $ probe_common_main_argument# *argcxx . . $ $anonymous_type_5b6d52305350878e_0#arg.; |
| 63 | } SEAP_desc_tcxx . . $ SEAP_desc_t#; |
| 64 | |
| 65 | #define SEAP_DESC_FDINcxx . . $ `src/OVAL/probes/SEAP/seap-descriptor.h:65:9`! 0x00000001 |
| 66 | #define SEAP_DESC_FDOUTcxx . . $ `src/OVAL/probes/SEAP/seap-descriptor.h:66:9`! 0x00000002 |
| 67 | #define SEAP_DESC_SELFcxx . . $ `src/OVAL/probes/SEAP/seap-descriptor.h:67:9`! -1 |
| 68 | |
| 69 | #define SEAP_DESCTBL_INITIALIZERcxx . . $ `src/OVAL/probes/SEAP/seap-descriptor.h:69:9`! { NULL, NULL } |
| 70 | |
| 71 | #define SEAP_BUFFER_SIZEcxx . . $ `src/OVAL/probes/SEAP/seap-descriptor.h:71:9`! 2*4096 |
| 72 | #define SEAP_MAX_OPENDESCcxx . . $ `src/OVAL/probes/SEAP/seap-descriptor.h:72:9`! 128 |
| 73 | #define SDTABLE_REALLOC_ADDcxx . . $ `src/OVAL/probes/SEAP/seap-descriptor.h:73:9`! 4 |
| 74 | |
| 75 | int SEAP_desc_addcxx . . $ SEAP_desc_add(4bfd83e388c9f71b).(SEAP_desctable_tcxx . . $ SEAP_desctable_t# *sd_table, SEAP_scheme_tcxx . . $ SEAP_scheme_t# scheme, void *scheme_data); |
| 76 | int SEAP_desc_delcxx . . $ SEAP_desc_del(ad0fa72a6b5db2). (SEAP_desctable_tcxx . . $ SEAP_desctable_t# *sd_table, int sd); |
| 77 | SEAP_desc_tcxx . . $ SEAP_desc_t# *SEAP_desc_getcxx . . $ SEAP_desc_get(b324436d5ff0f8fe). (SEAP_desctable_tcxx . . $ SEAP_desctable_t# *sd_table, int sd); |
| 78 | |
| 79 | SEAP_desctable_tcxx . . $ SEAP_desctable_t# *SEAP_desctable_newcxx . . $ SEAP_desctable_new(3edbe157c33b3149). (void); |
| 80 | void SEAP_desctable_freecxx . . $ SEAP_desctable_free(dcdcf0775e6a3e02).(SEAP_desctable_tcxx . . $ SEAP_desctable_t# *sd_table); |
| 81 | void SEAP_desc_freecxx . . $ SEAP_desc_free(13ce8cd49ba0beb5).(SEAP_desc_tcxx . . $ SEAP_desc_t# *dsc); |
| 82 | |
| 83 | static inline int SEAP_desc_trylockcxx . . $ SEAP_desc_trylock(d89ae235521888f9). (pthread_mutex_tcxx . . $ pthread_mutex_t# *m) |
| 84 | { |
| 85 | switch (pthread_mutex_trylockcxx . . $ pthread_mutex_trylock(d89ae235521888f9). (m)) { |
| 86 | case 0: |
| 87 | return (1); |
| 88 | case EBUSYcxx . . $ `<external>/8987895939074593727/errno-base.h:20:9`!: |
| 89 | return (0); |
| 90 | case EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!: |
| 91 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; |
| 92 | /* FALLTHROUGH */ |
| 93 | default: |
| 94 | return (-1); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | static inline int SEAP_desc_lockcxx . . $ SEAP_desc_lock(d89ae235521888f9). (pthread_mutex_tcxx . . $ pthread_mutex_t# *m) |
| 99 | { |
| 100 | switch (pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9). (m)) { |
| 101 | case 0: |
| 102 | return (1); |
| 103 | default: |
| 104 | return (-1); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | static inline int SEAP_desc_unlockcxx . . $ SEAP_desc_unlock(d89ae235521888f9). (pthread_mutex_tcxx . . $ pthread_mutex_t# *m) |
| 109 | { |
| 110 | switch (pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9). (m)) { |
| 111 | case 0: |
| 112 | return (1); |
| 113 | default: |
| 114 | return (-1); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | #define DESC_TRYRLOCKcxx . . $ `src/OVAL/probes/SEAP/seap-descriptor.h:118:9`!(d) SEAP_desc_trylock (&((d)->r_lock)) |
| 119 | #define DESC_RLOCKcxx . . $ `src/OVAL/probes/SEAP/seap-descriptor.h:119:9`!(d) SEAP_desc_lock (&((d)->r_lock)) |
| 120 | #define DESC_RUNLOCKcxx . . $ `src/OVAL/probes/SEAP/seap-descriptor.h:120:9`!(d) SEAP_desc_unlock (&((d)->r_lock)) |
| 121 | |
| 122 | #define DESC_TRYWLOCKcxx . . $ `src/OVAL/probes/SEAP/seap-descriptor.h:122:9`!(d) SEAP_desc_trylock (&((d)->w_lock)) |
| 123 | #define DESC_WLOCKcxx . . $ `src/OVAL/probes/SEAP/seap-descriptor.h:123:9`!(d) SEAP_desc_lock (&((d)->w_lock)) |
| 124 | #define DESC_WUNLOCKcxx . . $ `src/OVAL/probes/SEAP/seap-descriptor.h:124:9`!(d) SEAP_desc_unlock (&((d)->w_lock)) |
| 125 | |
| 126 | SEAP_msgid_tcxx . . $ SEAP_msgid_t# SEAP_desc_genmsgidcxx . . $ SEAP_desc_genmsgid(c52f604638ef6a39). (SEAP_desctable_tcxx . . $ SEAP_desctable_t# *sd_table, int sd); |
| 127 | SEAP_cmdid_tcxx . . $ SEAP_cmdid_t# SEAP_desc_gencmdidcxx . . $ SEAP_desc_gencmdid(bbbb35498d66006b). (SEAP_desctable_tcxx . . $ SEAP_desctable_t# *sd_table, int sd); |
| 128 | |
| 129 | |
| 130 | #endif /* _SEAP_DESCRIPTOR_H */ |