SayoriOS 0.3.3

arp.h
1 #pragma once
2
3 #include "common.h"
4 #include "cards.h"
5
6 #define ARP_REQUEST 1
7 #define ARP_REPLY 2
8
9 #define ARP_TABLE_MAX_SIZE 128
10
11 typedef struct arp_packet {
12 uint16_t hardware_type;
13 uint16_t protocol;
14 uint8_t hardware_addr_len;
15 uint8_t protocol_addr_len;
16 uint16_t opcode;
17
18 uint8_t src_mac[6];
19 uint8_t src_ip[4];
20
21 uint8_t dest_mac[6];
22 uint8_t dest_ip[4];
23 } __attribute__((packed)) arp_packet_t;
24
25 typedef struct arp_table_entry {
26 uint32_t ip_addr;
27 uint8_t mac_addr[6];
28 } arp_table_entry_t;
29
30 void arp_handle_packet(netcard_entry_t* card, arp_packet_t* arp_packet, size_t len);
31 void arp_send_packet(netcard_entry_t* card, uint8_t* dst_hardware_addr, uint8_t* dst_protocol_addr);
32 bool arp_lookup(uint8_t* ret_hardware_addr, const uint8_t* ip_addr);
33 void arp_lookup_add(uint8_t* ret_hardware_addr, uint8_t* ip_addr);
34 void arp_init();
common.h
Основные определения ядра
__attribute__
struct registers __attribute__((packed))
Структура данных пакета от мыши
Definition: psf.h:19
arp_packet
Definition: arp.h:11
arp_table_entry
Definition: arp.h:25
netcard_entry_t
Definition: cards.h:5