|
mod_tile 0.9.1
Renders map tiles with Mapnik and serves them using Apache HTTP Server
|
#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. | |
| #define APR_WANT_MEMFUNC |
| #define APR_WANT_STRFUNC |
| #define MOD_TILE_SET_MUTEX_PERMS |
Enable POSIX file-permission adjustment on APR global mutexes for Apache child processes.
|
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.
| cmd | Apache configuration command parameters. |
| baseuri | Base URI path prefix for this layer (e.g., "/osm/"). |
| name | Target map style identifier (xmlname) in renderd. |
| minzoom | Minimum allowed zoom level. |
| maxzoom | Maximum allowed zoom level. |
| aspect_x | Horizontal projection aspect ratio multiplier. |
| aspect_y | Vertical projection aspect ratio multiplier. |
| fileExtension | Tile filename extension without leading dot (e.g., "png"). |
| mimeType | HTTP Content-Type string (e.g., "image/png"). |
| description | Human-readable layer description for TileJSON. |
| attribution | Attribution HTML/text string (defaults to DEFAULT_ATTRIBUTION when empty). |
| server_alias | Optional secondary TileJSON host URL. |
| cors | Optional CORS policy string ("" disables CORS). |
| tile_dir | Optional per-layer storage URI/path ("" inherits scfg->tile_dir). |
| enableOptions | Non-zero to enable style parameterization options in URLs. |
|
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).
| r | Active Apache HTTP request record. |
| cors | Configured CORS policy string ("*" or space/comma-separated origins). |
|
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.
| r | Active Apache HTTP request record. |
| cmd | Wire protocol descriptor specifying the tile zoom level z. |
|
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().
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| argc | Number of directive arguments. |
| argv | Array of directive argument strings. |
|
static |
Apache directive handler for deprecated AddTileMimeConfig <baseuri> <name> <extension>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| baseuri | Base URI path prefix for the layer. |
| name | Map style identifier (xmlname). |
| fileExtension | Tile filename extension without leading dot. |
| APLOG_USE_MODULE | ( | tile | ) |
|
static |
Parse a directive argument as a 64-bit signed integer (apr_int64_t).
| cmd | Apache configuration command parameters. |
| buf | Input argument string. |
| dest | Destination pointer receiving the parsed integer. |
| config_directive_name | Directive name used in error and debug messages. |
|
static |
Parse a directive argument as a floating-point double.
| cmd | Apache configuration command parameters. |
| buf | Input argument string. |
| dest | Destination pointer receiving the parsed floating-point value. |
| config_directive_name | Directive name used in error and debug messages. |
|
static |
Parse a directive argument as a standard int.
| cmd | Apache configuration command parameters. |
| buf | Input argument string. |
| dest | Destination pointer receiving the parsed integer. |
| config_directive_name | Directive name used in error and debug messages. |
|
static |
Duplicate a directive string argument into cmd->pool (bounded by PATH_MAX).
| cmd | Apache configuration command parameters. |
| buf | Input argument string. |
| dest | Destination pointer receiving the pool-allocated string copy. |
| config_directive_name | Directive name used in debug logs. |
|
static |
APR pool cleanup callback closing all per-thread storage backends when a worker thread exits.
| data | Pointer to the thread's struct storage_backends container. |
|
static |
Allocate and initialize default tile_server_conf settings for a server or virtual host.
| p | Apache configuration memory pool. |
| s | Target Apache server_rec. |
|
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.
| r | Active Apache HTTP request record. |
| state | Current freshness state of the requested tile (tileMissing consumes a render token). |
|
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).
| r | Active Apache HTTP request record. |
| format | printf-style format string. |
| ... | Format arguments. |
|
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.
| filename | Mutable filename buffer (e.g., "123.png" -> "123"). |
| ext_dest | Destination buffer receiving the file extension without leading dot. |
| dest_len | Capacity of ext_dest in bytes. |
|
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).
| r | Active Apache HTTP request record (used for request-scoped logging). |
| mutex | Global mutex to acquire. |
|
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.
| r | Active Apache HTTP request record. |
| scfg | Virtual host server configuration. |
| stats_copy | Output pointer receiving the pool-allocated stats_data copy. |
|
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.
| r | Active Apache HTTP request record. |
| tile_layer | Zero-based index of the target map layer in scfg->configs. |
|
static |
Increment shared-memory cache-hit vs. on-demand-render outcome counters.
| status | Outcome code (FRESH, FRESH_RENDER, OLD, VERYOLD, OLD_RENDER, or VERYOLD_RENDER). |
| r | Active Apache HTTP request record. |
|
static |
Increment shared-memory HTTP response status, zoom-level, and per-layer counters.
| resp | HTTP status code returned (OK, HTTP_NOT_MODIFIED, HTTP_NOT_FOUND, etc.). |
| r | Active Apache HTTP request record. |
| cmd | Optional wire protocol request descriptor (for zoom-level counters; may be NULL). |
| layerNumber | Zero-based index of the matched map layer. |
|
static |
Record tile storage retrieval duration (in microseconds) in shared-memory timing statistics.
| duration | Elapsed storage read time in microseconds. |
| z | Tile zoom level (0..MAX_ZOOM_SERVER). |
| r | Active Apache HTTP request record. |
|
static |
Apache directive handler for LoadTileConfigFile <path> importing map sections from renderd.conf.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| config_file_name | Filesystem path to the INI configuration file (renderd.conf). |
|
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).
| p | Apache configuration memory pool. |
| basev | Base tile_server_conf *. |
| overridesv | Virtual-host override tile_server_conf *. |
|
static |
Apache directive handler for ModTileCacheDurationDirty <seconds>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| cache_duration_dirty_string | Base Cache-Control max-age in seconds when serving dirty/old tiles. |
|
static |
Apache directive handler for ModTileCacheLastModifiedFactor <factor>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| cache_duration_last_modified_factor_string | Floating-point multiplier applied to tile age since modification. |
|
static |
Apache directive handler for ModTileCacheDurationLowZoom <max_zoom> <seconds>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| cache_level_low_zoom_string | Upper zoom level cutoff for low-zoom cache duration. |
| cache_duration_low_zoom_string | Minimum Cache-Control max-age in seconds for low-zoom tiles. |
|
static |
Apache directive handler for ModTileCacheDurationMax <seconds>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| cache_duration_max_string | Maximum HTTP Cache-Control max-age cap in seconds. |
|
static |
Apache directive handler for ModTileCacheDurationMediumZoom <max_zoom> <seconds>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| cache_level_medium_zoom_string | Upper zoom level cutoff for medium-zoom cache duration. |
| cache_duration_medium_zoom_string | Minimum Cache-Control max-age in seconds for medium-zoom tiles. |
|
static |
Apache directive handler for ModTileCacheDurationMinimum <seconds>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| cache_duration_minimum_string | Default minimum Cache-Control max-age in seconds for high-zoom tiles. |
|
static |
Apache directive handler for ModTileCacheExtendedDuration <seconds>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| cache_extended_duration_string | Cache-Control max-age in seconds for extended-cache hosts. |
|
static |
Apache directive handler for ModTileCacheExtendedHostName <hostname>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| cache_extended_hostname_string | Hostname substring receiving ModTileCacheExtendedDuration. |
|
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.
| p | Child process memory pool. |
| s | Main Apache server_rec. |
|
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).
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| delaypool_render_size_string | Maximum render token bucket capacity per client IP. |
| top_up_render_rate_string | Render token refill rate in renders per second ((0, 1000000]). |
|
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).
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| delaypool_tile_size_string | Maximum tile token bucket capacity per client IP. |
| top_up_tile_rate_string | Tile token refill rate in tiles per second ((0, 1000000]). |
|
static |
Apache flag directive handler for ModTileBulkMode <On|Off>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| enable_bulk_mode | Boolean flag (1 for On, 0 for Off). |
|
static |
Apache flag directive handler for ModTileEnableDirtyURL <On|Off>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| enable_dirty_url | Boolean flag (1 for On, 0 for Off). |
|
static |
Apache flag directive handler for ModTileEnableStats <On|Off>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| enable_global_stats | Boolean flag (1 for On, 0 for Off). |
|
static |
Apache flag directive handler for ModTileEnableStatusURL <On|Off>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| enable_status_url | Boolean flag (1 for On, 0 for Off). |
|
static |
Apache flag directive handler for ModTileEnableTileThrottling <On|Off>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| enable_tile_throttling | Boolean flag (1 for On, 0 for Off). |
|
static |
Apache directive handler for ModTileEnableTileThrottlingXForward <0|1|2>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| enable_tile_throttling_xforward_string | Mode string ("0" off, "1" first hop, "2" last proxy hop). |
|
static |
Apache directive handler for ModTileMaxLoadMissing <load>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| max_load_missing_string | Maximum 1-minute load average before returning 404 for missing tiles. |
|
static |
Apache directive handler for ModTileMaxLoadOld <load>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| max_load_old_string | Maximum 1-minute load average before skipping re-renders of old tiles. |
|
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.
| pconf | Configuration memory pool. |
| plog | Logging memory pool. |
| ptemp | Temporary configuration memory pool. |
| s | Main Apache server_rec. |
|
static |
Apache directive handler for ModTileRenderdSocketAddr <host> <port>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| renderd_socket_address_string | Hostname or IP address of renderd. |
| renderd_socket_port_string | TCP port number of renderd. |
|
static |
Apache directive handler for ModTileRenderdSocketName <path>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| renderd_socket_name_string | UNIX domain socket path for renderd. |
|
static |
Apache directive handler for ModTileRequestTimeout <seconds>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| request_timeout_string | Timeout in seconds for non-missing tile render waits. |
|
static |
Apache directive handler for ModTileMissingRequestTimeout <seconds>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| request_timeout_priority_string | Timeout in seconds for high-priority missing tile render waits. |
|
static |
Apache directive handler for ModTileTileDir <path_or_uri>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| tile_dir_string | Default tile directory path or storage backend connection URI. |
|
static |
Apache directive handler for ModTileVeryOldThreshold <microseconds>.
| cmd | Apache configuration command parameters. |
| mconfig | Per-directory configuration pointer (unused). |
| very_old_threshold_string | Age threshold in microseconds classifying expired tiles as tileVeryOld. |
|
static |
Register all mod_tile lifecycle, URI translation, storage mapping, and content hooks with Apache.
| p | Pool passed by Apache during module registration (unused). |
|
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.
| r | Active Apache HTTP request record. |
| cmd | Pre-populated wire protocol request packet (ver, x, y, z, xmlname, options). |
| renderImmediately | Priority level (0 for fire-and-forget cmdDirty, 1..3 for synchronous render wait). |
|
static |
Parse a base-10 integer string strictly, rejecting empty or trailing non-numeric characters.
| str | Null-terminated numeric input string. |
| result | Output pointer receiving the parsed integer value. |
|
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.
| r | Active Apache HTTP request record. |
|
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.
| r | Active Apache HTTP request record. |
|
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.
| r | Active Apache HTTP request record. |
|
static |
Apache content handler exporting Prometheus-formatted metrics at /metrics.
| r | Active Apache HTTP request record. |
|
static |
Apache content handler rendering legacy plain-text mod_tile statistics at /mod_tile.
| r | Active Apache HTTP request record. |
|
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.
| r | Active Apache HTTP request record. |
|
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.
| r | Active Apache HTTP request record. |
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.
| r | Active Apache HTTP request record. |
| cmd | Wire protocol descriptor specifying (xmlname, options, x, y, z). |
|
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.
| r | Active Apache HTTP request record. |
|
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.
| r | Active Apache HTTP request record. |
| apr_global_mutex_t* delaypool_mutex |
Cross-process mutex serializing reads and updates to delaypool_shm.
| char* delaypool_mutexfilename |
Filesystem lockfile path backing delaypool_mutex.
| apr_shm_t* delaypool_shm |
Shared-memory segment holding the per-client IP rate-limiting delaypool table.
| int global_max_zoom = 0 |
Highest maxzoom configured across all registered map layers.
| int layerCount = 0 |
Total number of configured map layers registered across all virtual hosts.
| apr_global_mutex_t* stats_mutex |
Cross-process mutex serializing reads and updates to stats_shm.
| char* stats_mutexfilename |
Filesystem lockfile path backing stats_mutex.
| apr_shm_t* stats_shm |
Shared-memory segment holding global and per-layer stats_data counters across worker processes.
|
static |
Apache configuration directive dispatch table for mod_tile.
| module_rec tile_module |
Apache HTTP Server module structure declaration for mod_tile.
Apache HTTP Server module registration record for mod_tile.