git-svn-id: https://spexeah.com:8443/svn/Asuro@699 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c

This commit is contained in:
kieron
2018-05-10 13:21:12 +00:00
parent 8385a5fcec
commit 22751a384d
18 changed files with 52 additions and 3 deletions

View File

@ -11,6 +11,8 @@ function stringToMAC(str : pchar) : puint8;
function stringToIPv4(str : pchar) : puint8;
procedure writeMACAddress(mac : puint8; WND : HWND);
procedure writeIPv4Address(ip : puint8; WND : HWND);
procedure writeMACAddressEx(mac : puint8; WND : HWND);
procedure writeIPv4AddressEx(ip : puint8; WND : HWND);
function MACEqual(mac1 : puint8; mac2 : puint8) : boolean;
function IPEqual(ip1 : puint8; ip2 : puint8) : boolean;
function newPacketContext : PPacketContext;
@ -80,6 +82,32 @@ begin
pop_trace;
end;
procedure writeIPv4AddressEx(ip : puint8; WND : HWND);
var
i : integer;
begin
push_trace('netutils.writeIPv4Address');
console.writeintWND(ip[0], WND);
for i:=1 to 3 do begin
console.writestringWND('.', WND);
console.writeintWND(ip[i], WND);
end;
end;
procedure writeMACAddressEx(mac : puint8; WND : HWND);
var
i : integer;
begin
push_trace('netutils.writeMACAddress');
console.writehexpairWND(mac[0], WND);
for i:=1 to 5 do begin
console.writestringWND(':', WND);
console.writehexpairWND(mac[i], WND);
end;
end;
procedure writeIPv4Address(ip : puint8; WND : HWND);
var
i : integer;

View File

@ -4,7 +4,7 @@ interface
uses
tracer, lmemorymanager,
util, lists, console,
util, lists, console, terminal,
net, nettypes, netutils,
netlog,
eth2, ipv4;
@ -189,12 +189,33 @@ begin
end;
end;
procedure terminal_command_arp(Params : PParamList);
var
i : uint32;
elm : PARPCacheRecord;
begin
if LL_Size(Cache) > 0 then begin
writestringlnWND('MAC IPv4', getTerminalHWND);
For i:=0 to LL_Size(Cache)-1 do begin
elm:= PARPCacheRecord(LL_Get(Cache, i));
writeMACAddressEx(@elm^.MAC[0], getTerminalHWND);
writestringWND(' ', getTerminalHWND);
writeIPv4AddressEx(@elm^.IP[0], getTerminalHWND);
writestringlnWND(' ', getTerminalHWND);
end;
end else begin
writestringlnWND('No entries in ARP table.', getTerminalHWND);
end;
end;
procedure register;
begin
push_trace('arp.register');
if not Registered then begin
Cache:= LL_New(sizeof(TARPCacheRecord));
eth2.registerType($0806, @recv);
terminal.registerCommand('ARP', @terminal_command_arp, 'Get ARP Table.');
Registered:= true;
end;
pop_trace;

View File

@ -9,14 +9,14 @@ const
VERSION_SUB = '1';
REVISION = '677';
RELEASE = 'ia';
LINE_COUNT = 27855;
LINE_COUNT = 27904;
FILE_COUNT = 89;
DRIVER_COUNT = 32;
FPC_VERSION = '2.6.4';
NASM_VERSION = '2.10.09';
MAKE_VERSION = '3.81';
COMPILE_DATE = '10/05/18';
COMPILE_TIME = '14:03:49';
COMPILE_TIME = '14:21:06';
implementation