- fix multiple include of rfid_protocol_mifare_classic.h problem
[librfid] / src / rfid_proto_mifare_classic.c
index 99386a1..d45eefc 100644 (file)
@@ -1,7 +1,7 @@
 
 /* Mifare Classic implementation, PCD side.
  *
- * (C) 2005 by Harald Welte <laforge@gnumonks.org>
+ * (C) 2005-2006 by Harald Welte <laforge@gnumonks.org>
  *
  */
 
 #include <string.h>
 #include <errno.h>
 
-#include <rfid/rfid.h>
-#include <rfid/rfid_protocol.h>
-#include <rfid/rfid_layer2.h>
-#include <rfid/rfid_protocol_mifare_classic.h>
+#include <librfid/rfid.h>
+#include <librfid/rfid_protocol.h>
+#include <librfid/rfid_layer2.h>
+#include <librfid/rfid_protocol_mifare_classic.h>
 
-#include <rfid/rfid_reader.h>
+#include <librfid/rfid_reader.h>
 
 #include "rfid_iso14443_common.h"
 
@@ -57,9 +57,9 @@ mfcl_read(struct rfid_protocol_handle *ph, unsigned int page,
        tx[0] = MIFARE_CL_CMD_READ;
        tx[1] = page & 0xff;
 
-       ret = ph->l2h->l2->fn.transcieve(ph->l2h, RFID_MIFARE_FRAME, tx,
-                                        sizeof(tx), rx_buf, &real_rx_len,
-                                        MIFARE_CL_READ_FWT, 0);
+       ret = rfid_layer2_transceive(ph->l2h, RFID_MIFARE_FRAME, tx,
+                                    sizeof(tx), rx_buf, &real_rx_len,
+                                    MIFARE_CL_READ_FWT, 0);
 
        if (ret < 0)
                return ret;
@@ -93,9 +93,9 @@ mfcl_write(struct rfid_protocol_handle *ph, unsigned int page,
 
        memcpy(tx+2, tx_data, 16);
 
-       ret = ph->l2h->l2->fn.transcieve(ph->l2h, RFID_MIFARE_FRAME, tx,
-                                        sizeof(tx), rx, &rx_len, 
-                                        MIFARE_CL_WRITE_FWT, 0);
+       ret = rfid_layer2_transceive(ph->l2h, RFID_MIFARE_FRAME, tx,
+                                    sizeof(tx), rx, &rx_len, 
+                                    MIFARE_CL_WRITE_FWT, 0);
                                        
        if (ret < 0)
                return ret;
@@ -110,17 +110,17 @@ static struct rfid_protocol_handle *
 mfcl_init(struct rfid_layer2_handle *l2h)
 {
        struct rfid_protocol_handle *ph;
-       ph = malloc(sizeof(struct rfid_protocol_handle));
+       ph = malloc_protocol_handle(sizeof(struct rfid_protocol_handle));
        return ph;
 }
 
 static int mfcl_fini(struct rfid_protocol_handle *ph)
 {
-       free(ph);
+       free_protocol_handle(ph);
        return 0;
 }
 
-struct rfid_protocol rfid_protocol_mfcl = {
+const struct rfid_protocol rfid_protocol_mfcl = {
        .id     = RFID_PROTOCOL_MIFARE_CLASSIC,
        .name   = "Mifare Classic",
        .fn     = {