00001 /* 00002 * Copyright (c) 2005, 2007 by KoanLogic s.r.l. <http://www.koanlogic.com> 00003 * All rights reserved. 00004 * 00005 * This file is part of KLone, and as such it is subject to the license stated 00006 * in the LICENSE file which you have received as part of this distribution. 00007 * 00008 * $Id: hook.h,v 1.2 2007/09/04 19:48:39 tat Exp $ 00009 */ 00010 00011 #ifndef _KLONE_HOOK_H_ 00012 #define _KLONE_HOOK_H_ 00013 #include <klone/request.h> 00014 #include <klone/response.h> 00015 #include <klone/session.h> 00016 00017 struct hook_s; 00018 typedef struct hook_s hook_t; 00019 00020 #ifdef __cplusplus 00021 extern "C" { 00022 #endif 00023 00024 /* server init/term hooks */ 00025 typedef int (*hook_server_init_t)(void); 00026 typedef int (*hook_server_term_t)(void); 00027 00028 int hook_server_init( hook_server_init_t ); 00029 int hook_server_term( hook_server_term_t ); 00030 00031 /* children init/term hooks */ 00032 typedef int (*hook_child_init_t)(void); 00033 typedef int (*hook_child_term_t)(void); 00034 00035 int hook_child_init( hook_child_init_t ); 00036 int hook_child_term( hook_child_term_t ); 00037 00038 /* per-request hook */ 00039 typedef int (*hook_request_t)(request_t *, response_t *); 00040 int hook_request( hook_request_t ); 00041 00042 /* hooks container object */ 00043 int hook_create( hook_t **phook); 00044 int hook_free( hook_t *hook); 00045 00046 #ifdef ENABLE_HOOKS 00047 /* user-provided function used to register hooks */ 00048 void hooks_setup(void); 00049 #endif 00050 00051 #ifdef __cplusplus 00052 } 00053 #endif 00054 00055 #endif