Changeset 1084 for trunk/reader-dre.c


Ignore:
Timestamp:
Jan 5, 2010, 11:44:35 PM (10 years ago)
Author:
C.H.A.D.o
Message:

Fix implicit-function-declaration warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/reader-dre.c

    r938 r1084  
    1313#define CMD_BYTE 0x59
    1414
    15 #define dre_cmd(cmd) \
    16 { \
    17     dre_command(cmd, sizeof(cmd)); \
    18 }
    19 
    20 int dre_set_provider_info (void)
    21 {
    22   int i;
    23   static uchar cmd59[] = { 0x59, 0x14 };    // subscriptions
    24   static uchar cmd5b[] = { 0x5b, 0x00, 0x14 };  //validity dates
    25 
    26   cmd59[1] = provider;
    27   if ((dre_cmd (cmd59))) {  //ask subscription packages, returns error on 0x11 card
    28     uchar pbm[32];
    29     memcpy (pbm, cta_res + 3, cta_lr - 6);
    30     cs_debug ("DRECRYPT pbm: %s", cs_hexdump (0, pbm, 32));
    31 
    32     if (pbm[0] == 0xff)
    33       cs_log ("No active packages!");
    34     else
    35       for (i = 0; i < 32; i++)
    36     if (pbm[i] != 0xff) {
    37       cmd5b[1] = i;
    38       cmd5b[2] = provider;
    39       dre_cmd (cmd5b);  //ask for validity dates
    40 
    41       time_t start;
    42       time_t end;
    43       start = (cta_res[3] << 24) | (cta_res[4] << 16) | (cta_res[5] << 8) | cta_res[6];
    44       end = (cta_res[7] << 24) | (cta_res[8] << 16) | (cta_res[9] << 8) | cta_res[10];
    45 
    46       struct tm *temp;
    47 
    48       temp = localtime (&start);
    49       int startyear = temp->tm_year + 1900;
    50       int startmonth = temp->tm_mon + 1;
    51       int startday = temp->tm_mday;
    52       temp = localtime (&end);
    53       int endyear = temp->tm_year + 1900;
    54       int endmonth = temp->tm_mon + 1;
    55       int endday = temp->tm_mday;
    56       cs_log ("Active package %i valid from %04i/%02i/%02i to %04i/%02i/%02i", i, startyear, startmonth, startday,
    57           endyear, endmonth, endday);
    58     }
    59   }
    60   return 1;
    61 }
    62 
    6315uchar xor (uchar * cmd, int cmdlen)
    6416{
     
    6921  return checksum;
    7022}
    71 
    7223
    7324int dre_command (uchar * cmd, int cmdlen)   //attention: inputcommand will be changed!!!! answer will be in cta_res, length cta_lr ; returning 1 = no error, return 0 = err
     
    13687        cta_res[length_excl_leader - 1], cs_hexdump (0, cta_res, cta_lr));
    13788    return 0;           //error
     89  }
     90  return 1;
     91}
     92
     93#define dre_cmd(cmd) \
     94{ \
     95    dre_command(cmd, sizeof(cmd)); \
     96}
     97
     98int dre_set_provider_info (void)
     99{
     100  int i;
     101  static uchar cmd59[] = { 0x59, 0x14 };    // subscriptions
     102  static uchar cmd5b[] = { 0x5b, 0x00, 0x14 };  //validity dates
     103
     104  cmd59[1] = provider;
     105  if ((dre_cmd (cmd59))) {  //ask subscription packages, returns error on 0x11 card
     106    uchar pbm[32];
     107    memcpy (pbm, cta_res + 3, cta_lr - 6);
     108    cs_debug ("DRECRYPT pbm: %s", cs_hexdump (0, pbm, 32));
     109
     110    if (pbm[0] == 0xff)
     111      cs_log ("No active packages!");
     112    else
     113      for (i = 0; i < 32; i++)
     114    if (pbm[i] != 0xff) {
     115      cmd5b[1] = i;
     116      cmd5b[2] = provider;
     117      dre_cmd (cmd5b);  //ask for validity dates
     118
     119      time_t start;
     120      time_t end;
     121      start = (cta_res[3] << 24) | (cta_res[4] << 16) | (cta_res[5] << 8) | cta_res[6];
     122      end = (cta_res[7] << 24) | (cta_res[8] << 16) | (cta_res[9] << 8) | cta_res[10];
     123
     124      struct tm *temp;
     125
     126      temp = localtime (&start);
     127      int startyear = temp->tm_year + 1900;
     128      int startmonth = temp->tm_mon + 1;
     129      int startday = temp->tm_mday;
     130      temp = localtime (&end);
     131      int endyear = temp->tm_year + 1900;
     132      int endmonth = temp->tm_mon + 1;
     133      int endday = temp->tm_mday;
     134      cs_log ("Active package %i valid from %04i/%02i/%02i to %04i/%02i/%02i", i, startyear, startmonth, startday,
     135          endyear, endmonth, endday);
     136    }
    138137  }
    139138  return 1;
Note: See TracChangeset for help on using the changeset viewer.