rules.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //This function clears the entire anti-passback cache
  2. int apb_clear();
  3. // This function examines the state of the gps_stat and stop_stat structures and clears the anti-passback cache if the bus has
  4. //either moved at least APB_DIST_EXPIRE meters since the last accept, or if the route, trip, or stop have changed.
  5. // If the cache is cleared as the result of this function call, the cache state is updated so that it reflects the location
  6. //data as they stood when the flush was completed. If there is nothing in the cache, the location is simply updated.
  7. int apb_flush_if_needed();
  8. //Add a rider to the anti-passback cache...
  9. int apb_add(logical_card_id_t id);
  10. // Look up a rider in the anti-passback cache. If the rider is not present, this function returns zero.
  11. //If the rider is present, this function returns the number of seconds since they last rode this bus.
  12. int apb_lookup(logical_card_id_t id);
  13. // This function does a "smart" magstripe lookup by looking up the token found
  14. //on track1, then track2, then track3 individually (ignoring tracks 1 and 2 if they
  15. //contain credit-card style field-delimiters), returning the index of the rider
  16. //in the riders database attached to ctx, or -1 if not found.
  17. // If the return is -1 (not found) final_token is filled with the whole list of
  18. //tracks that were attempted (with credit-card looking tracks blanked out).
  19. // If the return is >= 0 (record found) final_token is filled with the token that
  20. //was used to generate the match.
  21. int smart_find_mag(passdb_slim_context *ctx, char *token, char *final_token);
  22. // This function does a "smart" RFID lookup by translating the raw RFID format (NN|XXXX...)
  23. //where NN is the number of bits in hex, and XXXX... is the bitstring in hex (right justified
  24. //to the nearest nibble boundary) and processing it based on the number of bits and a list of
  25. //known formats until it either matches a known format or is determined not to match any of them.
  26. // If a match is found, the return value will be >= 0 and indicate the index of the rider in
  27. //the database that ctx is attached to. If no match is found, -1 is returned. In either case
  28. //final_token is filled with the string representing the decoded decimal RFID value "nbits:site:id"
  29. //or if the token was not in a known format, "nbits:rawval?".
  30. int smart_find_rf(passdb_slim_context *ctx, char *token, char *final_token);
  31. int rules_loaded();
  32. int load_rules(char *filename);
  33. int unload_rules();
  34. int process_rider(passdb_slim_context *ctx, int rider_index, char *credential);
  35. int process_driver_rulecall(struct driver_rulecall_struct *drc);