Changeset 1279


Ignore:
Timestamp:
01/18/10 12:28:06 (11 years ago)
Author:
dingo35
Message:

Remove ICC_Async dynamic data structure, cleanup some parameters in t0 and t1

Location:
trunk/csctapi
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/csctapi/ct_slot.c

    r1278 r1279  
    121121    unsigned buffer_len  = 0;
    122122   
    123     /* Initiaice ICC */
    124     slot->icc = ICC_Async_New ();
    125    
    126     if (slot->icc == NULL)
    127         return ERR_MEMORY;
    128    
    129     if (ICC_Async_Init (slot->icc) != ICC_ASYNC_OK)
    130     {
    131         ICC_Async_Delete (slot->icc);
    132                
    133         slot->icc = NULL;
    134         slot->icc_type = CT_SLOT_NULL;
     123    if (ICC_Async_Init () != ICC_ASYNC_OK)
     124    {
    135125        return ERR_TRANS;
    136126       
     
    148138    if (slot->icc_type == CT_SLOT_ICC_ASYNC)
    149139    {
    150         pps = PPS_New((ICC_Async *) slot->icc);
     140        pps = PPS_New();
    151141       
    152142        if (pps == NULL)
    153143        {
    154             ICC_Async_Close ((ICC_Async *) slot->icc);
    155             ICC_Async_Delete ((ICC_Async *) slot->icc);
     144            ICC_Async_Close ();
    156145           
    157146            slot->icc = NULL;
     
    169158            PPS_Delete (pps);
    170159           
    171             ICC_Async_Close ((ICC_Async *) slot->icc);
    172             ICC_Async_Delete ((ICC_Async *) slot->icc);
     160            ICC_Async_Close ();
    173161           
    174162            slot->icc = NULL;
     
    222210    if (slot->icc_type == CT_SLOT_ICC_ASYNC)
    223211    {
    224         if (ICC_Async_Close ((ICC_Async *) slot->icc) != ICC_ASYNC_OK)
    225             ret = ERR_TRANS;
    226        
    227         ICC_Async_Delete ((ICC_Async *) slot->icc);
     212        if (ICC_Async_Close () != ICC_ASYNC_OK)
     213            ret = ERR_TRANS;
    228214    }
    229215   
     
    241227    if (slot->protocol_type == CT_SLOT_PROTOCOL_T0) /* T=0 protocol ICC */
    242228    {
    243         if (Protocol_T0_Command ((Protocol_T0 *) slot->protocol, cmd, rsp) != PROTOCOL_T0_OK)
     229        if (Protocol_T0_Command ( cmd, rsp) != PROTOCOL_T0_OK)
    244230            ret = ERR_TRANS;
    245231        else
     
    255241    else if (slot->protocol_type == CT_SLOT_PROTOCOL_T14) /* T=14 protocol ICC */
    256242    {
    257         if (Protocol_T14_Command ((Protocol_T14 *) slot->protocol, cmd, rsp) != PROTOCOL_T14_OK)
     243        if (Protocol_T14_Command (cmd, rsp) != PROTOCOL_T14_OK)
    258244            ret = ERR_TRANS;
    259245        else
     
    339325    if (slot->icc_type == CT_SLOT_ICC_ASYNC)
    340326    {
    341         if (ICC_Async_Close ((ICC_Async *) slot->icc) != ICC_ASYNC_OK)
    342             ret = ERR_TRANS;
    343        
    344         ICC_Async_Delete ((ICC_Async *) slot->icc);
     327        if (ICC_Async_Close () != ICC_ASYNC_OK)
     328            ret = ERR_TRANS;
    345329    }
    346330   
  • trunk/csctapi/icc_async.c

    r1278 r1279  
    4343
    4444static void ICC_Async_InvertBuffer (unsigned size, BYTE * buffer);
    45 static void ICC_Async_Clear (ICC_Async * icc);
     45static void ICC_Async_Clear ();
    4646
    4747int fdmc=(-1);
     
    5050 * Exported functions definition
    5151 */
    52 
    53 ICC_Async *ICC_Async_New (void)
    54 {
    55     ICC_Async *icc;
    56    
    57     /* Allocate memory */
    58     icc = (ICC_Async *) malloc (sizeof (ICC_Async));
    59    
    60     if (icc != NULL)
    61         ICC_Async_Clear (icc);
    62    
    63     return icc;
    64 }
    6552
    6653int ICC_Async_Device_Init ()
     
    196183}
    197184
    198 int ICC_Async_Init (ICC_Async * icc)
     185int ICC_Async_Init ()
    199186{
    200187#ifndef ICC_TYPE_SYNC
     
    322309}
    323310
    324 int ICC_Async_SetBaudrate (ICC_Async * icc, unsigned long baudrate)
     311int ICC_Async_SetBaudrate (unsigned long baudrate)
    325312{
    326313    if (!Phoenix_SetBaudrate (baudrate))
     
    330317}
    331318
    332 int ICC_Async_GetBaudrate (ICC_Async * icc, unsigned long * baudrate)
     319int ICC_Async_GetBaudrate (unsigned long * baudrate)
    333320{
    334321    (*baudrate) = reader[ridx].baudrate;
     
    396383}
    397384
    398 int ICC_Async_Close (ICC_Async * icc)
     385int ICC_Async_Close ()
    399386{
    400387#ifdef SCI_DEV
     
    407394    ATR_Delete (atr);
    408395   
    409     ICC_Async_Clear (icc);
     396    ICC_Async_Clear ();
    410397   
    411398    return ICC_ASYNC_OK;
     
    425412}
    426413
    427 void ICC_Async_Delete (ICC_Async * icc)
    428 {
    429     free (icc);
    430 }
    431 
    432414/*
    433415 * Not exported functions definition
     
    442424}
    443425
    444 static void ICC_Async_Clear (ICC_Async * icc)
     426static void ICC_Async_Clear ()
    445427{
    446428    atr = NULL;
  • trunk/csctapi/icc_async.h

    r1278 r1279  
    5858}
    5959ICC_Async_Timings;
    60 
     60/*
    6161typedef struct
    6262{
    6363}
    6464ICC_Async;
    65 
     65*/
    6666ATR *atr;                     /* Answer to reset of this ICC */
    6767int convention;               /* Convention of this ICC */
     
    7373 */
    7474
    75 /* Creation and Deletion */
    76 extern ICC_Async * ICC_Async_New (void);
    77 extern void ICC_Async_Delete (ICC_Async * icc);
    78 
    7975/* Initialization and Deactivation */
    80 extern int ICC_Async_Init (ICC_Async * icc);
    81 extern int ICC_Async_Close (ICC_Async * icc);
     76extern int ICC_Async_Init ();
     77extern int ICC_Async_Close ();
    8278
    8379/* Attributes */
    8480extern int ICC_Async_SetTimings ();
    85 extern int ICC_Async_SetBaudrate (ICC_Async * icc, unsigned long baudrate);
    86 extern int ICC_Async_GetBaudrate (ICC_Async * icc, unsigned long * baudrate);
     81extern int ICC_Async_SetBaudrate (unsigned long baudrate);
     82extern int ICC_Async_GetBaudrate (unsigned long * baudrate);
    8783extern unsigned long ICC_Async_GetClockRate ();
    8884
  • trunk/csctapi/pps.c

    r1278 r1279  
    5151 */
    5252
    53 static int PPS_Exchange (PPS * pps, BYTE * params, unsigned *length);
     53static int PPS_Exchange (BYTE * params, unsigned *length);
    5454
    5555static bool PPS_Match (BYTE * request, unsigned len_request, BYTE * reply, unsigned len_reply);
     
    6767 */
    6868
    69 PPS * PPS_New (ICC_Async * icc)
     69PPS * PPS_New ()
    7070{
    7171    PPS *pps;
     
    7575    if (pps != NULL)
    7676    {
    77         pps->icc = icc;
    7877        pps->protocol = NULL;
    7978        pps->parameters.t = PPS_DEFAULT_PROTOCOL;
     
    106105    if ((*length) > 0)
    107106    {
    108         ret = PPS_Exchange (pps, params, length);
     107        ret = PPS_Exchange (params, length);
    109108       
    110109        /* Get parameters from PPS handsake */
     
    223222            //req[3]=PPS_GetPCK(req,sizeof(req)-1); will be set by PPS_Exchange
    224223                unsigned int len = sizeof(req);
    225                 ret = PPS_Exchange (pps, req, &len);
     224                ret = PPS_Exchange (req, &len);
    226225            if (ret == PPS_OK) {
    227226                    pps->parameters.FI = req[2] >> 4;
     
    317316 */
    318317
    319 static int PPS_Exchange (PPS * pps, BYTE * params, unsigned *length)
     318static int PPS_Exchange (BYTE * params, unsigned *length)
    320319{
    321320    BYTE confirm[PPS_MAX_LENGTH];
     
    485484   
    486485
    487     if (ICC_Async_SetBaudrate (pps->icc, baudrate) != ICC_ASYNC_OK)
     486    if (ICC_Async_SetBaudrate (baudrate) != ICC_ASYNC_OK)
    488487        return PPS_ICC_ERROR;
    489488   
     
    502501        if ((pps->protocol) != NULL)
    503502        {
    504             ret = Protocol_T0_Init ((Protocol_T0 *) pps->protocol, (ICC_Async *) pps->icc, &(pps->parameters), selected_protocol);
     503            ret = Protocol_T0_Init ((Protocol_T0 *) pps->protocol, &(pps->parameters), selected_protocol);
    505504           
    506505            if (ret != PROTOCOL_T0_OK)
     
    520519        if (pps->protocol != NULL)
    521520        {
    522             ret = Protocol_T1_Init ((Protocol_T1 *) pps->protocol, (ICC_Async *) pps->icc, selected_protocol);
     521            ret = Protocol_T1_Init ((Protocol_T1 *) pps->protocol, selected_protocol);
    523522           
    524523            if (ret != PROTOCOL_T1_OK)
     
    538537        if ((pps->protocol) != NULL)
    539538        {
    540             ret = Protocol_T14_Init ((Protocol_T14 *) pps->protocol, (ICC_Async *) pps->icc, &(pps->parameters), selected_protocol);
     539            ret = Protocol_T14_Init ((Protocol_T14 *) pps->protocol, &(pps->parameters), selected_protocol);
    541540           
    542541            if (ret != PROTOCOL_T14_OK)
  • trunk/csctapi/pps.h

    r833 r1279  
    5353typedef struct
    5454{
    55   ICC_Async *icc;
    5655  void *protocol;
    5756  PPS_ProtocolParameters parameters;
     
    6463
    6564/* Create PPS context */
    66 extern PPS *PPS_New (ICC_Async * icc);
     65extern PPS *PPS_New ();
    6766
    6867/* Perform protcol type selection and return confirm */
  • trunk/csctapi/protocol_t0.c

    r1278 r1279  
    5555static void Protocol_T14_Clear (Protocol_T14 * t14);
    5656
    57 static int Protocol_T0_Case1 (Protocol_T0 * t0, APDU_Cmd * cmd, APDU_Rsp ** rsp);
    58 
    59 static int Protocol_T0_Case2S (Protocol_T0 * t0, APDU_Cmd * cmd, APDU_Rsp ** rsp);
    60 static int Protocol_T14_Case2S (Protocol_T14 * t14, APDU_Cmd * cmd, APDU_Rsp ** rsp);
    61 
    62 static int Protocol_T0_Case3S (Protocol_T0 * t0, APDU_Cmd * cmd, APDU_Rsp ** rsp);
    63 static int Protocol_T14_Case3S (Protocol_T14 * t14, APDU_Cmd * cmd, APDU_Rsp ** rsp);
    64 
    65 static int Protocol_T0_Case4S (Protocol_T0 * t0, APDU_Cmd * cmd, APDU_Rsp ** rsp);
    66 
    67 static int Protocol_T0_Case2E (Protocol_T0 * t0, APDU_Cmd * cmd, APDU_Rsp ** rsp);
    68 
    69 static int Protocol_T0_Case3E (Protocol_T0 * t0, APDU_Cmd * cmd, APDU_Rsp ** rsp);
    70 
    71 static int Protocol_T0_Case4E (Protocol_T0 * t0, APDU_Cmd * cmd, APDU_Rsp ** rsp);
    72 
    73 static int Protocol_T0_ExchangeTPDU (Protocol_T0 * t0, APDU_Cmd * cmd, APDU_Rsp ** rsp);
    74 static int Protocol_T14_ExchangeTPDU (Protocol_T14 * t14, APDU_Cmd * cmd, APDU_Rsp ** rsp);
     57static int Protocol_T0_Case1 (APDU_Cmd * cmd, APDU_Rsp ** rsp);
     58
     59static int Protocol_T0_Case2S (APDU_Cmd * cmd, APDU_Rsp ** rsp);
     60static int Protocol_T14_Case2S (APDU_Cmd * cmd, APDU_Rsp ** rsp);
     61
     62static int Protocol_T0_Case3S (APDU_Cmd * cmd, APDU_Rsp ** rsp);
     63static int Protocol_T14_Case3S (APDU_Cmd * cmd, APDU_Rsp ** rsp);
     64
     65static int Protocol_T0_Case4S (APDU_Cmd * cmd, APDU_Rsp ** rsp);
     66
     67static int Protocol_T0_Case2E (APDU_Cmd * cmd, APDU_Rsp ** rsp);
     68
     69static int Protocol_T0_Case3E (APDU_Cmd * cmd, APDU_Rsp ** rsp);
     70
     71static int Protocol_T0_Case4E (APDU_Cmd * cmd, APDU_Rsp ** rsp);
     72
     73static int Protocol_T0_ExchangeTPDU (APDU_Cmd * cmd, APDU_Rsp ** rsp);
     74static int Protocol_T14_ExchangeTPDU (APDU_Cmd * cmd, APDU_Rsp ** rsp);
    7575
    7676/*
     
    102102}
    103103
    104 int Protocol_T0_Init (Protocol_T0 * t0, ICC_Async * icc, PPS_ProtocolParameters * params, int selected_protocol)
     104int Protocol_T0_Init (Protocol_T0 * t0, PPS_ProtocolParameters * params, int selected_protocol)
    105105{
    106106    BYTE wi;
    107    
    108     /* Set ICC */
    109     t0->icc = icc;
    110107   
    111108    /* Integer value WI  = TC2, by default 10 */
     
    131128}
    132129
    133 int Protocol_T14_Init (Protocol_T14 * t14, ICC_Async * icc, PPS_ProtocolParameters * params, int selected_protocol)
     130int Protocol_T14_Init (Protocol_T14 * t14, PPS_ProtocolParameters * params, int selected_protocol)
    134131{
    135132    BYTE wi;
    136    
    137     /* Set ICC */
    138     t14->icc = icc;
    139133   
    140134    /* Integer value WI  = TC2, by default 10 */
     
    161155}
    162156
    163 int Protocol_T0_Command (Protocol_T0 * t0, APDU_Cmd * cmd, APDU_Rsp ** rsp)
     157int Protocol_T0_Command (APDU_Cmd * cmd, APDU_Rsp ** rsp)
    164158{
    165159    int cmd_case, ret;
     
    173167   
    174168    if (cmd_case == APDU_CASE_1)
    175         ret = Protocol_T0_Case1 (t0, cmd, rsp);
     169        ret = Protocol_T0_Case1 (cmd, rsp);
    176170    else if (cmd_case == APDU_CASE_2S)
    177         ret = Protocol_T0_Case2S (t0, cmd, rsp);
     171        ret = Protocol_T0_Case2S (cmd, rsp);
    178172    else if (cmd_case == APDU_CASE_3S)
    179         ret = Protocol_T0_Case3S (t0, cmd, rsp);
     173        ret = Protocol_T0_Case3S (cmd, rsp);
    180174    else if (cmd_case == APDU_CASE_4S)
    181         ret = Protocol_T0_Case4S (t0, cmd, rsp);
     175        ret = Protocol_T0_Case4S (cmd, rsp);
    182176    else if (cmd_case == APDU_CASE_2E)
    183         ret = Protocol_T0_Case2E (t0, cmd, rsp);
     177        ret = Protocol_T0_Case2E (cmd, rsp);
    184178    else if (cmd_case == APDU_CASE_3E)
    185         ret = Protocol_T0_Case3E (t0, cmd, rsp);
     179        ret = Protocol_T0_Case3E (cmd, rsp);
    186180    else if (cmd_case == APDU_CASE_4E)
    187         ret = Protocol_T0_Case4E (t0, cmd, rsp);
     181        ret = Protocol_T0_Case4E (cmd, rsp);
    188182    else
    189183    {
     
    197191}
    198192
    199 int Protocol_T14_Command (Protocol_T14 * t14, APDU_Cmd * cmd, APDU_Rsp ** rsp)
     193int Protocol_T14_Command (APDU_Cmd * cmd, APDU_Rsp ** rsp)
    200194{
    201195    int cmd_case, ret;
     
    210204    if (cmd_case == APDU_CASE_2S)
    211205    {
    212         ret = Protocol_T14_Case2S (t14, cmd, rsp);
     206        ret = Protocol_T14_Case2S (cmd, rsp);
    213207    }
    214208    else if (cmd_case == APDU_CASE_3S)
    215209    {
    216         ret = Protocol_T14_Case3S (t14, cmd, rsp);
     210        ret = Protocol_T14_Case3S (cmd, rsp);
    217211    }
    218212    else
     
    255249 */
    256250
    257 static int Protocol_T0_Case1 (Protocol_T0 * t0, APDU_Cmd * cmd, APDU_Rsp ** rsp)
     251static int Protocol_T0_Case1 (APDU_Cmd * cmd, APDU_Rsp ** rsp)
    258252{
    259253    int ret;
     
    268262   
    269263    /* Send command TPDU */
    270     ret = Protocol_T0_ExchangeTPDU (t0, tpdu_cmd, rsp);
     264    ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, rsp);
    271265   
    272266    /* Delete command TPDU */
     
    277271
    278272
    279 static int Protocol_T0_Case2S (Protocol_T0 * t0, APDU_Cmd * cmd, APDU_Rsp ** rsp)
     273static int Protocol_T0_Case2S (APDU_Cmd * cmd, APDU_Rsp ** rsp)
    280274{
    281275    int ret;
    282276   
    283277    /* Send command TPDU */
    284     ret = Protocol_T0_ExchangeTPDU (t0, cmd, rsp);
     278    ret = Protocol_T0_ExchangeTPDU(cmd, rsp);
    285279   
    286280    return ret;
    287281}
    288282
    289 static int Protocol_T14_Case2S (Protocol_T14 * t14, APDU_Cmd * cmd, APDU_Rsp ** rsp)
     283static int Protocol_T14_Case2S (APDU_Cmd * cmd, APDU_Rsp ** rsp)
    290284{
    291285    int ret;
    292286   
    293287    /* Send command TPDU */
    294     ret = Protocol_T14_ExchangeTPDU (t14, cmd, rsp);
     288    ret = Protocol_T14_ExchangeTPDU(cmd, rsp);
    295289   
    296290    return ret;
    297291}
    298292
    299 static int Protocol_T0_Case3S (Protocol_T0 * t0, APDU_Cmd * cmd, APDU_Rsp ** rsp)
     293static int Protocol_T0_Case3S (APDU_Cmd * cmd, APDU_Rsp ** rsp)
    300294{
    301295    int ret;
     
    307301   
    308302    /* Send command TPDU */
    309     ret = Protocol_T0_ExchangeTPDU (t0, cmd, (&tpdu_rsp));
     303    ret = Protocol_T0_ExchangeTPDU(cmd, (&tpdu_rsp));
    310304   
    311305    if (ret == PROTOCOL_T0_OK)
     
    330324           
    331325            /* Re-issue command TPDU */
    332             ret = Protocol_T0_ExchangeTPDU (t0, tpdu_cmd, rsp);
     326            ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, rsp);
    333327           
    334328            /* Delete command TPDU */
     
    361355                tpdu_cmd = APDU_Cmd_New (buffer, 5);
    362356               
    363                 ret = Protocol_T0_ExchangeTPDU (t0, tpdu_cmd, (&tpdu_rsp));
     357                ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, (&tpdu_rsp));
    364358               
    365359                /* Delete command TPDU */
     
    400394}
    401395
    402 static int Protocol_T14_Case3S (Protocol_T14 * t14, APDU_Cmd * cmd, APDU_Rsp ** rsp)
     396static int Protocol_T14_Case3S (APDU_Cmd * cmd, APDU_Rsp ** rsp)
    403397{
    404398    int ret;
    405399   
    406400    /* Send command TPDU */
    407     ret = Protocol_T14_ExchangeTPDU (t14, cmd, rsp);
     401    ret = Protocol_T14_ExchangeTPDU(cmd, rsp);
    408402   
    409403    return ret;
    410404}
    411405
    412 static int Protocol_T0_Case4S (Protocol_T0 * t0, APDU_Cmd * cmd, APDU_Rsp ** rsp)
     406static int Protocol_T0_Case4S (APDU_Cmd * cmd, APDU_Rsp ** rsp)
    413407{
    414408    int ret;
     
    423417   
    424418    /* Send command TPDU */
    425     ret = Protocol_T0_ExchangeTPDU (t0, tpdu_cmd, (&tpdu_rsp));
     419    ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, (&tpdu_rsp));
    426420   
    427421    /* Delete command TPDU */
     
    451445           
    452446            /* Issue Get Reponse command */
    453             ret = Protocol_T0_ExchangeTPDU (t0, tpdu_cmd, rsp);
     447            ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, rsp);
    454448           
    455449            /* Delete command TPDU */
     
    490484
    491485
    492 static int Protocol_T0_Case2E (Protocol_T0 * t0, APDU_Cmd * cmd, APDU_Rsp ** rsp)
     486static int Protocol_T0_Case2E (APDU_Cmd * cmd, APDU_Rsp ** rsp)
    493487{
    494488    int ret = PROTOCOL_T0_OK;
     
    512506       
    513507        /* Send command TPDU */
    514         ret = Protocol_T0_ExchangeTPDU (t0, tpdu_cmd, rsp);
     508        ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, rsp);
    515509       
    516510        /* Delete command TPDU */
     
    534528           
    535529            /* Send envelope command TPDU */
    536             ret = Protocol_T0_ExchangeTPDU (t0, tpdu_cmd, (&tpdu_rsp));
     530            ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, (&tpdu_rsp));
    537531           
    538532            /* Delete command TPDU */
     
    574568
    575569
    576 static int Protocol_T0_Case3E (Protocol_T0 * t0, APDU_Cmd * cmd, APDU_Rsp ** rsp)
     570static int Protocol_T0_Case3E (APDU_Cmd * cmd, APDU_Rsp ** rsp)
    577571{
    578572    int ret;
     
    594588       
    595589        /* Send command TPDU */
    596         ret = Protocol_T0_Case3S (t0, tpdu_cmd, rsp);
     590        ret = Protocol_T0_Case3S (tpdu_cmd, rsp);
    597591       
    598592        /* Delete command TPDU */
     
    611605       
    612606        /* Send command TPDU */
    613         ret = Protocol_T0_ExchangeTPDU (t0, tpdu_cmd, (&tpdu_rsp));
     607        ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, (&tpdu_rsp));
    614608       
    615609        /* Delete command TPDU */
     
    636630               
    637631                /* Re-issue command TPDU */
    638                 ret = Protocol_T0_ExchangeTPDU (t0, tpdu_cmd, rsp);
     632                ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, rsp);
    639633               
    640634                /* Delete command TPDU */
     
    662656                   
    663657                    /* Issue Get Response command TPDU */
    664                     ret = Protocol_T0_ExchangeTPDU (t0, tpdu_cmd, (&tpdu_rsp));
     658                    ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, (&tpdu_rsp));
    665659                   
    666660                    /* Delete command TPDU */
     
    700694
    701695
    702 static int Protocol_T0_Case4E (Protocol_T0 * t0, APDU_Cmd * cmd, APDU_Rsp ** rsp)
     696static int Protocol_T0_Case4E (APDU_Cmd * cmd, APDU_Rsp ** rsp)
    703697{
    704698    int ret;
     
    722716       
    723717        /* Send command TPDU */
    724         ret = Protocol_T0_ExchangeTPDU (t0, tpdu_cmd, (&tpdu_rsp));
     718        ret = Protocol_T0_ExchangeTPDU(tpdu_cmd, (&tpdu_rsp));
    725719       
    726720        /* Delete command TPDU */
     
    729723    else /* 4E2 */
    730724    {
    731         ret = Protocol_T0_Case2E (t0, cmd, (&tpdu_rsp));
     725        ret = Protocol_T0_Case2E (cmd, (&tpdu_rsp));
    732726    }
    733727   
     
    759753           
    760754            /* Issue Case 3E get response command */
    761             ret = Protocol_T0_Case3E (t0, gr_cmd, rsp);
     755            ret = Protocol_T0_Case3E (gr_cmd, rsp);
    762756           
    763757            /* Delete Get Response command APDU */
     
    786780           
    787781            /* Issue Case 3E get response command */
    788             ret = Protocol_T0_Case3E (t0, gr_cmd, rsp);
     782            ret = Protocol_T0_Case3E (gr_cmd, rsp);
    789783           
    790784            /* Delete Get Response command APDU */
     
    796790
    797791
    798 static int Protocol_T0_ExchangeTPDU (Protocol_T0 * t0, APDU_Cmd * cmd, APDU_Rsp ** rsp)
     792static int Protocol_T0_ExchangeTPDU (APDU_Cmd * cmd, APDU_Rsp ** rsp)
    799793{
    800794    BYTE buffer[PROTOCOL_T0_MAX_SHORT_RESPONSE];
     
    965959}
    966960
    967 static int Protocol_T14_ExchangeTPDU (Protocol_T14 * t14, APDU_Cmd * cmd, APDU_Rsp ** rsp)
     961static int Protocol_T14_ExchangeTPDU (APDU_Cmd * cmd, APDU_Rsp ** rsp)
    968962{
    969963    BYTE buffer[PROTOCOL_T14_MAX_SHORT_RESPONSE];
     
    11101104static void Protocol_T0_Clear (Protocol_T0 * t0)
    11111105{
    1112     t0->icc = NULL;
    11131106    t0->wwt = 0;
    11141107}
     
    11161109static void Protocol_T14_Clear (Protocol_T14 * t14)
    11171110{
    1118     t14->icc = NULL;
    11191111    t14->wwt = 0;
    11201112}
  • trunk/csctapi/protocol_t0.h

    r833 r1279  
    5656typedef struct
    5757{
    58   ICC_Async *icc;       /* Asynchrosous integrated cirtuit card */
    5958  unsigned long wwt;        /* Work waiting time (ms) */
    6059}
     
    6463typedef struct
    6564{
    66   ICC_Async *icc;       /* Asynchrosous integrated cirtuit card */
    6765  unsigned long wwt;        /* Work waiting time (ms) */
    6866}
     
    8280
    8381/* Initialise a protocol handler */
    84 extern int Protocol_T0_Init (Protocol_T0 * t0, ICC_Async * icc, PPS_ProtocolParameters * params, int selected_protocol);
    85 extern int Protocol_T14_Init (Protocol_T14 * t14, ICC_Async * icc, PPS_ProtocolParameters * params, int selected_protocol);
     82extern int Protocol_T0_Init (Protocol_T0 * t0, PPS_ProtocolParameters * params, int selected_protocol);
     83extern int Protocol_T14_Init (Protocol_T14 * t14, PPS_ProtocolParameters * params, int selected_protocol);
    8684
    8785/* Send a command and return a response */
    88 extern int Protocol_T0_Command (Protocol_T0 * t0, APDU_Cmd * cmd, APDU_Rsp ** rsp);
    89 extern int Protocol_T14_Command (Protocol_T14 * t14, APDU_Cmd * cmd, APDU_Rsp ** rsp);
     86extern int Protocol_T0_Command (APDU_Cmd * cmd, APDU_Rsp ** rsp);
     87extern int Protocol_T14_Command (APDU_Cmd * cmd, APDU_Rsp ** rsp);
    9088
    9189/* Close a protocol handler */
  • trunk/csctapi/protocol_t1.c

    r1278 r1279  
    4949
    5050static int
    51 Protocol_T1_SendBlock (Protocol_T1 * t1, T1_Block * block);
     51Protocol_T1_SendBlock (T1_Block * block);
    5252
    5353static int
     
    5555
    5656static int
    57 Protocol_T1_UpdateBWT (Protocol_T1 * t1, unsigned short bwt);
     57Protocol_T1_UpdateBWT (unsigned short bwt);
    5858
    5959/*
     
    7575
    7676int
    77 Protocol_T1_Init (Protocol_T1 * t1, ICC_Async * icc, int selected_protocol)
     77Protocol_T1_Init (Protocol_T1 * t1, int selected_protocol)
    7878{
    7979  BYTE ta, tb, tc, cwi, bwi;
     
    8181  double work_etu;
    8282  int i;
    83 
    84   /* Set ICC */
    85   t1->icc = icc;
    8683
    8784  /* Set IFSC */
     
    116113 
    117114  /* Work etu  = (1000 / baudrate) milliseconds */
    118   ICC_Async_GetBaudrate (t1->icc, &baudrate);
     115  ICC_Async_GetBaudrate (&baudrate);
    119116  work_etu = 1000 / (double)baudrate;
    120117
     
    180177#endif
    181178      /* Send IFSD request */
    182       ret = Protocol_T1_SendBlock (t1, block);
     179      ret = Protocol_T1_SendBlock (block);
    183180
    184181      /* Delete block */
     
    225222
    226223  /* Send a block */
    227   ret = Protocol_T1_SendBlock (t1, block);
     224  ret = Protocol_T1_SendBlock (block);
    228225
    229226  /* Delete I-block */
     
    266263#endif
    267264              /* Send a block */
    268               ret = Protocol_T1_SendBlock (t1, block);
     265              ret = Protocol_T1_SendBlock (block);
    269266
    270267              /* Delete I-block */
     
    296293    {
    297294      if (wtx > 1)
    298         Protocol_T1_UpdateBWT (t1, wtx * (t1->bwt));         
     295        Protocol_T1_UpdateBWT (wtx * (t1->bwt));         
    299296
    300297      /* Receive a block */
     
    303300      if (wtx > 1)
    304301        {
    305           Protocol_T1_UpdateBWT (t1, t1->bwt);         
     302          Protocol_T1_UpdateBWT (t1->bwt);         
    306303          wtx = 0;
    307304        }
     
    340337#endif                   
    341338                  /* Send R-Block */
    342                   ret = Protocol_T1_SendBlock (t1, block);
     339                  ret = Protocol_T1_SendBlock (block);
    343340
    344341                  /* Delete I-block */
     
    364361#endif                   
    365362              /* Send WTX response */
    366               ret = Protocol_T1_SendBlock (t1, block);
     363              ret = Protocol_T1_SendBlock (block);
    367364                 
    368365              /* Delete block */
     
    405402
    406403static int
    407 Protocol_T1_SendBlock (Protocol_T1 * t1, T1_Block * block)
     404Protocol_T1_SendBlock (T1_Block * block)
    408405{
    409406  BYTE *buffer;
     
    445442        {
    446443          /* Set timings to read the remaining block */
    447           Protocol_T1_UpdateBWT (t1, t1->cwt);
     444          Protocol_T1_UpdateBWT (t1->cwt);
    448445
    449446          /* Receive remaining bytes */
     
    462459
    463460          /* Restore timings */
    464           Protocol_T1_UpdateBWT (t1, t1->bwt);
     461          Protocol_T1_UpdateBWT (t1->bwt);
    465462        }
    466463      else
     
    477474Protocol_T1_Clear (Protocol_T1 * t1)
    478475{
    479   t1->icc = NULL;
    480476  t1->ifsc = 0;
    481477  t1->ifsd = 0;
     
    488484
    489485static int
    490 Protocol_T1_UpdateBWT (Protocol_T1 * t1, unsigned short bwt)
     486Protocol_T1_UpdateBWT (unsigned short bwt)
    491487{
    492488  icc_timings.block_timeout = bwt;
  • trunk/csctapi/protocol_t1.h

    r1125 r1279  
    4848typedef struct
    4949{
    50   ICC_Async *icc;       /* Asynchronous integrated cirtuit card */
    5150  unsigned short ifsc;  /* Information field size for the ICC */
    5251  unsigned short ifsd;  /* Information field size for the IFD */
     
    7372/* Initialise a protocol handler */
    7473extern int
    75 Protocol_T1_Init (Protocol_T1 * t1, ICC_Async * icc, int selected_protocol);
     74Protocol_T1_Init (Protocol_T1 * t1, int selected_protocol);
    7675
    7776/* Send a command and return a response */
Note: See TracChangeset for help on using the changeset viewer.