<commit_before>/*
 * tcp.h
 *
 * Transmission Control Protocol (RFC 793).
 *
 * Copyright (c) 2000 <NAME> <<EMAIL>>
 *
 * $Id$
 */

#ifndef DNET_TCP_H
#define DNET_TCP_H

#define TCP_HDR_LEN	20
#define TCP_OPT_LEN	2
#define TCP_OPT_LEN_MAX	40
#define TCP_HDR_LEN_MAX	(TCP_HDR_LEN + TCP_OPT_LEN_MAX)

/*
 * TCP header
 */
struct tcp_hdr {
	uint16_t	th_sport;	/* source port */
	uint16_t	th_dport;	/* destination port */
	uint32_t	th_seq;		/* sequence number */
	uint32_t	th_ack;		/* acknowledgement number */
#if DNET_BYTESEX == DNET_LIL_ENDIAN
	uint8_t		th_x2:4,	/* (unused) */
			th_off:4;	/* data offset */
#elif DNET_BYTESEX == DNET_BIG_ENDIAN
	uint8_t		th_off:4,	/* data offset */
			th_x2:4;	/* (unused) */
#endif
	uint8_t		th_flags;
	uint16_t	th_win;		/* window */
	uint16_t	th_sum;		/* checksum */
	uint16_t	th_urp;		/* urgent pointer */
};

/*
 * TCP control flags
 */
#define TH_FIN		0x01
#define TH_SYN		0x02
#define TH_RST		0x04
#define TH_PUSH		0x08
#define TH_ACK		0x10
#define TH_URG		0x20
#define TH_ECE		0x40		/* RFC 3168 */
#define TH_CWR		0x80

#define TCP_PORT_MAX	65535
#define TCP_WIN_MAX	65535		/* maximum (unscaled) window */

/*
 * Options
 */

#define TCP_OPT_EOL		0
#define TCP_OPT_NOP		1
#define TCP_OPT_MSS		2
#define TCP_OPT_WSCALE		3
#define TCP_OPT_SACKOK		4
#define TCP_OPT_SACK		5
#define TCP_OPT_CC		11
#define TCP_OPT_CCNEW		12
#define TCP_OPT_CCECHO		13
#define TCP_OPT_MD5		19

#define TCP_OPT_TYPEONLY(type)	\
	((type) == TCP_OPT_EOL || (type) == TCP_OPT_NOP)

#ifndef __GNUC__
# define __attribute__(x)
# pragma pack(1)
#endif

struct tcp_opt {
	uint8_t		opt_type;
	uint8_t		opt_len;		/* length of entire option */
	union tcp_opt_data {
		uint16_t	mss;
		uint8_t		wscale[2];	/* XXX - scale + NOP */
		uint16_t	sack __flexarr;	/* origin / size pairs */
		uint32_t	cc;
		uint8_t		md5[16];
		uint8_t		data8[TCP_OPT_LEN_MAX - TCP_OPT_LEN];
	} opt_data;
} __attribute__((__packed__));

#ifndef __GNUC__
# pragma pack()
#endif
<commit_msg>no flexible array in union<commit_after>/*
 * tcp.h
 *
 * Transmission Control Protocol (RFC 793).
 *
 * Copyright (c) 2000 <NAME> <<EMAIL>>
 *
 * $Id$
 */

#ifndef DNET_TCP_H
#define DNET_TCP_H

#define TCP_HDR_LEN	20
#define TCP_OPT_LEN	2
#define TCP_OPT_LEN_MAX	40
#define TCP_HDR_LEN_MAX	(TCP_HDR_LEN + TCP_OPT_LEN_MAX)

/*
 * TCP header
 */
struct tcp_hdr {
	uint16_t	th_sport;	/* source port */
	uint16_t	th_dport;	/* destination port */
	uint32_t	th_seq;		/* sequence number */
	uint32_t	th_ack;		/* acknowledgement number */
#if DNET_BYTESEX == DNET_LIL_ENDIAN
	uint8_t		th_x2:4,	/* (unused) */
			th_off:4;	/* data offset */
#elif DNET_BYTESEX == DNET_BIG_ENDIAN
	uint8_t		th_off:4,	/* data offset */
			th_x2:4;	/* (unused) */
#endif
	uint8_t		th_flags;
	uint16_t	th_win;		/* window */
	uint16_t	th_sum;		/* checksum */
	uint16_t	th_urp;		/* urgent pointer */
};

/*
 * TCP control flags
 */
#define TH_FIN		0x01
#define TH_SYN		0x02
#define TH_RST		0x04
#define TH_PUSH		0x08
#define TH_ACK		0x10
#define TH_URG		0x20
#define TH_ECE		0x40		/* RFC 3168 */
#define TH_CWR		0x80

#define TCP_PORT_MAX	65535
#define TCP_WIN_MAX	65535		/* maximum (unscaled) window */

/*
 * Options
 */

#define TCP_OPT_EOL		0
#define TCP_OPT_NOP		1
#define TCP_OPT_MSS		2
#define TCP_OPT_WSCALE		3
#define TCP_OPT_SACKOK		4
#define TCP_OPT_SACK		5
#define TCP_OPT_CC		11
#define TCP_OPT_CCNEW		12
#define TCP_OPT_CCECHO		13
#define TCP_OPT_MD5		19

#define TCP_OPT_TYPEONLY(type)	\
	((type) == TCP_OPT_EOL || (type) == TCP_OPT_NOP)

#ifndef __GNUC__
# define __attribute__(x)
# pragma pack(1)
#endif

struct tcp_opt {
	uint8_t		opt_type;
	uint8_t		opt_len;		/* length of entire option */
	union tcp_opt_data {
		uint16_t	mss;
		uint8_t		wscale[2];	/* XXX - scale + NOP */
		uint16_t	sack[19];	/* XXX - origin / size pairs */
		uint32_t	cc;
		uint8_t		md5[16];
		uint8_t		data8[TCP_OPT_LEN_MAX - TCP_OPT_LEN];
	} opt_data;
} __attribute__((__packed__));

#ifndef __GNUC__
# pragma pack()
#endif

{'fraction_non_alphanumeric': 0.11448066717210008, 'fraction_numerical': 0.05357594136972454, 'mean_word_length': 3.7975757575757574, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4288802', 'n_tokens_mistral': 1943, 'n_tokens_neox': 1835, 'n_words': 408}