summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2005-10-23 20:03:56 +0000
committerlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2005-10-23 20:03:56 +0000
commitb9e8c17d8c4f28938c7cb0a665a1f21232ebdf66 (patch)
treed4d3004078f2de09d76f2798fba06d4eecc25a77 /include
parent5fc01ff6f98d72219420bc29fb59d2d6eb93e887 (diff)
make "frametype" a parameter of transcieve functions
git-svn-id: https://svn.gnumonks.org/trunk/librfid@1559 e0336214-984f-0b4b-a45f-81c69e1f0ede
Diffstat (limited to 'include')
-rw-r--r--include/rfid/rfid.h7
-rw-r--r--include/rfid/rfid_asic.h2
-rw-r--r--include/rfid/rfid_asic_rc632.h6
-rw-r--r--include/rfid/rfid_layer2.h4
-rw-r--r--include/rfid/rfid_protocol_mifare_classic.h11
-rw-r--r--include/rfid/rfid_reader.h7
6 files changed, 35 insertions, 2 deletions
diff --git a/include/rfid/rfid.h b/include/rfid/rfid.h
index bebb42a..f9d36c9 100644
--- a/include/rfid/rfid.h
+++ b/include/rfid/rfid.h
@@ -3,6 +3,13 @@
#include <stdio.h>
+enum rfid_frametype {
+ RFID_14443A_FRAME_REGULAR,
+ RFID_14443B_FRAME_REGULAR,
+ RFID_MIFARE_FRAME,
+};
+
+
#define DEBUGP(x, args ...) fprintf(stderr, "%s(%d):%s: " x, __FILE__, __LINE__, __FUNCTION__, ## args)
#define DEBUGPC(x, args ...) fprintf(stderr, x, ## args)
diff --git a/include/rfid/rfid_asic.h b/include/rfid/rfid_asic.h
index e336d01..6511615 100644
--- a/include/rfid/rfid_asic.h
+++ b/include/rfid/rfid_asic.h
@@ -1,6 +1,8 @@
#ifndef _RFID_ASIC_H
#define _RFID_ASIC_H
+enum rfid_frametype;
+
#include <rfid/rfid_asic_rc632.h>
struct rfid_asic_transport {
diff --git a/include/rfid/rfid_asic_rc632.h b/include/rfid/rfid_asic_rc632.h
index 7a984ff..a84f792 100644
--- a/include/rfid/rfid_asic_rc632.h
+++ b/include/rfid/rfid_asic_rc632.h
@@ -3,6 +3,8 @@
struct rfid_asic_transport_handle;
+#include <rfid/rfid_asic.h>
+
struct rfid_asic_rc632_transport {
struct {
int (*reg_write)(struct rfid_asic_transport_handle *rath,
@@ -33,6 +35,7 @@ struct rfid_asic_rc632 {
int (*turn_on_rf)(struct rfid_asic_handle *h);
int (*turn_off_rf)(struct rfid_asic_handle *h);
int (*transcieve)(struct rfid_asic_handle *h,
+ enum rfid_frametype,
const u_int32_t *tx_buf,
unsigned int tx_len,
u_int32_t *rx_buf,
@@ -55,7 +58,8 @@ struct rfid_asic_rc632 {
int (*init)(struct rfid_asic_handle *h);
} iso15693;
struct {
- int (*setkey)(struct rfid_asic_handle *h, unsigned char *key);
+ int (*setkey)(struct rfid_asic_handle *h,
+ const unsigned char *key);
int (*auth)(struct rfid_asic_handle *h, u_int8_t cmd,
u_int32_t serno, u_int8_t block);
} mifare_classic;
diff --git a/include/rfid/rfid_layer2.h b/include/rfid/rfid_layer2.h
index c87578b..f6d9117 100644
--- a/include/rfid/rfid_layer2.h
+++ b/include/rfid/rfid_layer2.h
@@ -4,6 +4,8 @@
struct rfid_layer2_handle;
struct rfid_reader_handle;
+#include <rfid/rfid.h>
+
#include <rfid/rfid_layer2_iso14443a.h>
#include <rfid/rfid_layer2_iso14443b.h>
#include <rfid/rfid_layer2_iso15693.h>
@@ -17,6 +19,7 @@ struct rfid_layer2 {
struct rfid_layer2_handle *(*init)(struct rfid_reader_handle *h);
int (*open)(struct rfid_layer2_handle *h);
int (*transcieve)(struct rfid_layer2_handle *h,
+ enum rfid_frametype frametype,
const unsigned char *tx_buf,
unsigned int tx_len, unsigned char *rx_buf,
unsigned int *rx_len, u_int64_t timeout,
@@ -50,6 +53,7 @@ struct rfid_layer2_handle *rfid_layer2_init(struct rfid_reader_handle *rh,
unsigned int id);
int rfid_layer2_open(struct rfid_layer2_handle *l2h);
int rfid_layer2_transcieve(struct rfid_layer2_handle *l2h,
+ enum rfid_frametype frametype,
const unsigned char *tx_buf, unsigned int tx_len,
unsigned char *rx_buf, unsigned int *rx_len,
u_int64_t timeout, unsigned int flags);
diff --git a/include/rfid/rfid_protocol_mifare_classic.h b/include/rfid/rfid_protocol_mifare_classic.h
index 01066f4..64ef11e 100644
--- a/include/rfid/rfid_protocol_mifare_classic.h
+++ b/include/rfid/rfid_protocol_mifare_classic.h
@@ -5,7 +5,16 @@ extern struct rfid_protocol rfid_protocol_mfcl;
#define RFID_CMD_MIFARE_AUTH1A 0x60
#define RFID_CMD_MIFARE_AUTH1B 0x61
-#define MIFARE_CLASSIC_KEY_DEFAULT "\xa0\xa1\xa2\xa3\xa4\xa5"
+#define MIFARE_CL_CMD_WRITE16 0xA0
+#define MIFARE_CL_CMD_READ 0x30
+
+#define MIFARE_CL_RESP_ACK 0x0a
+#define MIFARE_CL_RESP_NAK 0x00
+
+#define MIFARE_CL_PAGE_MAX 0xff
+
+#define MIFARE_CLASSIC_KEYA_DEFAULT "\xa0\xa1\xa2\xa3\xa4\xa5"
+#define MIFARE_CLASSIC_KEYB_DEFAULT "\xb0\xb1\xb2\xb3\xb4\xb5"
#endif
diff --git a/include/rfid/rfid_reader.h b/include/rfid/rfid_reader.h
index 0acd532..501119b 100644
--- a/include/rfid/rfid_reader.h
+++ b/include/rfid/rfid_reader.h
@@ -10,6 +10,7 @@ struct rfid_reader {
char *name;
unsigned int id;
int (*transcieve)(struct rfid_reader_handle *h,
+ enum rfid_frametype frametype,
const unsigned char *tx_buf, unsigned int tx_len,
unsigned char *rx_buf, unsigned int *rx_len,
u_int64_t timeout, unsigned int flags);
@@ -61,4 +62,10 @@ struct rfid_reader_handle {
} priv;
struct rfid_reader *reader;
};
+
+
+extern struct rfid_reader_handle *
+rfid_reader_open(void *data, unsigned int id);
+
+extern void rfid_reader_close(struct rfid_reader_handle *rh);
#endif
personal git repositories of Harald Welte. Your mileage may vary