|
mod_tile 0.9.1
Renders map tiles with Mapnik and serves them using Apache HTTP Server
|
#include <arpa/inet.h>#include <glib.h>#include <netdb.h>#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/socket.h>#include <unistd.h>#include "cache_expire.h"#include "g_logger.h"Functions | |
| static void | put_u16 (char *dst, uint16_t value) |
| Write a 16-bit unsigned integer in network byte order (big-endian) at an arbitrary (possibly unaligned) memory address. | |
| static void | put_u32 (char *dst, uint32_t value) |
| Write a 32-bit unsigned integer in network byte order (big-endian) at an arbitrary (possibly unaligned) memory address. | |
| static void | cache_expire_url (int sock, char *url) |
| Construct and send an HTCP (Hyper Text Caching Protocol) CLR (cache clear/purge) UDP datagram for a given URL. | |
| void | cache_expire (int sock, const char *host, const char *uri, int x, int y, int z) |
| Format a tile URL from Z/X/Y coordinates and send an HTCP purge request. | |
| int | init_cache_expire (const char *htcphost) |
| Initialize and connect a UDP socket to an HTCP caching server. | |
| void cache_expire | ( | int | sock, |
| const char * | host, | ||
| const char * | uri, | ||
| int | x, | ||
| int | y, | ||
| int | z ) |
Format a tile URL from Z/X/Y coordinates and send an HTCP purge request.
Constructs a URL of the form http://<host><uri><z>/<x>/<y>.png (assuming uri includes leading and trailing slashes) and passes it to cache_expire_url().
| sock | Connected UDP socket descriptor returned by init_cache_expire(). If negative, the function returns immediately without action. |
| host | Target cache hostname or IP address (e.g., "tile.openstreetmap.org"). |
| uri | Base URI path prefix for the tileset (e.g., "/"). |
| x | Tile X coordinate. |
| y | Tile Y coordinate. |
| z | Tile zoom level. |
|
static |
Construct and send an HTCP (Hyper Text Caching Protocol) CLR (cache clear/purge) UDP datagram for a given URL.
Follows RFC 2756 packet framing:
| sock | Connected UDP socket descriptor to the HTCP cache server. |
| url | Null-terminated URL string to purge from cache. |
| int init_cache_expire | ( | const char * | htcphost | ) |
Initialize and connect a UDP socket to an HTCP caching server.
Resolves htcphost using HTCP_EXPIRE_CACHE_PORT and attempts to create and connect a SOCK_DGRAM socket against each resolved address until one succeeds.
| htcphost | Hostname or IP address string of the HTCP cache server. |
|
static |
Write a 16-bit unsigned integer in network byte order (big-endian) at an arbitrary (possibly unaligned) memory address.
Casting &buf[idx] directly to uint16_t* is undefined behavior in C and can cause alignment faults on strict-alignment architectures.
| dst | Destination buffer pointer. |
| value | 16-bit value in host byte order. |
|
static |
Write a 32-bit unsigned integer in network byte order (big-endian) at an arbitrary (possibly unaligned) memory address.
Casting &buf[idx] directly to uint32_t* is undefined behavior in C and can cause alignment faults on strict-alignment architectures.
| dst | Destination buffer pointer. |
| value | 32-bit value in host byte order. |