1 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 Copyright (c) 2012 MOGI, Kazuhiro <kazhiro@marumo.ne.jp> 3 4 Permission to use, copy, modify, and/or distribute this software for any 5 purpose with or without fee is hereby granted, provided that the above 6 copyright notice and this permission notice appear in all copies. 7 8 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 9 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 10 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 11 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 12 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 13 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 14 PERFORMANCE OF THIS SOFTWARE. 15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ 16 17 #ifndef B_CAS_CARD_H 18 #define B_CAS_CARD_H 19 20 #include "portable.h" 21 22 typedef struct { 23 uint8_t system_key[32]; 24 uint8_t init_cbc[8]; 25 int64_t bcas_card_id; 26 int32_t card_status; 27 int32_t ca_system_id; 28 } B_CAS_INIT_STATUS; 29 30 typedef struct { 31 int64_t *data; 32 int32_t count; 33 } B_CAS_ID; 34 35 typedef struct { 36 37 int32_t s_yy; /* start date : year */ 38 int32_t s_mm; /* start date : month */ 39 int32_t s_dd; /* start date : day */ 40 41 int32_t l_yy; /* limit date : year */ 42 int32_t l_mm; /* limit date : month */ 43 int32_t l_dd; /* limit date : day */ 44 45 int32_t hold_time; /* in hour unit */ 46 47 int32_t broadcaster_group_id; 48 49 int32_t network_id; 50 int32_t transport_id; 51 52 } B_CAS_PWR_ON_CTRL; 53 54 typedef struct { 55 B_CAS_PWR_ON_CTRL *data; 56 int32_t count; 57 } B_CAS_PWR_ON_CTRL_INFO; 58 59 typedef struct { 60 uint8_t scramble_key[16]; 61 uint32_t return_code; 62 } B_CAS_ECM_RESULT; 63 64 typedef struct { 65 66 void *private_data; 67 68 void (* release)(void *bcas); 69 70 int (* init)(void *bcas); 71 72 int (* get_init_status)(void *bcas, B_CAS_INIT_STATUS *stat); 73 int (* get_id)(void *bcas, B_CAS_ID *dst); 74 int (* get_pwr_on_ctrl)(void *bcas, B_CAS_PWR_ON_CTRL_INFO *dst); 75 76 int (* proc_ecm)(void *bcas, B_CAS_ECM_RESULT *dst, uint8_t *src, int len); 77 int (* proc_emm)(void *bcas, uint8_t *src, int len); 78 79 } B_CAS_CARD; 80 81 #ifdef __cplusplus 82 extern "C" { 83 #endif 84 85 extern B_CAS_CARD *create_b_cas_card(); 86 87 #ifdef __cplusplus 88 } 89 #endif 90 91 #endif /* B_CAS_CARD_H */ 92