core-legacy/helpers.h

41 lines
947 B
C
Raw Normal View History

2019-07-14 22:39:37 +00:00
#ifndef EMGAUWA_CORE_HELPERS_H
#define EMGAUWA_CORE_HELPERS_H
2019-07-19 09:41:39 +00:00
#include <json/value.h>
#include <models/period.h>
#include <models/period_list.h>
#include <sqlite3.h>
2019-07-19 09:41:39 +00:00
2019-07-14 22:39:37 +00:00
namespace helpers
{
int
bind_tcp_server(const char *addr, const char *port, int max_client_backlog);
int
get_server_port(int fd);
int
2019-07-20 12:51:45 +00:00
send_udp_broadcast(const char *addr, uint16_t port, const char* message);
2019-07-19 09:41:39 +00:00
period_list*
parse_periods(Json::Value periods_json);
2019-07-21 22:00:07 +00:00
typedef struct sql_filter_builder
{
2019-07-21 22:00:07 +00:00
sql_filter_builder(const char *col_name, const void *value, intptr_t bind_func, const char *logic);
const char *col_name;
const void *value;
2019-07-21 22:00:07 +00:00
intptr_t bind_func;
const char *logic;
} sql_filter_builder;
sqlite3_stmt*
create_sql_filtered_query(const char *sql, sql_filter_builder **filters);
2019-07-29 20:02:38 +00:00
int
open_tcp_connection(char* host, char* port);
2019-07-14 22:39:37 +00:00
}
#endif //EMGAUWA_CORE_HELPERS_H