<commit_before>#include <stdio.h>

#if defined(NETMAP) || defined(MULTISTACK)

#include <string.h>
#include <stdint.h>
#include <fcntl.h>
#include <sys/types.h>
#include <net/ethernet.h>

#include <sys/mman.h>
#include <user_mbuf.h>
#include <netinet/sctp_pcb.h>
#include <netinet/sctputil.h>
#include <arpa/inet.h>
#include <sys/poll.h>
#include <netinet/udp.h>
#include <netinet/sctp_input.h>

/* ########## CONFIG SECTION ########## */

#ifdef NETMAP_DEBUG
#include "netmap_debug.h"
#endif

#if defined(MULTISTACK)
static const char *netmap_ifname = "valem:usrsctp1";
static const uint16_t multistack_port = 9899;
#else
static const char *netmap_ifname = "igb1";
#endif

static const char *netmap_mac_src = "08:00:27:12:0d:e1";
static const char *netmap_mac_dst = "0a:00:27:00:00:01";

static const int netmap_ip_override = 0;
static const char *netmap_ip_src = "192.168.57.2";
static const char *netmap_ip_dst = "192.168.57.1";

static const uint8_t thread_closed = 0;


static const int netmap_debug_operation = 1;
#if defined(NETMAP_DEBUG)
static const int netmap_debug_packet_info = 1;
static const int netmap_debug_packet_dump = 0;
#endif // defined(NETMAP_DEBUG)


#define MAXLEN_MBUF_CHAIN 32

/* ########## CONFIG SECTION END ########## */

static uint16_t ip_checksum(const char *data, size_t length);
static void 	handle_ethernet(const char* buffer, size_t length);
static void 	handle_ipv4(const char *buffer, size_t length);
static void 	handle_sctp(const char *buffer, size_t length, struct ip *ip_header, uint16_t udp_encaps_port);
static void 	handle_udp(const char *buffer, size_t length, struct ip *ip_header);<commit_msg>refactoring<commit_after>#include <stdio.h>

#if defined(NETMAP) || defined(MULTISTACK)

#include <string.h>
#include <stdint.h>
#include <fcntl.h>
#include <sys/types.h>
#include <net/ethernet.h>

#include <sys/mman.h>
#include <user_mbuf.h>
#include <netinet/sctp_pcb.h>
#include <netinet/sctputil.h>
#include <arpa/inet.h>
#include <sys/poll.h>
#include <netinet/udp.h>
#include <netinet/sctp_input.h>

#include "user_netmap_config.h"
#define MAXLEN_MBUF_CHAIN 32

static uint16_t ip_checksum(const char *data, size_t length);
static void 	handle_ethernet(const char* buffer, size_t length);
static void 	handle_ipv4(const char *buffer, size_t length);
static void 	handle_sctp(const char *buffer, size_t length, struct ip *ip_header, uint16_t udp_encaps_port);
static void 	handle_udp(const char *buffer, size_t length, struct ip *ip_header);
{'fraction_non_alphanumeric': 0.13745980707395497, 'fraction_numerical': 0.026929260450160773, 'mean_word_length': 6.2354651162790695, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '1648943', 'n_tokens_mistral': 1012, 'n_tokens_neox': 970, 'n_words': 233}