From 0bc8575dbfb281f5f5e9fb530247d29ba1f296fc Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Fri, 7 May 2004 17:52:22 +0000 Subject: Protocol: - version added to initial Ready - Added SET command - Added 202 Accept response Some structure changes --- daemon/httpauthd.h | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'daemon/httpauthd.h') diff --git a/daemon/httpauthd.h b/daemon/httpauthd.h index d225e4b..ce5b21b 100644 --- a/daemon/httpauthd.h +++ b/daemon/httpauthd.h @@ -131,7 +131,7 @@ typedef int (*auth_config_t)(struct ha_context* ctx, const char* name, const cha * for this handler. Note that all data access in this * function must be thread-safe. */ -typedef int (*auth_process_t)(struct ha_context* ctx, struct ha_request* req, +typedef int (*auth_process_t)(struct ha_context* ctx, const struct ha_request* req, struct ha_response* resp, ha_buffer_t* mem); /* An authentication handler */ @@ -143,7 +143,7 @@ typedef struct ha_handler auth_config_t f_config; /* #0 Called for each config param */ auth_process_t f_process; /* #2 Called for each auth request */ const void* context_default; /* The default context */ - size_t context_size; /* Bytes of extra context needed */ + const size_t context_size; /* Bytes of extra context needed */ } ha_handler_t; @@ -176,8 +176,8 @@ ha_handler_t; - -typedef struct ha_options +/* Standard options for the current context */ +typedef struct ha_context_opts { /* Basic options */ unsigned int types; @@ -190,18 +190,17 @@ typedef struct ha_options /* For digest auth: */ unsigned int digest_ignoreuri : 1; unsigned int digest_ignorenc : 1; - const char* digest_domains; const char* digest_debugnonce; } -ha_options_t; +ha_context_opts_t; -/* Context passed to the handler functions below */ +/* Context passed to the handler functions above */ typedef struct ha_context { - const char* name; /* A name assigned by the configuration file */ - ha_handler_t* handler; /* The original handler structure */ - ha_options_t opts; /* The options */ - void* data; /* Handler specific data */ + const char* name; /* A name assigned by the configuration file */ + const ha_handler_t* handler; /* The original handler structure */ + const ha_context_opts_t* opts; /* The options */ + void* data; /* Handler specific data */ } ha_context_t; @@ -246,23 +245,33 @@ ha_header_t; #define REQTYPE_IGNORE 0 #define REQTYPE_QUIT 1 #define REQTYPE_AUTH 2 +#define REQTYPE_SET 3 #define AUTH_ARG_CONN 1 #define AUTH_ARG_METHOD 2 #define AUTH_ARG_URI 3 +/* Options for the current request */ +typedef struct ha_request_opts +{ + const char* digest_domains; +} +ha_request_opts_t; + /* A single request from client */ typedef struct ha_request { int type; const char* args[HA_MAX_ARGS]; ha_header_t headers[HA_MAX_HEADERS]; + const ha_request_opts_t* opts; } ha_request_t; /* The various response codes for the client */ #define HA_SERVER_READY 100 -#define HA_SERVER_ACCEPT 200 +#define HA_SERVER_OK 200 +#define HA_SERVER_ACCEPTED 202 #define HA_SERVER_DECLINE 401 #define HA_SERVER_BADREQ 400 #define HA_SERVER_BUSY 500 @@ -277,8 +286,8 @@ typedef struct ha_response ha_response_t; /* Request functions */ -ha_header_t* ha_findheader(ha_request_t* req, const char* name); -const char* ha_getheader(ha_request_t* req, const char* name, const char* prefix); +const ha_header_t* ha_findheader(const ha_request_t* req, const char* name); +const char* ha_getheader(const ha_request_t* req, const char* name, const char* prefix); /* Response functions */ void ha_addheader(ha_response_t* resp, const char* name, const char* data); -- cgit v1.2.3