PyFCGI/include/conf.h

87 lines
2.4 KiB
C

/*
* Copyright (C) 2019 Weber Yann
*
* This file is part of PyFCGI.
*
* PyFCGI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PyFCGI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with PyFCGI. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CONF_H___
#define __CONF_H___
#include "config.h"
/**@defgroup conf_internal PYFCGI configuration handling
*/
/**@defgroup conf_glob PYFCGI global (for all process) configurations
* @see struct_pyfcgi_conf_s
* @ingroup conf_internal */
#include "logger.h"
/**@defgroup ret_status Function & process return status
*/
#define PYFCGI_ERR 16
/**@ingroup ret_status */
#define PYFCGI_WORKER_FAIL 32
/**@ingroup ret_status */
#define PYFCGI_MASTER_FAIL 64
/**@ingroup ret_status */
#define PYFCGI_FATAL 128
/**@brief Friendly name for @ref struct pyfcgi_conf_s
* @see struct pyfcgi_conf_s */
typedef struct pyfcgi_conf_s pyfcgi_conf_t;
typedef struct pyfcgi_conf_logger_s pyfcgi_conf_logger_t;
typedef struct pyfcgi_context_s pyfcgi_context_t;
struct pyfcgi_context_s {
pid_t pid;
pid_t ppid;
};
/**@brief Structure containing configuration
* @ingroup conf_internal
* The structure is used for the global @ref pyfcgi_conf variable.
* @see pyfcgi_conf_t
*/
struct pyfcgi_conf_s
{
/**@brief Entrypoint module name
* @ingroup conf_glob */
char *py_entrymod;
/**@brief Entrypoint function name
* @ingroup conf_glob */
char *py_entryfun;
/**@brief Minimum count worker in pool
* @ingroup conf_glob */
int min_wrk;
/**@brief Maximum count workers in pool
* @ingroup conf_glob */
int max_wrk;
/**@brief Maximum request before a worker restarts (0 for no restart)
* @ingroup conf_glob */
int max_reqs;
/**@brief Logger configuration
* @ingroupe conf_glob */
pyfcgi_conf_logger_t logs;
/**@brief Context informations */
pyfcgi_context_t context;
};
/**@brief Configuration globals, inherited from parent to childs */
pyfcgi_conf_t PyFCGI_conf;
#endif