Gong Ke | 3489c0f | 2020-01-16 18:11:44 +0800 | [diff] [blame^] | 1 | /** |
| 2 | * \file |
| 3 | * Crypto function definition. |
| 4 | */ |
| 5 | |
Pengfei Liu | 2afc35d | 2020-01-07 10:47:39 +0800 | [diff] [blame] | 6 | #ifndef _DVR_CRYPTO_H_ |
| 7 | #define _DVR_CRYPTO_H_ |
| 8 | |
| 9 | #ifdef __cplusplus |
| 10 | extern "C" { |
| 11 | #endif |
| 12 | |
Gong Ke | 3489c0f | 2020-01-16 18:11:44 +0800 | [diff] [blame^] | 13 | /**Work type.*/ |
Pengfei Liu | c181a98 | 2020-01-07 19:27:13 +0800 | [diff] [blame] | 14 | typedef enum { |
Gong Ke | 3489c0f | 2020-01-16 18:11:44 +0800 | [diff] [blame^] | 15 | DVR_CRYPTO_TYPE_ENCRYPT, /**< Encrypt.*/ |
| 16 | DVR_CRYPTO_TYPE_DECRYPT /**< Decrypt.*/ |
| 17 | } DVR_CryptoType_t; |
Pengfei Liu | c181a98 | 2020-01-07 19:27:13 +0800 | [diff] [blame] | 18 | |
Gong Ke | 3489c0f | 2020-01-16 18:11:44 +0800 | [diff] [blame^] | 19 | /**Crypto parameters.*/ |
Pengfei Liu | 2afc35d | 2020-01-07 10:47:39 +0800 | [diff] [blame] | 20 | typedef struct DVR_CryptoParams_s { |
Gong Ke | 3489c0f | 2020-01-16 18:11:44 +0800 | [diff] [blame^] | 21 | DVR_CryptoType_t type; /**< Work type.*/ |
| 22 | char location[DVR_MAX_LOCATION_SIZE]; /**< Location of the record file.*/ |
| 23 | int segment_id; /**< Current segment's index.*/ |
| 24 | loff_t offset; /**< Current offset in the segment file.*/ |
| 25 | DVR_Buffer_t input_buffer; /**< Input data buffer.*/ |
| 26 | DVR_Buffer_t output_buffer; /**< Output data buffer.*/ |
| 27 | size_t output_size; /**< Output data size in bytes.*/ |
Pengfei Liu | c181a98 | 2020-01-07 19:27:13 +0800 | [diff] [blame] | 28 | } DVR_CryptoParams_t; |
Pengfei Liu | 2afc35d | 2020-01-07 10:47:39 +0800 | [diff] [blame] | 29 | |
Gong Ke | 3489c0f | 2020-01-16 18:11:44 +0800 | [diff] [blame^] | 30 | /**Crypto function.*/ |
| 31 | typedef DVR_Result (*DVR_CryptoFunction_t) (DVR_CryptoParams_t *params_t, void *userdata); |
Pengfei Liu | 2afc35d | 2020-01-07 10:47:39 +0800 | [diff] [blame] | 32 | |
| 33 | #ifdef __cplusplus |
| 34 | } |
| 35 | #endif |
| 36 | |
| 37 | #endif /*END _DVR_CRYPTO_H_*/ |