pcsc-relay: Made libnfc optional

This commit is contained in:
Frank Morgner
2017-03-02 15:48:08 +01:00
parent 7e70c87dde
commit c2b90a0f10
3 changed files with 82 additions and 18 deletions

View File

@@ -16,12 +16,18 @@
* You should have received a copy of the GNU General Public License along with
* pcsc-relay. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcsc-relay.h"
#ifdef ENABLE_LIBNFC
#include <nfc/nfc.h>
#include <stdlib.h>
#include <string.h>
#include "pcsc-relay.h"
struct lnfc_data {
/* PN53X only supports short APDUs */
uint8_t abtCapdu[4+1+0xff+1];
@@ -101,7 +107,6 @@ static size_t get_historical_bytes(unsigned char *atr, size_t atrlen,
}
#endif
static int lnfc_connect(driver_data_t **driver_data)
{
struct lnfc_data *data;
@@ -237,6 +242,37 @@ static int lnfc_send_rapdu(driver_data_t *driver_data,
return 1;
}
#else
static int error(void)
{
RELAY_ERROR("Compiled without support for libnfc\n");
return 0;
}
static int lnfc_connect(driver_data_t **driver_data)
{
return error();
}
static int lnfc_disconnect(driver_data_t *driver_data)
{
return error();
}
static int lnfc_receive_capdu(driver_data_t *driver_data,
unsigned char **capdu, size_t *len)
{
return error();
}
static int lnfc_send_rapdu(driver_data_t *driver_data,
const unsigned char *rapdu, size_t len)
{
return error();
}
#endif
struct rf_driver driver_libnfc = {
.connect = lnfc_connect,