proxmark3/client/hidcardformats.h
grauerfuchs be59094de9 lf hid improvements - encoding and long tag simulation
**DEVICE FIRMWARE UPDATE**
The code changes needed to support long tag emulation required an update to the device firmware. As of this patch, devices running older firmware will not be able to read or emulate HID tags until the firmware is updated. Additionally, devices with the firmware from this update or newer will not properly read or encode HID tags with a prior version client.

The 'lf hid encode' command has been further refined, and is now entirely parameterized to support use of fields other than facility code and card number. The client help data has been updated to show the correct syntax.
2018-08-30 21:01:21 -04:00

43 lines
1.4 KiB
C

//-----------------------------------------------------------------------------
// Copyright (C) 2018 grauerfuchs
//
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
// at your option, any later version. See the LICENSE.txt file for the text of
// the license.
//-----------------------------------------------------------------------------
// HID card format packing/unpacking routines
//-----------------------------------------------------------------------------
#ifndef HIDCARDFORMATS_H__
#define HIDCARDFORMATS_H__
#include <stdint.h>
#include <stdbool.h>
#include "hidcardformatutils.h"
typedef struct hidcardformatdescriptor_s{
bool hasCardNumber;
bool hasFacilityCode;
bool hasIssueLevel;
bool hasOEMCode;
bool hasParity;
} hidcardformatdescriptor_t;
// Structure for defined HID card formats available for packing/unpacking
typedef struct hidcardformat_s{
const char* Name;
bool (*Pack)(/*in*/hidproxcard_t* card, /*out*/hidproxmessage_t* packed);
bool (*Unpack)(/*in*/hidproxmessage_t* packed, /*out*/hidproxcard_t* card);
const char* Descrp;
hidcardformatdescriptor_t Fields;
} hidcardformat_t;
void HIDListFormats();
int HIDFindCardFormat(const char *format);
hidcardformat_t HIDGetCardFormat(int idx);
bool HIDPack(/* in */int FormatIndex, /* in */hidproxcard_t* card, /* out */hidproxmessage_t* packed);
bool HIDTryUnpack(/* in */hidproxmessage_t* packed, /* in */bool ignoreParity);
#endif