1 #ifndef _RFID_PROTOCOL_H
2 #define _RFID_PROTOCOL_H
4 #include <rfid/rfid_layer2.h>
6 #include <rfid/rfid_protocol_tcl.h>
8 struct rfid_protocol_handle;
10 struct rfid_protocol {
11 struct rfid_protocol *next;
15 struct rfid_protocol_handle *(*init)(struct rfid_layer2_handle *l2h);
16 int (*open)(struct rfid_protocol_handle *ph);
17 int (*close)(struct rfid_protocol_handle *ph);
18 int (*fini)(struct rfid_protocol_handle *ph);
19 int (*transcieve)(struct rfid_protocol_handle *ph,
20 const unsigned char *tx_buf,
22 unsigned char *rx_buf,
29 struct rfid_protocol_handle {
30 struct rfid_layer2_handle *l2h;
31 struct rfid_protocol *proto;
33 struct tcl_handle tcl;
34 } priv; /* priv has to be last, since
35 * it could contain additional
36 * private data over the end of
40 struct rfid_protocol_handle *
41 rfid_protocol_init(struct rfid_layer2_handle *l2h, unsigned int id);
42 int rfid_protocol_open(struct rfid_protocol_handle *ph);
43 int rfid_protocol_transcieve(struct rfid_protocol_handle *ph,
44 const unsigned char *tx_buf, unsigned int tx_len,
45 unsigned char *rx_buf, unsigned int *rx_len,
46 unsigned int timeout, unsigned int flags);
47 int rfid_protocol_fini(struct rfid_protocol_handle *ph);
48 int rfid_protocol_close(struct rfid_protocol_handle *ph);
50 int rfid_protocol_register(struct rfid_protocol *p);
52 enum rfid_protocol_id {
53 RFID_PROTOCOL_UNKNOWN,