first beta - patch sent to librfid list
[rfid/librfid.git] / gemtag / gemtag.h
index fa716f8..e5c24bf 100644 (file)
@@ -1,5 +1,6 @@
 /*
- * (C) 2006 by Frank Zirkelbach <hackbard@hackdaworld.org>
+ * (C) 2006 by Harald Welte <laforge@gnumonks.org>
+ *             Frank Zirkelbach <hackbard@hackdaworld.org>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 
@@ -44,8 +45,11 @@ struct gemtag_cmd_hdr {
 #define CMD_FAILED                     0x04
 #define AUTH_FAILED                    0x05
 #define READ_FAILED                    0x06
-#define NO_PICC                                0x07
-#define PICC_SELECT_ERROR              0x08
+#define WRITE_FAILED                   0x07
+#define NO_PICC                                0x08
+#define PICC_SELECT_ERROR              0x09
+#define LOAD_E2_FAILED                 0x0a
+#define AUTH_E2_FAILED                 0x0b
 
 /* gemtag commands */
 
@@ -119,4 +123,26 @@ struct gemtag_cmd_hdr {
 #define GEMTAG_CMD_PPS_REQUEST         0xa0
 #define GEMTAG_CMD_DESELECT            0xa1
 
+
+/* function prototypes */
+
+int asciidump(unsigned char *data,int len);
+int hexdump(unsigned char *data,int len);
+struct usb_device *find_device(unsigned short vendor,unsigned short device);
+u_int16_t gemtag_calc_crc(unsigned char *data,u_int16_t len);
+int gemtag_transceive(struct gemtag_handle *gh,unsigned char cmd,
+                      unsigned char *tx,unsigned int tx_len,
+                      unsigned char *rx,unsigned int *rx_len);
+struct gemtag_handle *gemtag_open(void);
+int gemtag_close(struct gemtag_handle *gh);
+int gemtag_transform_mifare_key(struct gemtag_handle *gh,
+                                unsigned char *key6,unsigned char *key12);
+int gemtag_auth_e2(struct gemtag_handle *gh,unsigned char authmode,
+                   int sector,unsigned char *key6);
+int gemtag_auth_mifare_key(struct gemtag_handle *gh,
+                           unsigned char *key6,int sector);
+int gemtag_read16(struct gemtag_handle *gh,int sector,unsigned char *data);
+int gemtag_write16(struct gemtag_handle *gh,int sector,unsigned char *data);
+int gemtag_select_picc(struct gemtag_handle *gh);
+
 #endif