1 /* librfid - layer 3 protocol handler
2 * (C) 2005 by Harald Welte <laforge@gnumonks.org>
8 #include <rfid/rfid_layer2.h>
9 #include <rfid/rfid_protocol.h>
11 static struct rfid_protocol *rfid_protocol_list;
13 struct rfid_protocol_handle *
14 rfid_protocol_init(struct rfid_layer2_handle *l2h, unsigned int id)
16 struct rfid_protocol *p;
18 for (p = rfid_protocol_list; p; p = p->next)
20 return p->fn.init(l2h);
26 rfid_protocol_open(struct rfid_protocol_handle *ph)
28 return ph->proto->fn.open(ph);
32 rfid_protocol_transcieve(struct rfid_protocol_handle *ph,
33 const unsigned char *tx_buf, unsigned int len,
34 unsigned char *rx_buf, unsigned int *rx_len,
35 unsigned int timeout, unsigned int flags)
37 return ph->proto->fn.transcieve(ph, tx_buf, len, rx_buf, rx_len,
41 int rfid_protocol_fini(struct rfid_protocol_handle *ph)
43 return ph->proto->fn.fini(ph);
47 rfid_protocol_close(struct rfid_protocol_handle *ph)
49 return ph->proto->fn.close(ph);
53 rfid_protocol_register(struct rfid_protocol *p)
55 p->next = rfid_protocol_list;
56 rfid_protocol_list = p;