/* * Copyright (C) 2016 Robin Krahl * * dbfp.h -- provides access to the timetable API of the Deutsche Bahn */ #ifndef DBFP_H_ #define DBFP_H_ #include #include #include #define DBFP_VERSION_MAJOR 0 #define DBFP_VERSION_MINOR 1 #define DBFP_VERSION_PATCH 0 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(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, char *location_id, time_t time, size_t *n, struct dbfp_departure **departures); #endif /* DBFP_H_ */