summaryrefslogtreecommitdiff
path: root/easytool/easycard.h
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-08-15 14:41:48 +0800
committerHarald Welte <laforge@gnumonks.org>2010-08-15 14:41:48 +0800
commit1214269f6f7ab7e8ad705ad6c990afa23284eb29 (patch)
tree376aa7f91f582dadc587428182aa4725d9c508f2 /easytool/easycard.h
parent010d1367fc401d44a6fb5dc65fac080ea8e6721c (diff)
add functions to do comprehensive modifications of last purchase or recharge
Diffstat (limited to 'easytool/easycard.h')
-rw-r--r--easytool/easycard.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/easytool/easycard.h b/easytool/easycard.h
index 37caf1f..8979524 100644
--- a/easytool/easycard.h
+++ b/easytool/easycard.h
@@ -1,6 +1,8 @@
#ifndef EASYCARD_H
#define EASYCARD_H
+#include <nfc/nfc-types.h>
+#include <nfc/mifaretag.h>
#include "utils.h"
#define EASY_TT_MRT_ENTER 0x00
@@ -52,17 +54,31 @@ struct easy_log_rec {
uint8_t unknown3[2];
} __attribute__ ((packed));
+/* functions for data format conversion */
+
time_t easy_timestamp2time(const uint8_t *easy_ts);
char *easy_asc_timestamp(const uint8_t *timestamp);
-/* apply a telta (positive or negative) to a EasyCard log record */
+/* functions to make a change to individual portions of the card */
+
+/* apply a delta (positive or negative) to a EasyCard log record */
int easy_update_log_rec(struct easy_log_rec *elr, int16_t delta);
/* apply a delta to the 'sum of day' record in Sector 15 Block 2 */
int easy_update_sum_of_day(struct easy_sect15blk2 *s15b2, int16_t delta);
-void easy_dump_log_rec(const struct easy_log_rec *elr);
+/* functions to make a comprehensive change, leave all card state in
+ * a consistent state */
-typedef mifare_tag;
+/* positive value: make it more expensive. negative: cheaper */
+int easy_alter_last_purchase(mifare_tag *mft, int16_t delta);
+/* positive value: make it more expensive. negative: cheaper */
+int easy_alter_last_recharge(mifare_tag *mft, int16_t delta);
+
+/* functions to dump the transaction log */
+
+/* dump a single log record */
+void easy_dump_log_rec(const struct easy_log_rec *elr);
+/* dump the entire transaction log */
void easy_dump_log(mifare_tag *mft);
#endif /* EASYCARD_H */
personal git repositories of Harald Welte. Your mileage may vary