#ifndef ethH #define ethH #include "globals.h" extern const unsigned char mymac[6]; extern const unsigned char myip[4]; // BUFFER_SIZE jsem prestehoval do globals.h // bylo tady 1248 // na 48 bunce v bufferu zacinaji data pro vrtvr // dali jsme tam 100 + ... to musi stacit // ale struktura pro vetve MUSI mit 3 byte #define MAX_CLIENT 8 extern unsigned char buffer[BUFFER_SIZE]; /*****************/ /**************/ extern const unsigned char myname[15]; extern unsigned int max_tcp_packet; extern unsigned char client[MAX_CLIENT][4]; // 0 = sum mac + port // 1 = number sending block + 0xFE 0xFD // 2 = pointer - H + 0xA0 // 3 = pointer - L #define ETHTYPE_ARP 0x0806 // typelen field values #define ETHTYPE_IP 0x0800 #define ETH_TYPE_H 12 #define ETH_TYPE_L 13 #define IP_HEDLEN 14 #define IP_TOTLEN_H 16 #define IP_TOTLEN_L 17 #define IP_TYPEFIELD 23 #define PORT_FIELD_L 37 #define UDP_DATA 42 #define UDP_PORT_L 37 #define UDP_PORT_H 36 #define PORT_HTTP 80 #define PORT_FTP 21 #define TCP_PORT_L 37 #define TCP_PORT_H 36 #define TCP_BYTE 38 #define TCP_FLAGS 47 #define TCP_HEDLEN 46 #define ETH_HEADERLENGHT 14 #define TCP_HEADERLENGHT 20 #define IP_UDP_HEADERLENGHT 28 #define IP_TCP_HEADERLENGHT 40 #define IP_HEADERLENGHT 20 #define UDP_HEADERLENGHT 8 struct ETH_header { unsigned char ETH_destMac[6]; // destination MAC address unsigned char ETH_sourceMac[6]; // source MAC address unsigned int typelen; // protocol type or frame length unsigned char tail[]; }; // FUNCTION extern void eth_init (void); extern void eth_proc(void); extern void eth ( unsigned char *buff); extern void ack_received(unsigned char tcpflags); extern unsigned char Checkbroadcast (void); extern unsigned char Checkmymac(void); #endif