aboutsummaryrefslogtreecommitdiffstats
path: root/src/libtipidee/tipidee_conf_get_responseheaders.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-10-24 09:59:08 +0000
committerLaurent Bercot <ska@appnovation.com>2023-10-24 09:59:08 +0000
commit37d2f8cb438f68eaa1da8a56ea9ce5023091f128 (patch)
tree81672ad4254ea18e7d240230ba47ef6743d491ad /src/libtipidee/tipidee_conf_get_responseheaders.c
parent907f1c64369095b5b2d5f6fb23a8b937720d94cc (diff)
downloadtipidee-37d2f8cb438f68eaa1da8a56ea9ce5023091f128.tar.gz
Full custom header support, switch not made yet
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libtipidee/tipidee_conf_get_responseheaders.c')
-rw-r--r--src/libtipidee/tipidee_conf_get_responseheaders.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libtipidee/tipidee_conf_get_responseheaders.c b/src/libtipidee/tipidee_conf_get_responseheaders.c
new file mode 100644
index 0000000..ee8c786
--- /dev/null
+++ b/src/libtipidee/tipidee_conf_get_responseheaders.c
@@ -0,0 +1,22 @@
+/* ISC license. */
+
+#include <stddef.h>
+#include <errno.h>
+#include <string.h>
+
+#include <skalibs/uint32.h>
+#include <skalibs/cdb.h>
+
+#include <tipidee/conf.h>
+
+#include <skalibs/posixishard.h>
+
+char const *tipidee_conf_get_responseheaders (tipidee_conf const *conf, char const *key, uint32_t *len, uint32_t *n)
+{
+ cdb_data data ;
+ if (!tipidee_conf_get(conf, key, &data)) return NULL ;
+ if (data.len < 4) return (errno = EPROTO, NULL) ;
+ uint32_unpack_big(data.s + data.len - 4, n) ;
+ *len = data.len - 4 ;
+ return data.s ;
+}