3
3
h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/socket.h>
#include <linux/if_ether.h>
#include <arpa/inet.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#ifndef ETH_FRAME_LEN
#define ETH_FRAME_LEN 2048
#endif
/*
* zadanie01.c
*
* Created on: Dec 19, 2024
* Author: Dawid Kusik
*/
int main(void) {
printf("Uruchamiam odbieranie ramek Ethernet.\n"); /* prints */
// Dane TCP
if (tcp_data_len > 0) {
printf("----- Dane TCP (%d bajtow) -----\n", tcp_data_len);
unsigned char *tcp_data = (unsigned char *)(buffer + 14 +
ip_header_len + tcp_header_len);
for (int i = 0; i < tcp_data_len; i++) {
printf("%.2x ", tcp_data[i]);
if ((i + 1) % 16 == 0)
printf("\n");
}
printf("\n");
}
}
}
}
}
free(buffer);
close(iEthSockHandl);
return EXIT_SUCCESS;
}