hook.h

00001 /*
00002  * Copyright (c) 2005-2012 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 #ifndef ENABLE_HOOKS
00025     #include <ctype.h>
00026     #define hook_create(hook) isspace(0)  /* nop */
00027     #define hook_free(hook) isspace(0)    /* nop */
00028 #else
00029 
00030 /* server init/term hooks */
00031 typedef int (*hook_server_init_t)(void);
00032 typedef int (*hook_server_term_t)(void);
00033 
00034 int hook_server_init( hook_server_init_t );
00035 int hook_server_term( hook_server_term_t );
00036 
00037 /* children init/term hooks */
00038 typedef int (*hook_child_init_t)(void);
00039 typedef int (*hook_child_term_t)(void);
00040 
00041 int hook_child_init( hook_child_init_t );
00042 int hook_child_term( hook_child_term_t );
00043 
00044 /* per-request hook */
00045 typedef int (*hook_request_t)(request_t *, response_t *);
00046 int hook_request( hook_request_t );
00047 
00048 /* server loop hook */
00049 typedef int (*hook_server_loop_t)(void);
00050 int hook_server_loop( hook_server_loop_t );
00051 
00052 /* hooks container object */
00053 int hook_create( hook_t **phook);
00054 int hook_free( hook_t *hook);
00055 
00056 /* user-provided function used to register hooks */
00057 void hooks_setup(void);
00058 
00059 #endif  /* ENABLE_HOOKS */
00060 
00061 #ifdef __cplusplus
00062 }
00063 #endif 
00064 
00065 #endif

←Products
Copyright © 2005-2012 - KoanLogic S.r.l. - All rights reserved