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

This commit is contained in:
kieron
2018-05-11 09:09:04 +00:00
parent 79ef3385d8
commit da474b5573
16 changed files with 17 additions and 5 deletions

View File

@ -13,6 +13,7 @@ uses
procedure send(p_data : void; p_len : uint16; eth_type : uint16; p_context : PPacketContext);
procedure registerType(eType : uint16; RecvCB : TRecvCallback);
procedure registerTypePromisc(eType : uint16; RecvCB : TRecvCallback);
procedure register;
implementation
@ -23,14 +24,22 @@ uses
var
Registered : Boolean = false;
EthTypes : Array[0..65535] of TRecvCallback;
Promisc : Array[0..65535] of Boolean;
MAC : puint8;
procedure registerTypePromisc(eType : uint16; RecvCB : TRecvCallback);
begin
push_trace('eth2.registerType');
register;
if EthTypes[eType] = nil then EthTypes[eType]:= RecvCB;
Promisc[eType]:= true;
end;
procedure registerType(eType : uint16; RecvCB : TRecvCallback);
begin
push_trace('eth2.registerType');
register;
if EthTypes[eType] = nil then EthTypes[eType]:= RecvCB;
pop_trace;
end;
procedure send(p_data : void; p_len : uint16; eth_type : uint16; p_context : PPacketContext);
@ -81,7 +90,9 @@ begin
copyMAC(@Header^.src[0], @p_context^.MAC.Source[0]);
copyMAC(@Header^.dst[0], @p_context^.MAC.Destination[0]);
if MACEqual(@Header^.dst[0], @Header^.src[0]) or MACEqual(@Header^.dst[0], @BROADCAST_MAC[0]) then begin
if MACEqual(@Header^.dst[0], @Header^.src[0]) or
MACEqual(@Header^.dst[0], @BROADCAST_MAC[0]) or
Promisc[proto_type] then begin
if EthTypes[proto_type] <> nil then begin
EthTypes[proto_type](void(buf), p_len - 14, p_context);
end;
@ -98,6 +109,7 @@ begin
if not Registered then begin
for i:=0 to 65535 do begin
EthTypes[i]:= nil;
Promisc[i]:= false;
end;
net.registerNextLayer(@recv);
MAC:= net.getMAC;

View File

@ -250,7 +250,7 @@ begin
push_trace('arp.register');
if not Registered then begin
Cache:= LL_New(sizeof(TARPCacheRecord));
eth2.registerType($0806, @recv);
eth2.registerTypePromisc($0806, @recv);
terminal.registerCommand('ARP', @terminal_command_arp, 'Get ARP Table.');
Registered:= true;
end;

View File

@ -9,14 +9,14 @@ const
VERSION_SUB = '1';
REVISION = '677';
RELEASE = 'ia';
LINE_COUNT = 28032;
LINE_COUNT = 28044;
FILE_COUNT = 90;
DRIVER_COUNT = 32;
FPC_VERSION = '2.6.4';
NASM_VERSION = '2.10.09';
MAKE_VERSION = '3.81';
COMPILE_DATE = '11/05/18';
COMPILE_TIME = '09:58:04';
COMPILE_TIME = '10:09:01';
implementation