X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=src%2Frfid.c;h=10abb999779572fcb3d8c00e480ce5c70ee30b68;hb=9ce76f09417c31a8fc904b67624c0f3b397c21c0;hp=6fba46ab1afbebef91f2a73977af91ed851accc0;hpb=1fcc35aad699f3d40ca786b99c7255cf8aa55892;p=librfid diff --git a/src/rfid.c b/src/rfid.c index 6fba46a..10abb99 100644 --- a/src/rfid.c +++ b/src/rfid.c @@ -1,4 +1,6 @@ -/* +/* librfid core + * (C) 2005-2006 by Harald Welte + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation @@ -15,12 +17,20 @@ #include #include -#include +#include #include #include #include #include +#ifdef LIBRFID_STATIC +struct rfid_asic_handle rfid_ah; +struct rfid_layer2_handle rfid_l2h; +struct rfid_protocol_handle rfid_ph; +struct rfid_asic_transport_handle rfid_ath; +struct rfid_reader_handle rfid_rh; +#endif + const char * rfid_hexdump(const void *data, unsigned int len) { @@ -38,14 +48,65 @@ rfid_hexdump(const void *data, unsigned int len) return string; } +#if 0 +int rfid_setopt(struct rfid_handle *rh, unsigned int level, + unsigned int optname, + const void *opt, unsigned int *optlen) +{ + switch (level) { + case RFID_LEVEL_ASIC: + case RFID_LEVEL_READER: + return -EINVAL; + break; + case RFID_LEVEL_LAYER2: + return rfid_layer2_setopt(optname, opt, optlen); + break; + case RFID_LEVEL_LAYER3: + return rfid_layer3_setopt(optname, opt, optlen); + break; + default: + return -EINVAL; + break; + } + + return 0; +} + +int rfid_getopt(struct rfid_handle *rh, unsigned int level, + unsigned int optname, + void *opt, unsigned int *optlen) +{ + switch (level) { + case RFID_LEVEL_ASIC: + case RFID_LEVEL_READER: + return -EINVAL; + break; + case RFID_LEVEL_LAYER2: + return rfid_layer2_getopt(optname, opt, optlen); + break; + case RFID_LEVEL_LAYER3: + return rfid_layer3_getopt(optname, opt, optlen); + break; + default: + return -EINVAL; + break; + } + + return 0; +} +#endif + int rfid_init() { +#if 0 rfid_reader_register(&rfid_reader_cm5121); + rfid_reader_register(&rfid_reader_openpcd); rfid_layer2_register(&rfid_layer2_iso14443a); rfid_layer2_register(&rfid_layer2_iso14443b); rfid_protocol_register(&rfid_protocol_tcl); rfid_protocol_register(&rfid_protocol_mful); rfid_protocol_register(&rfid_protocol_mfcl); +#endif return 0; }