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

This commit is contained in:
kieron committed 2018-05-12 09:20:28 +00:00
1 parent b8ebad8d42
commit 5dee385248
22 files changed
+56 -9

No files matched your search

BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+6 -1
View File
@@ -77,7 +77,7 @@ type
total_len_Lo : uint8; total_len_Lo : uint8;
identifier_Hi : uint8; identifier_Hi : uint8;
identifier_Lo : uint8; identifier_Lo : uint8;
Flags : ubit3; Flags : ubit3;
Fragment_Off : ubit13; Fragment_Off : ubit13;
TTL : uint8; TTL : uint8;
Protocol : uint8; Protocol : uint8;
@@ -89,6 +89,11 @@ type
Padding : uint8; Padding : uint8;
end; end;
PIPv4AsWORDs = ^TIPv4AsWORDs;
TIPv4AsWORDs = bitpacked record
WORDS : Array[0..11] of uint16;
end;
TTCPFlags = record TTCPFlags = record
RS : Boolean; RS : Boolean;
DF : Boolean; DF : Boolean;
+7 -1
View File
@@ -21,7 +21,7 @@ procedure writeToLogLn(str : pchar);
implementation implementation
uses uses
ipv4, arp, eth2; ipv4, arp, eth2, e1000, terminal;
var var
CBSend : TNetSendCallback = nil; CBSend : TNetSendCallback = nil;
@@ -108,12 +108,18 @@ begin
pop_trace; pop_trace;
end; end;
procedure terminal_command_e1000status(Params : PParamList);
begin
console.writeHexLnWND(e1000.readStatus, getTerminalHWND);
end;
procedure init; procedure init;
begin begin
push_trace('net.init'); push_trace('net.init');
eth2.register; eth2.register;
arp.register; arp.register;
ipv4.register; ipv4.register;
terminal.registerCommand('e1000status', @terminal_command_e1000status, 'e1000 status');
pop_trace; pop_trace;
end; end;
+32 -2
View File
@@ -67,6 +67,18 @@ begin
end; end;
end; end;
function findCacheRecord(ip : puint8) : PARPCacheRecord;
var
CacheRecord : PARPCacheRecord;
begin
CacheRecord:= findCacheRecordByIP(ip);
if CacheRecord = nil then begin
end;
findCacheRecord:= CacheRecord;
end;
procedure send(hType : uint16; pType : uint16; op : uint16; p_context : PPacketContext); procedure send(hType : uint16; pType : uint16; op : uint16; p_context : PPacketContext);
var var
buf : void; buf : void;
@@ -124,6 +136,24 @@ begin
freePacketContext(context); freePacketContext(context);
end; end;
procedure sendRequestGateway(ip : puint8);
var
context : PPacketContext;
CacheRecord : PARPCacheRecord;
begin
context:= newPacketContext;
CacheRecord:= findCacheRecordByIP(@getIPv4Config^.Gateway[0]);
if CacheRecord <> nil then begin
CopyMAC(@CacheRecord^.MAC[0], @context^.MAC.Destination[0]);
CopyIPv4(ip, @context^.IP.Destination[0]);
CopyIPv4(@getIPv4Config^.Address[0], @context^.IP.Source[0]);
CopyMAC(GetMAC, @context^.MAC.Source[0]);
arp.send($1, $0800, $1, context);
end;
freePacketContext(context);
end;
procedure sendRequest(ip : puint8); procedure sendRequest(ip : puint8);
var var
context : PPacketContext; context : PPacketContext;
@@ -135,10 +165,10 @@ begin
CopyIPv4(@getIPv4Config^.Address[0], @context^.IP.Source[0]); CopyIPv4(@getIPv4Config^.Address[0], @context^.IP.Source[0]);
CopyMAC(GetMAC, @context^.MAC.Source[0]); CopyMAC(GetMAC, @context^.MAC.Source[0]);
CacheRecord:= findCacheRecordByIP(@getIPv4Config^.Gateway[0]); CacheRecord:= findCacheRecordByIP(@getIPv4Config^.Gateway[0]);
if CacheRecord <> nil then CopyMAC(@CacheRecord^.MAC[0], @context^.MAC.Destination[0]) CopyMAC(@NULL_MAC[0], @context^.MAC.Destination[0]);
else CopyMAC(@NULL_MAC[0], @context^.MAC.Destination[0]);
arp.send($1, $0800, $1, context); arp.send($1, $0800, $1, context);
freePacketContext(context); freePacketContext(context);
sendRequestGateway(ip);
end; end;
procedure recv(p_data : void; p_len : uint16; p_context : PPacketContext); procedure recv(p_data : void; p_len : uint16; p_context : PPacketContext);
Loaded 20 of 22 files, more files were not shown because too many files have changed in this diff. Show more