<commit_before>#include <stdio.h>
#include <stdint.h>
#include <tw_api.h>
#include <tw_common.h>


int main(int, char **);
int user_app_main(void *);
struct ether_addr * dst_eth0;
struct ether_addr * dst_eth1;
void reply_payload(tw_rx_t *, tw_buf_t *);

void reply_payload(tw_rx_t * handle, tw_buf_t * buffer) {
    struct ether_hdr * eth = buffer->data;
    tw_copy_ether_addr(&(eth->s_addr), &(eth->d_addr));
	tw_copy_ether_addr(dst_eth0, &(eth->s_addr));
	tw_send_pkt(buffer, "tw0");
}

int main(int argc, char **argv) {
    tw_init_global(argc, argv);
    tw_map_port_to_engine("tw0", "engine0");
	tw_map_port_to_engine("tw1", "engine0");
	dst_eth0=tw_get_ether_addr("tw0");
	dst_eth1=tw_get_ether_addr("tw1");
    user_app_main(NULL);
    return 0;
}

int user_app_main(__attribute__((unused)) void * app_params) {

    tw_rx_t * server;
    int status;
    struct tw_sockaddr_in * addr;
    tw_loop_t * tw_loop = tw_default_loop(INFINITE_LOOP);

    server = tw_rx_init(tw_loop);
    if (server == NULL) {
        printf("Error in RX init\n");
        exit(1);
    }

    status = tw_rx_start(server, reply_payload);
    if (status) {
        printf("Error in receive start\n");
        exit(1);
    }

    tw_run(tw_loop);
    return 0;
}
<commit_msg>Multiport Echo Application cleaned Up<commit_after>#include <stdio.h>
#include <stdint.h>
#include <tw_api.h>
#include <tw_common.h>


int main(int, char **);
int user_app_main(void *);
struct ether_addr * dst_eth0;
struct ether_addr * dst_eth1;
void reply_payload(tw_rx_t *, tw_buf_t *);

void reply_payload(tw_rx_t * handle, tw_buf_t * buffer) {
    struct ether_hdr * eth = buffer->data;
    tw_copy_ether_addr(&(eth->s_addr), &(eth->d_addr));
    tw_copy_ether_addr(dst_eth0, &(eth->s_addr));
    tw_send_pkt(buffer, buffer->port_name);
}

int main(int argc, char **argv) {
    tw_init_global(argc, argv);
    tw_map_port_to_engine("tw0", "engine0");
    tw_map_port_to_engine("tw1", "engine0");
    dst_eth0=tw_get_ether_addr("tw0");
    dst_eth1=tw_get_ether_addr("tw1");
    user_app_main(NULL);
    return 0;
}

int user_app_main(__attribute__((unused)) void * app_params) {

    tw_rx_t * server;
    int status;
    tw_loop_t * tw_loop = tw_default_loop(INFINITE_LOOP);

    server = tw_rx_init(tw_loop);
    if (server == NULL) {
        printf("Error in RX init\n");
        exit(1);
    }
    status = tw_rx_start(server, reply_payload);
    if (status) {
        printf("Error in receive start\n");
        exit(1);
    }

    tw_run(tw_loop);
    return 0;
}

{'fraction_non_alphanumeric': 0.14375987361769352, 'fraction_numerical': 0.012243285939968405, 'mean_word_length': 4.025793650793651, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 20, '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': '4913809', 'n_tokens_mistral': 1016, 'n_tokens_neox': 998, 'n_words': 181}