]> git.zerfleddert.de Git - proxmark3-svn/blob - client/hidcardformatutils.h
Bugfixes for LF FDX
[proxmark3-svn] / client / hidcardformatutils.h
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2018 grauerfuchs
3 //
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
6 // the license.
7 //-----------------------------------------------------------------------------
8 // HID card format packing/unpacking support functions
9 //-----------------------------------------------------------------------------
10
11 #ifndef HIDCARDFORMATUTILS_H__
12 #define HIDCARDFORMATUTILS_H__
13
14 #include <stdarg.h>
15 #include <stdint.h>
16 #include <stdbool.h>
17
18 // Structure for packed HID messages
19 // Always align lowest value (last transmitted) bit to ordinal position 0 (lowest valued bit bottom)
20 typedef struct hidproxmessage_s{
21 uint8_t Length; // Number of encoded bits in prox message (excluding headers and preamble)
22 uint32_t top; // Bits in x<<64 positions
23 uint32_t mid; // Bits in x<<32 positions
24 uint32_t bot; // Lowest ordinal positions
25 } hidproxmessage_t;
26
27 // Structure for unpacked HID prox cards
28 typedef struct hidproxcard_s{
29 uint32_t FacilityCode;
30 uint64_t CardNumber;
31 uint32_t IssueLevel;
32 uint32_t OEM;
33 bool ParityValid; // Only valid for responses
34 } hidproxcard_t;
35
36 bool get_bit_by_position(/* in */hidproxmessage_t* data, /* in */uint8_t pos);
37 bool set_bit_by_position(/* inout */hidproxmessage_t* data, /* in */bool value, /* in */uint8_t pos);
38
39 uint64_t get_linear_field(/* in */hidproxmessage_t* data, /* in */uint8_t firstBit, /* in */uint8_t length);
40 bool set_linear_field(/* inout */hidproxmessage_t* data, /* in */uint64_t value, /* in */uint8_t firstBit, /* in */uint8_t length);
41
42 uint64_t get_nonlinear_field(/* in */hidproxmessage_t* data, /* in */uint8_t numBits, /* in */uint8_t* bits);
43 bool set_nonlinear_field(/* inout */hidproxmessage_t* data, /* in */uint64_t value, /* in */uint8_t numBits, /* in */uint8_t* bits);
44
45 hidproxmessage_t initialize_proxmessage_object(/* in */uint32_t top, /* in */uint32_t mid, /* in */uint32_t bot);
46 bool add_HID_header(/* inout */hidproxmessage_t* data);
47 #endif
Impressum, Datenschutz