logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

mifare_application_alloc, mifare_application_find, mifare_application_free, mifare_application_read,

Authors

       Romain Tartiere <romain@blogreen.org>
       Romuald Conty <romuald@libnfc.org>

Debian                                           March 30, 2010                            MIFARE_APPLICATION(3)

Description

       The mifare_application_*() functions facilitate  management  of  applications  in  a  Mifare  Application
       Directory.

       The mifare_application_alloc() function allocates enought sectors to store size bytes for the Application
       Identifier aid and returns the list of allocated sectors.

       The   list   of   the   sectors   previously   allocated  for  aid  in  a  mad  can  be  requested  using
       mifare_application_find().

       An application can be removed from a mad using mifare_application_free().

       The mifare_application_read() reads at most nbytes of the application identified by aid in the mad on the
       tag and copy them into buf. The function returns the amount of data it copied, or -1 on error.

       The mifare_application_write() functions writes at most nbytes of buf in the  application  identified  by
       aid on the mad of the tag and returns the quantity of data written, or -1 on error.

Implementation Notes

       The  mifare_application_alloc()  function  will try to avoid wasting space and might not allocate sectors
       sequentially if a large amount of space is requested and the target has sectors of different size.

       The nbytes argument of mifare_application_read() and  mifare_application_write()  does  not  need  to  be
       aligned on blocks not sectors.

Library

       Mifare card manipulation library (libfreefare, -lfreefare)

Name

       mifare_application_alloc,   mifare_application_find,   mifare_application_free,  mifare_application_read,
       mifare_application_write — Mifare Applications Manipulation Functions

Return Values

       Unless  stated  otherwise,  all  functions  return a value greater than or equal to 0 on success or -1 on
       failure.

See Also

mad(3), mifare_classic(3)

Synopsis

#include<freefare.h>MifareClassicSectorNumber*mifare_application_alloc(Madmad, MadAidaid, size_tsize);

       voidmifare_application_free(Madmad, MadAidaid);

       MifareClassicSectorNumber*mifare_application_find(Madmad, MadAidaid);

       ssize_tmifare_application_read(MifareTagtag,   Madmad,   MadAidaid,   void*buf,    size_tnbytes,
           MifareClassicKeykey, MifareClassicKeyTypekey_type);

       ssize_tmifare_application_write(MifareTagtag,   Madmad,  MadAidaid,  constvoid*buf,  size_tnbytes,
           MifareClassicKeykey, MifareClassicKeyTypekey_type);

See Also