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

This commit is contained in:
kieron 2018-05-10 07:56:44 +00:00
parent fabe8bd6eb
commit 514b6a1683
24 changed files with 57 additions and 18 deletions

BIN
Asuro.iso

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -6,7 +6,8 @@ uses
tracer, tracer,
console, console,
nettypes, netutils, nettypes, netutils,
netlog; netlog,
RTC;
procedure init; procedure init;
procedure registerNetworkCard(SendCallback : TNetSendCallback; _MAC : puint8); procedure registerNetworkCard(SendCallback : TNetSendCallback; _MAC : puint8);
@ -14,6 +15,8 @@ procedure registerNextLayer(RecvCallback : TRecvCallback);
procedure send(p_data : void; p_len : uint16); procedure send(p_data : void; p_len : uint16);
procedure recv(p_data : void; p_len : uint16); procedure recv(p_data : void; p_len : uint16);
function getMAC : puint8; function getMAC : puint8;
procedure writeToLog(str : pchar);
procedure writeToLogLn(str : pchar);
implementation implementation
@ -25,6 +28,39 @@ var
CBNext : TRecvCallback = nil; CBNext : TRecvCallback = nil;
MAC : puint8 = nil; MAC : puint8 = nil;
procedure writeToLog(str : pchar);
var
DateTime : TDateTime;
begin
if getNetlogHWND <> 0 then begin
DateTime:= getDateTime;
writeStringWND('[', getNetlogHWND);
if DateTime.Hours < 10 then writeIntWND(0, getNetlogHWND);
writeIntWND(DateTime.Hours, getNetlogHWND);
writeStringWND(':', getNetlogHWND);
if DateTime.Minutes < 10 then writeIntWND(0, getNetlogHWND);
writeIntWND(DateTime.Minutes, getNetlogHWND);
writeStringWND(':', getNetlogHWND);
if DateTime.Seconds < 10 then writeIntWND(0, getNetlogHWND);
writeIntWND(DateTime.Seconds, getNetlogHWND);
writeStringWND('] ', getNetlogHWND);
writeStringWND(str, getNetlogHWND);
end;
end;
procedure writeToLogLn(str : pchar);
begin
writeToLog(str);
if getNetlogHWND <> 0 then begin
writestringlnWND(' ', getNetlogHWND);
end;
end;
procedure registerNetworkCard(SendCallback : TNetSendCallback; _MAC : puint8); procedure registerNetworkCard(SendCallback : TNetSendCallback; _MAC : puint8);
begin begin
push_trace('net.registerNetworkCard'); push_trace('net.registerNetworkCard');
@ -47,7 +83,7 @@ end;
procedure send(p_data : void; p_len : uint16); procedure send(p_data : void; p_len : uint16);
begin begin
push_trace('net.send'); push_trace('net.send');
if getNetlogHWND <> 0 then writestringlnWND('net.send', getNetlogHWND); writeToLogLn('net.send');
if CBSend <> nil then CBSend(p_data, p_len); if CBSend <> nil then CBSend(p_data, p_len);
pop_trace; pop_trace;
end; end;
@ -58,7 +94,7 @@ var
begin begin
push_trace('net.recv'); push_trace('net.recv');
if getNetlogHWND <> 0 then writestringlnWND('net.recv', getNetlogHWND); writeToLogLn('net.recv');
context:= newPacketContext; context:= newPacketContext;
if CBNext <> nil then CBNext(p_data, p_len, context); if CBNext <> nil then CBNext(p_data, p_len, context);
freePacketContext(context); freePacketContext(context);

View File

@ -22,6 +22,9 @@ function MACToIIPv4(mac : puint8) : puint8;
implementation implementation
uses
net;
var var
Registered : Boolean = false; Registered : Boolean = false;
Cache : PLinkedListBase; Cache : PLinkedListBase;
@ -70,7 +73,7 @@ var
begin begin
push_trace('arp.recv'); push_trace('arp.recv');
if getNetlogHWND <> 0 then writestringlnWND('arp.recv', getNetlogHWND); writeToLogLn('arp.recv');
{ Get our converted Header } { Get our converted Header }
Header:= PARPHeader(p_data); Header:= PARPHeader(p_data);
AHeader.Hardware_Type:= (Header^.Hardware_Type_Hi SHL 8) + Header^.Hardware_Type_Lo; AHeader.Hardware_Type:= (Header^.Hardware_Type_Hi SHL 8) + Header^.Hardware_Type_Lo;
@ -84,31 +87,31 @@ begin
copyIPv4(@Header^.Destination_Protocol[0], @AHeader.Destination_Protocol[0]); copyIPv4(@Header^.Destination_Protocol[0], @AHeader.Destination_Protocol[0]);
case AHeader.Operation of case AHeader.Operation of
$1:begin { ARP Request } $1:begin { ARP Request }
if getNetlogHWND <> 0 then writestringlnWND('arp.recv.arp.req', getNetlogHWND); writeToLogLn('arp.recv.arp.req');
end; end;
$2:begin { ARP Reply } $2:begin { ARP Reply }
if getNetlogHWND <> 0 then writestringlnWND('arp.recv.arp.rep', getNetlogHWND); writeToLogLn('arp.recv.arp.rep');
end; end;
$3:begin { RARP Request } $3:begin { RARP Request }
if getNetlogHWND <> 0 then writestringlnWND('arp.recv.rarp.req', getNetlogHWND); writeToLogLn('arp.recv.rarp.req');
end; end;
$4:begin { RARP Reply } $4:begin { RARP Reply }
if getNetlogHWND <> 0 then writestringlnWND('arp.recv.rarp.rep', getNetlogHWND); writeToLogLn('arp.recv.rarp.rep');
end; end;
$5:begin { DRARP Request } $5:begin { DRARP Request }
if getNetlogHWND <> 0 then writestringlnWND('arp.recv.drarp.req', getNetlogHWND); writeToLogLn('arp.recv.drarp.req');
end; end;
$6:begin { DRARP Reply } $6:begin { DRARP Reply }
if getNetlogHWND <> 0 then writestringlnWND('arp.recv.drarp.rep', getNetlogHWND); writeToLogLn('arp.recv.drarp.rep');
end; end;
$7:begin { DRARP Error } $7:begin { DRARP Error }
if getNetlogHWND <> 0 then writestringlnWND('arp.recv.drarp.err', getNetlogHWND); writeToLogLn('arp.recv.drarp.err');
end; end;
$8:begin { InARP Request } $8:begin { InARP Request }
if getNetlogHWND <> 0 then writestringlnWND('arp.recv.inarp.req', getNetlogHWND); writeToLogLn('arp.recv.inarp.req');
end; end;
$9:begin { InARP Reply } $9:begin { InARP Reply }
if getNetlogHWND <> 0 then writestringlnWND('arp.recv.inarp.rep', getNetlogHWND); writeToLogLn('arp.recv.inarp.rep');
end; end;
end; end;
pop_trace; pop_trace;

View File

@ -29,7 +29,7 @@ var
begin begin
push_trace('ipv4.recv'); push_trace('ipv4.recv');
if getNetlogHWND <> 0 then writestringlnWND('ipv4.recv', getNetlogHWND); writeToLogLn('ipv4.recv');
Header:= PIPV4Header(p_data); Header:= PIPV4Header(p_data);
AHeader.version:= Header^.version; AHeader.version:= Header^.version;
AHeader.header_len:= Header^.header_len; AHeader.header_len:= Header^.header_len;

View File

@ -3,20 +3,20 @@ unit asuro;
interface interface
const const
VERSION = '1.0.1-674ia'; VERSION = '1.0.1-677ia';
VERSION_MAJOR = '1'; VERSION_MAJOR = '1';
VERSION_MINOR = '0'; VERSION_MINOR = '0';
VERSION_SUB = '1'; VERSION_SUB = '1';
REVISION = '674'; REVISION = '677';
RELEASE = 'ia'; RELEASE = 'ia';
LINE_COUNT = 27628; LINE_COUNT = 27664;
FILE_COUNT = 89; FILE_COUNT = 89;
DRIVER_COUNT = 32; DRIVER_COUNT = 32;
FPC_VERSION = '2.6.4'; FPC_VERSION = '2.6.4';
NASM_VERSION = '2.10.09'; NASM_VERSION = '2.10.09';
MAKE_VERSION = '3.81'; MAKE_VERSION = '3.81';
COMPILE_DATE = '10/05/18'; COMPILE_DATE = '10/05/18';
COMPILE_TIME = '08:36:31'; COMPILE_TIME = '08:56:35';
implementation implementation