GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
MAD(3) FreeBSD Library Functions Manual MAD(3)

mad_new, mad_read, mad_write, mad_get_version, mad_set_version, mad_get_card_publisher_sector, mad_set_card_publisher_sector, mad_get_aid, mad_set_aid, mad_free, —
Mifare Application Directory (MAD) Manipulation Functions

Mifare card manipulation library (libfreefare, -lfreefare)

#include <freefare.h>

Mad
mad_new(uint8_t version);

Mad
mad_read(MifareTag tag);

int
mad_write(MifareTag tag, Mad mad, MifareClassicKey key_b_sector_00, MifareClassicKey key_b_sector_10);

int
mad_get_version(Mad mad);

void
mad_set_version(Mad mad, uint8_t version);

MifareClassicSectorNumber
mad_get_card_publisher_sector(Mad mad);

int
mad_set_card_publisher_sector(Mad mad, MifareClassicSectorNumber cps);

int
mad_get_aid(Mad mad, MifareClassicSectorNumber sector, MadAid *aid);

int
mad_set_aid(Mad mad, MifareClassicSectorNumber sector, MadAid aid);

void
mad_free(Mad mad);

Mifare Application Directories (MAD) can be easily manipulated using the mad_*() set of functions.

A mad can be loaded form a Mifare Classic tag using mad_read() or generated from scratch using mad_new() and providing the version of the mad to generate. After using a mad, the memory can be reclaimed using mad_free().

A mad can be written to a Mifare Classic tag using mad_write() and providing the B keys required for writing to sectors 0, key_b_sector_00, and the one required for writing to sectors 10, key_b_sector_10. When writing a MAD version 1 mad, the key_b_sector_10.

The version of a MAD mad can be read using mad_get_version() and changed using mad_set_version().

The card publisher sector number cps can be read read using mad_get_card_publisher_sector() and writen using mad_set_card_publisher_sector().

Sectors allocation in the mad is handled by the mad_get_aid() and mad_set_aid() functions. These functions fill-in or read the Application Identifier, aid for the given sector.

The mad_new() function return NULL on failure and allocates memory that has to be freed using mad_free() on success. Unless stated otherwise, all other functions return a value greater than or equal to 0 on success or -1 on failure.

freefare(3), mifare_application(3), mifare_classic(3)

Romain Tartiere ⟨romain@blogreen.org⟩
Romuald Conty ⟨romuald@libnfc.org⟩
March 30, 2010 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.