fix crash of librfid-tool in scan function (Mate Soos)
[librfid] / include / librfid / rfid_protocol.h
index d1960ef..b4a145d 100644 (file)
@@ -27,18 +27,32 @@ rfid_protocol_write(struct rfid_protocol_handle *ph,
 int rfid_protocol_fini(struct rfid_protocol_handle *ph);
 int rfid_protocol_close(struct rfid_protocol_handle *ph);
 
+int rfid_protocol_getopt(struct rfid_protocol_handle *ph, int optname,
+                        void *optval, unsigned int *optlen);
+
+int rfid_protocol_setopt(struct rfid_protocol_handle *ph, int optname,
+                        const void *optval, unsigned int optlen);
+
+char *rfid_protocol_name(struct rfid_protocol_handle *ph);
+
 enum rfid_protocol_id {
        RFID_PROTOCOL_UNKNOWN,
        RFID_PROTOCOL_TCL,
        RFID_PROTOCOL_MIFARE_UL,
        RFID_PROTOCOL_MIFARE_CLASSIC,
+       RFID_PROTOCOL_ICODE_SLI,
+       RFID_PROTOCOL_TAGIT,
+       NUM_RFID_PROTOCOLS
 };
 
+enum rfid_protocol_opt {
+       RFID_OPT_PROTO_ID,
+       RFID_OPT_PROTO_SIZE     = 0x10000001,
+};
 
 #ifdef __LIBRFID__
 
 struct rfid_protocol {
-       struct rfid_protocol *next;
        unsigned int id;
        char *name;
        struct {
@@ -63,18 +77,22 @@ struct rfid_protocol {
                             unsigned int page,
                             unsigned char *tx_data,
                             unsigned int tx_len);
+               int (*getopt)(struct rfid_protocol_handle *h,
+                             int optname, void *optval, unsigned int *optlen);
+               int (*setopt)(struct rfid_protocol_handle *h,
+                             int optname, const void *optval,
+                             unsigned int optlen);
        } fn;
 };
 
-int rfid_protocol_register(struct rfid_protocol *p);
-
 #include <librfid/rfid_protocol_tcl.h>
 #include <librfid/rfid_protocol_mifare_ul.h>
 #include <librfid/rfid_protocol_mifare_classic.h>
+#include <librfid/rfid_protocol_tagit.h>
 
 struct rfid_protocol_handle {
        struct rfid_layer2_handle *l2h;
-       struct rfid_protocol *proto;
+       const struct rfid_protocol *proto;
        union {
                struct tcl_handle tcl;
        } priv;                         /* priv has to be last, since