2025-01-30 18:10:38 +00:00
|
|
|
#ifndef PIPELINE_H_
|
|
|
|
|
#define PIPELINE_H_
|
|
|
|
|
|
|
|
|
|
#include "status.h"
|
|
|
|
|
|
|
|
|
|
#include <blue/core/queue.h>
|
|
|
|
|
#include <stddef.h>
|
2025-02-15 12:36:37 +00:00
|
|
|
#include <stdio.h>
|
2025-01-30 18:10:38 +00:00
|
|
|
|
|
|
|
|
enum ec3_pipeline_stage_type_id {
|
|
|
|
|
EC3_PIPELINE_NONE = 0,
|
|
|
|
|
EC3_PIPELINE_AES256,
|
|
|
|
|
EC3_PIPELINE_ZSTD,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum ec3_pipeline_stage_type_flags {
|
|
|
|
|
EC3_PIPELINE_F_NONE = 0x00u,
|
|
|
|
|
EC3_PIPELINE_F_BUFFERED = 0x01u,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct ec3_pipeline_stage;
|
|
|
|
|
|
|
|
|
|
struct ec3_pipeline_stage_type {
|
|
|
|
|
enum ec3_pipeline_stage_type_id t_id;
|
|
|
|
|
enum ec3_pipeline_stage_type_flags t_flags;
|
|
|
|
|
|
2025-02-15 12:36:37 +00:00
|
|
|
enum ec3_status (*t_cluster_in)(
|
2025-01-30 18:10:38 +00:00
|
|
|
struct ec3_pipeline_stage *,
|
|
|
|
|
const void *,
|
2025-02-15 12:36:37 +00:00
|
|
|
size_t,
|
2025-01-30 18:10:38 +00:00
|
|
|
void *,
|
2025-02-15 12:36:37 +00:00
|
|
|
size_t,
|
2025-01-30 18:10:38 +00:00
|
|
|
size_t *);
|
2025-02-15 12:36:37 +00:00
|
|
|
enum ec3_status (*t_cluster_out)(
|
2025-01-30 18:10:38 +00:00
|
|
|
struct ec3_pipeline_stage *,
|
|
|
|
|
const void *,
|
|
|
|
|
size_t,
|
|
|
|
|
void *,
|
2025-02-15 12:36:37 +00:00
|
|
|
size_t,
|
2025-01-30 18:10:38 +00:00
|
|
|
size_t *);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct ec3_pipeline_stage {
|
|
|
|
|
const struct ec3_pipeline_stage_type *s_type;
|
|
|
|
|
void *s_buf;
|
|
|
|
|
void *s_arg;
|
|
|
|
|
b_queue_entry s_entry;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct ec3_pipeline_stage_args {
|
|
|
|
|
enum ec3_pipeline_stage_type_id type;
|
|
|
|
|
void *arg;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct ec3_pipeline {
|
2025-02-15 12:36:37 +00:00
|
|
|
size_t p_cluster_size;
|
2025-01-30 18:10:38 +00:00
|
|
|
b_queue p_stages;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern enum ec3_status ec3_pipeline_create(
|
|
|
|
|
struct ec3_pipeline_stage_args stages[],
|
|
|
|
|
size_t nr_stages,
|
|
|
|
|
size_t cluster_size,
|
|
|
|
|
struct ec3_pipeline **out);
|
|
|
|
|
extern void ec3_pipeline_destroy(struct ec3_pipeline *p);
|
|
|
|
|
|
2025-02-23 20:52:59 +00:00
|
|
|
extern enum ec3_status ec3_pipeline_encode_cluster(
|
2025-01-30 18:10:38 +00:00
|
|
|
struct ec3_pipeline *pipeline,
|
2025-02-23 20:52:59 +00:00
|
|
|
void *in,
|
|
|
|
|
size_t in_len,
|
|
|
|
|
void *out,
|
|
|
|
|
size_t out_max,
|
|
|
|
|
size_t *out_len);
|
|
|
|
|
extern enum ec3_status ec3_pipeline_decode_cluster(
|
2025-01-30 18:10:38 +00:00
|
|
|
struct ec3_pipeline *pipeline,
|
2025-02-23 20:52:59 +00:00
|
|
|
void *in,
|
|
|
|
|
size_t in_len,
|
|
|
|
|
void *out,
|
|
|
|
|
size_t out_max,
|
|
|
|
|
size_t *out_len);
|
2025-01-30 18:10:38 +00:00
|
|
|
|
2025-02-23 20:52:59 +00:00
|
|
|
#if 0
|
2025-02-16 08:46:22 +00:00
|
|
|
extern enum ec3_status ec3_pipeline_copy_all(
|
|
|
|
|
struct ec3_pipeline *dest,
|
|
|
|
|
struct cluster_table *clusters,
|
|
|
|
|
FILE *data);
|
2025-02-23 20:52:59 +00:00
|
|
|
#endif
|
2025-02-16 08:46:22 +00:00
|
|
|
|
2025-02-15 12:36:37 +00:00
|
|
|
extern enum ec3_pipeline_stage_type_id
|
|
|
|
|
ec3_get_pipeline_stage_for_encryption_func(unsigned int func);
|
|
|
|
|
extern enum ec3_pipeline_stage_type_id
|
|
|
|
|
ec3_get_pipeline_stage_for_compression_func(unsigned int func);
|
2025-02-02 20:56:29 +00:00
|
|
|
|
2025-01-30 18:10:38 +00:00
|
|
|
#endif
|