SayoriOS 0.3.3

net_info_cli.c
1 //
2 // Created by ndraey on 01.11.23.
3 //
4
5 #include <common.h>
6
7 #include "net/cards.h"
8 #include "io/tty.h"
9 #include "io/ports.h"
10
11 uint32_t CLI_CMD_NET(uint32_t c, char **v) {
12 uint8_t mac_buffer[6] = {0};
13
14 for(int i = 0; i < netcards_get_count(); i++) {
15 netcard_entry_t* entry = netcard_get(i);
16
17 _tty_printf("%s\n", entry->name);
18 entry->get_mac_addr(mac_buffer);
19
20 _tty_printf("\t|- MAC адрес: %v:%v:%v:%v:%v:%v\n",
21 mac_buffer[0],
22 mac_buffer[1],
23 mac_buffer[2],
24 mac_buffer[3],
25 mac_buffer[4],
26 mac_buffer[5]
27 );
28
29 _tty_printf("\t|- IPv4 адрес: %d.%d.%d.%d\n",
30 entry->ipv4_addr[0],
31 entry->ipv4_addr[1],
32 entry->ipv4_addr[2],
33 entry->ipv4_addr[3]
34 );
35 }
36
37 return 0;
38 }
common.h
Основные определения ядра
netcard_entry_t
Definition: cards.h:5