Add man pages.

This commit is contained in:
Romain Tartiere 2010-03-30 12:54:49 +00:00
parent 3b737a11e8
commit 26aef03a48
6 changed files with 822 additions and 1 deletions

View file

@ -12,4 +12,56 @@ libfreefare_la_SOURCES = freefare.c \
libfreefare_la_HEADERS = freefare.h libfreefare_la_HEADERS = freefare.h
libfreefare_ladir = $(includedir) libfreefare_ladir = $(includedir)
EXTRA_DIST = freefare_internal.h man_MANS = freefare.3 \
mifare_ultralight.3 \
mifare_classic.3 \
mad.3 \
mifare_application.3
linkedman = \
freefare.3 freefare_get_tags.3 \
freefare.3 freefare_get_tag_type.3 \
freefare.3 freefare_get_tag_friendly_name.3 \
freefare.3 freefare_free_tags.3 \
mifare_ultralight.3 mifare_ultralight_connect.3 \
mifare_ultralight.3 mifare_ultralight_disconnect.3 \
mifare_ultralight.3 mifare_ultralight_read.3 \
mifare_ultralight.3 mifare_ultralight_write.3 \
mifare_ultralight.3 mifare_ultralight_get_uid.3 \
mifare_classic.3 mifare_classic_connect.3 \
mifare_classic.3 mifare_classic_disconnect.3 \
mifare_classic.3 mifare_classic_authenticate.3 \
mifare_classic.3 mifare_classic_read.3 \
mifare_classic.3 mifare_classic_init_value.3 \
mifare_classic.3 mifare_classic_read_value.3 \
mifare_classic.3 mifare_classic_write.3 \
mifare_classic.3 mifare_classic_increment.3 \
mifare_classic.3 mifare_classic_decrement.3 \
mifare_classic.3 mifare_classic_restore.3 \
mifare_classic.3 mifare_classic_transfer.3 \
mifare_classic.3 mifare_classic_get_trailer_block_permission.3 \
mifare_classic.3 mifare_classic_get_data_block_permission.3 \
mifare_classic.3 mifare_classic_format_sector.3 \
mifare_classic.3 mifare_classic_get_uid.3 \
mifare_classic.3 mifare_classic_trailer_block.3 \
mad.3 mad_new.3 \
mad.3 mad_read.3 \
mad.3 mad_write.3 \
mad.3 mad_get_version.3 \
mad.3 mad_set_version.3 \
mad.3 mad_get_card_publisher_sector.3 \
mad.3 mad_set_card_publisher_sector.3 \
mad.3 mad_get_aid.3 \
mad.3 mad_set_aid.3 \
mad.3 mad_free.3 \
mifare_application.3 mifare_application_alloc.3 \
mifare_application.3 mifare_application_free.3 \
mifare_application.3 mifare_application_find.3
install-data-hook:
(cd $(DESTDIR)$(man3dir); for i in `echo $(linkedman) | xargs -n2 echo | awk '{print $$2}'`; do rm -f $$i; done; echo $(linkedman) | xargs -n2 $(LN_S))
uninstall-hook:
(cd $(DESTDIR)$(man3dir); for i in `echo $(linkedman) | xargs -n2 echo | awk '{print $$2}'`; do rm -f $$i; done;)
EXTRA_DIST = freefare_internal.h $(man_MANS)

114
libfreefare/freefare.3 Normal file
View file

@ -0,0 +1,114 @@
.\" Copyright (C) 2010 Romain Tartiere
.\"
.\" This program is free software: you can redistribute it and/or modify it
.\" under the terms of the GNU Lesser General Public License as published by the
.\" Free Software Foundation, either version 3 of the License, or (at your
.\" option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
.\" more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public License
.\" along with this program. If not, see <http://www.gnu.org/licenses/>
.\"
.\" $Id$
.\"
.Dd March 30, 2010
.Dt FREEFARE 3
.Os
.\" _ _
.\" | \ | | __ _ _ __ ___ ___
.\" | \| |/ _` | '_ ` _ \ / _ \
.\" | |\ | (_| | | | | | | __/
.\" |_| \_|\__,_|_| |_| |_|\___|
.\"
.Sh NAME
.Nm freefare_get_tags ,
.Nm freefare_get_tag_type ,
.Nm freefare_get_tag_friendly_name ,
.Nm freefare_free_tags
.Nd Generic target manipulation functions
.\" _ _ _
.\" | | (_) |__ _ __ __ _ _ __ _ _
.\" | | | | '_ \| '__/ _` | '__| | | |
.\" | |___| | |_) | | | (_| | | | |_| |
.\" |_____|_|_.__/|_| \__,_|_| \__, |
.\" |___/
.Sh LIBRARY
Mifare card manipulation library (libfreefare, \-lfreefare)
.\" ____ _
.\" / ___| _ _ _ __ ___ _ __ ___(_)___
.\" \___ \| | | | '_ \ / _ \| '_ \/ __| / __|
.\" ___) | |_| | | | | (_) | |_) \__ \ \__ \
.\" |____/ \__, |_| |_|\___/| .__/|___/_|___/
.\" |___/ |_|
.Sh SYNOPSIS
.In freefare.h
.Ft "MifareTag *"
.Fn freefare_get_tags "nfc_device_t *device"
.Ft enum mifare_tag_type
.Fn freefare_get_tag_type "MifareTag tag"
.Ft "const char *"
.Fn freefare_get_tag_friendly_name "MifareTag tag"
.Ft void
.Fn freefare_free_tags "MifareTag *tags"
.\" ____ _ _ _
.\" | _ \ ___ ___ ___ _ __(_)_ __ | |_(_) ___ _ __
.\" | | | |/ _ \/ __|/ __| '__| | '_ \| __| |/ _ \| '_ \
.\" | |_| | __/\__ \ (__| | | | |_) | |_| | (_) | | | |
.\" |____/ \___||___/\___|_| |_| .__/ \__|_|\___/|_| |_|
.\" |_|
.Sh DESCRIPTION
The
.Fn freefare_*
family of functions allow agnostic access to the
.Vt MifareTag
present on a given NFC device.
.Pp
.Fn freefare_get_tags
returns a NULL-terminated list of
.Vt MifareTag
present on
.Vt device .
This list has to be freed after usage using
.Fn freefare_free_tags .
.Pp
Information about a given
.Vt MifareTag
can be gathered using the
.Fn freefare_get_tag_type
and
.Fn freefare_get_tag_friendly_name
functions.
.\" ____ _ _
.\" | _ \ ___| |_ _ _ _ __ _ __ __ ____ _| |_ _ ___ ___
.\" | |_) / _ \ __| | | | '__| '_ \ \ \ / / _` | | | | |/ _ \/ __|
.\" | _ < __/ |_| |_| | | | | | | \ V / (_| | | |_| | __/\__ \
.\" |_| \_\___|\__|\__,_|_| |_| |_| \_/ \__,_|_|\__,_|\___||___/
.\"
.Sh RETURN VALUES
Unless stated otherwise, all functions return a value greater than or equal to
.Va 0
on success or
.Va -1
on failure.
.\" ____ _
.\" / ___| ___ ___ __ _| |___ ___
.\" \___ \ / _ \/ _ \ / _` | / __|/ _ \
.\" ___) | __/ __/ | (_| | \__ \ (_) |
.\" |____/ \___|\___| \__,_|_|___/\___/
.\"
.Sh SEE ALSO
.Xr mifare_classic 3 ,
.Xr mifare_ultralight 3
.\" _ _ _
.\" / \ _ _| |_| |__ ___ _ __ ___
.\" / _ \| | | | __| '_ \ / _ \| '__/ __|
.\" / ___ \ |_| | |_| | | | (_) | | \__ \
.\" /_/ \_\__,_|\__|_| |_|\___/|_| |___/
.\"
.Sh AUTHORS
.An Romain Tartiere Aq romain@blogreen.org
.An Romuald Conty Aq rconty@il4p.fr

174
libfreefare/mad.3 Normal file
View file

@ -0,0 +1,174 @@
.\" Copyright (C) 2010 Romain Tartiere
.\"
.\" This program is free software: you can redistribute it and/or modify it
.\" under the terms of the GNU Lesser General Public License as published by the
.\" Free Software Foundation, either version 3 of the License, or (at your
.\" option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
.\" more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public License
.\" along with this program. If not, see <http://www.gnu.org/licenses/>
.\"
.\" $Id$
.\"
.Dd March 30, 2010
.Dt MAD 3
.Os
.\" _ _
.\" | \ | | __ _ _ __ ___ ___
.\" | \| |/ _` | '_ ` _ \ / _ \
.\" | |\ | (_| | | | | | | __/
.\" |_| \_|\__,_|_| |_| |_|\___|
.\"
.Sh NAME
.Nm mad_new ,
.Nm mad_read ,
.Nm mad_write ,
.Nm mad_get_version ,
.Nm mad_set_version ,
.Nm mad_get_card_publisher_sector ,
.Nm mad_set_card_publisher_sector ,
.Nm mad_get_aid ,
.Nm mad_set_aid ,
.Nm mad_free
.Nd "Mifare Application Directory (MAD) Manipulation Functions"
.\" _ _ _
.\" | | (_) |__ _ __ __ _ _ __ _ _
.\" | | | | '_ \| '__/ _` | '__| | | |
.\" | |___| | |_) | | | (_| | | | |_| |
.\" |_____|_|_.__/|_| \__,_|_| \__, |
.\" |___/
.Sh LIBRARY
Mifare card manipulation library (libfreefare, \-lfreefare)
.\" ____ _
.\" / ___| _ _ _ __ ___ _ __ ___(_)___
.\" \___ \| | | | '_ \ / _ \| '_ \/ __| / __|
.\" ___) | |_| | | | | (_) | |_) \__ \ \__ \
.\" |____/ \__, |_| |_|\___/| .__/|___/_|___/
.\" |___/ |_|
.Sh SYNOPSIS
.In freefare.h
.Ft Mad
.Fn mad_new "uint8_t version"
.Ft Mad
.Fn mad_read "MifareTag tag"
.Ft int
.Fn mad_write "MifareTag tag" "Mad mad" "MifareClassicKey key_b_sector_00" "MifareClassicKey key_b_sector_10"
.Ft int
.Fn mad_get_version "Mad mad"
.Ft void
.Fn mad_set_version "Mad mad" "uint8_t version"
.Ft MifareSectorNumber
.Fn mad_get_card_publisher_sector "Mad mad"
.Ft int
.Fn mad_set_card_publisher_sector "Mad mad" "MifareSectorNumber cps"
.Ft int
.Fn mad_get_aid "Mad mad" "MifareSectorNumber sector" "MadAid *aid"
.Ft int
.Fn mad_set_aid "Mad mad" "MifareSectorNumber sector" "MadAid aid"
.Ft void
.Fn mad_free "Mad mad"
.\" ____ _ _ _
.\" | _ \ ___ ___ ___ _ __(_)_ __ | |_(_) ___ _ __
.\" | | | |/ _ \/ __|/ __| '__| | '_ \| __| |/ _ \| '_ \
.\" | |_| | __/\__ \ (__| | | | |_) | |_| | (_) | | | |
.\" |____/ \___||___/\___|_| |_| .__/ \__|_|\___/|_| |_|
.\" |_|
.Sh DESCRIPTION
Mifare Application Directories (MAD) can be easily manipulated using the
.Fn mad_*
set of functions.
.Pp
A
.Vt mad
can be loaded form a Mifare Classic
.Vt tag
using
.Fn mad_read
or generated from scratch using
.Fn mad_new
and providing the
.Vt version
of the
.Vt mad
to generate. After using a
.Vt mad ,
the memory can be reclaimed using
.Fn mad_free .
.Pp
A
.Vt mad
can be written to a Mifare Classic
.Vt tag
using
.Fn mad_write
and providing the B keys required for writing to sectors 0,
.Vt key_b_sector_00,
and the one required for writing to sectors 10,
.Vt key_b_sector_10 .
When writing a MAD version 1
.Vt mad ,
the
.Vt key_b_sector_10 .
.Pp
The
.Vt version
of a MAD
.Vt mad
can be read using
.Fn mad_get_version
and changed using
.Fn mad_set_version .
.Pp
The card publisher sector number
.Vt cps
can be read read using
.Fn mad_get_card_publisher_sector
and writen using
.Fn mad_set_card_publisher_sector .
.Pp
Sectors allocation in the
.Vt mad
is handled by the
.Fn mad_get_aid
and
.Fn mad_set_aid
functions. These functions fill-in or read the Application Identifier,
.Vt aid
for the given
.Vt sector .
.\" ____ _ _
.\" | _ \ ___| |_ _ _ _ __ _ __ __ ____ _| |_ _ ___ ___
.\" | |_) / _ \ __| | | | '__| '_ \ \ \ / / _` | | | | |/ _ \/ __|
.\" | _ < __/ |_| |_| | | | | | | \ V / (_| | | |_| | __/\__ \
.\" |_| \_\___|\__|\__,_|_| |_| |_| \_/ \__,_|_|\__,_|\___||___/
.\"
.Sh RETURN VALUES
Unless stated otherwise, all functions return a value greater than or equal to
.Va 0
on success or
.Va -1
on failure.
.\" ____ _
.\" / ___| ___ ___ __ _| |___ ___
.\" \___ \ / _ \/ _ \ / _` | / __|/ _ \
.\" ___) | __/ __/ | (_| | \__ \ (_) |
.\" |____/ \___|\___| \__,_|_|___/\___/
.\"
.Sh SEE ALSO
.Xr freefare 3 ,
.Xr mifare_application 3 ,
.Xr mifare_classic 3
.\" _ _ _
.\" / \ _ _| |_| |__ ___ _ __ ___
.\" / _ \| | | | __| '_ \ / _ \| '__/ __|
.\" / ___ \ |_| | |_| | | | (_) | | \__ \
.\" /_/ \_\__,_|\__|_| |_|\___/|_| |___/
.\"
.Sh AUTHORS
.An Romain Tartiere Aq romain@blogreen.org
.An Romuald Conty Aq rconty@il4p.fr

View file

@ -0,0 +1,113 @@
.\" Copyright (C) 2010 Romain Tartiere
.\"
.\" This program is free software: you can redistribute it and/or modify it
.\" under the terms of the GNU Lesser General Public License as published by the
.\" Free Software Foundation, either version 3 of the License, or (at your
.\" option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
.\" more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public License
.\" along with this program. If not, see <http://www.gnu.org/licenses/>
.\"
.\" $Id$
.\"
.Dd March 30, 2010
.Dt MIFARE_APPLICATION 3
.Os
.\" _ _
.\" | \ | | __ _ _ __ ___ ___
.\" | \| |/ _` | '_ ` _ \ / _ \
.\" | |\ | (_| | | | | | | __/
.\" |_| \_|\__,_|_| |_| |_|\___|
.\"
.Sh NAME
.Nm mifare_application_alloc ,
.Nm mifare_application_free ,
.Nm mifare_application_find
.Nd Mifare Applications Manipulation Functions
.\" _ _ _
.\" | | (_) |__ _ __ __ _ _ __ _ _
.\" | | | | '_ \| '__/ _` | '__| | | |
.\" | |___| | |_) | | | (_| | | | |_| |
.\" |_____|_|_.__/|_| \__,_|_| \__, |
.\" |___/
.Sh LIBRARY
Mifare card manipulation library (libfreefare, \-lfreefare)
.\" ____ _
.\" / ___| _ _ _ __ ___ _ __ ___(_)___
.\" \___ \| | | | '_ \ / _ \| '_ \/ __| / __|
.\" ___) | |_| | | | | (_) | |_) \__ \ \__ \
.\" |____/ \__, |_| |_|\___/| .__/|___/_|___/
.\" |___/ |_|
.Sh SYNOPSIS
.In freefare.h
.Ft "MifareSectorNumber *"
.Fn mifare_application_alloc "Mad mad" "MadAid aid" "size_t size"
.Ft void
.Fn mifare_application_free "Mad mad" "MadAid aid"
.Ft "MifareSectorNumber *"
.Fn mifare_application_find "Mad mad" "MadAid aid"
.\" ____ _ _ _
.\" | _ \ ___ ___ ___ _ __(_)_ __ | |_(_) ___ _ __
.\" | | | |/ _ \/ __|/ __| '__| | '_ \| __| |/ _ \| '_ \
.\" | |_| | __/\__ \ (__| | | | |_) | |_| | (_) | | | |
.\" |____/ \___||___/\___|_| |_| .__/ \__|_|\___/|_| |_|
.\" |_|
The
.Fn mifare_application_*
functions facilitate management of applications in a Mifare Application
Directory.
.Pp
The
.Fn mifare_application_alloc
function allocates enought sectors to store
.Vt size
blocks for the Application Identifier
.Vt aid
and returns the list of allocated sectors.
.Pp
The list of the sectors previously allocated for
.Vt aid
in a
.Vt mad
can be requested using
.Fn mifare_application_find .
.Pp
An application can be removed from a
.Vt mad
using
.Fn mifare_application_free .
.\" ____ _ _
.\" | _ \ ___| |_ _ _ _ __ _ __ __ ____ _| |_ _ ___ ___
.\" | |_) / _ \ __| | | | '__| '_ \ \ \ / / _` | | | | |/ _ \/ __|
.\" | _ < __/ |_| |_| | | | | | | \ V / (_| | | |_| | __/\__ \
.\" |_| \_\___|\__|\__,_|_| |_| |_| \_/ \__,_|_|\__,_|\___||___/
.\"
.Sh RETURN VALUES
Unless stated otherwise, all functions return a value greater than or equal to
.Va 0
on success or
.Va -1
on failure.
.\" ____ _
.\" / ___| ___ ___ __ _| |___ ___
.\" \___ \ / _ \/ _ \ / _` | / __|/ _ \
.\" ___) | __/ __/ | (_| | \__ \ (_) |
.\" |____/ \___|\___| \__,_|_|___/\___/
.\"
.Sh SEE ALSO
.Xr mad 3 ,
.Xr mifare_classic 3
.\" _ _ _
.\" / \ _ _| |_| |__ ___ _ __ ___
.\" / _ \| | | | __| '_ \ / _ \| '__/ __|
.\" / ___ \ |_| | |_| | | | (_) | | \__ \
.\" /_/ \_\__,_|\__|_| |_|\___/|_| |___/
.\"
.Sh AUTHORS
.An Romain Tartiere Aq romain@blogreen.org
.An Romuald Conty Aq rconty@il4p.fr

View file

@ -0,0 +1,241 @@
.\" Copyright (C) 2010 Romain Tartiere
.\"
.\" This program is free software: you can redistribute it and/or modify it
.\" under the terms of the GNU Lesser General Public License as published by the
.\" Free Software Foundation, either version 3 of the License, or (at your
.\" option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
.\" more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public License
.\" along with this program. If not, see <http://www.gnu.org/licenses/>
.\"
.\" $Id$
.\"
.Dd March 30, 2010
.Dt MIFARE_CLASSIC 3
.Os
.\" _ _
.\" | \ | | __ _ _ __ ___ ___
.\" | \| |/ _` | '_ ` _ \ / _ \
.\" | |\ | (_| | | | | | | __/
.\" |_| \_|\__,_|_| |_| |_|\___|
.\"
.Sh NAME
.Nm mifare_classic_connect ,
.Nm mifare_classic_disconnect ,
.Nm mifare_classic_authenticate ,
.Nm mifare_classic_read ,
.Nm mifare_classic_init_value ,
.Nm mifare_classic_read_value ,
.Nm mifare_classic_write ,
.Nm mifare_classic_increment ,
.Nm mifare_classic_decrement ,
.Nm mifare_classic_restore ,
.Nm mifare_classic_transfer ,
.Nm mifare_classic_get_trailer_block_permission ,
.Nm mifare_classic_get_data_block_permission ,
.Nm mifare_classic_format_sector ,
.Nm mifare_classic_get_uid ,
.Nm mifare_classic_trailer_block
.Nd Mifare Classic Manipulation Functions
.\" _ _ _
.\" | | (_) |__ _ __ __ _ _ __ _ _
.\" | | | | '_ \| '__/ _` | '__| | | |
.\" | |___| | |_) | | | (_| | | | |_| |
.\" |_____|_|_.__/|_| \__,_|_| \__, |
.\" |___/
.Sh LIBRARY
Mifare card manipulation library (libfreefare, \-lfreefare)
.\" ____ _
.\" / ___| _ _ _ __ ___ _ __ ___(_)___
.\" \___ \| | | | '_ \ / _ \| '_ \/ __| / __|
.\" ___) | |_| | | | | (_) | |_) \__ \ \__ \
.\" |____/ \__, |_| |_|\___/| .__/|___/_|___/
.\" |___/ |_|
.Sh SYNOPSIS
.In freefare.h
.Ft int
.Fn mifare_classic_connect "MifareTag tag"
.Ft int
.Fn mifare_classic_disconnect "MifareTag tag"
.Ft int
.Fn mifare_classic_authenticate "MifareTag tag" "const MifareClassicBlockNumber block" "const MifareClassicKey key" "const MifareClassicKeyType key_type"
.Ft int
.Fn mifare_classic_read "MifareTag tag" "const MifareClassicBlockNumber block" "MifareClassicBlock *data"
.Ft int
.Fn mifare_classic_init_value "MifareTag tag" "const MifareClassicBlockNumber block" "const int32_t value" "const MifareClassicBlockNumber adr"
.Ft int
.Fn mifare_classic_read_value "MifareTag tag" "const MifareClassicBlockNumber block" "int32_t *value" "MifareClassicBlockNumber *adr"
.Ft int
.Fn mifare_classic_write "MifareTag tag" "const MifareClassicBlockNumber block" "const MifareClassicBlock data"
.Ft int
.Fn mifare_classic_increment "MifareTag tag" "const MifareClassicBlockNumber block" "const uint32_t amount"
.Ft int
.Fn mifare_classic_decrement "MifareTag tag" "const MifareClassicBlockNumber block" "const uint32_t amount"
.Ft int
.Fn mifare_classic_restore "MifareTag tag" "const MifareClassicBlockNumber block"
.Ft int
.Fn mifare_classic_transfer "MifareTag tag" "const MifareClassicBlockNumber block"
.Ft int
.Fn mifare_classic_get_trailer_block_permission "MifareTag tag" "const MifareClassicBlockNumber block" "const uint16_t permission" "const MifareClassicKeyType key_type"
.Ft int
.Fn mifare_classic_get_data_block_permission "MifareTag tag" "const MifareClassicBlockNumber block" "const unsigned char permission" "const MifareClassicKeyType key_type"
.Ft int
.Fn mifare_classic_format_sector "MifareTag tag" "const MifareClassicBlockNumber block"
.Ft "char *"
.Fn mifare_classic_get_uid "MifareTag tag"
.Ft void
.Fn mifare_classic_trailer_block "MifareClassicBlock *block" "const MifareClassicKey key_a" "const uint8_t ab_0" "const uint8_t ab_1" "const uint8_t ab_2" "const uint8_t ab_tb" "const uint8_t gpb" "const MifareClassicKey key_b"
.\" ____ _ _ _
.\" | _ \ ___ ___ ___ _ __(_)_ __ | |_(_) ___ _ __
.\" | | | |/ _ \/ __|/ __| '__| | '_ \| __| |/ _ \| '_ \
.\" | |_| | __/\__ \ (__| | | | |_) | |_| | (_) | | | |
.\" |____/ \___||___/\___|_| |_| .__/ \__|_|\___/|_| |_|
.\" |_|
.Sh DESCRIPTION
The
.Fn mifare_classic_*
set of functions allow manipulation of both Mifare Classic 1k and Mifare
Classic 4k cards.
.Pp
A given
.Vt tag
is activated using
.Fn mifare_classic_connect ,
deactivation is performed with
.Fn mifare_classic_disconnect .
.Pp
After a successful connection, an authentication for a
.Vt block
using a
.Vt key
of type
.Vt key_type
(either
.Ar MFC_KEY_A
or
.Ar MFC_KEY_B )
using
.Fn mifare_classic_authenticate
is required for further operation.
.Pp
Once successfuly authenticated,
.Vt data
of a
.Vt block
can be read using
.Fn mifare_classic_read
and written using
.Fn mifare_classic_write .
.Pp
Value-blocks can be easily accessed using the
.Fn mifare_classic_read_value
and
.Fn mifare_classic_init_value
functions. Aditional functions are available for such
.Vt blocks :
.Fn mifare_classic_increment
and
.Fn mifare_classic_decrement
increment or decrement the value of the provided
.Vt block
by
.Vt amount
and store the result in the target's internal data register. The value in this
register can also be loaded with the value from another
.Vt block
using
.Fn mifare_classic_restore .
Writing back the value of the target's internal data register to a
.Vt block
is requested using
.Fn mifare_classic_transfer .
.Pp
Permissions for a data
.Vt block
can be fetched using
.Fn mifare_classic_get_data_block_permission .
The access
.Vt permission
to be checkf for key
.Vt key_type
is one of
.Ar MCAB_R ,
.Ar MCAB_W ,
.Ar MCAB_I or
.Ar MCAB_D ;
respectively for read, write, increment and decrement permissions.
.Pp
.Fn mifare_classic_get_trailer_block_permission
acts like
.Fn mifare_classic_get_data_block_permission
but the available
.Vt permissions
are
.Ar MCAB_READ_KEYA ,
.Ar MCAB_READ_KEYB ,
.Ar MCAB_READ_ACCESS_BITS ,
.Ar MCAB_WRITE_ACCESS_BITS ,
.Ar MCAB_READ_KEYB and
.Ar MCAB_WRITE_KEYB .
.Pp
A whole sector can be reset to factory defaults using
.Fn mifare_classic_format_sector
and providing any
.Vt block
in the sector.
.Pp
The
.Fn mifare_classic_trailer_block
is a convenience function for building a trailer block
.Vt block
given a A key
.Vt key_a ;
access bits for the blocks of the sector
.Vt ab_0 ,
.Vt ab_1 and
.Vt ab_2 ;
and a B key
.Vt key_b .
.Pp
The
.Fn mifare_classic_get_uid
function retrieves a text representation of the UID of a
.Fn tag .
It is not required for the
.Vt tag
to be active to use this function.
.\" ____ _ _
.\" | _ \ ___| |_ _ _ _ __ _ __ __ ____ _| |_ _ ___ ___
.\" | |_) / _ \ __| | | | '__| '_ \ \ \ / / _` | | | | |/ _ \/ __|
.\" | _ < __/ |_| |_| | | | | | | \ V / (_| | | |_| | __/\__ \
.\" |_| \_\___|\__|\__,_|_| |_| |_| \_/ \__,_|_|\__,_|\___||___/
.\"
.Sh RETURN VALUES
Unless stated otherwise, all functions return a value greater than or equal to
.Va 0
on success or
.Va -1
on failure.
.\" ____ _
.\" / ___| ___ ___ __ _| |___ ___
.\" \___ \ / _ \/ _ \ / _` | / __|/ _ \
.\" ___) | __/ __/ | (_| | \__ \ (_) |
.\" |____/ \___|\___| \__,_|_|___/\___/
.\"
.Sh SEE ALSO
.Xr freefare 3 ,
.Xr mad 3
.\" _ _ _
.\" / \ _ _| |_| |__ ___ _ __ ___
.\" / _ \| | | | __| '_ \ / _ \| '__/ __|
.\" / ___ \ |_| | |_| | | | (_) | | \__ \
.\" /_/ \_\__,_|\__|_| |_|\___/|_| |___/
.\"
.Sh AUTHORS
.An Romain Tartiere Aq romain@blogreen.org
.An Romuald Conty Aq rconty@il4p.fr

View file

@ -0,0 +1,127 @@
.\" Copyright (C) 2010 Romain Tartiere
.\"
.\" This program is free software: you can redistribute it and/or modify it
.\" under the terms of the GNU Lesser General Public License as published by the
.\" Free Software Foundation, either version 3 of the License, or (at your
.\" option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
.\" more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public License
.\" along with this program. If not, see <http://www.gnu.org/licenses/>
.\"
.\" $Id$
.\"
.Dd March 30, 2010
.Dt MIFARE_ULTRALIGHT 3
.Os
.\" _ _
.\" | \ | | __ _ _ __ ___ ___
.\" | \| |/ _` | '_ ` _ \ / _ \
.\" | |\ | (_| | | | | | | __/
.\" |_| \_|\__,_|_| |_| |_|\___|
.\"
.Sh NAME
.Nm mifare_ultralight_connect ,
.Nm mifare_ultralight_disconnect ,
.Nm mifare_ultralight_read ,
.Nm mifare_ultralight_write ,
.Nm mifare_ultralight_get_uid ,
.Nd Mifare UltraLight Manipulation Functions
.\" _ _ _
.\" | | (_) |__ _ __ __ _ _ __ _ _
.\" | | | | '_ \| '__/ _` | '__| | | |
.\" | |___| | |_) | | | (_| | | | |_| |
.\" |_____|_|_.__/|_| \__,_|_| \__, |
.\" |___/
.Sh LIBRARY
Mifare card manipulation library (libfreefare, \-lfreefare)
.\" ____ _
.\" / ___| _ _ _ __ ___ _ __ ___(_)___
.\" \___ \| | | | '_ \ / _ \| '_ \/ __| / __|
.\" ___) | |_| | | | | (_) | |_) \__ \ \__ \
.\" |____/ \__, |_| |_|\___/| .__/|___/_|___/
.\" |___/ |_|
.Sh SYNOPSIS
.Ft int
.Fn mifare_ultralight_connect "MifareTag tag"
.Ft int
.Fn mifare_ultralight_disconnect "MifareTag tag"
.Ft int
.Fn mifare_ultralight_read "MifareTag tag" "const MifareUltralightPageNumber page" "MifareUltralightPage *data"
.Ft int
.Fn mifare_ultralight_write "MifareTag tag" "const MifareUltralightPageNumber page" "const MifareUltralightPage data"
.Ft "char *"
.Fn mifare_ultralight_get_uid "MifareTag tag"
.\" ____ _ _ _
.\" | _ \ ___ ___ ___ _ __(_)_ __ | |_(_) ___ _ __
.\" | | | |/ _ \/ __|/ __| '__| | '_ \| __| |/ _ \| '_ \
.\" | |_| | __/\__ \ (__| | | | |_) | |_| | (_) | | | |
.\" |____/ \___||___/\___|_| |_| .__/ \__|_|\___/|_| |_|
.\" |_|
.Sh DESCRIPTION
The
.Fn mifare_ultralight_*
functions allows management of Mifare UltraLight tags.
.Pp
The
.Fn mifare_ultralight_connect
function activates the specified
.Vt tag .
.Pp
A
.Vt page
of
.Vt data
can be read from a
.Vt tag
using
.Fn mifare_ultralight_read ,
and written
using
.Fn mifare_ultralight_write .
.Pp
After usage, a
.Vt tag
is deactivated using
.Fn mifare_ultralight_disconnect .
.Pp
The
.Fn mifare_ultralight_get_uid
function retrieves a text representation of the UID of a
.Fn tag .
It is not required for the
.Vt tag
to be active to use this function.
.\" ____ _ _
.\" | _ \ ___| |_ _ _ _ __ _ __ __ ____ _| |_ _ ___ ___
.\" | |_) / _ \ __| | | | '__| '_ \ \ \ / / _` | | | | |/ _ \/ __|
.\" | _ < __/ |_| |_| | | | | | | \ V / (_| | | |_| | __/\__ \
.\" |_| \_\___|\__|\__,_|_| |_| |_| \_/ \__,_|_|\__,_|\___||___/
.\"
.Sh RETURN VALUES
Unless stated otherwise, all functions return a value greater than or equal to
.Va 0
on success or
.Va -1
on failure.
.\" ____ _
.\" / ___| ___ ___ __ _| |___ ___
.\" \___ \ / _ \/ _ \ / _` | / __|/ _ \
.\" ___) | __/ __/ | (_| | \__ \ (_) |
.\" |____/ \___|\___| \__,_|_|___/\___/
.\"
.Sh SEE ALSO
.Xr freefare 3
.\" _ _ _
.\" / \ _ _| |_| |__ ___ _ __ ___
.\" / _ \| | | | __| '_ \ / _ \| '__/ __|
.\" / ___ \ |_| | |_| | | | (_) | | \__ \
.\" /_/ \_\__,_|\__|_| |_|\___/|_| |___/
.\"
.Sh AUTHORS
.An Romain Tartiere Aq romain@blogreen.org
.An Romuald Conty Aq rconty@il4p.fr