| Joel Nider | 5556a85 | 2011-10-16 10:52:13 +0200 | [diff] [blame] | 1 | #ifndef _TSPP_H_ | 
 | 2 | #define _TSPP_H_ | 
 | 3 |  | 
 | 4 | #include <linux/ioctl.h> | 
 | 5 |  | 
 | 6 | #define TSPP_NUM_SYSTEM_KEYS 8 | 
 | 7 |  | 
 | 8 | enum tspp_key_parity { | 
 | 9 | 	TSPP_KEY_PARITY_EVEN, | 
 | 10 | 	TSPP_KEY_PARITY_ODD | 
 | 11 | }; | 
 | 12 |  | 
 | 13 | enum tspp_source { | 
 | 14 | 	TSPP_SOURCE_TSIF0, | 
 | 15 | 	TSPP_SOURCE_TSIF1, | 
 | 16 | 	TSPP_SOURCE_MEM, | 
 | 17 | 	TSPP_SOURCE_NONE = -1 | 
 | 18 | }; | 
 | 19 |  | 
 | 20 | enum tspp_mode { | 
 | 21 | 	TSPP_MODE_DISABLED, | 
 | 22 | 	TSPP_MODE_PES, | 
 | 23 | 	TSPP_MODE_RAW, | 
 | 24 | 	TSPP_MODE_RAW_NO_SUFFIX | 
 | 25 | }; | 
 | 26 |  | 
 | 27 | struct tspp_filter { | 
 | 28 | 	int pid; | 
 | 29 | 	int mask; | 
 | 30 | 	enum tspp_mode mode; | 
 | 31 | 	int priority;	/* 0 - 15 */ | 
 | 32 | 	int decrypt; | 
 | 33 | 	enum tspp_source source; | 
 | 34 | }; | 
 | 35 |  | 
 | 36 | struct tspp_select_source { | 
 | 37 | 	enum tspp_source source; | 
 | 38 | }; | 
 | 39 |  | 
 | 40 | struct tspp_pid { | 
 | 41 | 	int pid; | 
 | 42 | }; | 
 | 43 |  | 
 | 44 | struct tspp_key { | 
 | 45 | 	enum tspp_key_parity parity; | 
 | 46 | 	int lsb; | 
 | 47 | 	int msb; | 
 | 48 | }; | 
 | 49 |  | 
 | 50 | struct tspp_iv { | 
 | 51 | 	int data[2]; | 
 | 52 | }; | 
 | 53 |  | 
 | 54 | struct tspp_system_keys { | 
 | 55 | 	int data[TSPP_NUM_SYSTEM_KEYS]; | 
 | 56 | }; | 
 | 57 |  | 
 | 58 | struct tspp_buffer { | 
 | 59 | 	int size; | 
 | 60 | }; | 
 | 61 |  | 
 | 62 | /* defines for IOCTL functions */ | 
 | 63 | /* read Documentation/ioctl-number.txt */ | 
 | 64 | /* some random number to avoid coinciding with other ioctl numbers */ | 
 | 65 | #define TSPP_IOCTL_BASE					0xAA | 
 | 66 | #define TSPP_IOCTL_SELECT_SOURCE		\ | 
 | 67 | 	_IOW(TSPP_IOCTL_BASE, 0, struct tspp_select_source) | 
 | 68 | #define TSPP_IOCTL_ADD_FILTER			\ | 
 | 69 | 	_IOW(TSPP_IOCTL_BASE, 1, struct tspp_filter) | 
 | 70 | #define TSPP_IOCTL_REMOVE_FILTER		\ | 
 | 71 | 	_IOW(TSPP_IOCTL_BASE, 2, struct tspp_pid) | 
 | 72 | #define TSPP_IOCTL_SET_KEY				\ | 
 | 73 | 	_IOW(TSPP_IOCTL_BASE, 3, struct tspp_key) | 
 | 74 | #define TSPP_IOCTL_SET_IV				\ | 
 | 75 | 	_IOW(TSPP_IOCTL_BASE, 4, struct tspp_iv) | 
 | 76 | #define TSPP_IOCTL_SET_SYSTEM_KEYS	\ | 
 | 77 | 	_IOW(TSPP_IOCTL_BASE, 5, struct tspp_system_keys) | 
 | 78 | #define TSPP_IOCTL_BUFFER_SIZE		\ | 
 | 79 | 	_IOW(TSPP_IOCTL_BASE, 6, struct tspp_buffer) | 
 | 80 | #define TSPP_IOCTL_LOOPBACK			\ | 
 | 81 | 	_IOW(TSPP_IOCTL_BASE, 0xFF, int) | 
 | 82 |  | 
 | 83 |  | 
 | 84 | #endif /* _TSPP_H_ */ |