/* * Copyright (C) 2016 Robin Krahl * * dbfp.h */ #ifndef DBFP_H_ #define DBFP_H_ #include #include #include enum dbfp_error { DBFP_ERROR_CURL = -1, DBFP_ERROR_FORMAT = -2, DBFP_ERROR_STRUCTURE = -3, DBFP_ERROR_API = -4, DBFP_ERROR_PARSE = -5 }; struct dbfp { char *key; CURL *curl; }; struct dbfp_location { char *name; char *id; float lon; float lat; }; struct dbfp_departure { char *name; char *type; char *stopid; char *stop; time_t time; char *direction; char *track; }; int dbfp_init(struct dbfp *dbfp, char *key); void dbfp_close(struct dbfp *dbfp); void dbfp_location_close(struct dbfp_location *location); int dbfp_query_location_name(struct dbfp *dbfp, char *input, size_t *n, struct dbfp_location **locations); void dbfp_departure_close(struct dbfp_departure *departure); int dbfp_query_departure(struct dbfp *dbfp, struct dbfp_location *location, char *location_id, time_t time, size_t *n, struct dbfp_departure **departures); #endif /* DBFP_H_ */