summaryrefslogtreecommitdiff
path: root/src/rfid_protocol.c
diff options
context:
space:
mode:
authorlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2006-10-15 19:17:22 +0000
committerlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2006-10-15 19:17:22 +0000
commit7f44cae7c1c1a7e54099655365afde4f20aeee6a (patch)
tree2214b97f6172e0d3446f04f50003a55c356a2983 /src/rfid_protocol.c
parent966a8e3acc6244025d265db0af5e20365566f2a4 (diff)
- fix multiple include of rfid_protocol_mifare_classic.h problem
- add some more layer2 {get,set}opt()s - add rfid_protocol_{get,set}opt() - export functions for l2/proto scanning, not just for combined scanning - add support for sending WUPA instead of REQA in iso14443a git-svn-id: https://svn.gnumonks.org/trunk/librfid@1910 e0336214-984f-0b4b-a45f-81c69e1f0ede
Diffstat (limited to 'src/rfid_protocol.c')
-rw-r--r--src/rfid_protocol.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/rfid_protocol.c b/src/rfid_protocol.c
index 1a4262a..99fc8b1 100644
--- a/src/rfid_protocol.c
+++ b/src/rfid_protocol.c
@@ -1,4 +1,4 @@
-/* librfid - layer 3 protocol handler
+/* librfid - layer 4 protocol handler
* (C) 2005-2006 by Harald Welte <laforge@gnumonks.org>
*/
@@ -106,6 +106,47 @@ rfid_protocol_close(struct rfid_protocol_handle *ph)
return 0;
}
+int
+rfid_protocol_getopt(struct rfid_protocol_handle *ph, int optname,
+ void *optval, unsigned int *optlen)
+{
+ if (optname >> 16 == 0) {
+ unsigned char *optchar = optval;
+
+ switch (optname) {
+ break;
+ default:
+ return -EINVAL;
+ break;
+ }
+ } else {
+ if (!ph->proto->fn.getopt)
+ return -EINVAL;
+
+ return ph->proto->fn.getopt(ph, optname, optval, optlen);
+ }
+ return 0;
+}
+
+int
+rfid_protocol_setopt(struct rfid_protocol_handle *ph, int optname,
+ const void *optval, unsigned int optlen)
+{
+ if (optname >> 16 == 0) {
+ switch (optname) {
+ default:
+ return -EINVAL;
+ break;
+ }
+ } else {
+ if (!ph->proto->fn.setopt)
+ return -EINVAL;
+
+ return ph->proto->fn.setopt(ph, optname, optval, optlen);
+ }
+ return 0;
+}
+
char *rfid_protocol_name(struct rfid_protocol_handle *ph)
{
return ph->proto->name;
personal git repositories of Harald Welte. Your mileage may vary