1 #ifndef __OPENXCAS_API_H__
2 #define __OPENXCAS_API_H__
4 #include "openxcas_message.h"
5 #include "openxcas_smartcard.h"
8 * Be careful! This API is not safe in multi-process
12 enum eOPENXCAS_FILTER_TYPE
{
13 OPENXCAS_FILTER_UNKNOWN
= 0,
22 /* This function will be used for checking compatibility with API
23 * After printing information, it is terminated automatically
24 * Be careful! Module name & version info should set exactly
26 void openxcas_show_info_and_exit(char * module_name
, char * version_info
);
28 /* RETURN VALUE: status
32 int openxcas_open(char * module_name
);
34 /* RETURN VALUE: status
38 int openxcas_open_with_smartcard(char * module_name
);
40 /* RETURN VALUE: status
44 int openxcas_close(void);
47 * This function should be called after opening openxcas
49 void openxcas_debug_message_onoff(int bVerbose
);
51 /* RETURN VALUE: device fd
55 int openxcas_get_smartcard_device(unsigned int idx
);
57 /* RETURN VALUE: status
61 int openxcas_release_smartcard_device(unsigned int idx
);
64 /* RETURN VALUE: status
65 * path of working directory
68 char * openxcas_get_working_directory(void);
70 /* RETURN VALUE: status
75 int openxcas_get_message(openxcas_msg_t
* message
, int wait_time
);
77 /* RETURN VALUE: status
82 int openxcas_put_message(int streamd_id
, unsigned int sequence
,
83 int msg_type
, unsigned char *msg_buf
, unsigned int msg_size
);
90 /* RETURN VALUE: status
95 int openxcas_set_key(int stream_id
, unsigned int sequence
,
96 unsigned short ca_system_id
, unsigned short cipher_index
,
97 unsigned char * even
, unsigned char * odd
);
99 /* RETURN VALUE: status
105 * If you call this function,
106 * all filter information is reset(same to call openxcas_remove_filter)
108 int openxcas_key_not_found(int stream_id
, unsigned int sequence
);
119 /* RETURN VALUE: filter_index
123 int openxcas_add_filter(int stream_id
,
124 int type
, unsigned short ca_system_id
,
125 unsigned short target_pid
, unsigned short pid
,
126 unsigned char * mask
, unsigned char * comp
,
127 ecmemm_callback callback_func
);
129 /* RETURN VALUE: status
134 int openxcas_start_filter(int stream_id
, unsigned int sequence
, int type
);
136 /* RETURN VALUE: status
141 int openxcas_stop_filter(int stream_id
, int type
);
143 /* RETURN VALUE: status
147 int openxcas_remove_filter(int stream_id
, int type
);
149 /* RETURN VALUE: status
153 int openxcas_filter_callback(int stream_id
, unsigned int sequence
, int type
,
154 struct stOpenXCAS_Data
* openxcas_data
);
157 int openxcas_send_private_message(int stream_id
, unsigned int sequence
, int msg_type
,
158 unsigned char *msg_buf
, unsigned int msg_size
);
161 const char * openxcas_get_time(void);
175 /* RETURN VALUE: filter_index
179 int openxcas_start_filter_ex(int stream_id
, unsigned int sequence
,
180 unsigned short pid
, unsigned char * mask
, unsigned char * comp
,
181 filter_callback callback_func
);
183 /* RETURN VALUE: status
187 int openxcas_stop_filter_ex(int stream_id
, unsigned int sequence
,
191 int openxcas_filter_callback_ex(int stream_id
, unsigned int sequence
,
192 struct stOpenXCAS_Data
* openxcas_data
);
194 /* RETURN VALUE: status
199 int openxcas_create_cipher_ex(int stream_id
, unsigned int sequence
,
200 unsigned short ca_system_id
,
201 unsigned short ecm_pid
,
202 unsigned short video_pid
, unsigned short video_ecm_pid
,
203 unsigned short audio_pid
, unsigned short audio_ecm_pid
,
204 unsigned short data_pid
, unsigned short data_ecm_pid
);
206 /* RETURN VALUE: status
211 int openxcas_destory_cipher_ex(int stream_id
, unsigned int sequence
);
213 /* RETURN VALUE: status
218 int openxcas_set_key_ex(int stream_id
, unsigned int sequence
,
219 unsigned short ca_system_id
,
220 unsigned short ecm_pid
,
221 unsigned char * even
, unsigned char * odd
);