git-svn-id: https://spexeah.com:8443/svn/Asuro@722 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
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.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -77,7 +77,7 @@ type
|
||||
total_len_Lo : uint8;
|
||||
identifier_Hi : uint8;
|
||||
identifier_Lo : uint8;
|
||||
Flags : ubit3;
|
||||
Flags : ubit3;
|
||||
Fragment_Off : ubit13;
|
||||
TTL : uint8;
|
||||
Protocol : uint8;
|
||||
@@ -89,6 +89,11 @@ type
|
||||
Padding : uint8;
|
||||
end;
|
||||
|
||||
PIPv4AsWORDs = ^TIPv4AsWORDs;
|
||||
TIPv4AsWORDs = bitpacked record
|
||||
WORDS : Array[0..11] of uint16;
|
||||
end;
|
||||
|
||||
TTCPFlags = record
|
||||
RS : Boolean;
|
||||
DF : Boolean;
|
||||
|
||||
@@ -21,7 +21,7 @@ procedure writeToLogLn(str : pchar);
|
||||
implementation
|
||||
|
||||
uses
|
||||
ipv4, arp, eth2;
|
||||
ipv4, arp, eth2, e1000, terminal;
|
||||
|
||||
var
|
||||
CBSend : TNetSendCallback = nil;
|
||||
@@ -108,12 +108,18 @@ begin
|
||||
pop_trace;
|
||||
end;
|
||||
|
||||
procedure terminal_command_e1000status(Params : PParamList);
|
||||
begin
|
||||
console.writeHexLnWND(e1000.readStatus, getTerminalHWND);
|
||||
end;
|
||||
|
||||
procedure init;
|
||||
begin
|
||||
push_trace('net.init');
|
||||
eth2.register;
|
||||
arp.register;
|
||||
ipv4.register;
|
||||
terminal.registerCommand('e1000status', @terminal_command_e1000status, 'e1000 status');
|
||||
pop_trace;
|
||||
end;
|
||||
|
||||
|
||||
@@ -67,6 +67,18 @@ begin
|
||||
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);
|
||||
var
|
||||
buf : void;
|
||||
@@ -124,6 +136,24 @@ begin
|
||||
freePacketContext(context);
|
||||
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);
|
||||
var
|
||||
context : PPacketContext;
|
||||
@@ -135,10 +165,10 @@ begin
|
||||
CopyIPv4(@getIPv4Config^.Address[0], @context^.IP.Source[0]);
|
||||
CopyMAC(GetMAC, @context^.MAC.Source[0]);
|
||||
CacheRecord:= findCacheRecordByIP(@getIPv4Config^.Gateway[0]);
|
||||
if CacheRecord <> nil then CopyMAC(@CacheRecord^.MAC[0], @context^.MAC.Destination[0])
|
||||
else CopyMAC(@NULL_MAC[0], @context^.MAC.Destination[0]);
|
||||
CopyMAC(@NULL_MAC[0], @context^.MAC.Destination[0]);
|
||||
arp.send($1, $0800, $1, context);
|
||||
freePacketContext(context);
|
||||
sendRequestGateway(ip);
|
||||
end;
|
||||
|
||||
procedure recv(p_data : void; p_len : uint16; p_context : PPacketContext);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user