blob: 79471db5c0a32bcdebbcb214b1cbecb2403072f2 [file] [log] [blame]
Gong Ke3489c0f2020-01-16 18:11:44 +08001/**
2 * \file
3 * Crypto function definition.
4 */
5
Pengfei Liu2afc35d2020-01-07 10:47:39 +08006#ifndef _DVR_CRYPTO_H_
7#define _DVR_CRYPTO_H_
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
Gong Ke3489c0f2020-01-16 18:11:44 +080013/**Work type.*/
Pengfei Liuc181a982020-01-07 19:27:13 +080014typedef enum {
Gong Ke3489c0f2020-01-16 18:11:44 +080015 DVR_CRYPTO_TYPE_ENCRYPT, /**< Encrypt.*/
16 DVR_CRYPTO_TYPE_DECRYPT /**< Decrypt.*/
17} DVR_CryptoType_t;
Pengfei Liuc181a982020-01-07 19:27:13 +080018
Gong Ke3489c0f2020-01-16 18:11:44 +080019/**Crypto parameters.*/
Pengfei Liu2afc35d2020-01-07 10:47:39 +080020typedef struct DVR_CryptoParams_s {
Gong Ke3489c0f2020-01-16 18:11:44 +080021 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 Liuc181a982020-01-07 19:27:13 +080028} DVR_CryptoParams_t;
Pengfei Liu2afc35d2020-01-07 10:47:39 +080029
Gong Ke3489c0f2020-01-16 18:11:44 +080030/**Crypto function.*/
31typedef DVR_Result (*DVR_CryptoFunction_t) (DVR_CryptoParams_t *params_t, void *userdata);
Pengfei Liu2afc35d2020-01-07 10:47:39 +080032
33#ifdef __cplusplus
34}
35#endif
36
37#endif /*END _DVR_CRYPTO_H_*/