mod_tile 0.9.1
Renders map tiles with Mapnik and serves them using Apache HTTP Server
Loading...
Searching...
No Matches
mod_tile.c File Reference
#include <ap_config.h>
#include <apr.h>
#include <apr_errno.h>
#include <apr_file_info.h>
#include <apr_global_mutex.h>
#include <apr_hooks.h>
#include <apr_pools.h>
#include <apr_portable.h>
#include <apr_proc_mutex.h>
#include <apr_shm.h>
#include <apr_strings.h>
#include <apr_tables.h>
#include <apr_thread_proc.h>
#include <apr_time.h>
#include <apr_want.h>
#include <arpa/inet.h>
#include <errno.h>
#include <httpd.h>
#include <http_config.h>
#include <http_log.h>
#include <http_protocol.h>
#include <http_request.h>
#include <inttypes.h>
#include <limits.h>
#include <netdb.h>
#include <netinet/in.h>
#include <poll.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/un.h>
#include <unistd.h>
#include <util_cfgtree.h>
#include <util_md5.h>
#include "config.h"
#include "mod_tile.h"
#include "protocol.h"
#include "render_config.h"
#include "renderd.h"
#include "renderd_config.h"
#include "store.h"
#include "sys_utils.h"
#include <unixd.h>

Classes

struct  storage_backends
 Per-worker-thread array of initialized storage backend instances indexed by layer number. More...

Macros

#define APR_WANT_STRFUNC
#define APR_WANT_MEMFUNC
#define MOD_TILE_SET_MUTEX_PERMS
 Enable POSIX file-permission adjustment on APR global mutexes for Apache child processes.

Functions

 APLOG_USE_MODULE (tile)
static int error_message (request_rec *r, const char *format,...)
 Send a formatted plain-text diagnostic response body with HTTP 200 status.
static int get_global_lock (request_rec *r, apr_global_mutex_t *mutex)
 Attempt to acquire an APR cross-process global mutex with bounded spin-sleep retries.
static int get_stats_copy (request_rec *r, tile_server_conf *scfg, stats_data **stats_copy)
 Snapshot shared-memory statistics into request-pool memory under stats_mutex.
static int socket_init (request_rec *r)
 Open and connect a stream socket to the renderd daemon over TCP or UNIX domain socket.
static int request_tile (request_rec *r, struct protocol *cmd, int renderImmediately)
 Submit a tile render or dirty invalidation request to renderd and optionally wait for completion.
static apr_status_t cleanup_storage_backend (void *data)
 APR pool cleanup callback closing all per-thread storage backends when a worker thread exits.
static struct storage_backend * get_storage_backend (request_rec *r, int tile_layer)
 Retrieve or lazily initialize the thread-local storage backend for a given map layer.
static enum tileState tile_state (request_rec *r, struct protocol *cmd)
 Query the storage backend to determine whether a tile is missing, current, old, or very old.
static int add_cors (request_rec *r, const char *cors)
 Validate incoming Origin headers and attach Cross-Origin Resource Sharing (CORS) response headers.
static void add_expiry (request_rec *r, struct protocol *cmd)
 Compute and attach HTTP Cache-Control (max-age) and Expires response headers.
static int incRespCounter (int resp, request_rec *r, struct protocol *cmd, int layerNumber)
 Increment shared-memory HTTP response status, zoom-level, and per-layer counters.
static int incFreshCounter (int status, request_rec *r)
 Increment shared-memory cache-hit vs. on-demand-render outcome counters.
static int incTimingCounter (apr_uint64_t duration, int z, request_rec *r)
 Record tile storage retrieval duration (in microseconds) in shared-memory timing statistics.
static int delay_allowed (request_rec *r, enum tileState state)
 Enforce per-client IP token-bucket rate limits for tile and render requests.
static int tile_storage_hook (request_rec *r)
 Apache map_to_storage hook managing tile freshness checks, throttling, load shedding, and on-demand rendering.
static apr_status_t safe_parse_int (const char *str, int *result)
 Parse a base-10 integer string strictly, rejecting empty or trailing non-numeric characters.
static void get_extension (char *filename, char *ext_dest, size_t dest_len)
 Split a filename's trailing extension at the last '.' character in place.
static int tile_translate (request_rec *r)
 Apache translate_name hook mapping incoming URIs to mod_tile handlers and tile coordinates.
static int tile_handler_dirty (request_rec *r)
 Apache content handler for .../dirty tile invalidation URLs (tile_dirty).
static int tile_handler_status (request_rec *r)
 Apache content handler for .../status tile diagnostic URLs (tile_status).
static int tile_handler_json (request_rec *r)
 Apache content handler serving a TileJSON 2.0.0 metadata document (tile_json).
static int tile_handler_mod_stats (request_rec *r)
 Apache content handler rendering legacy plain-text mod_tile statistics at /mod_tile.
static int tile_handler_metrics (request_rec *r)
 Apache content handler exporting Prometheus-formatted metrics at /metrics.
static int tile_handler_serve (request_rec *r)
 Primary Apache content handler reading and serving tile payloads (tile_serve).
static int mod_tile_post_config (apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
 Apache post_config hook allocating shared-memory segments and cross-process mutexes in the parent process.
static void mod_tile_child_init (apr_pool_t *p, server_rec *s)
 Apache child_init hook reopening the global statistics mutex in each forked worker process.
static void register_hooks (__attribute__((unused)) apr_pool_t *p)
 Register all mod_tile lifecycle, URI translation, storage mapping, and content hooks with Apache.
static const char * _add_tile_config (cmd_parms *cmd, const char *baseuri, const char *name, int minzoom, int maxzoom, int aspect_x, int aspect_y, const char *fileExtension, const char *mimeType, const char *description, const char *attribution, const char *server_alias, const char *cors, const char *tile_dir, const int enableOptions)
 Append and normalize a map layer configuration (tile_config_rec) on the target virtual host.
static const char * add_tile_mime_config (cmd_parms *cmd, void *mconfig, const char *baseuri, const char *name, const char *fileExtension)
 Apache directive handler for deprecated AddTileMimeConfig <baseuri> <name> <extension>.
static const char * add_tile_config (cmd_parms *cmd, void *mconfig, int argc, char *const argv[])
 Apache directive handler for AddTileConfig <baseuri> <name> [key=value ...].
static const char * load_tile_config (cmd_parms *cmd, void *mconfig, const char *config_file_name)
 Apache directive handler for LoadTileConfigFile <path> importing map sections from renderd.conf.
static const char * arg_to_apr_int64_t (cmd_parms *cmd, const char *buf, apr_int64_t *dest, const char *config_directive_name)
 Parse a directive argument as a 64-bit signed integer (apr_int64_t).
static const char * arg_to_double (cmd_parms *cmd, const char *buf, double *dest, const char *config_directive_name)
 Parse a directive argument as a floating-point double.
static const char * arg_to_int (cmd_parms *cmd, const char *buf, int *dest, const char *config_directive_name)
 Parse a directive argument as a standard int.
static const char * arg_to_string (cmd_parms *cmd, const char *buf, const char **dest, const char *config_directive_name)
 Duplicate a directive string argument into cmd->pool (bounded by PATH_MAX).
static const char * mod_tile_request_timeout_config (cmd_parms *cmd, void *mconfig, const char *request_timeout_string)
 Apache directive handler for ModTileRequestTimeout <seconds>.
static const char * mod_tile_request_timeout_priority_config (cmd_parms *cmd, void *mconfig, const char *request_timeout_priority_string)
 Apache directive handler for ModTileMissingRequestTimeout <seconds>.
static const char * mod_tile_max_load_old_config (cmd_parms *cmd, void *mconfig, const char *max_load_old_string)
 Apache directive handler for ModTileMaxLoadOld <load>.
static const char * mod_tile_max_load_missing_config (cmd_parms *cmd, void *mconfig, const char *max_load_missing_string)
 Apache directive handler for ModTileMaxLoadMissing <load>.
static const char * mod_tile_very_old_threshold_config (cmd_parms *cmd, void *mconfig, const char *very_old_threshold_string)
 Apache directive handler for ModTileVeryOldThreshold <microseconds>.
static const char * mod_tile_renderd_socket_name_config (cmd_parms *cmd, void *mconfig, const char *renderd_socket_name_string)
 Apache directive handler for ModTileRenderdSocketName <path>.
static const char * mod_tile_renderd_socket_address_config (cmd_parms *cmd, void *mconfig, const char *renderd_socket_address_string, const char *renderd_socket_port_string)
 Apache directive handler for ModTileRenderdSocketAddr <host> <port>.
static const char * mod_tile_tile_dir_config (cmd_parms *cmd, void *mconfig, const char *tile_dir_string)
 Apache directive handler for ModTileTileDir <path_or_uri>.
static const char * mod_tile_cache_extended_hostname_config (cmd_parms *cmd, void *mconfig, const char *cache_extended_hostname_string)
 Apache directive handler for ModTileCacheExtendedHostName <hostname>.
static const char * mod_tile_cache_extended_duration_config (cmd_parms *cmd, void *mconfig, const char *cache_extended_duration_string)
 Apache directive handler for ModTileCacheExtendedDuration <seconds>.
static const char * mod_tile_cache_duration_last_modified_factor_config (cmd_parms *cmd, void *mconfig, const char *cache_duration_last_modified_factor_string)
 Apache directive handler for ModTileCacheLastModifiedFactor <factor>.
static const char * mod_tile_cache_duration_max_config (cmd_parms *cmd, void *mconfig, const char *cache_duration_max_string)
 Apache directive handler for ModTileCacheDurationMax <seconds>.
static const char * mod_tile_cache_duration_dirty_config (cmd_parms *cmd, void *mconfig, const char *cache_duration_dirty_string)
 Apache directive handler for ModTileCacheDurationDirty <seconds>.
static const char * mod_tile_cache_duration_minimum_config (cmd_parms *cmd, void *mconfig, const char *cache_duration_minimum_string)
 Apache directive handler for ModTileCacheDurationMinimum <seconds>.
static const char * mod_tile_cache_duration_low_config (cmd_parms *cmd, void *mconfig, const char *cache_level_low_zoom_string, const char *cache_duration_low_zoom_string)
 Apache directive handler for ModTileCacheDurationLowZoom <max_zoom> <seconds>.
static const char * mod_tile_cache_duration_medium_config (cmd_parms *cmd, void *mconfig, const char *cache_level_medium_zoom_string, const char *cache_duration_medium_zoom_string)
 Apache directive handler for ModTileCacheDurationMediumZoom <max_zoom> <seconds>.
static const char * mod_tile_enable_stats (cmd_parms *cmd, void *mconfig, int enable_global_stats)
 Apache flag directive handler for ModTileEnableStats <On|Off>.
static const char * mod_tile_enable_throttling (cmd_parms *cmd, void *mconfig, int enable_tile_throttling)
 Apache flag directive handler for ModTileEnableTileThrottling <On|Off>.
static const char * mod_tile_enable_throttling_xforward (cmd_parms *cmd, void *mconfig, const char *enable_tile_throttling_xforward_string)
 Apache directive handler for ModTileEnableTileThrottlingXForward <0|1|2>.
static const char * mod_tile_enable_bulk_mode (cmd_parms *cmd, void *mconfig, int enable_bulk_mode)
 Apache flag directive handler for ModTileBulkMode <On|Off>.
static const char * mod_tile_enable_status_url (cmd_parms *cmd, void *mconfig, int enable_status_url)
 Apache flag directive handler for ModTileEnableStatusURL <On|Off>.
static const char * mod_tile_enable_dirty_url (cmd_parms *cmd, void *mconfig, int enable_dirty_url)
 Apache flag directive handler for ModTileEnableDirtyURL <On|Off>.
static const char * mod_tile_delaypool_tiles_config (cmd_parms *cmd, void *mconfig, const char *delaypool_tile_size_string, const char *top_up_tile_rate_string)
 Apache directive handler for ModTileThrottlingTiles <bucket_size> <tiles_per_sec>.
static const char * mod_tile_delaypool_render_config (cmd_parms *cmd, void *mconfig, const char *delaypool_render_size_string, const char *top_up_render_rate_string)
 Apache directive handler for ModTileThrottlingRenders <bucket_size> <renders_per_sec>.
static void * create_tile_config (apr_pool_t *p, server_rec *s)
 Allocate and initialize default tile_server_conf settings for a server or virtual host.
static void * merge_tile_config (apr_pool_t *p, void *basev, void *overridesv)
 Merge base server and virtual-host tile_server_conf records and precompute mincachetime[].

Variables

module_rec tile_module
 Apache HTTP Server module structure declaration for mod_tile.
apr_shm_t * stats_shm
 Shared-memory segment holding global and per-layer stats_data counters across worker processes.
apr_shm_t * delaypool_shm
 Shared-memory segment holding the per-client IP rate-limiting delaypool table.
apr_global_mutex_t * stats_mutex
 Cross-process mutex serializing reads and updates to stats_shm.
apr_global_mutex_t * delaypool_mutex
 Cross-process mutex serializing reads and updates to delaypool_shm.
char * stats_mutexfilename
 Filesystem lockfile path backing stats_mutex.
char * delaypool_mutexfilename
 Filesystem lockfile path backing delaypool_mutex.
int layerCount = 0
 Total number of configured map layers registered across all virtual hosts.
int global_max_zoom = 0
 Highest maxzoom configured across all registered map layers.
static const command_rec tile_cmds []
 Apache configuration directive dispatch table for mod_tile.

Macro Definition Documentation

◆ APR_WANT_MEMFUNC

#define APR_WANT_MEMFUNC

◆ APR_WANT_STRFUNC

#define APR_WANT_STRFUNC

◆ MOD_TILE_SET_MUTEX_PERMS

#define MOD_TILE_SET_MUTEX_PERMS

Enable POSIX file-permission adjustment on APR global mutexes for Apache child processes.

Function Documentation

◆ _add_tile_config()

const char * _add_tile_config ( cmd_parms * cmd,
const char * baseuri,
const char * name,
int minzoom,
int maxzoom,
int aspect_x,
int aspect_y,
const char * fileExtension,
const char * mimeType,
const char * description,
const char * attribution,
const char * server_alias,
const char * cors,
const char * tile_dir,
const int enableOptions )
static

Append and normalize a map layer configuration (tile_config_rec) on the target virtual host.

Normalizes trailing slashes on baseuri, fills defaults for attribution and tile_dir, constructs TileJSON host URL arrays from server_hostname and server_alias, updates global_max_zoom, and increments layerCount.

Parameters
cmdApache configuration command parameters.
baseuriBase URI path prefix for this layer (e.g., "/osm/").
nameTarget map style identifier (xmlname) in renderd.
minzoomMinimum allowed zoom level.
maxzoomMaximum allowed zoom level.
aspect_xHorizontal projection aspect ratio multiplier.
aspect_yVertical projection aspect ratio multiplier.
fileExtensionTile filename extension without leading dot (e.g., "png").
mimeTypeHTTP Content-Type string (e.g., "image/png").
descriptionHuman-readable layer description for TileJSON.
attributionAttribution HTML/text string (defaults to DEFAULT_ATTRIBUTION when empty).
server_aliasOptional secondary TileJSON host URL.
corsOptional CORS policy string ("" disables CORS).
tile_dirOptional per-layer storage URI/path ("" inherits scfg->tile_dir).
enableOptionsNon-zero to enable style parameterization options in URLs.
Returns
NULL on success (standard Apache directive handler convention).

◆ add_cors()

int add_cors ( request_rec * r,
const char * cors )
static

Validate incoming Origin headers and attach Cross-Origin Resource Sharing (CORS) response headers.

Handles both standard GET/HEAD requests and OPTIONS preflight requests against the configured CORS policy ("*" or allowed origin substring list).

Parameters
rActive Apache HTTP request record.
corsConfigured CORS policy string ("*" or space/comma-separated origins).
Returns
DONE when headers are added (or no Origin header is present), OK for a valid OPTIONS preflight request, or HTTP_FORBIDDEN if the origin is disallowed.

◆ add_expiry()

void add_expiry ( request_rec * r,
struct protocol * cmd )
static

Compute and attach HTTP Cache-Control (max-age) and Expires response headers.

Selects max-age based on extended-cache hostname rules, stale/dirty tile status, or zoom-level minimum cache durations combined with last-modified age scaling, randomized jitter (to prevent synchronized cache stampedes), and scfg->cache_duration_max.

Parameters
rActive Apache HTTP request record.
cmdWire protocol descriptor specifying the tile zoom level z.

◆ add_tile_config()

const char * add_tile_config ( cmd_parms * cmd,
void * mconfig,
int argc,
char *const argv[] )
static

Apache directive handler for AddTileConfig <baseuri> <name> [key=value ...].

Parses optional minzoom, maxzoom, extension, mimetype, and tile_dir key-value arguments and registers the layer via _add_tile_config().

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
argcNumber of directive arguments.
argvArray of directive argument strings.
Returns
NULL on success, or an error message string if required arguments or zoom bounds are invalid.

◆ add_tile_mime_config()

const char * add_tile_mime_config ( cmd_parms * cmd,
void * mconfig,
const char * baseuri,
const char * name,
const char * fileExtension )
static

Apache directive handler for deprecated AddTileMimeConfig <baseuri> <name> <extension>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
baseuriBase URI path prefix for the layer.
nameMap style identifier (xmlname).
fileExtensionTile filename extension without leading dot.
Returns
NULL on success, or an error string on failure.

◆ APLOG_USE_MODULE()

APLOG_USE_MODULE ( tile )

◆ arg_to_apr_int64_t()

const char * arg_to_apr_int64_t ( cmd_parms * cmd,
const char * buf,
apr_int64_t * dest,
const char * config_directive_name )
static

Parse a directive argument as a 64-bit signed integer (apr_int64_t).

Parameters
cmdApache configuration command parameters.
bufInput argument string.
destDestination pointer receiving the parsed integer.
config_directive_nameDirective name used in error and debug messages.
Returns
NULL on success, or an error message string if buf is not numeric.

◆ arg_to_double()

const char * arg_to_double ( cmd_parms * cmd,
const char * buf,
double * dest,
const char * config_directive_name )
static

Parse a directive argument as a floating-point double.

Parameters
cmdApache configuration command parameters.
bufInput argument string.
destDestination pointer receiving the parsed floating-point value.
config_directive_nameDirective name used in error and debug messages.
Returns
NULL on success, or an error message string if buf is not a valid float.

◆ arg_to_int()

const char * arg_to_int ( cmd_parms * cmd,
const char * buf,
int * dest,
const char * config_directive_name )
static

Parse a directive argument as a standard int.

Parameters
cmdApache configuration command parameters.
bufInput argument string.
destDestination pointer receiving the parsed integer.
config_directive_nameDirective name used in error and debug messages.
Returns
NULL on success, or an error message string if buf is not numeric.

◆ arg_to_string()

const char * arg_to_string ( cmd_parms * cmd,
const char * buf,
const char ** dest,
const char * config_directive_name )
static

Duplicate a directive string argument into cmd->pool (bounded by PATH_MAX).

Parameters
cmdApache configuration command parameters.
bufInput argument string.
destDestination pointer receiving the pool-allocated string copy.
config_directive_nameDirective name used in debug logs.
Returns
Always returns NULL.

◆ cleanup_storage_backend()

apr_status_t cleanup_storage_backend ( void * data)
static

APR pool cleanup callback closing all per-thread storage backends when a worker thread exits.

Parameters
dataPointer to the thread's struct storage_backends container.
Returns
Always returns APR_SUCCESS.

◆ create_tile_config()

void * create_tile_config ( apr_pool_t * p,
server_rec * s )
static

Allocate and initialize default tile_server_conf settings for a server or virtual host.

Parameters
pApache configuration memory pool.
sTarget Apache server_rec.
Returns
Newly allocated and defaulted tile_server_conf *.

◆ delay_allowed()

int delay_allowed ( request_rec * r,
enum tileState state )
static

Enforce per-client IP token-bucket rate limits for tile and render requests.

Extracts the client IP (honoring X-Forwarded-For when configured), checks the IPv4 whitelist, and consumes one tile token (plus one render token if state == tileMissing) from the client's hash slot in delaypool_shm. When a bucket is depleted, refills all buckets based on elapsed time and sleeps CLIENT_PENALTY seconds before re-checking.

Parameters
rActive Apache HTTP request record.
stateCurrent freshness state of the requested tile (tileMissing consumes a render token).
Returns
1 if the request is permitted; 0 if the client exceeded its rate limit.

◆ error_message()

int static int error_message ( request_rec * r,
const char * format,
... )
static

Send a formatted plain-text diagnostic response body with HTTP 200 status.

Logs the formatted message at APLOG_INFO level and writes it to the response stream unless the incoming request is a HEAD request (r->header_only).

Parameters
rActive Apache HTTP request record.
formatprintf-style format string.
...Format arguments.
Returns
Always returns Apache OK.

◆ get_extension()

void get_extension ( char * filename,
char * ext_dest,
size_t dest_len )
static

Split a filename's trailing extension at the last '.' character in place.

Copies the substring following the last '.' into ext_dest and truncates filename at the dot. Leaves both unchanged if no '.' is found.

Parameters
filenameMutable filename buffer (e.g., "123.png" -> "123").
ext_destDestination buffer receiving the file extension without leading dot.
dest_lenCapacity of ext_dest in bytes.

◆ get_global_lock()

int get_global_lock ( request_rec * r,
apr_global_mutex_t * mutex )
static

Attempt to acquire an APR cross-process global mutex with bounded spin-sleep retries.

Polls apr_global_mutex_trylock() up to MAXCAMP times, sleeping CAMPOUT microseconds between attempts when contended (APR_EBUSY), or falling back to a blocking lock if trylock is unimplemented on the platform (APR_ENOTIMPL).

Parameters
rActive Apache HTTP request record (used for request-scoped logging).
mutexGlobal mutex to acquire.
Returns
1 if the lock was successfully acquired; 0 on timeout or error.

◆ get_stats_copy()

int get_stats_copy ( request_rec * r,
tile_server_conf * scfg,
stats_data ** stats_copy )
static

Snapshot shared-memory statistics into request-pool memory under stats_mutex.

Duplicates stats_data along with its trailing per-layer noResp200Layer and noResp404Layer arrays into r->pool so handlers can format responses without holding the global lock.

Parameters
rActive Apache HTTP request record.
scfgVirtual host server configuration.
stats_copyOutput pointer receiving the pool-allocated stats_data copy.
Returns
Apache OK on success (or after writing an error message if lock acquisition fails).

◆ get_storage_backend()

struct storage_backend * get_storage_backend ( request_rec * r,
int tile_layer )
static

Retrieve or lazily initialize the thread-local storage backend for a given map layer.

Caches a struct storage_backends array in the Apache worker thread's lifecycle pool (apr_thread_pool_get(r->connection->current_thread)) so storage handles (such as file, memcached, RADOS, or curl connections) are reused safely without cross-thread locking.

Parameters
rActive Apache HTTP request record.
tile_layerZero-based index of the target map layer in scfg->configs.
Returns
Pointer to the initialized struct storage_backend, or NULL on initialization failure.

◆ incFreshCounter()

int incFreshCounter ( int status,
request_rec * r )
static

Increment shared-memory cache-hit vs. on-demand-render outcome counters.

Parameters
statusOutcome code (FRESH, FRESH_RENDER, OLD, VERYOLD, OLD_RENDER, or VERYOLD_RENDER).
rActive Apache HTTP request record.
Returns
1 if counters were updated (or stats collection is disabled); 0 if mutex acquisition failed.

◆ incRespCounter()

int incRespCounter ( int resp,
request_rec * r,
struct protocol * cmd,
int layerNumber )
static

Increment shared-memory HTTP response status, zoom-level, and per-layer counters.

Parameters
respHTTP status code returned (OK, HTTP_NOT_MODIFIED, HTTP_NOT_FOUND, etc.).
rActive Apache HTTP request record.
cmdOptional wire protocol request descriptor (for zoom-level counters; may be NULL).
layerNumberZero-based index of the matched map layer.
Returns
1 if counters were updated (or stats collection is disabled); 0 if mutex acquisition failed.

◆ incTimingCounter()

int incTimingCounter ( apr_uint64_t duration,
int z,
request_rec * r )
static

Record tile storage retrieval duration (in microseconds) in shared-memory timing statistics.

Parameters
durationElapsed storage read time in microseconds.
zTile zoom level (0..MAX_ZOOM_SERVER).
rActive Apache HTTP request record.
Returns
1 if counters were updated (or stats collection is disabled); 0 if mutex acquisition failed.

◆ load_tile_config()

const char * load_tile_config ( cmd_parms * cmd,
void * mconfig,
const char * config_file_name )
static

Apache directive handler for LoadTileConfigFile <path> importing map sections from renderd.conf.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
config_file_nameFilesystem path to the INI configuration file (renderd.conf).
Returns
NULL on success, or an error message string if the file cannot be opened or a section fails.

◆ merge_tile_config()

void * merge_tile_config ( apr_pool_t * p,
void * basev,
void * overridesv )
static

Merge base server and virtual-host tile_server_conf records and precompute mincachetime[].

Appends virtual-host layer definitions onto the base server's configs array and populates the per-zoom mincachetime lookup table (0..MAX_ZOOM_SERVER).

Parameters
pApache configuration memory pool.
basevBase tile_server_conf *.
overridesvVirtual-host override tile_server_conf *.
Returns
Merged tile_server_conf *.

◆ mod_tile_cache_duration_dirty_config()

const char * mod_tile_cache_duration_dirty_config ( cmd_parms * cmd,
void * mconfig,
const char * cache_duration_dirty_string )
static

Apache directive handler for ModTileCacheDurationDirty <seconds>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
cache_duration_dirty_stringBase Cache-Control max-age in seconds when serving dirty/old tiles.
Returns
NULL on success, or an error string on invalid input.

◆ mod_tile_cache_duration_last_modified_factor_config()

const char * mod_tile_cache_duration_last_modified_factor_config ( cmd_parms * cmd,
void * mconfig,
const char * cache_duration_last_modified_factor_string )
static

Apache directive handler for ModTileCacheLastModifiedFactor <factor>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
cache_duration_last_modified_factor_stringFloating-point multiplier applied to tile age since modification.
Returns
NULL on success, or an error string on invalid input.

◆ mod_tile_cache_duration_low_config()

const char * mod_tile_cache_duration_low_config ( cmd_parms * cmd,
void * mconfig,
const char * cache_level_low_zoom_string,
const char * cache_duration_low_zoom_string )
static

Apache directive handler for ModTileCacheDurationLowZoom <max_zoom> <seconds>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
cache_level_low_zoom_stringUpper zoom level cutoff for low-zoom cache duration.
cache_duration_low_zoom_stringMinimum Cache-Control max-age in seconds for low-zoom tiles.
Returns
NULL on success, or an error string on invalid input.

◆ mod_tile_cache_duration_max_config()

const char * mod_tile_cache_duration_max_config ( cmd_parms * cmd,
void * mconfig,
const char * cache_duration_max_string )
static

Apache directive handler for ModTileCacheDurationMax <seconds>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
cache_duration_max_stringMaximum HTTP Cache-Control max-age cap in seconds.
Returns
NULL on success, or an error string on invalid input.

◆ mod_tile_cache_duration_medium_config()

const char * mod_tile_cache_duration_medium_config ( cmd_parms * cmd,
void * mconfig,
const char * cache_level_medium_zoom_string,
const char * cache_duration_medium_zoom_string )
static

Apache directive handler for ModTileCacheDurationMediumZoom <max_zoom> <seconds>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
cache_level_medium_zoom_stringUpper zoom level cutoff for medium-zoom cache duration.
cache_duration_medium_zoom_stringMinimum Cache-Control max-age in seconds for medium-zoom tiles.
Returns
NULL on success, or an error string on invalid input.

◆ mod_tile_cache_duration_minimum_config()

const char * mod_tile_cache_duration_minimum_config ( cmd_parms * cmd,
void * mconfig,
const char * cache_duration_minimum_string )
static

Apache directive handler for ModTileCacheDurationMinimum <seconds>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
cache_duration_minimum_stringDefault minimum Cache-Control max-age in seconds for high-zoom tiles.
Returns
NULL on success, or an error string on invalid input.

◆ mod_tile_cache_extended_duration_config()

const char * mod_tile_cache_extended_duration_config ( cmd_parms * cmd,
void * mconfig,
const char * cache_extended_duration_string )
static

Apache directive handler for ModTileCacheExtendedDuration <seconds>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
cache_extended_duration_stringCache-Control max-age in seconds for extended-cache hosts.
Returns
NULL on success, or an error string on invalid input.

◆ mod_tile_cache_extended_hostname_config()

const char * mod_tile_cache_extended_hostname_config ( cmd_parms * cmd,
void * mconfig,
const char * cache_extended_hostname_string )
static

Apache directive handler for ModTileCacheExtendedHostName <hostname>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
cache_extended_hostname_stringHostname substring receiving ModTileCacheExtendedDuration.
Returns
NULL on success.

◆ mod_tile_child_init()

void mod_tile_child_init ( apr_pool_t * p,
server_rec * s )
static

Apache child_init hook reopening the global statistics mutex in each forked worker process.

Exits the child process with status 1 if apr_global_mutex_child_init() fails.

Parameters
pChild process memory pool.
sMain Apache server_rec.

◆ mod_tile_delaypool_render_config()

const char * mod_tile_delaypool_render_config ( cmd_parms * cmd,
void * mconfig,
const char * delaypool_render_size_string,
const char * top_up_render_rate_string )
static

Apache directive handler for ModTileThrottlingRenders <bucket_size> <renders_per_sec>.

Converts the top-up rate from renders per second into microseconds per render token (APR_USEC_PER_SEC / top_up_render_rate).

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
delaypool_render_size_stringMaximum render token bucket capacity per client IP.
top_up_render_rate_stringRender token refill rate in renders per second ((0, 1000000]).
Returns
NULL on success, or an error string if arguments are out of range.

◆ mod_tile_delaypool_tiles_config()

const char * mod_tile_delaypool_tiles_config ( cmd_parms * cmd,
void * mconfig,
const char * delaypool_tile_size_string,
const char * top_up_tile_rate_string )
static

Apache directive handler for ModTileThrottlingTiles <bucket_size> <tiles_per_sec>.

Converts the top-up rate from tiles per second into microseconds per tile token (APR_USEC_PER_SEC / top_up_tile_rate).

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
delaypool_tile_size_stringMaximum tile token bucket capacity per client IP.
top_up_tile_rate_stringTile token refill rate in tiles per second ((0, 1000000]).
Returns
NULL on success, or an error string if arguments are out of range.

◆ mod_tile_enable_bulk_mode()

const char * mod_tile_enable_bulk_mode ( cmd_parms * cmd,
void * mconfig,
int enable_bulk_mode )
static

Apache flag directive handler for ModTileBulkMode <On|Off>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
enable_bulk_modeBoolean flag (1 for On, 0 for Off).
Returns
Always returns NULL.

◆ mod_tile_enable_dirty_url()

const char * mod_tile_enable_dirty_url ( cmd_parms * cmd,
void * mconfig,
int enable_dirty_url )
static

Apache flag directive handler for ModTileEnableDirtyURL <On|Off>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
enable_dirty_urlBoolean flag (1 for On, 0 for Off).
Returns
Always returns NULL.

◆ mod_tile_enable_stats()

const char * mod_tile_enable_stats ( cmd_parms * cmd,
void * mconfig,
int enable_global_stats )
static

Apache flag directive handler for ModTileEnableStats <On|Off>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
enable_global_statsBoolean flag (1 for On, 0 for Off).
Returns
Always returns NULL.

◆ mod_tile_enable_status_url()

const char * mod_tile_enable_status_url ( cmd_parms * cmd,
void * mconfig,
int enable_status_url )
static

Apache flag directive handler for ModTileEnableStatusURL <On|Off>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
enable_status_urlBoolean flag (1 for On, 0 for Off).
Returns
Always returns NULL.

◆ mod_tile_enable_throttling()

const char * mod_tile_enable_throttling ( cmd_parms * cmd,
void * mconfig,
int enable_tile_throttling )
static

Apache flag directive handler for ModTileEnableTileThrottling <On|Off>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
enable_tile_throttlingBoolean flag (1 for On, 0 for Off).
Returns
Always returns NULL.

◆ mod_tile_enable_throttling_xforward()

const char * mod_tile_enable_throttling_xforward ( cmd_parms * cmd,
void * mconfig,
const char * enable_tile_throttling_xforward_string )
static

Apache directive handler for ModTileEnableTileThrottlingXForward <0|1|2>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
enable_tile_throttling_xforward_stringMode string ("0" off, "1" first hop, "2" last proxy hop).
Returns
NULL on success, or an error string if the value is outside [0, 2].

◆ mod_tile_max_load_missing_config()

const char * mod_tile_max_load_missing_config ( cmd_parms * cmd,
void * mconfig,
const char * max_load_missing_string )
static

Apache directive handler for ModTileMaxLoadMissing <load>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
max_load_missing_stringMaximum 1-minute load average before returning 404 for missing tiles.
Returns
NULL on success, or an error string on invalid input.

◆ mod_tile_max_load_old_config()

const char * mod_tile_max_load_old_config ( cmd_parms * cmd,
void * mconfig,
const char * max_load_old_string )
static

Apache directive handler for ModTileMaxLoadOld <load>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
max_load_old_stringMaximum 1-minute load average before skipping re-renders of old tiles.
Returns
NULL on success, or an error string on invalid input.

◆ mod_tile_post_config()

int mod_tile_post_config ( apr_pool_t * pconf,
apr_pool_t * plog,
apr_pool_t * ptemp,
server_rec * s )
static

Apache post_config hook allocating shared-memory segments and cross-process mutexes in the parent process.

Uses a process-pool sentinel ("mod_tile_init_module") to skip Apache's initial config dry-run pass, then creates and zero-initializes stats_shm, delaypool_shm, stats_mutex, and delaypool_mutex.

Parameters
pconfConfiguration memory pool.
plogLogging memory pool.
ptempTemporary configuration memory pool.
sMain Apache server_rec.
Returns
OK on success, or HTTP_INTERNAL_SERVER_ERROR if shared memory or mutex creation fails.

◆ mod_tile_renderd_socket_address_config()

const char * mod_tile_renderd_socket_address_config ( cmd_parms * cmd,
void * mconfig,
const char * renderd_socket_address_string,
const char * renderd_socket_port_string )
static

Apache directive handler for ModTileRenderdSocketAddr <host> <port>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
renderd_socket_address_stringHostname or IP address of renderd.
renderd_socket_port_stringTCP port number of renderd.
Returns
NULL on success, or an error string if the port argument is invalid.

◆ mod_tile_renderd_socket_name_config()

const char * mod_tile_renderd_socket_name_config ( cmd_parms * cmd,
void * mconfig,
const char * renderd_socket_name_string )
static

Apache directive handler for ModTileRenderdSocketName <path>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
renderd_socket_name_stringUNIX domain socket path for renderd.
Returns
NULL on success.

◆ mod_tile_request_timeout_config()

const char * mod_tile_request_timeout_config ( cmd_parms * cmd,
void * mconfig,
const char * request_timeout_string )
static

Apache directive handler for ModTileRequestTimeout <seconds>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
request_timeout_stringTimeout in seconds for non-missing tile render waits.
Returns
NULL on success, or an error string on invalid input.

◆ mod_tile_request_timeout_priority_config()

const char * mod_tile_request_timeout_priority_config ( cmd_parms * cmd,
void * mconfig,
const char * request_timeout_priority_string )
static

Apache directive handler for ModTileMissingRequestTimeout <seconds>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
request_timeout_priority_stringTimeout in seconds for high-priority missing tile render waits.
Returns
NULL on success, or an error string on invalid input.

◆ mod_tile_tile_dir_config()

const char * mod_tile_tile_dir_config ( cmd_parms * cmd,
void * mconfig,
const char * tile_dir_string )
static

Apache directive handler for ModTileTileDir <path_or_uri>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
tile_dir_stringDefault tile directory path or storage backend connection URI.
Returns
NULL on success.

◆ mod_tile_very_old_threshold_config()

const char * mod_tile_very_old_threshold_config ( cmd_parms * cmd,
void * mconfig,
const char * very_old_threshold_string )
static

Apache directive handler for ModTileVeryOldThreshold <microseconds>.

Parameters
cmdApache configuration command parameters.
mconfigPer-directory configuration pointer (unused).
very_old_threshold_stringAge threshold in microseconds classifying expired tiles as tileVeryOld.
Returns
NULL on success, or an error string on invalid input.

◆ register_hooks()

void register_hooks ( __attribute__((unused)) apr_pool_t * p)
static

Register all mod_tile lifecycle, URI translation, storage mapping, and content hooks with Apache.

Parameters
pPool passed by Apache during module registration (unused).

◆ request_tile()

int request_tile ( request_rec * r,
struct protocol * cmd,
int renderImmediately )
static

Submit a tile render or dirty invalidation request to renderd and optionally wait for completion.

Maps renderImmediately to a wire protocol opcode (0 -> cmdDirty, 1 -> cmdRenderLow, 2 -> cmdRender, 3 -> cmdRenderPrio, or cmdRenderBulk when bulk mode is active), sends the v2/v3 packet over a transient socket, and for non-zero priority waits via poll() up to request_timeout or request_timeout_priority seconds for a matching cmdDone reply.

Parameters
rActive Apache HTTP request record.
cmdPre-populated wire protocol request packet (ver, x, y, z, xmlname, options).
renderImmediatelyPriority level (0 for fire-and-forget cmdDirty, 1..3 for synchronous render wait).
Returns
1 if renderd replied with cmdDone matching the requested tile; 0 on timeout, error, or cmdDirty.

◆ safe_parse_int()

apr_status_t safe_parse_int ( const char * str,
int * result )
static

Parse a base-10 integer string strictly, rejecting empty or trailing non-numeric characters.

Parameters
strNull-terminated numeric input string.
resultOutput pointer receiving the parsed integer value.
Returns
APR_SUCCESS on valid full-string parse, or APR_EINVAL otherwise.

◆ socket_init()

int socket_init ( request_rec * r)
static

Open and connect a stream socket to the renderd daemon over TCP or UNIX domain socket.

Uses TCP (getaddrinfo + connect) when scfg->renderd_socket_port > 0, otherwise connects to the local AF_UNIX socket path specified in scfg->renderd_socket_name.

Parameters
rActive Apache HTTP request record.
Returns
Connected socket file descriptor on success, or FD_INVALID (-1) on failure.

◆ tile_handler_dirty()

int tile_handler_dirty ( request_rec * r)
static

Apache content handler for .../dirty tile invalidation URLs (tile_dirty).

Submits a background cmdDirty request to renderd when ModTileEnableDirtyURL is enabled and bulk mode is inactive.

Parameters
rActive Apache HTTP request record.
Returns
OK with a confirmation message, HTTP_NOT_FOUND if /dirty URLs are disabled, or DECLINED if r->handler is not "tile_dirty".

◆ tile_handler_json()

int tile_handler_json ( request_rec * r)
static

Apache content handler serving a TileJSON 2.0.0 metadata document (tile_json).

Generates a JSON metadata payload conforming to the Mapbox TileJSON 2.0.0 specification (https://github.com/mapbox/tilejson-spec/tree/master/2.0.0) with layer name, description, attribution, zoom bounds, tile URL templates, MD5 ETag, and 1-week caching headers.

Parameters
rActive Apache HTTP request record.
Returns
OK after writing the TileJSON response, HTTP_FORBIDDEN if CORS rejects the origin, or DECLINED if r->handler is not "tile_json".

◆ tile_handler_metrics()

int tile_handler_metrics ( request_rec * r)
static

Apache content handler exporting Prometheus-formatted metrics at /metrics.

Parameters
rActive Apache HTTP request record.
Returns
OK after writing the Prometheus exposition payload, or DECLINED if r->handler is not "tile_metrics".

◆ tile_handler_mod_stats()

int tile_handler_mod_stats ( request_rec * r)
static

Apache content handler rendering legacy plain-text mod_tile statistics at /mod_tile.

Parameters
rActive Apache HTTP request record.
Returns
OK after writing the key-value statistics report, or DECLINED if r->handler is not "tile_mod_stats".

◆ tile_handler_serve()

int tile_handler_serve ( request_rec * r)
static

Primary Apache content handler reading and serving tile payloads (tile_serve).

Applies CORS headers, reads the tile bytes from the layer's storage backend, sets Content-Encoding: gzip when the stored tile is compressed, computes an MD5 ETag, attaches Cache-Control/Expires headers, evaluates conditional requests (304 Not Modified), and streams the tile payload to the client.

Parameters
rActive Apache HTTP request record.
Returns
OK when the tile is served, HTTP_NOT_MODIFIED (or other conditional status) when ap_meets_conditions() triggers, HTTP_NOT_FOUND / HTTP_INTERNAL_SERVER_ERROR on error, or DECLINED if the tile could not be read or r->handler is not "tile_serve".

◆ tile_handler_status()

int tile_handler_status ( request_rec * r)
static

Apache content handler for .../status tile diagnostic URLs (tile_status).

Queries tile_state() and responds with a human-readable summary of the tile's cleanliness/expiry state, last render timestamp (mtime), last access timestamp (atime), and backend storage identifier.

Parameters
rActive Apache HTTP request record.
Returns
OK with diagnostic text, HTTP_NOT_FOUND if /status URLs are disabled or the request lacks parsed tile coordinates, or DECLINED for other handlers.

◆ tile_state()

enum tileState tile_state ( request_rec * r,
struct protocol * cmd )
static

Query the storage backend to determine whether a tile is missing, current, old, or very old.

Populates r->finfo timestamps (mtime, atime, ctime converted to microseconds) from tile_stat() and classifies expired tiles using scfg->very_old_threshold.

Parameters
rActive Apache HTTP request record.
cmdWire protocol descriptor specifying (xmlname, options, x, y, z).
Returns
Classified freshness state (tileMissing, tileOld, tileVeryOld, or tileCurrent).

◆ tile_storage_hook()

int tile_storage_hook ( request_rec * r)
static

Apache map_to_storage hook managing tile freshness checks, throttling, load shedding, and on-demand rendering.

Bypasses filesystem mapping for mod_tile handlers, enforces delaypool throttling, checks system 1-minute load averages against max_load_old and max_load_missing, and triggers synchronous or background rendering via request_tile() as needed.

Parameters
rActive Apache HTTP request record.
Returns
OK when the request may proceed to the content handler, DECLINED for non-tile requests, or an HTTP error status (HTTP_SERVICE_UNAVAILABLE, HTTP_NOT_FOUND, HTTP_INTERNAL_SERVER_ERROR).

◆ tile_translate()

int tile_translate ( request_rec * r)
static

Apache translate_name hook mapping incoming URIs to mod_tile handlers and tile coordinates.

Matches global endpoints (/mod_tile, /metrics) as well as configured layer baseuri prefixes (/tile-layer.json, /[options/]z/x/y.ext[/status|/dirty]), validates zoom/coordinate bounds and file extensions, initializes the layer's thread-local storage backend, and stores a struct tile_request_data record on r->request_config.

Parameters
rActive Apache HTTP request record.
Returns
OK if handled by mod_tile, DECLINED if the URI does not match, or an HTTP status code (HTTP_NOT_FOUND for out-of-bounds coordinates, HTTP_INTERNAL_SERVER_ERROR if backend initialization fails).

Variable Documentation

◆ delaypool_mutex

apr_global_mutex_t* delaypool_mutex

Cross-process mutex serializing reads and updates to delaypool_shm.

◆ delaypool_mutexfilename

char* delaypool_mutexfilename

Filesystem lockfile path backing delaypool_mutex.

◆ delaypool_shm

apr_shm_t* delaypool_shm

Shared-memory segment holding the per-client IP rate-limiting delaypool table.

◆ global_max_zoom

int global_max_zoom = 0

Highest maxzoom configured across all registered map layers.

◆ layerCount

int layerCount = 0

Total number of configured map layers registered across all virtual hosts.

◆ stats_mutex

apr_global_mutex_t* stats_mutex

Cross-process mutex serializing reads and updates to stats_shm.

◆ stats_mutexfilename

char* stats_mutexfilename

Filesystem lockfile path backing stats_mutex.

◆ stats_shm

apr_shm_t* stats_shm

Shared-memory segment holding global and per-layer stats_data counters across worker processes.

◆ tile_cmds

const command_rec tile_cmds[]
static
Initial value:
= {
AP_INIT_FLAG("ModTileBulkMode", mod_tile_enable_bulk_mode, NULL, OR_OPTIONS, "On Off - Make all requests to renderd with bulk render priority, never mark tiles dirty"),
AP_INIT_FLAG("ModTileEnableDirtyURL", mod_tile_enable_dirty_url, NULL, OR_OPTIONS, "On Off - Whether to handle .../dirty urls"),
AP_INIT_FLAG("ModTileEnableStats", mod_tile_enable_stats, NULL, OR_OPTIONS, "On Off - Enable keeping stats about what mod_tile is serving"),
AP_INIT_FLAG("ModTileEnableStatusURL", mod_tile_enable_status_url, NULL, OR_OPTIONS, "On Off - Whether to handle .../status urls"),
AP_INIT_FLAG("ModTileEnableTileThrottling", mod_tile_enable_throttling, NULL, OR_OPTIONS, "On Off - Enable throttling of IPs that excessively download tiles such as scrapers"),
AP_INIT_TAKE1("LoadTileConfigFile", load_tile_config, NULL, OR_OPTIONS, "Load an entire renderd config file"),
AP_INIT_TAKE1("ModTileCacheDurationDirty", mod_tile_cache_duration_dirty_config, NULL, OR_OPTIONS, "Set the cache expiry for serving dirty tiles"),
AP_INIT_TAKE1("ModTileCacheDurationMax", mod_tile_cache_duration_max_config, NULL, OR_OPTIONS, "Set the maximum cache expiry in seconds"),
AP_INIT_TAKE1("ModTileCacheDurationMinimum", mod_tile_cache_duration_minimum_config, NULL, OR_OPTIONS, "Set the minimum cache expiry"),
AP_INIT_TAKE1("ModTileCacheExtendedDuration", mod_tile_cache_extended_duration_config, NULL, OR_OPTIONS, "Set length of extended period caching"),
AP_INIT_TAKE1("ModTileCacheExtendedHostName", mod_tile_cache_extended_hostname_config, NULL, OR_OPTIONS, "Set hostname for extended period caching"),
AP_INIT_TAKE1("ModTileCacheLastModifiedFactor", mod_tile_cache_duration_last_modified_factor_config, NULL, OR_OPTIONS, "Set the factor by which the last modified determines cache expiry"),
AP_INIT_TAKE1("ModTileEnableTileThrottlingXForward", mod_tile_enable_throttling_xforward, NULL, OR_OPTIONS, "0 1 2 - Use X-Forwarded-For http header to determine IP for throttling when available. 0 => off, 1 => use first entry, 2 => use last entry of the caching chain"),
AP_INIT_TAKE1("ModTileMaxLoadMissing", mod_tile_max_load_missing_config, NULL, OR_OPTIONS, "Set max load for rendering missing tiles"),
AP_INIT_TAKE1("ModTileMaxLoadOld", mod_tile_max_load_old_config, NULL, OR_OPTIONS, "Set max load for rendering old tiles"),
AP_INIT_TAKE1("ModTileMissingRequestTimeout", mod_tile_request_timeout_priority_config, NULL, OR_OPTIONS, "Set timeout in seconds on missing mod_tile requests"),
AP_INIT_TAKE1("ModTileRenderdSocketName", mod_tile_renderd_socket_name_config, NULL, OR_OPTIONS, "Set name of unix domain socket for connecting to rendering daemon"),
AP_INIT_TAKE1("ModTileRequestTimeout", mod_tile_request_timeout_config, NULL, OR_OPTIONS, "Set timeout in seconds on mod_tile requests"),
AP_INIT_TAKE1("ModTileTileDir", mod_tile_tile_dir_config, NULL, OR_OPTIONS, "Set name of tile cache directory"),
AP_INIT_TAKE1("ModTileVeryOldThreshold", mod_tile_very_old_threshold_config, NULL, OR_OPTIONS, "Set the time threshold from when an outdated tile is considered very old and rendered with slightly higher priority."),
AP_INIT_TAKE2("ModTileCacheDurationLowZoom", mod_tile_cache_duration_low_config, NULL, OR_OPTIONS, "Set the minimum cache duration and zoom level for low zoom tiles"),
AP_INIT_TAKE2("ModTileCacheDurationMediumZoom", mod_tile_cache_duration_medium_config, NULL, OR_OPTIONS, "Set the minimum cache duration and zoom level for medium zoom tiles"),
AP_INIT_TAKE2("ModTileRenderdSocketAddr", mod_tile_renderd_socket_address_config, NULL, OR_OPTIONS, "Set address and port of the TCP socket for connecting to rendering daemon"),
AP_INIT_TAKE2("ModTileThrottlingRenders", mod_tile_delaypool_render_config, NULL, OR_OPTIONS, "Set the initial bucket size (number of render requests) and top up rate (render requests per second) for throttling render requests per IP"),
AP_INIT_TAKE2("ModTileThrottlingTiles", mod_tile_delaypool_tiles_config, NULL, OR_OPTIONS, "Set the initial bucket size (number of tiles) and top up rate (tiles per second) for throttling tile request per IP"),
AP_INIT_TAKE3("AddTileMimeConfig", add_tile_mime_config, NULL, OR_OPTIONS, "Set the path, name of renderd config and file extension to use"),
AP_INIT_TAKE_ARGV("AddTileConfig", add_tile_config, NULL, OR_OPTIONS, "Set the path, name of renderd config and optional key-value pairs to use"),
{0}}
static const char * mod_tile_cache_duration_medium_config(cmd_parms *cmd, void *mconfig, const char *cache_level_medium_zoom_string, const char *cache_duration_medium_zoom_string)
Apache directive handler for ModTileCacheDurationMediumZoom <max_zoom> <seconds>.
Definition mod_tile.c:2802
static const char * mod_tile_delaypool_render_config(cmd_parms *cmd, void *mconfig, const char *delaypool_render_size_string, const char *top_up_render_rate_string)
Apache directive handler for ModTileThrottlingRenders <bucket_size> <renders_per_sec>.
Definition mod_tile.c:2976
static const char * mod_tile_cache_duration_max_config(cmd_parms *cmd, void *mconfig, const char *cache_duration_max_string)
Apache directive handler for ModTileCacheDurationMax <seconds>.
Definition mod_tile.c:2737
static const char * mod_tile_cache_duration_low_config(cmd_parms *cmd, void *mconfig, const char *cache_level_low_zoom_string, const char *cache_duration_low_zoom_string)
Apache directive handler for ModTileCacheDurationLowZoom <max_zoom> <seconds>.
Definition mod_tile.c:2780
static const char * mod_tile_enable_throttling_xforward(cmd_parms *cmd, void *mconfig, const char *enable_tile_throttling_xforward_string)
Apache directive handler for ModTileEnableTileThrottlingXForward <0|1|2>.
Definition mod_tile.c:2855
static const char * mod_tile_request_timeout_config(cmd_parms *cmd, void *mconfig, const char *request_timeout_string)
Apache directive handler for ModTileRequestTimeout <seconds>.
Definition mod_tile.c:2575
static const char * mod_tile_tile_dir_config(cmd_parms *cmd, void *mconfig, const char *tile_dir_string)
Apache directive handler for ModTileTileDir <path_or_uri>.
Definition mod_tile.c:2681
static const char * load_tile_config(cmd_parms *cmd, void *mconfig, const char *config_file_name)
Apache directive handler for LoadTileConfigFile <path> importing map sections from renderd....
Definition mod_tile.c:2449
static const char * mod_tile_delaypool_tiles_config(cmd_parms *cmd, void *mconfig, const char *delaypool_tile_size_string, const char *top_up_tile_rate_string)
Apache directive handler for ModTileThrottlingTiles <bucket_size> <tiles_per_sec>.
Definition mod_tile.c:2935
static const char * add_tile_mime_config(cmd_parms *cmd, void *mconfig, const char *baseuri, const char *name, const char *fileExtension)
Apache directive handler for deprecated AddTileMimeConfig <baseuri> <name> <extension>.
Definition mod_tile.c:2368
static const char * mod_tile_renderd_socket_name_config(cmd_parms *cmd, void *mconfig, const char *renderd_socket_name_string)
Apache directive handler for ModTileRenderdSocketName <path>.
Definition mod_tile.c:2645
static const char * mod_tile_request_timeout_priority_config(cmd_parms *cmd, void *mconfig, const char *request_timeout_priority_string)
Apache directive handler for ModTileMissingRequestTimeout <seconds>.
Definition mod_tile.c:2589
static const char * mod_tile_cache_duration_minimum_config(cmd_parms *cmd, void *mconfig, const char *cache_duration_minimum_string)
Apache directive handler for ModTileCacheDurationMinimum <seconds>.
Definition mod_tile.c:2765
static const char * mod_tile_cache_extended_hostname_config(cmd_parms *cmd, void *mconfig, const char *cache_extended_hostname_string)
Apache directive handler for ModTileCacheExtendedHostName <hostname>.
Definition mod_tile.c:2695
static const char * mod_tile_cache_duration_dirty_config(cmd_parms *cmd, void *mconfig, const char *cache_duration_dirty_string)
Apache directive handler for ModTileCacheDurationDirty <seconds>.
Definition mod_tile.c:2751
static const char * mod_tile_enable_status_url(cmd_parms *cmd, void *mconfig, int enable_status_url)
Apache flag directive handler for ModTileEnableStatusURL <On|Off>.
Definition mod_tile.c:2899
static const char * mod_tile_max_load_missing_config(cmd_parms *cmd, void *mconfig, const char *max_load_missing_string)
Apache directive handler for ModTileMaxLoadMissing <load>.
Definition mod_tile.c:2617
static const char * mod_tile_max_load_old_config(cmd_parms *cmd, void *mconfig, const char *max_load_old_string)
Apache directive handler for ModTileMaxLoadOld <load>.
Definition mod_tile.c:2603
static const char * mod_tile_renderd_socket_address_config(cmd_parms *cmd, void *mconfig, const char *renderd_socket_address_string, const char *renderd_socket_port_string)
Apache directive handler for ModTileRenderdSocketAddr <host> <port>.
Definition mod_tile.c:2660
static const char * mod_tile_enable_bulk_mode(cmd_parms *cmd, void *mconfig, int enable_bulk_mode)
Apache flag directive handler for ModTileBulkMode <On|Off>.
Definition mod_tile.c:2883
static const char * mod_tile_enable_dirty_url(cmd_parms *cmd, void *mconfig, int enable_dirty_url)
Apache flag directive handler for ModTileEnableDirtyURL <On|Off>.
Definition mod_tile.c:2915
static const char * mod_tile_very_old_threshold_config(cmd_parms *cmd, void *mconfig, const char *very_old_threshold_string)
Apache directive handler for ModTileVeryOldThreshold <microseconds>.
Definition mod_tile.c:2631
static const char * mod_tile_enable_throttling(cmd_parms *cmd, void *mconfig, int enable_tile_throttling)
Apache flag directive handler for ModTileEnableTileThrottling <On|Off>.
Definition mod_tile.c:2839
static const char * add_tile_config(cmd_parms *cmd, void *mconfig, int argc, char *const argv[])
Apache directive handler for AddTileConfig <baseuri> <name> [key=value ...].
Definition mod_tile.c:2396
static const char * mod_tile_cache_duration_last_modified_factor_config(cmd_parms *cmd, void *mconfig, const char *cache_duration_last_modified_factor_string)
Apache directive handler for ModTileCacheLastModifiedFactor <factor>.
Definition mod_tile.c:2723
static const char * mod_tile_enable_stats(cmd_parms *cmd, void *mconfig, int enable_global_stats)
Apache flag directive handler for ModTileEnableStats <On|Off>.
Definition mod_tile.c:2823
static const char * mod_tile_cache_extended_duration_config(cmd_parms *cmd, void *mconfig, const char *cache_extended_duration_string)
Apache directive handler for ModTileCacheExtendedDuration <seconds>.
Definition mod_tile.c:2709

Apache configuration directive dispatch table for mod_tile.

◆ tile_module

module_rec tile_module
Initial value:
= {
STANDARD20_MODULE_STUFF,
NULL,
NULL,
}
static void * merge_tile_config(apr_pool_t *p, void *basev, void *overridesv)
Merge base server and virtual-host tile_server_conf records and precompute mincachetime[].
Definition mod_tile.c:3061
static void * create_tile_config(apr_pool_t *p, server_rec *s)
Allocate and initialize default tile_server_conf settings for a server or virtual host.
Definition mod_tile.c:3012
static void register_hooks(__attribute__((unused)) apr_pool_t *p)
Register all mod_tile lifecycle, URI translation, storage mapping, and content hooks with Apache.
Definition mod_tile.c:2212
static const command_rec tile_cmds[]
Apache configuration directive dispatch table for mod_tile.
Definition mod_tile.c:3113

Apache HTTP Server module structure declaration for mod_tile.

Apache HTTP Server module registration record for mod_tile.