root/trunk/src/libopensc/muscle-filesystem.h

Revision 3510, 2.0 kB (checked in by ludovic.rousseau, 7 months ago)

Use size_t instead of int when needed, plus some other minor changes

Patch bug.1 included in Ticket #176

Line 
1/*
2 * muscle-filesystem.h: Support for MuscleCard Applet from musclecard.com
3 *
4 * Copyright (C) 2006, Identity Alliance, Thomas Harning <support@identityalliance.com>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21#ifndef MUSCLE_FILESYSTEM_H
22#define MUSCLE_FILESYSTEM_H
23
24#include <stdlib.h>
25
26#include <opensc/types.h>
27
28typedef struct msc_id {
29        u8 id[4];
30} msc_id;
31
32typedef struct mscfs_file {
33        msc_id objectId;
34        size_t size;
35        unsigned short read, write, delete;
36        int ef;
37} mscfs_file_t;
38
39typedef struct mscfs_cache {
40        int size;
41        int totalSize;
42        mscfs_file_t *array;
43} mscfs_cache_t;
44
45typedef struct mscsfs {
46        u8 currentFile[2];
47        u8 currentPath[2];
48        int currentFileIndex;
49        mscfs_cache_t cache;
50        void* udata;
51        int (*listFile)(mscfs_file_t *fileOut, int reset, void* udata);
52} mscfs_t;
53
54mscfs_t *mscfs_new(void);
55void mscfs_free(mscfs_t *fs);
56void mscfs_clear_cache(mscfs_t* fs);
57int mscfs_push_file(mscfs_t* fs, mscfs_file_t *file);
58int mscfs_update_cache(mscfs_t* fs);
59
60void mscfs_check_cache(mscfs_t* fs);
61
62int mscfs_lookup_path(mscfs_t* fs, const u8 *path, int pathlen, msc_id* objectId, int isDirectory);
63
64int mscfs_lookup_local(mscfs_t* fs, const int id, msc_id* objectId);
65/* -1 any, 0 DF, 1 EF */
66int mscfs_check_selection(mscfs_t *fs, int requiredItem);
67int mscfs_loadFileInfo(mscfs_t* fs, const u8 *path, int pathlen, mscfs_file_t **file_data, int* index);
68
69
70#endif
Note: See TracBrowser for help on using the browser.