/usr/include/c_icap/cfg_param.h is in libicapapi-dev 1:0.4.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | /*
* Copyright (C) 2004-2008 Christos Tsantilas
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA.
*/
#ifndef __CFG_PARAM_H
#define __CFG_PARAM_H
#include "body.h"
#ifdef __cplusplus
extern "C"
{
#endif
struct ci_magics_db;
/**
\defgroup CONFIG c-icap server configuration API
\ingroup API
*
*/
/**
* This struct holds the basic configurations of c-icap server. It passed as argument to
* services and modules inititalization functions
\ingroup CONFIG
*
* Do not use directly this struct but better use the documended macros and functions
*/
struct ci_server_conf{
char *ADDRESS;
int PORT;
int PROTOCOL_FAMILY;
char *TMPDIR;
char *PIDFILE;
char *COMMANDS_SOCKET;
char *RUN_USER;
char *RUN_GROUP;
char *cfg_file;
char *magics_file;
struct ci_magics_db *MAGIC_DB;
char *SERVICES_DIR;
char *MODULES_DIR;
char *SERVER_ADMIN;
char *SERVER_NAME;
int START_SERVERS;
int MAX_SERVERS;
int THREADS_PER_CHILD;
int MIN_SPARE_THREADS;
int MAX_SPARE_THREADS;
};
/**
* This struct holds a configuration parameter of c-icap server.
\ingroup CONFIG
* An array of ci_conf_entry structs can be used to define the configuration directives
* of a service or module which can be set in c-icap configuration file.
\code
int AParam;
struct ci_conf_entry conf_table[]= {
{"Aparameter", &AParam, ci_cfg_set_int, "This is a simple configuration parameter"},
{NULL,NULL,NULL,NULL}
}
\endcode
In the above example the ci_cfg_set_int function is predefined.
If the table "conf_table" attached to the service "AService" then the AParam integer variable can be set from the
c-icap configuration file using the directive "AService.Aparameter"
*/
struct ci_conf_entry{
/**
* The configuration directive
*/
const char *name;
/**
* A pointer to the configuration data
*/
void *data;
/**
* Pointer to the function which will be used to set configuration data.
\param name is the configuration directive.It passed as argument by the c-icap server
\param argv is a NULL termined string array which holds the list of arguments of configuration parameter
\param setdata is o pointer to set data which passed as argument by c-icap server
\return Non zero on success, zero otherwise
*/
int (*action)(const char *name, const char **argv,void *setdata);
/**
* A description message
*/
const char *msg;
};
/* Command line options implementation structure */
struct ci_options_entry{
const char *name;
const char *parameter;
void *data;
int (*action)(const char *name, const char **argv,void *setdata);
const char *msg;
};
/*Struct for storing default parameter values*/
struct cfg_default_value{
void *param;
void *value;
int size;
struct cfg_default_value *next;
};
#define MAIN_TABLE 1
#define ALIAS_TABLE 2
#ifndef CI_BUILD_LIB
extern struct ci_server_conf CI_CONF;
struct cfg_default_value * cfg_default_value_store(void *param, void *value,int size);
struct cfg_default_value * cfg_default_value_replace(void *param, void *value);
void * cfg_default_value_restore(void *value);
struct cfg_default_value * cfg_default_value_search(void *param);
int register_conf_table(const char *name,struct ci_conf_entry *table,int type);
struct ci_conf_entry * unregister_conf_table(const char *name);
int config(int argc, char **argv);
int intl_cfg_set_str(const char *directive,const char **argv,void *setdata);
int intl_cfg_set_int(const char *directive,const char **argv,void *setdata);
int intl_cfg_onoff(const char *directive,const char **argv,void *setdata);
int intl_cfg_disable(const char *directive,const char **argv,void *setdata);
int intl_cfg_enable(const char *directive,const char **argv,void *setdata);
int intl_cfg_size_off(const char *directive,const char **argv,void *setdata);
int intl_cfg_size_long(const char *directive,const char **argv,void *setdata);
#endif
CI_DECLARE_FUNC(void) ci_cfg_lib_init();
CI_DECLARE_FUNC(void) ci_cfg_lib_reset();
CI_DECLARE_FUNC(void *) ci_cfg_alloc_mem(int size);
/**
* Sets a string configuration parameter. The setdata are a pointer to a string pointer
\ingroup CONFIG
*/
CI_DECLARE_FUNC(int) ci_cfg_set_str(const char *directive,const char **argv,void *setdata);
/**
* Sets an int configuration parameter. The setdata is a pointer to an integer
\ingroup CONFIG
*/
CI_DECLARE_FUNC(int) ci_cfg_set_int(const char *directive,const char **argv,void *setdata);
/**
* Sets an on/off configuration parameter. The setdata is a pointer to an integer, which
* when the argument is "on" it is set to 1 and when the argument is "off" it is set to 0.
\ingroup CONFIG
*/
CI_DECLARE_FUNC(int) ci_cfg_onoff(const char *directive,const char **argv,void *setdata);
/**
* Can used with configuration parameters which does not takes arguments but when defined just disable a feature.
* The setdata is a pointer to an int which is set to zero.
\ingroup CONFIG
*/
CI_DECLARE_FUNC(int) ci_cfg_disable(const char *directive,const char **argv,void *setdata);
/**
* Can used with configuration parameters which does not takes arguments but when defined just enable a feature.
* The setdata is a pointer to an int which is set to non zero.
\ingroup CONFIG
*/
CI_DECLARE_FUNC(int) ci_cfg_enable(const char *directive,const char **argv,void *setdata);
/**
* Sets a configuration parameter of type ci_off_t (typedef of off_t type).
\ingroup CONFIG
*/
CI_DECLARE_FUNC(int) ci_cfg_size_off(const char *directive,const char **argv,void *setdata);
/**
* Sets a configuration parameter of type long.
\ingroup CONFIG
*/
CI_DECLARE_FUNC(int) ci_cfg_size_long(const char *directive,const char **argv,void *setdata);
CI_DECLARE_FUNC(void) ci_args_usage(const char *progname,struct ci_options_entry *options);
CI_DECLARE_FUNC(int) ci_args_apply(int argc, char *argv[],struct ci_options_entry *options);
#ifdef __CI_COMPAT
#define icap_server_conf ci_server_conf
#define conf_entry ci_conf_entry
#define options_entry ci_options_entry
#endif
#ifdef __cplusplus
}
#endif
#endif
|