1 | #ifndef __OPENXCAS_API_H__
|
---|
2 | #define __OPENXCAS_API_H__
|
---|
3 |
|
---|
4 | #include "openxcas_message.h"
|
---|
5 | #include "openxcas_smartcard.h"
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Be careful! This API is not safe in multi-process
|
---|
9 | *
|
---|
10 | */
|
---|
11 |
|
---|
12 | enum eOPENXCAS_FILTER_TYPE {
|
---|
13 | OPENXCAS_FILTER_UNKNOWN = 0,
|
---|
14 | OPENXCAS_FILTER_ECM,
|
---|
15 | OPENXCAS_FILTER_EMM,
|
---|
16 | };
|
---|
17 |
|
---|
18 | #ifdef __cplusplus
|
---|
19 | extern "C" {
|
---|
20 | #endif
|
---|
21 |
|
---|
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
|
---|
25 | */
|
---|
26 | void openxcas_show_info_and_exit(char * module_name, char * version_info);
|
---|
27 |
|
---|
28 | /* RETURN VALUE: status
|
---|
29 | * -1 : error
|
---|
30 | * 0 : success
|
---|
31 | */
|
---|
32 | int openxcas_open(char * module_name);
|
---|
33 |
|
---|
34 | /* RETURN VALUE: status
|
---|
35 | * -1 : error
|
---|
36 | * 0 : success
|
---|
37 | */
|
---|
38 | int openxcas_open_with_smartcard(char * module_name);
|
---|
39 |
|
---|
40 | /* RETURN VALUE: status
|
---|
41 | * -1 : error
|
---|
42 | * 0 : success
|
---|
43 | */
|
---|
44 | int openxcas_close(void);
|
---|
45 |
|
---|
46 | /*
|
---|
47 | * This function should be called after opening openxcas
|
---|
48 | */
|
---|
49 | void openxcas_debug_message_onoff(int bVerbose);
|
---|
50 |
|
---|
51 | /* RETURN VALUE: device fd
|
---|
52 | * -1 : error
|
---|
53 | * >0 : success
|
---|
54 | */
|
---|
55 | int openxcas_get_smartcard_device(unsigned int index);
|
---|
56 |
|
---|
57 | /* RETURN VALUE: status
|
---|
58 | * -1 : error
|
---|
59 | * 0 : success
|
---|
60 | */
|
---|
61 | int openxcas_release_smartcard_device(unsigned int index);
|
---|
62 |
|
---|
63 |
|
---|
64 | /* RETURN VALUE: status
|
---|
65 | * path of working directory
|
---|
66 | *
|
---|
67 | */
|
---|
68 | char * openxcas_get_working_directory(void);
|
---|
69 |
|
---|
70 | /* RETURN VALUE: status
|
---|
71 | * -1 : error
|
---|
72 | * 0 : timeout
|
---|
73 | * 1 : success
|
---|
74 | */
|
---|
75 | int openxcas_get_message(openxcas_msg_t * message, int wait);
|
---|
76 |
|
---|
77 | /* RETURN VALUE: status
|
---|
78 | * -1 : error
|
---|
79 | * 0 : timeout
|
---|
80 | * 1 : success
|
---|
81 | */
|
---|
82 | int openxcas_put_message(int streamd_id, unsigned int sequence,
|
---|
83 | int msg_type, unsigned char *msg_buf, unsigned int msg_size);
|
---|
84 |
|
---|
85 | /*
|
---|
86 | * DVB-CSA Key API
|
---|
87 | *
|
---|
88 | */
|
---|
89 |
|
---|
90 | /* RETURN VALUE: status
|
---|
91 | * -1 : error
|
---|
92 | * 0 : timeout
|
---|
93 | * 1 : success
|
---|
94 | */
|
---|
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);
|
---|
98 |
|
---|
99 | /* RETURN VALUE: status
|
---|
100 | * -1 : error
|
---|
101 | * 0 : timeout
|
---|
102 | * 1 : success
|
---|
103 | *
|
---|
104 | * Be careful!
|
---|
105 | * If you call this function,
|
---|
106 | * all filter information is reset(same to call openxcas_remove_filter)
|
---|
107 | */
|
---|
108 | int openxcas_key_not_found(int stream_id, unsigned int sequence);
|
---|
109 |
|
---|
110 |
|
---|
111 | /* for ADAPTOR */
|
---|
112 |
|
---|
113 | /*
|
---|
114 | * Filter API
|
---|
115 | * Use for ECM & EMM
|
---|
116 | *
|
---|
117 | */
|
---|
118 |
|
---|
119 | /* RETURN VALUE: filter_index
|
---|
120 | * -1 : error
|
---|
121 | * >= 0 : success
|
---|
122 | */
|
---|
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);
|
---|
128 |
|
---|
129 | /* RETURN VALUE: status
|
---|
130 | * -1 : error
|
---|
131 | * 0 : timeout
|
---|
132 | * 1 : success
|
---|
133 | */
|
---|
134 | int openxcas_start_filter(int stream_id, unsigned int sequence, int type);
|
---|
135 |
|
---|
136 | /* RETURN VALUE: status
|
---|
137 | * -1 : error
|
---|
138 | * 0 : timeout
|
---|
139 | * 1 : success
|
---|
140 | */
|
---|
141 | int openxcas_stop_filter(int stream_id, int type);
|
---|
142 |
|
---|
143 | /* RETURN VALUE: status
|
---|
144 | * -1 : error
|
---|
145 | * 0 : success
|
---|
146 | */
|
---|
147 | int openxcas_remove_filter(int stream_id, int type);
|
---|
148 |
|
---|
149 | /* RETURN VALUE: status
|
---|
150 | * -1 : error
|
---|
151 | * 0 : success
|
---|
152 | */
|
---|
153 | int openxcas_filter_callback(int stream_id, unsigned int sequence, int type,
|
---|
154 | struct stOpenXCAS_Data * openxcas_data);
|
---|
155 |
|
---|
156 |
|
---|
157 | int openxcas_send_private_message(int stream_id, unsigned int sequence, int msg_type,
|
---|
158 | unsigned char *msg_buf, unsigned int msg_size);
|
---|
159 |
|
---|
160 |
|
---|
161 | const char * openxcas_get_time(void);
|
---|
162 |
|
---|
163 |
|
---|
164 |
|
---|
165 |
|
---|
166 |
|
---|
167 |
|
---|
168 |
|
---|
169 |
|
---|
170 |
|
---|
171 |
|
---|
172 |
|
---|
173 |
|
---|
174 |
|
---|
175 | /* RETURN VALUE: filter_index
|
---|
176 | * -1 : error
|
---|
177 | * >= 0 : success
|
---|
178 | */
|
---|
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);
|
---|
182 |
|
---|
183 | /* RETURN VALUE: status
|
---|
184 | * -1 : error
|
---|
185 | * 0 : success
|
---|
186 | */
|
---|
187 | int openxcas_stop_filter_ex(int stream_id, unsigned int sequence,
|
---|
188 | int filter_index);
|
---|
189 |
|
---|
190 |
|
---|
191 | int openxcas_filter_callback_ex(int stream_id, unsigned int sequence,
|
---|
192 | struct stOpenXCAS_Data * openxcas_data);
|
---|
193 |
|
---|
194 | /* RETURN VALUE: status
|
---|
195 | * -1 : error
|
---|
196 | * 0 : timeout
|
---|
197 | * 1 : success
|
---|
198 | */
|
---|
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);
|
---|
205 |
|
---|
206 | /* RETURN VALUE: status
|
---|
207 | * -1 : error
|
---|
208 | * 0 : timeout
|
---|
209 | * 1 : success
|
---|
210 | */
|
---|
211 | int openxcas_destory_cipher_ex(int stream_id, unsigned int sequence);
|
---|
212 |
|
---|
213 | /* RETURN VALUE: status
|
---|
214 | * -1 : error
|
---|
215 | * 0 : timeout
|
---|
216 | * 1 : success
|
---|
217 | */
|
---|
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);
|
---|
222 |
|
---|
223 |
|
---|
224 | #ifdef __cplusplus
|
---|
225 | }
|
---|
226 | #endif
|
---|
227 |
|
---|
228 | #endif
|
---|