Commit 648913de authored by Felix Delattre's avatar Felix Delattre Committed by Felix
Browse files

Formatted code as per Linux style

parent a125f9c7
......@@ -10,7 +10,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; If not, see http://www.gnu.org/licenses/.
*/
......
This diff is collapsed.
......@@ -10,7 +10,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; If not, see http://www.gnu.org/licenses/.
*/
......@@ -23,7 +23,7 @@ extern "C" {
#endif
#ifndef HAVE_DAEMON
int daemon(int nochdir, int noclose);
int daemon(int nochdir, int noclose);
#endif
#include <limits.h> /* for PATH_MAX */
......@@ -34,30 +34,30 @@ extern "C" {
#define MAX_SLAVES 5
typedef struct {
char *socketname;
char *iphostname;
int ipport;
int num_threads;
char *tile_dir;
char *mapnik_plugins_dir;
char *mapnik_font_dir;
int mapnik_font_dir_recurse;
char * stats_filename;
char *socketname;
char *iphostname;
int ipport;
int num_threads;
char *tile_dir;
char *mapnik_plugins_dir;
char *mapnik_font_dir;
int mapnik_font_dir_recurse;
char * stats_filename;
} renderd_config;
typedef struct {
char xmlname[XMLCONFIG_MAX];
char xmlfile[PATH_MAX];
char xmluri[PATH_MAX];
char host[PATH_MAX];
char htcpip[PATH_MAX];
char tile_dir[PATH_MAX];
char parameterization[PATH_MAX];
int tile_px_size;
double scale_factor;
int min_zoom;
int max_zoom;
int num_threads;
char xmlname[XMLCONFIG_MAX];
char xmlfile[PATH_MAX];
char xmluri[PATH_MAX];
char host[PATH_MAX];
char htcpip[PATH_MAX];
char tile_dir[PATH_MAX];
char parameterization[PATH_MAX];
int tile_px_size;
double scale_factor;
int min_zoom;
int max_zoom;
int num_threads;
} xmlconfigitem;
......
......@@ -10,7 +10,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; If not, see http://www.gnu.org/licenses/.
*/
......@@ -28,14 +28,14 @@ extern "C" {
enum queueEnum {queueRequest, queueRequestPrio, queueRequestBulk, queueDirty, queueRender, queueDuplicate, queueRequestLow};
struct item {
struct item *next;
struct item *prev;
struct protocol req;
int mx, my;
int fd;
struct item *duplicates;
enum queueEnum inQueue;
enum queueEnum originatedQueue;
struct item *next;
struct item *prev;
struct protocol req;
int mx, my;
int fd;
struct item *duplicates;
enum queueEnum inQueue;
enum queueEnum originatedQueue;
};
//int render(Map &m, int x, int y, int z, const char *filename);
......
......@@ -10,7 +10,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; If not, see http://www.gnu.org/licenses/.
*/
......@@ -29,41 +29,42 @@ extern "C" {
#define META_MAGIC "META"
#define META_MAGIC_COMPRESSED "METZ"
struct entry {
int offset;
int size;
};
struct meta_layout {
char magic[4];
int count; // METATILE ^ 2
int x, y, z; // lowest x,y of this metatile, plus z
struct entry index[]; // count entries
// Followed by the tile data
// The index offsets are measured from the start of the file
};
struct entry {
int offset;
int size;
};
struct meta_layout {
char magic[4];
int count; // METATILE ^ 2
int x, y, z; // lowest x,y of this metatile, plus z
struct entry index[]; // count entries
// Followed by the tile data
// The index offsets are measured from the start of the file
};
#ifdef __cplusplus
}
class metaTile {
public:
metaTile(const std::string &xmlconfig, const std::string &options, int x, int y, int z);
void clear();
void set(int x, int y, const std::string &data);
const std::string get(int x, int y);
int xyz_to_meta_offset(int x, int y, int z);
void save(struct storage_backend * store);
void expire_tiles(int sock, char * host, char * uri);
private:
int x_, y_, z_;
std::string xmlconfig_;
std::string options_;
std::string tile[METATILE][METATILE];
static const int header_size = sizeof(struct meta_layout) + (sizeof(struct entry) * (METATILE * METATILE));
class metaTile
{
public:
metaTile(const std::string &xmlconfig, const std::string &options, int x, int y, int z);
void clear();
void set(int x, int y, const std::string &data);
const std::string get(int x, int y);
int xyz_to_meta_offset(int x, int y, int z);
void save(struct storage_backend * store);
void expire_tiles(int sock, char * host, char * uri);
private:
int x_, y_, z_;
std::string xmlconfig_;
std::string options_;
std::string tile[METATILE][METATILE];
static const int header_size = sizeof(struct meta_layout) + (sizeof(struct entry) * (METATILE * METATILE));
};
#endif
......
......@@ -10,12 +10,12 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; If not, see http://www.gnu.org/licenses/.
*/
#ifndef MODTILE_H
#ifndef MODTILE_H
#define MODTILE_H
#include "store.h"
......@@ -66,81 +66,81 @@ typedef struct delaypool {
} delaypool;
typedef struct stats_data {
apr_uint64_t noResp200;
apr_uint64_t noResp304;
apr_uint64_t noResp404;
apr_uint64_t noResp200;
apr_uint64_t noResp304;
apr_uint64_t noResp404;
apr_uint64_t noResp503;
apr_uint64_t noResp5XX;
apr_uint64_t noRespOther;
apr_uint64_t noFreshCache;
apr_uint64_t noFreshRender;
apr_uint64_t noOldCache;
apr_uint64_t noOldRender;
apr_uint64_t noVeryOldCache;
apr_uint64_t noVeryOldRender;
apr_uint64_t noResp5XX;
apr_uint64_t noRespOther;
apr_uint64_t noFreshCache;
apr_uint64_t noFreshRender;
apr_uint64_t noOldCache;
apr_uint64_t noOldRender;
apr_uint64_t noVeryOldCache;
apr_uint64_t noVeryOldRender;
apr_uint64_t noRespZoom[MAX_ZOOM_SERVER + 1];
apr_uint64_t totalBufferRetrievalTime;
apr_uint64_t noTotalBufferRetrieval;
apr_uint64_t zoomBufferRetrievalTime[MAX_ZOOM_SERVER + 1];
apr_uint64_t noZoomBufferRetrieval[MAX_ZOOM_SERVER + 1];
apr_uint64_t totalBufferRetrievalTime;
apr_uint64_t noTotalBufferRetrieval;
apr_uint64_t zoomBufferRetrievalTime[MAX_ZOOM_SERVER + 1];
apr_uint64_t noZoomBufferRetrieval[MAX_ZOOM_SERVER + 1];
apr_uint64_t *noResp200Layer;
apr_uint64_t *noResp404Layer;
apr_uint64_t *noResp200Layer;
apr_uint64_t *noResp404Layer;
} stats_data;
typedef struct {
const char * store;
char xmlname[XMLCONFIG_MAX];
char baseuri[PATH_MAX];
char fileExtension[PATH_MAX];
char mimeType[PATH_MAX];
const char * description;
const char * attribution;
const char * cors;
char **hostnames;
int noHostnames;
int minzoom;
int maxzoom;
int aspect_x;
int aspect_y;
int enableOptions;
const char * store;
char xmlname[XMLCONFIG_MAX];
char baseuri[PATH_MAX];
char fileExtension[PATH_MAX];
char mimeType[PATH_MAX];
const char * description;
const char * attribution;
const char * cors;
char **hostnames;
int noHostnames;
int minzoom;
int maxzoom;
int aspect_x;
int aspect_y;
int enableOptions;
} tile_config_rec;
typedef struct {
apr_array_header_t *configs;
int request_timeout;
apr_array_header_t *configs;
int request_timeout;
int request_timeout_priority;
int max_load_old;
int max_load_missing;
apr_time_t veryold_threshold;
int cache_duration_dirty;
int cache_duration_max;
int cache_duration_minimum;
int cache_duration_low_zoom;
int cache_level_low_zoom;
int cache_duration_medium_zoom;
int cache_level_medium_zoom;
double cache_duration_last_modified_factor;
char renderd_socket_name[PATH_MAX];
int renderd_socket_port;
char tile_dir[PATH_MAX];
int max_load_old;
int max_load_missing;
apr_time_t veryold_threshold;
int cache_duration_dirty;
int cache_duration_max;
int cache_duration_minimum;
int cache_duration_low_zoom;
int cache_level_low_zoom;
int cache_duration_medium_zoom;
int cache_level_medium_zoom;
double cache_duration_last_modified_factor;
char renderd_socket_name[PATH_MAX];
int renderd_socket_port;
char tile_dir[PATH_MAX];
char cache_extended_hostname[PATH_MAX];
int cache_extended_duration;
int mincachetime[MAX_ZOOM_SERVER + 1];
int enableGlobalStats;
int cache_extended_duration;
int mincachetime[MAX_ZOOM_SERVER + 1];
int enableGlobalStats;
int enableTileThrottling;
int enableTileThrottlingXForward;
int enableTileThrottlingXForward;
int delaypoolTileSize;
long delaypoolTileRate;
int delaypoolRenderSize;
long delaypoolRenderRate;
int bulkMode;
int bulkMode;
} tile_server_conf;
typedef struct tile_request_data {
struct protocol * cmd;
struct storage_backend * store;
struct storage_backend * store;
int layerNumber;
} tile_request_data;
......
......@@ -10,7 +10,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; If not, see http://www.gnu.org/licenses/.
*/
......
......@@ -10,7 +10,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; If not, see http://www.gnu.org/licenses/.
*/
......@@ -40,31 +40,31 @@ extern "C" {
enum protoCmd { cmdIgnore, cmdRender, cmdDirty, cmdDone, cmdNotDone, cmdRenderPrio, cmdRenderBulk, cmdRenderLow };
struct protocol {
int ver;
enum protoCmd cmd;
int x;
int y;
int z;
char xmlname[XMLCONFIG_MAX];
char mimetype[XMLCONFIG_MAX];
char options[XMLCONFIG_MAX];
int ver;
enum protoCmd cmd;
int x;
int y;
int z;
char xmlname[XMLCONFIG_MAX];
char mimetype[XMLCONFIG_MAX];
char options[XMLCONFIG_MAX];
};
struct protocol_v1 {
int ver;
enum protoCmd cmd;
int x;
int y;
int z;
};
int ver;
enum protoCmd cmd;
int x;
int y;
int z;
};
struct protocol_v2 {
int ver;
enum protoCmd cmd;
int x;
int y;
int z;
char xmlname[XMLCONFIG_MAX];
struct protocol_v2 {
int ver;
enum protoCmd cmd;
int x;
int y;
int z;
char xmlname[XMLCONFIG_MAX];
};
#ifdef __cplusplus
......
......@@ -10,7 +10,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; If not, see http://www.gnu.org/licenses/.
*/
......
......@@ -10,7 +10,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; If not, see http://www.gnu.org/licenses/.
*/
......
......@@ -10,7 +10,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; If not, see http://www.gnu.org/licenses/.
*/
......
......@@ -10,7 +10,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; If not, see http://www.gnu.org/licenses/.
*/
......@@ -27,34 +27,34 @@ extern "C" {
#define HASHIDX_SIZE 2213
typedef struct {
long noDirtyRender;
long noReqRender;
long noReqPrioRender;
long noReqLowRender;
long noReqBulkRender;
long noReqDroped;
long noZoomRender[MAX_ZOOM + 1];
long timeReqRender;
long timeReqPrioRender;
long timeReqLowRender;
long timeReqBulkRender;
long timeReqDirty;
long timeZoomRender[MAX_ZOOM + 1];
long noDirtyRender;
long noReqRender;
long noReqPrioRender;
long noReqLowRender;
long noReqBulkRender;
long noReqDroped;
long noZoomRender[MAX_ZOOM + 1];
long timeReqRender;
long timeReqPrioRender;
long timeReqLowRender;
long timeReqBulkRender;
long timeReqDirty;
long timeZoomRender[MAX_ZOOM + 1];
} stats_struct;
struct item_idx {
struct item_idx *next;
struct item *item;
struct item_idx *next;
struct item *item;
};
struct request_queue {
int hashidxSize;
struct item reqHead, reqPrioHead, reqLowHead, reqBulkHead, dirtyHead, renderHead;
struct item_idx * item_hashidx;
int reqNum, reqPrioNum, reqLowNum, reqBulkNum, dirtyNum;
pthread_mutex_t qLock;
pthread_cond_t qCond;
stats_struct stats;
int hashidxSize;
struct item reqHead, reqPrioHead, reqLowHead, reqBulkHead, dirtyHead, renderHead;
struct item_idx * item_hashidx;
int reqNum, reqPrioNum, reqLowNum, reqBulkNum, dirtyNum;
pthread_mutex_t qLock;
pthread_cond_t qCond;
stats_struct stats;
};
......
......@@ -10,7 +10,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; If not, see http://www.gnu.org/licenses/.
*/
......@@ -31,30 +31,30 @@ extern "C" {
#define STORE_LOGLVL_WARNING 2
#define STORE_LOGLVL_ERR 3
struct stat_info {
off_t size; /* total size, in bytes */
time_t atime; /* time of last access */
time_t mtime; /* time of last modification */
time_t ctime; /* time of last status change */
int expired; /* has the tile expired */
};
struct storage_backend {
int (*tile_read)(struct storage_backend * store, const char *xmlconfig, const char *options, int x, int y, int z, char *buf, size_t sz, int * compressed, char * err_msg);
struct stat_info (*tile_stat)(struct storage_backend * store, const char *xmlconfig, const char *options, int x, int y, int z);
int (*metatile_write)(struct storage_backend * store, const char *xmlconfig, const char *options, int x, int y, int z, const char *buf, int sz);
int (*metatile_delete)(struct storage_backend * store, const char *xmlconfig, int x, int y, int z);
int (*metatile_expire)(struct storage_backend * store, const char *xmlconfig, int x, int y, int z);
char * (*tile_storage_id)(struct storage_backend * store, const char *xmlconfig, const char *options, int x, int y, int z, char * string);
int (*close_storage)(struct storage_backend * store);
void * storage_ctx;
};
void log_message(int log_lvl, const char *format, ...);
struct storage_backend * init_storage_backend(const char * options);
struct stat_info {
off_t size; /* total size, in bytes */
time_t atime; /* time of last access */
time_t mtime; /* time of last modification */
time_t ctime; /* time of last status change */
int expired; /* has the tile expired */
};
struct storage_backend {
int (*tile_read)(struct storage_backend * store, const char *xmlconfig, const char *options, int x, int y, int z, char *buf, size_t sz, int * compressed, char * err_msg);
struct stat_info(*tile_stat)(struct storage_backend * store, const char *xmlconfig, const char *options, int x, int y, int z);
int (*metatile_write)(struct storage_backend * store, const char *xmlconfig, const char *options, int x, int y, int z, const char *buf, int sz);
int (*metatile_delete)(struct storage_backend * store, const char *xmlconfig, int x, int y, int z);
int (*metatile_expire)(struct storage_backend * store, const char *xmlconfig, int x, int y, int z);
char * (*tile_storage_id)(struct storage_backend * store, const char *xmlconfig, const char *options, int x, int y, int z, char * string);
int (*close_storage)(struct storage_backend * store);
void * storage_ctx;
};
void log_message(int log_lvl, const char *format, ...);
struct storage_backend * init_storage_backend(const char * options);
#ifdef __cplusplus
}
#endif
......
......@@ -10,7 +10,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; If not, see http://www.gnu.org/licenses/.
*/
......@@ -23,9 +23,9 @@ extern "C" {
#endif
#include "store.h"
struct storage_backend * init_storage_file(const char * tile_dir);
int xyzo_to_meta(char *path, size_t len, const char *tile_dir, const char *xmlconfig, const char *options, int x, int y, int z);
struct storage_backend * init_storage_file(const char * tile_dir);
int xyzo_to_meta(char *path, size_t len, const char *tile_dir, const char *xmlconfig, const char *options, int x, int y, int z);
#ifdef __cplusplus
}
......
......@@ -10,7 +10,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; If not, see http://www.gnu.org/licenses/.
*/
......@@ -21,7 +21,7 @@
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
extern "C" {