Asuro/src/driver/net/netutils.pas
kieron d98a81b540 E1000 Driver & Net Stack
- E1000 Driver Near Finished
- Network stack added (Eth->IPv4)
- Other Stuff
- Things.
- This commit message needs to be longer to make it look like I'm doing more work than I actually am.
- Other things.

git-svn-id: https://spexeah.com:8443/svn/Asuro@456 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
2018-04-09 20:34:39 +00:00

54 lines
959 B
ObjectPascal

unit netutils;
interface
uses
nettypes, console;
procedure writeMACAddress(mac : puint8);
procedure writeIPv4Address(ip : puint8);
function MACEqual(mac1 : puint8; mac2 : puint8) : boolean;
implementation
function MACEqual(mac1 : puint8; mac2 : puint8) : boolean;
var
i : uint8;
begin
MACEqual:= true;
for i:=0 to 5 do begin
if mac1[i] <> mac2[i] then begin
MACEqual:= false;
exit;
end;
end;
end;
procedure writeIPv4Address(ip : puint8);
var
i : integer;
begin
console.writeint(ip[0]);
for i:=1 to 3 do begin
console.writestring('.');
console.writeint(ip[i]);
end;
console.writestringln(' ');
end;
procedure writeMACAddress(mac : puint8);
var
i : integer;
begin
console.writehexpair(mac[0]);
for i:=1 to 5 do begin
console.writestring(':');
console.writehexpair(mac[i]);
end;
console.writestringln(' ');
end;
end.