summaryrefslogtreecommitdiff
path: root/easytool/easytool.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-08-12 18:29:31 +0800
committerHarald Welte <laforge@gnumonks.org>2010-08-12 18:29:31 +0800
commit4d4a06afcbc6ca1a2056ab2e4973b454eba59de3 (patch)
tree548e0ffbf36d7491f98c6c901bc094bce2ec534e /easytool/easytool.c
parente59e499029c05a68156cdf9d61ceac54e6813d3a (diff)
split easytool into multiple files, add database of MRT station names
Diffstat (limited to 'easytool/easytool.c')
-rw-r--r--easytool/easytool.c38
1 files changed, 4 insertions, 34 deletions
diff --git a/easytool/easytool.c b/easytool/easytool.c
index 5a77997..52a6c53 100644
--- a/easytool/easytool.c
+++ b/easytool/easytool.c
@@ -10,30 +10,12 @@
#include <sys/stat.h>
#include <sys/mman.h>
+#include <netinet/in.h>
+
#include <nfc/nfc-types.h>
#include <nfc/mifaretag.h>
-struct value_string {
- unsigned int value;
- const char *str;
-};
-
-static char namebuf[255];
-const char *get_value_string(const struct value_string *vs, uint32_t val)
-{
- int i;
-
- for (i = 0;; i++) {
- if (vs[i].value == 0 && vs[i].str == NULL)
- break;
- if (vs[i].value == val)
- return vs[i].str;
- }
-
- snprintf(namebuf, sizeof(namebuf), "unknown 0x%x", val);
- return namebuf;
-}
-
+#include "easycard.h"
struct {
int fd;
@@ -85,17 +67,6 @@ static void parse_acc_bits(struct acc_bits_parsed *abp, uint8_t *acc_bits)
}
}
-#define EASY_TT_MRT_ENTER 0x00
-#define EASY_TT_MRT_EXIT 0x11
-#define EASY_TT_PURCHASE 0x20
-
-struct value_string easy_tt_names[] = {
- { EASY_TT_MRT_ENTER, "Enter MRT Stn" },
- { EASY_TT_MRT_EXIT, "Leave MRT Stn" },
- { EASY_TT_PURCHASE, "Shop Purchase" },
- { 0, NULL }
-};
-
/* storage of a transaction log record on the transponder itself */
struct easy_log_rec {
uint8_t unknown[2];
@@ -122,7 +93,7 @@ static void dump_easy_log(const struct easy_log_rec *elr)
elr->amount, elr->remaining);
}
-static dump_mfcl(mifare_tag *mft)
+static void dump_mfcl(mifare_tag *mft)
{
unsigned int sect;
@@ -150,7 +121,6 @@ static dump_mfcl(mifare_tag *mft)
}
}
-
int main(int argc, char **argv)
{
struct stat st;
personal git repositories of Harald Welte. Your mileage may vary