summaryrefslogtreecommitdiff
path: root/daemon/httpauthd.h
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2008-07-21 19:35:56 +0000
committerStef Walter <stef@memberwebs.com>2008-07-21 19:35:56 +0000
commit4c4bfb64b62ff5b7b7fa21ec0185db797f434386 (patch)
tree531eaed845b2997a3d71edaf2a522a00ea9307da /daemon/httpauthd.h
parent56805d33c1ed477f6839074748bfa373db01c431 (diff)
- Rework event handling system so we don't use a full thread per
connection, but instead only use threads for active requests.
Diffstat (limited to 'daemon/httpauthd.h')
-rw-r--r--daemon/httpauthd.h38
1 files changed, 30 insertions, 8 deletions
diff --git a/daemon/httpauthd.h b/daemon/httpauthd.h
index e533dde..604c4db 100644
--- a/daemon/httpauthd.h
+++ b/daemon/httpauthd.h
@@ -22,6 +22,7 @@
#ifndef __HTTPAUTHD_H__
#define __HTTPAUTHD_H__
+#include <stdlib.h>
#include "buffer.h"
#include <syslog.h>
@@ -126,7 +127,7 @@ ha_context_t;
/* -----------------------------------------------------------------------
- * HTTP Auth Structures and Constants
+ * Request Stuff
*/
/*
@@ -175,6 +176,8 @@ ha_header_t;
typedef struct ha_request
{
unsigned int id; /* Unique connection identifier */
+ int ifd; /* Input file descriptor */
+ int ofd; /* Output file descriptor */
int req_type; /* The command type */
const char* req_args[HA_MAX_ARGS]; /* Arguments for the command */
@@ -185,11 +188,14 @@ typedef struct ha_request
const char* digest_domain;
char** requested_groups;
+ /* Shortcut to req_buf below, for compatibility */
+ ha_buffer_t *buf;
+
/* The buffer in use for the request */
- ha_buffer_t* buf;
+ ha_buffer_t req_buf;
/* The buffer in use for the connection */
- ha_buffer_t* conn_buf;
+ ha_buffer_t conn_buf;
int resp_code; /* The response code */
const char* resp_detail; /* The details for response */
@@ -212,7 +218,25 @@ const char* ha_getheader(const ha_request_t* rq, const char* name, const char* p
/* Response functions */
void ha_addheader(ha_request_t* rq, const char* name, const char* data);
-/* Configuration functions */
+/* Implemented in request.c */
+void ha_request_destroy (ha_request_t *rq);
+ha_request_t* ha_request_setup (int ifd, int ofd);
+void ha_request_setup_handler (void *arg);
+int ha_request_process (ha_request_t *rq);
+void ha_request_process_handler (void *arg);
+void ha_request_loop (int ifd, int ofd);
+
+/* Implemented in httpauthd.c */
+int ha_register_request (ha_request_t *rq);
+int ha_register_watch (ha_request_t *rq);
+void ha_unregister_request (ha_request_t *rq);
+ha_context_t* ha_lookup_handler (const char *name);
+
+
+/* -----------------------------------------------------------------------
+ * Configuration
+ */
+
int ha_confbool(const char* name, const char* conf, int* value);
int ha_confint(const char* name, const char* conf, int min, int max, int* value);
@@ -261,13 +285,12 @@ char* ha_uriformat(ha_buffer_t* buf, const ha_uri_t* uri);
int ha_uriparse(ha_buffer_t* buf, const char* suri, ha_uri_t* uri);
int ha_uricmp(ha_uri_t* one, ha_uri_t* two);
-
/* -----------------------------------------------------------------------
* Locking
*/
-void ha_lock();
-void ha_unlock();
+void ha_lock (pthread_mutex_t* mtx);
+void ha_unlock (pthread_mutex_t* mtx);
/* -----------------------------------------------------------------------
@@ -276,5 +299,4 @@ void ha_unlock();
int ha_genrandom(unsigned char* data, size_t len);
-
#endif /* __HTTPAUTHD_H__ */