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

#ifndef ATSC30_NET_PROT_IP_V4_H
#define ATSC30_NET_PROT_IP_V4_H

#include <linux/types.h>

#define IPV4_HEADER_VER_HL (0x45)
#define IPV4_DF (0x4000)
#define IP_PROTOCOL_UDP (17)
#define IP_MAX_IP_ID (0xFFFFU)
#define MAX_UDP_IP_PAYLOAD_SIZE (0xFFFFU - 28U)

struct ipv4_header {
	u8	ver_hl;
	u8	tos;
	u16 tot_len;
	u16 id;
	u16 frag_info;	/**< Fragment flags and Fragment offset*/
	u8	ttl;
	u8	prot;
	u16 csum;
	u32 src_addr;
	u32 dst_addr;
} __packed;

typedef struct ipv4_header ipv4_header_t;

#endif /* ATSC30_NET_PROT_IP_V4_H */
