24 #ifndef _SEAP_DESCRIPTOR_H
25 #define _SEAP_DESCRIPTOR_H
31 #include "generic/bitmap.h"
32 #include "generic/rbt/rbt.h"
33 #include "_sexp-types.h"
34 #include "_seap-packetq.h"
35 #include "_sexp-output.h"
36 #include "_seap-command.h"
37 #include "../../../common/util.h"
39 typedef uint8_t SEAP_scheme_t;
56 pthread_mutex_t w_lock;
57 pthread_mutex_t r_lock;
59 SEAP_cmdid_t next_cid;
65 #define SEAP_DESC_FDIN 0x00000001
66 #define SEAP_DESC_FDOUT 0x00000002
67 #define SEAP_DESC_SELF -1
69 #define SEAP_DESCTBL_INITIALIZER { NULL, NULL }
71 #define SEAP_BUFFER_SIZE 2*4096
72 #define SEAP_MAX_OPENDESC 128
73 #define SDTABLE_REALLOC_ADD 4
75 int SEAP_desc_add(
SEAP_desctable_t *sd_table, SEAP_scheme_t scheme,
void *scheme_data);
83 static inline int SEAP_desc_trylock (pthread_mutex_t *m)
85 switch (pthread_mutex_trylock (m)) {
98 static inline int SEAP_desc_lock (pthread_mutex_t *m)
100 switch (pthread_mutex_lock (m)) {
108 static inline int SEAP_desc_unlock (pthread_mutex_t *m)
110 switch (pthread_mutex_unlock (m)) {
118 #define DESC_TRYRLOCK(d) SEAP_desc_trylock (&((d)->r_lock))
119 #define DESC_RLOCK(d) SEAP_desc_lock (&((d)->r_lock))
120 #define DESC_RUNLOCK(d) SEAP_desc_unlock (&((d)->r_lock))
122 #define DESC_TRYWLOCK(d) SEAP_desc_trylock (&((d)->w_lock))
123 #define DESC_WLOCK(d) SEAP_desc_lock (&((d)->w_lock))
124 #define DESC_WUNLOCK(d) SEAP_desc_unlock (&((d)->w_lock))