1 //-----------------------------------------------------------------------------
2 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // See LICENSE.txt for the text of the license.
15 //-----------------------------------------------------------------------------
16 // Wiegand format packing/unpacking routines
17 //-----------------------------------------------------------------------------
19 #ifndef WIEGAND_FORMATS_H__
20 #define WIEGAND_FORMATS_H__
22 #include <string.h> // memset
29 #include "wiegand_formatutils.h"
30 #include "parity.h" // for parity
39 } cardformatdescriptor_t
;
41 // Structure for defined Wiegand card formats available for packing/unpacking
44 bool (*Pack
)(wiegand_card_t
*card
, wiegand_message_t
*packed
, bool preamble
);
45 bool (*Unpack
)(wiegand_message_t
*packed
, wiegand_card_t
*card
);
47 cardformatdescriptor_t Fields
;
50 void HIDListFormats(void);
51 int HIDFindCardFormat(const char *format
);
52 cardformat_t
HIDGetCardFormat(int idx
);
53 bool HIDPack(int format_idx
, wiegand_card_t
*card
, wiegand_message_t
*packed
, bool preamble
);
54 bool HIDTryUnpack(wiegand_message_t
*packed
);
55 void HIDPackTryAll(wiegand_card_t
*card
, bool preamble
);
56 void HIDUnpack(int idx
, wiegand_message_t
*packed
);
57 void print_wiegand_code(wiegand_message_t
*packed
);
58 void print_desc_wiegand(cardformat_t
*fmt
, wiegand_message_t
*packed
);