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

This commit is contained in:
kieron
2018-05-10 12:17:35 +00:00
parent 2d91631c3d
commit 35edc9e455
23 changed files with 100 additions and 23 deletions

View File

@ -16,6 +16,9 @@ procedure register;
implementation
uses
arp;
var
Registered : Boolean = false;
EthTypes : Array[0..65535] of TRecvCallback;
@ -59,28 +62,17 @@ var
begin
push_trace('eth2.recv');
writeToLogLn(' L2: eth2.recv');
//console.outputln('net.eth2', 'RECV.');
buf:= puint8(p_data);
Header:= PEthernetHeader(buf);
//console.output('net.eth2', 'DEST: ');
//writeMACAddress(@Header^.dst[0]);
//console.output('net.eth2', 'SRC: ');
//writeMACAddress(@Header^.src[0]);
proto_type:= Header^.EthTypeHi SHL 8;
proto_type:= proto_type + Header^.EthTypeLo;
//console.output('net.eth2', 'PROTO: ');
//console.writehexln(proto_type);
buf:= buf + 14;
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
//console.outputln('net.eth2', 'MAC HIT');
if EthTypes[proto_type] <> nil then begin
EthTypes[proto_type](void(buf), p_len - 14, p_context);
end;