summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-10-30 11:16:55 +0000
committerLaurent Bercot <ska@appnovation.com>2023-10-30 11:16:55 +0000
commit1c5f682f4dcbca5afa9dd4a9688bde40efaeb12c (patch)
tree9c5ac88f1c430686d45de44ee36f29fe26be42b1 /src/include
parentad88c5ec68b1cfd47017face422132ab8c7b2874 (diff)
downloadtipidee-1c5f682f4dcbca5afa9dd4a9688bde40efaeb12c.tar.xz
Revamp (and hopefully fix) resattr management
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/tipidee/conf.h5
-rw-r--r--src/include/tipidee/log.h10
-rw-r--r--src/include/tipidee/resattr.h23
-rw-r--r--src/include/tipidee/tipidee.h1
4 files changed, 30 insertions, 9 deletions
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 <stdint.h>
#include <skalibs/uint16.h>
+#include <skalibs/uint32.h>
#include <skalibs/cdb.h>
+#include <tipidee/resattr.h>
#include <tipidee/uri.h>
#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 <tipidee/rql.h>
#include <tipidee/headers.h>
+#include <tipidee/resattr.h>
#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 <stdint.h>
+
+#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 <tipidee/headers.h>
#include <tipidee/log.h>
#include <tipidee/method.h>
+#include <tipidee/resattr.h>
#include <tipidee/response.h>
#include <tipidee/rql.h>
#include <tipidee/uri.h>