/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
/*
 * Copyright (c) 2021 MediaTek Inc.
 */

#ifndef ATSC30_PARSER_ALP_RDT_H
#define ATSC30_PARSER_ALP_RDT_H

#include <linux/types.h>
#include "rohc.h"
#include "net_buf.h"

typedef enum {
	MAX_RDT_S_CHAIN_LEN  = 16,
	MAX_RDT_D_CHAIN_LEN  = 16,
	MAX_CTX_NUM_PER_PLP  = 128,
} RDT_MAX_LENGTH_DEF_T;

typedef enum {
	adapt_mode1 = 0x1,
	adapt_mode2 = 0x2,
	adapt_mode3 = 0x3,
	adapt_mode_unknown,
} adaption_mode_t;

typedef struct {
	bool new_update;
	u8 cid;
	u8 profile;
	rohc_packet_decomp_decomp_context_t rohc_ctx;
} rdt_rohc_context_info_t;

typedef struct {
	bool valid;
	u8 PLP_ID;
	u8 max_CID;
	u8 ctx_cfg;
	u8 num_ctx;
	adaption_mode_t adpt_mode;
	rdt_rohc_context_info_t ctx[MAX_CTX_NUM_PER_PLP];
} rohc_U_description_table_t;

bool alp_rdt_parse_rdt_packet(
		rohc_U_description_table_t *const rdt,
		const net_buf_t payload);

#endif

