summaryrefslogtreecommitdiff
path: root/src/keyvalue.h
diff options
context:
space:
mode:
authorJan Kneschke <jan@kneschke.de>2005-02-20 14:27:00 +0000
committerJan Kneschke <jan@kneschke.de>2005-02-20 14:27:00 +0000
commitbcdc6a3bbcde8e66da41aa2311642e53f4fc7c9b (patch)
treea0536d23ba17a40c236fc3cd2a4a133110ae7501 /src/keyvalue.h
downloadlighttpd-git-bcdc6a3bbcde8e66da41aa2311642e53f4fc7c9b.tar.gz
moved everything below trunk/ and added branches/ and tags/
git-svn-id: svn://svn.lighttpd.net/lighttpd/trunk@30 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'src/keyvalue.h')
-rw-r--r--src/keyvalue.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/keyvalue.h b/src/keyvalue.h
new file mode 100644
index 00000000..3c1f0519
--- /dev/null
+++ b/src/keyvalue.h
@@ -0,0 +1,80 @@
+#ifndef _KEY_VALUE_H_
+#define _KEY_VALUE_H_
+
+#include "config.h"
+
+#ifdef HAVE_PCRE_H
+# include <pcre.h>
+#endif
+
+typedef enum { HTTP_METHOD_UNSET = -1, HTTP_METHOD_GET, HTTP_METHOD_POST, HTTP_METHOD_HEAD } http_method_t;
+typedef enum { HTTP_VERSION_UNSET = -1, HTTP_VERSION_1_0, HTTP_VERSION_1_1 } http_version_t;
+
+typedef struct {
+ int key;
+
+ char *value;
+} keyvalue;
+
+typedef struct {
+ char *key;
+
+ char *value;
+} s_keyvalue;
+
+typedef struct {
+#ifdef HAVE_PCRE_H
+ pcre *key;
+#endif
+
+ char *value;
+} pcre_keyvalue;
+
+typedef enum { HTTP_AUTH_BASIC, HTTP_AUTH_DIGEST } httpauth_type;
+
+typedef struct {
+ char *key;
+
+ char *realm;
+ httpauth_type type;
+} httpauth_keyvalue;
+
+#define KVB(x) \
+typedef struct {\
+ x **kv; \
+ size_t used;\
+ size_t size;\
+} x ## _buffer
+
+KVB(keyvalue);
+KVB(s_keyvalue);
+KVB(httpauth_keyvalue);
+KVB(pcre_keyvalue);
+
+const char *get_http_status_name(int i);
+const char *get_http_version_name(int i);
+const char *get_http_method_name(http_method_t i);
+const char *get_http_status_body_name(int i);
+int get_http_version_key(const char *s);
+http_method_t get_http_method_key(const char *s);
+
+const char *keyvalue_get_value(keyvalue *kv, int k);
+int keyvalue_get_key(keyvalue *kv, const char *s);
+
+keyvalue_buffer *keyvalue_buffer_init(void);
+int keyvalue_buffer_append(keyvalue_buffer *kvb, int k, const char *value);
+void keyvalue_buffer_free(keyvalue_buffer *kvb);
+
+s_keyvalue_buffer *s_keyvalue_buffer_init(void);
+int s_keyvalue_buffer_append(s_keyvalue_buffer *kvb, const char *key, const char *value);
+void s_keyvalue_buffer_free(s_keyvalue_buffer *kvb);
+
+httpauth_keyvalue_buffer *httpauth_keyvalue_buffer_init(void);
+int httpauth_keyvalue_buffer_append(httpauth_keyvalue_buffer *kvb, const char *key, const char *realm, httpauth_type type);
+void httpauth_keyvalue_buffer_free(httpauth_keyvalue_buffer *kvb);
+
+pcre_keyvalue_buffer *pcre_keyvalue_buffer_init(void);
+int pcre_keyvalue_buffer_append(pcre_keyvalue_buffer *kvb, const char *key, const char *value);
+void pcre_keyvalue_buffer_free(pcre_keyvalue_buffer *kvb);
+
+#endif