mod_tile 0.9.1
Renders map tiles with Mapnik and serves them using Apache HTTP Server
Loading...
Searching...
No Matches
renderd_config.h File Reference
#include "render_config.h"
#include "renderd.h"
#include <iniparser.h>

Go to the source code of this file.

Functions

double min_max_double_opt (const char *opt_arg, const char *opt_type_name, double minimum, double maximum)
 Parse and validate a double command-line or config option against optional bounds.
int min_max_int_opt (const char *opt_arg, const char *opt_type_name, int minimum, int maximum)
 Parse and validate an int command-line or config option against optional bounds.
void free_map_section (xmlconfigitem *map_section)
 Free all heap-allocated string fields inside a single xmlconfigitem and zero the struct.
void free_map_sections (xmlconfigitem *map_sections)
 Free all populated entries in an array of XMLCONFIGS_MAX map configurations.
void free_renderd_section (renderd_config *renderd_section)
 Free all heap-allocated string fields inside a single renderd_config and zero the struct.
void free_renderd_sections (renderd_config *renderd_sections)
 Free all populated entries in an array of MAX_SLAVES renderd instance configurations.
void process_config_file (const char *config_file_name, int active_renderd_section_num, int log_level)
 Load and parse a complete renderd.conf file and populate global configuration state.
void process_map_sections (const dictionary *ini, const char *config_file_name, xmlconfigitem *maps_dest, const char *default_tile_dir, int num_threads)
 Parse all map style sections from a renderd.conf INI file into maps_dest[].
void process_mapnik_section (const dictionary *ini, const char *config_file_name, renderd_config *config_dest)
 Parse the [mapnik] section from a renderd.conf INI file into config_dest.
void process_renderd_sections (const dictionary *ini, const char *config_file_name, renderd_config *configs_dest)
 Parse all [renderd] and [renderdN] sections from a renderd.conf INI file.

Variables

int num_maps
 Total number of map style sections parsed into maps[].
int num_slave_threads
 Sum of num_threads across all inactive (slave) [renderdN] sections.
renderd_config * config
 Pointer to the active renderd_config entry inside config_slaves[].
renderd_config config_slaves [5]
 Array of parsed [renderd] / [renderdN] instance configurations indexed by section number.
xmlconfigitem maps [100]
 Array of parsed map style configurations ([default], etc.) up to XMLCONFIGS_MAX.

Function Documentation

◆ free_map_section()

void free_map_section ( xmlconfigitem * map_section)

Free all heap-allocated string fields inside a single xmlconfigitem and zero the struct.

Parameters
map_sectionPointer to the xmlconfigitem structure to release.

◆ free_map_sections()

void free_map_sections ( xmlconfigitem * map_sections)

Free all populated entries in an array of XMLCONFIGS_MAX map configurations.

Parameters
map_sectionsArray of xmlconfigitem structures (XMLCONFIGS_MAX elements).

◆ free_renderd_section()

void free_renderd_section ( renderd_config * renderd_section)

Free all heap-allocated string fields inside a single renderd_config and zero the struct.

Parameters
renderd_sectionPointer to the renderd_config structure to release.

◆ free_renderd_sections()

void free_renderd_sections ( renderd_config * renderd_sections)

Free all populated entries in an array of MAX_SLAVES renderd instance configurations.

Parameters
renderd_sectionsArray of renderd_config structures (MAX_SLAVES elements).

◆ min_max_double_opt()

double min_max_double_opt ( const char * opt_arg,
const char * opt_type_name,
double minimum,
double maximum )

Parse and validate a double command-line or config option against optional bounds.

Terminates the process with exit(1) if opt_arg cannot be parsed as a floating-point number or violates [minimum, maximum] (where -1 disables the corresponding bound check).

Parameters
opt_argInput string to parse as a double.
opt_type_nameDescriptive option name used in error log messages.
minimumInclusive lower bound, or -1 to skip lower-bound validation.
maximumInclusive upper bound, or -1 to skip upper-bound validation.
Returns
Parsed and validated double value.

◆ min_max_int_opt()

int min_max_int_opt ( const char * opt_arg,
const char * opt_type_name,
int minimum,
int maximum )

Parse and validate an int command-line or config option against optional bounds.

Rejects non-numeric strings as well as fractional numbers (by comparing strtol() and strtof() results), and enforces [minimum, maximum] (where -1 disables a bound check). Terminates with exit(1) on invalid input.

Parameters
opt_argInput string to parse as an int.
opt_type_nameDescriptive option name used in error log messages.
minimumInclusive lower bound, or -1 to skip lower-bound validation.
maximumInclusive upper bound, or -1 to skip upper-bound validation.
Returns
Parsed and validated integer value.

◆ process_config_file()

void process_config_file ( const char * config_file_name,
int active_renderd_section_num,
int log_level )

Load and parse a complete renderd.conf file and populate global configuration state.

Orchestrates parsing of [renderd*] sections into config_slaves[], selects config = &config_slaves[active_renderd_section_num], parses [mapnik] into the active config, parses all map sections into maps[], totals num_slave_threads across non-active instances, and logs the effective runtime configuration.

Parameters
config_file_nameFilesystem path to renderd.conf.
active_renderd_section_numIndex (0 .. MAX_SLAVES - 1) of the [renderd*] section this process instance should run as.
log_levelGLib log level used to emit the parsed configuration summary.

◆ process_map_sections()

void process_map_sections ( const dictionary * ini,
const char * config_file_name,
xmlconfigitem * maps_dest,
const char * default_tile_dir,
int num_threads )

Parse all map style sections from a renderd.conf INI file into maps_dest[].

Treats every INI section whose name neither starts with "renderd" nor equals "mapnik" as a map configuration section. Parses tile dimensions, zoom range (0..MAX_ZOOM), scale factor (0.1..8.0), paths, HTCP settings, and space-delimited type (<ext> <mime> [format]), then verifies that at least one map exists and no earlier map's xmluri is a prefix of a later map's xmluri. Updates the global num_maps counter.

Parameters
iniPre-loaded iniparser dictionary, or NULL to load config_file_name locally.
config_file_namePath to the configuration file (used for loading if ini == NULL and in logs).
maps_destDestination array of XMLCONFIGS_MAX xmlconfigitem entries.
default_tile_dirFallback tile directory inherited from the active [renderd] section.
num_threadsActive worker thread count propagated to each xmlconfigitem.

◆ process_mapnik_section()

void process_mapnik_section ( const dictionary * ini,
const char * config_file_name,
renderd_config * config_dest )

Parse the [mapnik] section from a renderd.conf INI file into config_dest.

Extracts font_dir_recurse, font_dir, and plugins_dir. Exits with code 1 if the [mapnik] section is missing.

Parameters
iniPre-loaded iniparser dictionary, or NULL to load config_file_name locally.
config_file_namePath to the configuration file (used for loading if ini == NULL and in logs).
config_destDestination renderd_config structure receiving the Mapnik paths.

◆ process_renderd_sections()

void process_renderd_sections ( const dictionary * ini,
const char * config_file_name,
renderd_config * configs_dest )

Parse all [renderd] and [renderdN] sections from a renderd.conf INI file.

Maps [renderd] and [renderd0] to index 0, and [renderdN] (1 <= N < MAX_SLAVES) to index N in configs_dest[]. Resolves num_threads = -1 to the online CPU core count (sysconf(_SC_NPROCESSORS_ONLN)), validates Unix socket path length against sockaddr_un.sun_path, and rejects duplicate or out-of-range section indices.

Parameters
iniPre-loaded iniparser dictionary, or NULL to load config_file_name locally.
config_file_namePath to the configuration file (used for loading if ini == NULL and in logs).
configs_destDestination array of MAX_SLAVES renderd_config entries.

Variable Documentation

◆ config

renderd_config* config
extern

Pointer to the active renderd_config entry inside config_slaves[].

◆ config_slaves

renderd_config config_slaves[5]
extern

Array of parsed [renderd] / [renderdN] instance configurations indexed by section number.

◆ maps

xmlconfigitem maps[100]
extern

Array of parsed map style configurations ([default], etc.) up to XMLCONFIGS_MAX.

◆ num_maps

int num_maps
extern

Total number of map style sections parsed into maps[].

◆ num_slave_threads

int num_slave_threads
extern

Sum of num_threads across all inactive (slave) [renderdN] sections.