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

#ifndef ATSC30_PARSER_ALP_LMT_H
#define ATSC30_PARSER_ALP_LMT_H

#include <linux/types.h>
#include "alp_hal_hw.h"
#include "net_buf.h"
#include "alp_hal_internal.h"

typedef enum {
	MAX_MULTICAST_CNT = 255,
	MAX_PLP_NUM = 64,
	MAX_PLP_ID = 63,
	MAX_PLP_NUMBER_SUPPORTED  = eATSC30_HW_SUPPORT_PLP_NUM,
} alp_link_layer_signaling_defination_t;

typedef struct {
	u32 src_IP_addr;
	u32 dst_IP_addr;

	u16 src_UDP_port;
	u16 dst_UDP_port;

	bool SID_flag;
	u8 SID;

	bool compress_flag;
	u8 context_id;
} lls_multicast_t;

typedef struct {
	u8 PLP_ID;
	u8 num_multicasts;
	lls_multicast_t mc[MAX_MULTICAST_CNT];
} lls_plp_t;

typedef struct {
	u8 num_PLPs;
	lls_plp_t plp[MAX_PLP_NUM];
} link_mapping_table_t;

bool alp_lmt_parse_lmt(
		link_mapping_table_t *const lmt,
		const net_buf_t lmt_pkt);

#endif /* ATSC30_PARSER_ALP_LMT_H */

