1 /* librfid - layer 3 protocol handler
2 * (C) 2005 by Harald Welte <laforge@gnumonks.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <rfid/rfid_layer2.h>
24 #include <rfid/rfid_protocol.h>
26 static struct rfid_protocol *rfid_protocol_list;
28 struct rfid_protocol_handle *
29 rfid_protocol_init(struct rfid_layer2_handle *l2h, unsigned int id)
31 struct rfid_protocol *p;
33 for (p = rfid_protocol_list; p; p = p->next)
35 return p->fn.init(l2h);
41 rfid_protocol_open(struct rfid_protocol_handle *ph)
43 return ph->proto->fn.open(ph);
47 rfid_protocol_transcieve(struct rfid_protocol_handle *ph,
48 const unsigned char *tx_buf, unsigned int len,
49 unsigned char *rx_buf, unsigned int *rx_len,
50 unsigned int timeout, unsigned int flags)
52 return ph->proto->fn.transcieve(ph, tx_buf, len, rx_buf, rx_len,
56 int rfid_protocol_fini(struct rfid_protocol_handle *ph)
58 return ph->proto->fn.fini(ph);
62 rfid_protocol_close(struct rfid_protocol_handle *ph)
64 return ph->proto->fn.close(ph);
68 rfid_protocol_register(struct rfid_protocol *p)
70 p->next = rfid_protocol_list;
71 rfid_protocol_list = p;