2015-08-20 10:16:26 -07:00
|
|
|
#ifndef _STORAGE_H_INCL_
|
|
|
|
# define _STORAGE_H_INCL_
|
|
|
|
|
2015-08-21 12:11:42 -07:00
|
|
|
#include <time.h>
|
2015-08-20 10:16:26 -07:00
|
|
|
#include "json.h"
|
2016-12-07 11:40:59 -07:00
|
|
|
#include "udata.h"
|
2015-08-20 10:16:26 -07:00
|
|
|
|
2015-09-11 01:36:47 -07:00
|
|
|
#define DEFAULT_HISTORY_HOURS 6
|
|
|
|
|
2015-09-21 02:34:00 -07:00
|
|
|
/* Output types */
|
2015-08-29 07:34:20 -07:00
|
|
|
typedef enum {
|
|
|
|
GEOJSON = 0,
|
|
|
|
CSV,
|
|
|
|
JSON,
|
|
|
|
RAW,
|
2015-08-29 12:11:03 -07:00
|
|
|
GPX,
|
2015-09-01 12:03:50 -07:00
|
|
|
RAWPAYLOAD,
|
2015-09-01 12:45:57 -07:00
|
|
|
LINESTRING,
|
2015-09-16 06:27:11 -07:00
|
|
|
XML,
|
2015-08-29 07:34:20 -07:00
|
|
|
} output_type;
|
2015-08-20 10:16:26 -07:00
|
|
|
|
2015-09-21 02:34:00 -07:00
|
|
|
/* JSON payload types */
|
|
|
|
typedef enum {
|
|
|
|
T_UNKNOWN = 0,
|
|
|
|
T_BEACON,
|
|
|
|
T_CARD,
|
|
|
|
T_CMD,
|
|
|
|
T_CONFIG,
|
|
|
|
T_LOCATION,
|
|
|
|
T_LWT,
|
|
|
|
T_MSG,
|
|
|
|
T_STEPS,
|
|
|
|
T_TRANSITION,
|
|
|
|
T_WAYPOINT,
|
|
|
|
T_WAYPOINTS,
|
2016-01-22 14:42:30 -07:00
|
|
|
#if WITH_ENCRYPT
|
|
|
|
T_ENCRYPTED,
|
|
|
|
#endif
|
2022-08-06 09:46:11 -07:00
|
|
|
#ifdef WITH_TOURS
|
2022-08-04 02:25:23 -07:00
|
|
|
T_REQUEST,
|
|
|
|
#endif
|
2015-09-21 02:34:00 -07:00
|
|
|
} payload_type;
|
|
|
|
|
2015-08-29 11:50:13 -07:00
|
|
|
JsonNode *lister(char *username, char *device, time_t s_lo, time_t s_hi, int reverse);
|
2015-09-29 07:17:43 -07:00
|
|
|
JsonNode *multilister(JsonNode *udpairs, time_t s_lo, time_t s_hi, int reverse);
|
2015-10-02 07:26:21 -07:00
|
|
|
void locations(char *filename, JsonNode *obj, JsonNode *arr, time_t s_lo, time_t s_hi, output_type otype, int limit, JsonNode *fields, char *username, char *device);
|
2016-03-04 02:38:11 -07:00
|
|
|
int make_times(char *time_from, time_t *s_lo, char *time_to, time_t *s_to, int hours);
|
2015-08-22 07:42:35 -07:00
|
|
|
JsonNode *geo_json(JsonNode *json);
|
2015-09-01 12:45:57 -07:00
|
|
|
JsonNode *geo_linestring(JsonNode *location_array);
|
2015-08-23 06:04:54 -07:00
|
|
|
JsonNode *kill_datastore(char *username, char *device);
|
2015-10-23 06:32:52 -07:00
|
|
|
JsonNode *last_users(char *user, char *device, JsonNode *fields);
|
2015-08-29 12:11:03 -07:00
|
|
|
char *gpx_string(JsonNode *json);
|
2015-09-01 23:21:47 -07:00
|
|
|
void storage_init(int revgeo);
|
2015-09-24 03:49:14 -07:00
|
|
|
void storage_gcache_dump(char *lmdbname);
|
|
|
|
void storage_gcache_load(char *lmdbname);
|
2015-09-16 08:26:27 -07:00
|
|
|
void xml_output(JsonNode *json, output_type otype, JsonNode *fields, void (*func)(char *s, void *param), void *param);
|
2015-11-14 05:36:00 -07:00
|
|
|
void csv_output(JsonNode *json, output_type otype, JsonNode *fields, void (*func)(char *s, void *param), void *param);
|
2015-10-21 05:37:51 -07:00
|
|
|
char *storage_userphoto(char *username);
|
2016-03-01 14:02:33 -07:00
|
|
|
void append_card_to_object(JsonNode *obj, char *user, char *device);
|
2016-02-24 06:00:55 -07:00
|
|
|
void extra_http_json(JsonNode *array, char *user, char *device);
|
2016-12-07 11:40:59 -07:00
|
|
|
void load_otrw_from_string(struct udata *ud, char *username, char *device, char *js);
|
|
|
|
bool load_fences(struct udata *ud);
|
2015-08-20 10:16:26 -07:00
|
|
|
|
|
|
|
#endif
|