From 1c5f682f4dcbca5afa9dd4a9688bde40efaeb12c Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 30 Oct 2023 11:16:55 +0000 Subject: Revamp (and hopefully fix) resattr management Signed-off-by: Laurent Bercot --- src/include/tipidee/conf.h | 5 +++++ src/include/tipidee/log.h | 10 +--------- src/include/tipidee/resattr.h | 23 +++++++++++++++++++++++ src/include/tipidee/tipidee.h | 1 + 4 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 src/include/tipidee/resattr.h (limited to 'src/include') diff --git a/src/include/tipidee/conf.h b/src/include/tipidee/conf.h index 5f3b697..aa8cb45 100644 --- a/src/include/tipidee/conf.h +++ b/src/include/tipidee/conf.h @@ -7,8 +7,10 @@ #include #include +#include #include +#include #include #define TIPIDEE_CONF_KEY_MAXLEN 0x1000U @@ -44,4 +46,7 @@ extern int tipidee_conf_get_redirection (tipidee_conf const *, char const *, siz extern char const *tipidee_conf_get_content_type (tipidee_conf const *, char const *) ; extern char const *tipidee_conf_get_errorfile (tipidee_conf const *, char const *, unsigned int) ; +extern int tipidee_conf_get_resattr1 (tipidee_conf const *, char const *, tipidee_resattr *) ; /* direct key lookup */ +extern int tipidee_conf_get_resattr (tipidee_conf const *, char const *, tipidee_resattr *) ; /* high-level */ + #endif diff --git a/src/include/tipidee/log.h b/src/include/tipidee/log.h index 0904ca4..93ee386 100644 --- a/src/include/tipidee/log.h +++ b/src/include/tipidee/log.h @@ -11,6 +11,7 @@ #include #include +#include #define TIPIDEE_LOG_REQUEST 0x0001 #define TIPIDEE_LOG_REFERRER 0x0002 @@ -26,15 +27,6 @@ #define TIPIDEE_LOG_DEFAULT (TIPIDEE_LOG_REQUEST | TIPIDEE_LOG_ANSWER | TIPIDEE_LOG_SIZE) -typedef struct tipidee_resattr_s tipidee_resattr, *tipidee_resattr_ref ; -struct tipidee_resattr_s -{ - char const *content_type ; - uint32_t iscgi : 1 ; - uint32_t isnph : 1 ; -} ; -#define TIPIDEE_RESATTR_ZERO { .content_type = 0, .iscgi = 0, .isnph = 0 } - extern void tipidee_log_start (uint32_t, char const *, char const *) ; extern void tipidee_log_exit (uint32_t, unsigned int) ; diff --git a/src/include/tipidee/resattr.h b/src/include/tipidee/resattr.h new file mode 100644 index 0000000..edd0a41 --- /dev/null +++ b/src/include/tipidee/resattr.h @@ -0,0 +1,23 @@ +/* ISC license. */ + +#ifndef TIPIDEE_RESATTR_H +#define TIPIDEE_RESATTR_H + +#include + +#define TIPIDEE_RA_FLAG_CGI 0x0001 +#define TIPIDEE_RA_FLAG_NPH 0x0002 +#define TIPIDEE_RA_FLAG_BA 0x0004 + +#define TIPIDEE_RA_BITS 3 + +typedef struct tipidee_resattr_s tipidee_resattr, *tipidee_resattr_ref ; +struct tipidee_resattr_s +{ + uint32_t flags ; + uint32_t mask ; + char const *content_type ; +} ; +#define TIPIDEE_RESATTR_ZERO { .flags = 0, .mask = 0, .content_type = 0 } + +#endif diff --git a/src/include/tipidee/tipidee.h b/src/include/tipidee/tipidee.h index 7153b7d..7c5154c 100644 --- a/src/include/tipidee/tipidee.h +++ b/src/include/tipidee/tipidee.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include -- cgit v1.3.1