summaryrefslogtreecommitdiff
path: root/nfcommander.h
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2023-06-24 21:52:34 +0200
committercbdev <cb@cbcdn.com>2023-06-24 21:52:34 +0200
commitbf9f1fd058c5ca324b2df5223c582ef1ece7a698 (patch)
tree2825cca86cba15661e6a6e28893450c938392810 /nfcommander.h
parente3a80ac2d337b92514f3246dbacb8e4ca7b62d90 (diff)
downloadnfcommander-bf9f1fd058c5ca324b2df5223c582ef1ece7a698.tar.gz
nfcommander-bf9f1fd058c5ca324b2df5223c582ef1ece7a698.tar.bz2
nfcommander-bf9f1fd058c5ca324b2df5223c582ef1ece7a698.zip
Tag data management skeleton
Diffstat (limited to 'nfcommander.h')
-rw-r--r--nfcommander.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/nfcommander.h b/nfcommander.h
index b4622a1..00f0fb8 100644
--- a/nfcommander.h
+++ b/nfcommander.h
@@ -17,6 +17,7 @@ typedef enum {
#define FLAG_TAG_DATA_VALID 1
#define FLAG_TAG_UNPROGRAMMED 2
#define FLAG_TAG_LOCKED 4
+#define FLAG_TAG_READONLY 8
#define TAG_STATUS_FLAGS ((FLAG_TAG_DATA_VALID | FLAG_TAG_UNPROGRAMMED | FLAG_TAG_LOCKED))
typedef struct {
@@ -24,9 +25,14 @@ typedef struct {
nfc_tag_t type;
uint8_t uid_length;
uint8_t uid[10];
- //storage
+ //storage info
size_t bytes_available;
size_t granularity;
+ //data
+ size_t static_length;
+ uint8_t* static_data;
+ size_t dynamic_length;
+ uint8_t* dynamic_data;
} nfc_tag_info_t;
typedef int (*reader_plugin_init)(void);
@@ -45,8 +51,13 @@ int core_manage_fd(int fd, int manage, notification_target_t system);
* This API is to be called by reader backends to indicate presence of a tag.
* This can be done as soon as the UID of the tag has been read (ie. before
* reading EEPROM contents) to check whether the card has already been read.
- * If this API returns 1, a full read is requested and the nfc_tag_info_t should
- * be submitted again with the data fully read.
+ *
+ * If this API returns TAG_READ_REQUESTED, a full read is requested and the
+ * nfc_tag_info_t should be submitted again with the data fully read.
+ *
+ * If this API returns TAG_WRITE_REQUESTED, the nfc_tag_into_t has been filled
+ * with valid data pointers and sizes to be writen to the tag
*/
#define TAG_READ_REQUESTED 1
-int reader_tag_present(uint8_t flags, nfc_tag_info_t tag);
+#define TAG_WRITE_REQUESTED 2
+int reader_tag_present(uint8_t flags, nfc_tag_info_t* tag);