From a7c6ecb320ff1ba6ee85767bffde41cfab1a0cd0 Mon Sep 17 00:00:00 2001 From: cbdev Date: Thu, 24 Aug 2023 02:06:48 +0200 Subject: Mifare prototypes --- libtwn3.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'libtwn3.h') diff --git a/libtwn3.h b/libtwn3.h index 63e9b93..b6a8b93 100644 --- a/libtwn3.h +++ b/libtwn3.h @@ -2,6 +2,16 @@ #include #include +typedef enum /*_twn3_tag_type*/ { + tag_mf_light = 0x01, + tag_mf_classic_1k = 0x02, + tag_mf_classic_4l = 0x03, + tag_mf_prox = 0x04, + tag_mf_ultralight = 0x05, + tag_mf_desfire = 0x06, + tag_unknown = 0xFF +} twn3_tag_type_t; + /* Open a device port */ int twn3_open(char* device); @@ -17,9 +27,21 @@ ssize_t twn3_sync_command(int fd, uint8_t flags, uint8_t* cmd, size_t cmd_len, u /* Synchronous API */ /* These calls will return data directly, at the cost of blocking execution */ +int twn3_sync_restart(int fd, uint8_t flags); int twn3_sync_read_version(int fd, uint8_t flags, char* version, size_t max_length); int twn3_sync_read_eeprom(int fd, uint8_t flags, uint8_t reg, uint8_t* data); int twn3_sync_write_eeprom(int fd, uint8_t flags, uint8_t reg, uint8_t data); int twn3_sync_storekey(int fd, uint8_t flags, uint8_t keyid, uint8_t key[6]); int twn3_sync_antenna(int fd, uint8_t flags, uint8_t enable); +/* Mifare commands */ +int twn3_sync_select_first(int fd, uint8_t flags, uint8_t* type, uint8_t* serial, size_t* length); + +//TBD clarify interface +int twn3_sync_list(int fd, uint8_t flags, uint8_t* type, uint8_t* serial, size_t* length); +int twn3_sync_select(int fd, uint8_t flags, uint8_t* type, uint8_t* serial, size_t* length); + +int twn3_sync_auth(int fd, uint8_t flags, uint8_t key_a, uint8_t block, uint8_t key[6]); +int twn3_sync_auth_stored(int fd, uint8_t flags, uint8_t key_a, uint8_t block, uint8_t key_id); +int twn3_sync_read(int fd, uint8_t flags, uint8_t block, uint8_t* data, size_t max_len); +int twn3_sync_write(int fd, uint8_t flags, uint8_t block, uint8_t data[16]); -- cgit v1.2.3