00001 /* 00002 * Copyright (c) 2005, 2006 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: context.h,v 1.13 2009/10/23 14:08:28 tho Exp $ 00009 */ 00010 00011 #ifndef _KLONE_CONTEXT_H_ 00012 #define _KLONE_CONTEXT_H_ 00013 00014 #include "klone_conf.h" 00015 #include <u/libu.h> 00016 #include <klone/server.h> 00017 #include <klone/backend.h> 00018 #include <klone/os.h> 00019 #include <klone/hook.h> 00020 00021 #ifdef __cplusplus 00022 extern "C" { 00023 #endif 00024 00025 /* global applicaton context */ 00026 typedef struct context_s 00027 { 00028 server_t *server; /* server object */ 00029 u_config_t *config; /* server config object */ 00030 backend_t *backend; /* the backend served by this child */ 00031 hook_t *hook; /* object that keep track of hooks */ 00032 char *ext_config; /* additional external config file */ 00033 char *pid_file; /* path of the PID file */ 00034 int debug; /* debugging on/off */ 00035 int daemon; /* daemon/service mode on/off */ 00036 char **arg; /* cmd line args array */ 00037 size_t narg; /* # of cmd line args */ 00038 int pipc; /* parent IPC socket descriptor */ 00039 int cgi; /* if we're in cgi mode */ 00040 int nochdir; /* do not chdir when daemon'izing */ 00041 00042 #ifdef OS_WIN 00043 SERVICE_STATUS_HANDLE hServiceStatus; 00044 SERVICE_STATUS status; 00045 enum { SERV_NOP, SERV_INSTALL, SERV_REMOVE } serv_op; 00046 /* install/remove service bindings */ 00047 #endif 00048 } context_t; 00049 00050 /* exported variable (see entry.c) */ 00051 extern context_t *ctx; 00052 00053 #ifdef __cplusplus 00054 } 00055 #endif 00056 00057 #endif