--- parser3/src/include/pa_sapi.h 2001/03/24 14:30:57 1.2 +++ parser3/src/include/pa_sapi.h 2004/07/26 10:44:21 1.26 @@ -1,33 +1,45 @@ /** @file Parser: web server api interface object decl. - Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) - - Author: Alexander Petrosyan (http://design.ru/paf) - - $Id: pa_sapi.h,v 1.2 2001/03/24 14:30:57 paf Exp $ + Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexandr Petrosian (http://paf.design.ru) */ #ifndef PA_SAPI_H #define PA_SAPI_H -#include "pa_pool.h" +static const char * const IDENT_SAPI_H="$Date: 2004/07/26 10:44:21 $"; + +// includes + + #include "pa_types.h" +#include "pa_array.h" + +// forwards +class SAPI_Info; -/// target web-server api +/// target web-Server API struct SAPI { - /// get env - static const char *get_env(Pool& pool, const char *name); + /// log error message + static void log(SAPI_Info& info, const char* fmt, ...); + /// log error message & exit + static void die(const char* fmt, ...); + /// log error message & abort[write core] + static void abort(const char* fmt, ...); + /// environment strings + static const char* const* environment(SAPI_Info& info); + /// get environment string + static char* get_env(SAPI_Info& info, const char* name); /// read POST request bytes - static uint read_post(Pool& pool, char *buf, uint max_bytes); - /// add response header attribute - static void add_header_attribute(Pool& pool, const char *key, const char *value); - /// add response header attribute - static void send_header(Pool& pool); + static size_t read_post(SAPI_Info& info, char *buf, size_t max_bytes); + /// add response header attribute [but do not send it to client] + static void add_header_attribute(SAPI_Info& info, + const char* dont_store_key, const char* dont_store_value); + /// send collected header attributes to client + static void send_header(SAPI_Info& info); /// output body bytes - static void send_body(Pool& pool, const char *buf, size_t size); - /// log error message - static void log(Pool& pool, const char *fmt, ...); + static size_t send_body(SAPI_Info& info, const void *buf, size_t size); }; #endif