summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-10-10 08:06:46 +0000
committerLaurent Bercot <ska@appnovation.com>2023-10-10 08:06:46 +0000
commit541325d00c7078d063ea97333d3c9c64d6b6c7b6 (patch)
tree86453b9f547359546d74988b04ab33ec10b4000c /src/include
parentd9f5cb7a28ee79e299e41d3ce325171f01e1a3d7 (diff)
downloadtipidee-541325d00c7078d063ea97333d3c9c64d6b6c7b6.tar.xz
Add new logging functions, change method_conv for bsearch
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/tipidee/log.h41
-rw-r--r--src/include/tipidee/method.h16
2 files changed, 45 insertions, 12 deletions
diff --git a/src/include/tipidee/log.h b/src/include/tipidee/log.h
new file mode 100644
index 0000000..0fe44ce
--- /dev/null
+++ b/src/include/tipidee/log.h
@@ -0,0 +1,41 @@
+/* ISC license. */
+
+#ifndef TIPIDEE_LOG_H
+#define TIPIDEE_LOG_H
+
+#include <sys/types.h>
+#include <stdint.h>
+
+#include <skalibs/stralloc.h>
+
+#include <tipidee/rql.h>
+
+#define TIPIDEE_LOG_REQUEST 0x0001
+#define TIPIDEE_LOG_REFERRER 0x0002
+#define TIPIDEE_LOG_UA 0x0004
+#define TIPIDEE_LOG_RESOURCE 0x0008
+#define TIPIDEE_LOG_ANSWER 0x0010
+#define TIPIDEE_LOG_SIZE 0x0020
+#define TIPIDEE_LOG_START 0x100
+#define TIPIDEE_LOG_CLIENTIP 0x0200
+#define TIPIDEE_LOG_CLIENTHOST 0x0400
+
+#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) ;
+
+extern void tipidee_log_request (uint32_t, tipidee_rql const *, char const *, char const *, stralloc *) ;
+extern void tipidee_log_resource (uint32_t, char const *, char const *, tipidee_resattr const *) ;
+extern void tipidee_log_answer (uint32_t, unsigned int, off_t) ;
+
+#endif
diff --git a/src/include/tipidee/method.h b/src/include/tipidee/method.h
index 05123e8..b6efaa6 100644
--- a/src/include/tipidee/method.h
+++ b/src/include/tipidee/method.h
@@ -6,26 +6,18 @@
typedef enum tipidee_method_e tipidee_method, *tipidee_method_ref ;
enum tipidee_method_e
{
- TIPIDEE_METHOD_GET = 0,
+ TIPIDEE_METHOD_CONNECT = 0,
+ TIPIDEE_METHOD_DELETE,
+ TIPIDEE_METHOD_GET,
TIPIDEE_METHOD_HEAD,
TIPIDEE_METHOD_OPTIONS,
TIPIDEE_METHOD_POST,
+ TIPIDEE_METHOD_PRI,
TIPIDEE_METHOD_PUT,
- TIPIDEE_METHOD_DELETE,
TIPIDEE_METHOD_TRACE,
- TIPIDEE_METHOD_CONNECT,
- TIPIDEE_METHOD_PRI,
TIPIDEE_METHOD_UNKNOWN
} ;
-typedef struct tipidee_method_conv_s tipidee_method_conv, *tipidee_method_conv_ref ;
-struct tipidee_method_conv_s
-{
- tipidee_method num ;
- char const *str ;
-} ;
-
-extern tipidee_method_conv const *tipidee_method_conv_table ;
extern char const *tipidee_method_tostr (tipidee_method) ;
extern tipidee_method tipidee_method_tonum (char const *) ;