Added application functions from dir.c

Added app list to sc_card_t docs


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2199 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
bert 2005-02-23 23:36:06 +00:00
parent e53ab92d6e
commit 200697ff7e
8 changed files with 234 additions and 1 deletions

View File

@ -11,6 +11,7 @@
<xi:include href="init/chapter.xml"/>
<xi:include href="card/chapter.xml"/>
<xi:include href="file/chapter.xml"/>
<xi:include href="apps/chapter.xml"/>
<xi:include href="asn1/chapter.xml"/>
<xi:include href="util/chapter.xml"/>
<xi:include href="types/chapter.xml"/>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY scfreeapps SYSTEM "sc_free_apps.xml">
<!ENTITY scfindappbyaid SYSTEM "sc_find_app_by_aid.xml">
<!ENTITY scupdatedir SYSTEM "sc_update_dir.xml">
<!ENTITY scenumapps SYSTEM "sc_enum_apps.xml">
<!ENTITY scfindpkcs15app SYSTEM "sc_find_pkcs15_app.xml">
]>
<chapter>
<title>Applications</title>
&scenumapps;
&scfindappbyaid;
&scfindpkcs15app;
&scupdatedir;
&scfreeapps;
</chapter>

View File

@ -0,0 +1,41 @@
<refentry id="scenumapps">
<refmeta>
<refentrytitle>sc_enum_apps</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>opensc</refmiscinfo>
</refmeta>
<refnamediv>
<refname>sc_enum_apps</refname>
<refpurpose>Enumerate the applications on a card</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<para>
<programlisting>
#include &lt;opensc.h&gt;
int sc_enum_apps(struct sc_card *card);
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Description</title>
<para>
This function enumerates the applications on <emphasis>card</emphasis>, and
stores them in the structure. The list of applications can then later be
searched with <link linkend="scfindappbyaid">sc_find_app_by_aid()</link> or
<link linkend="scfindpkcs15app">sc_find_pkcs15_app()</link>.
</para>
</refsect1>
<refsect1>
<title>Return value</title>
<para>
Returns the number of applications on the card, or a negative value in case
of error.
</para>
</refsect1>
</refentry>

View File

@ -0,0 +1,48 @@
<refentry id="scfindappbyaid">
<refmeta>
<refentrytitle>sc_find_app_by_aid</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>opensc</refmiscinfo>
</refmeta>
<refnamediv>
<refname>sc_find_app_by_aid</refname>
<refpurpose>Find an application on a card</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<para>
<programlisting>
#include &lt;opensc.h&gt;
const sc_app_info_t *sc_find_app_by_aid(sc_card_t *card,
const unsigned char *aid,
size_t aid_len);
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Description</title>
<para>
This function finds an application on <emphasis>card</emphasis> by its
<emphasis>aid</emphasis>. The AID's length is specified in
<emphasis>aid_len</emphasis>.
</para>
<para>
Before calling this function, you MUST call <link
linkend="scenumapps">sc_enum_apps()</link> first.
</para>
</refsect1>
<refsect1>
<title>Return value</title>
<para>
Returns a <link linkend="scappinfot">sc_app_info_t</link> structure
describing the application corresponding to <emphasis>aid</emphasis>, or NULL
if none was found.
</para>
</refsect1>
</refentry>

View File

@ -0,0 +1,45 @@
<refentry id="scfindpkcs15app">
<refmeta>
<refentrytitle>sc_find_pkcs15_app</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>opensc</refmiscinfo>
</refmeta>
<refnamediv>
<refname>sc_find_pkcs15_app</refname>
<refpurpose>Find a PKCS#15 application on a card</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<para>
<programlisting>
#include &lt;opensc.h&gt;
const sc_app_info_t *sc_find_pkcs15_app(sc_card_t *card);
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Description</title>
<para>
This function attempts to find a PKCS#15 application on
<emphasis>card</emphasis>. Currently, this means either a standard PKCS#15
implementation or a Belgian eID.
</para>
<para>
Before calling this function, you MUST call <link
linkend="scenumapps">sc_enum_apps()</link> first.
</para>
</refsect1>
<refsect1>
<title>Return value</title>
<para>
Returns a <link linkend="scappinfot">sc_app_info_t</link> structure
describing the PKCS#15 application, or NULL if none was found.
</para>
</refsect1>
</refentry>

View File

@ -0,0 +1,32 @@
<refentry id="scfreeapps">
<refmeta>
<refentrytitle>sc_free_apps</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>opensc</refmiscinfo>
</refmeta>
<refnamediv>
<refname>sc_free_apps</refname>
<refpurpose>Free application list</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<para>
<programlisting>
#include &lt;opensc.h&gt;
void sc_free_apps(struct sc_card *card);
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Description</title>
<para>
This functions releases all memory associated with the list of applications
on <emphasis>card</emphasis>, as obtained by a call to <link
linkend="scenumapps">sc_enum_apps()</link>.
</para>
</refsect1>
</refentry>

View File

@ -0,0 +1,45 @@
<refentry id="scupdatedir">
<refmeta>
<refentrytitle>sc_update_dir</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>opensc</refmiscinfo>
</refmeta>
<refnamediv>
<refname>sc_update_dir</refname>
<refpurpose>Update application directory on a card</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<para>
<programlisting>
#include &lt;opensc.h&gt;
int sc_update_dir(sc_card_t *card, sc_app_info_t *app);
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Description</title>
<para>
This function updates the application directory on <emphasis>card</emphasis>.
If the card has a record-structured directory file, <emphasis>app</emphasis>
may contain the application to update. Otherwise, the entire directory file
is updated.
</para>
<para>
Before calling this function, you MUST call <link
linkend="scenumapps">sc_enum_apps()</link> first.
</para>
</refsect1>
<refsect1>
<title>Return value</title>
<para>
Returns 0 if successful, or a negative value in case of error.
</para>
</refsect1>
</refentry>

View File

@ -18,12 +18,13 @@
&includes;
#define SC_MAX_ATR_SIZE 33
#define SC_MAX_CARD_APPS 8
typedef struct sc_card {
struct sc_context *ctx;
struct sc_reader *reader;
struct sc_slot_info *slot;
struct sc_app_info *app[SC_MAX_CARD_APPS];
unsigned char atr[SC_MAX_ATR_SIZE];
} sc_card_t;