Linux Kernel Network Programming - struct iphdr data-structure - code walk, Example
Linux Kernel Network Programming - struct iphdr data-structure - code walk, Example

Refer:
struct iphdr data-structure ↗
sk_buff to iphdr APIs ↗
Definitions for the IP module ↗

And here is the copy paste of struct iphdr data-structure (/include/uapi/linux/ip.h) from the Kernel-source version 4.13 for quick reference:

struct iphdr {
#if defined(__LITTLE_ENDIAN_BITFIELD)
	__u8	ihl:4,
		version:4;
#elif defined (__BIG_ENDIAN_BITFIELD)
	__u8	version:4,
  		ihl:4;
#else
#error	"Please fix "
#endif
	__u8	tos;
	__be16	tot_len;
	__be16	id;
	__be16	frag_off;
	__u8	ttl;
	__u8	protocol;
	__sum16	check;
	__be32	saddr;
	__be32	daddr;
	/*The options start here. */
};