core-legacy/helpers.h

43 lines
984 B
C++

#ifndef EMGAUWA_CORE_HELPERS_H
#define EMGAUWA_CORE_HELPERS_H
#include <json/value.h>
#include <models/period.h>
#include <models/period_list.h>
#include <sqlite3.h>
namespace helpers
{
int
bind_tcp_server(const char *addr, const char *port, int max_client_backlog);
int
get_server_port(int fd);
int
send_udp_broadcast(const char *addr, uint16_t port, void *message, size_t length);
period_list*
parse_periods(Json::Value periods_json);
typedef struct sql_filter_builder
{
sql_filter_builder(const char *col_name, const void *value, intptr_t bind_func, const char *logic);
const char *col_name;
const void *value;
intptr_t bind_func;
const char *logic;
} sql_filter_builder;
sqlite3_stmt*
create_sql_filtered_query(const char *sql, sql_filter_builder **filters);
int
open_tcp_connection(char* host, char* port);
int
migrate_sql();
}
#endif //EMGAUWA_CORE_HELPERS_H