git-svn-id: https://spexeah.com:8443/svn/Asuro@728 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
24027a3109
commit
fd2364ecaf
BIN
bin/kernel.bin
BIN
bin/kernel.bin
Binary file not shown.
Binary file not shown.
BIN
lib/E1000.ppu
BIN
lib/E1000.ppu
Binary file not shown.
BIN
lib/arp.ppu
BIN
lib/arp.ppu
Binary file not shown.
BIN
lib/asuro.ppu
BIN
lib/asuro.ppu
Binary file not shown.
BIN
lib/eth2.ppu
BIN
lib/eth2.ppu
Binary file not shown.
BIN
lib/ipv4.ppu
BIN
lib/ipv4.ppu
Binary file not shown.
BIN
lib/kernel.ppu
BIN
lib/kernel.ppu
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/libpsystem.a
BIN
lib/libpsystem.a
Binary file not shown.
BIN
lib/net.ppu
BIN
lib/net.ppu
Binary file not shown.
BIN
lib/nettypes.ppu
BIN
lib/nettypes.ppu
Binary file not shown.
BIN
lib/netutils.ppu
BIN
lib/netutils.ppu
Binary file not shown.
BIN
lib/shell.ppu
BIN
lib/shell.ppu
Binary file not shown.
BIN
lib/terminal.ppu
BIN
lib/terminal.ppu
Binary file not shown.
@ -18,10 +18,19 @@ type
|
||||
Destination : TIPv4Address;
|
||||
end;
|
||||
|
||||
TProtocol = record
|
||||
L1 : uint16;
|
||||
L2 : uint16;
|
||||
L3 : uint16;
|
||||
L4 : uint16;
|
||||
end;
|
||||
|
||||
PPacketContext = ^TPacketContext;
|
||||
TPacketContext = record
|
||||
MAC : TMACPair;
|
||||
IP : TIPv4Pair;
|
||||
Protocol : TProtocol;
|
||||
TTL : uint8;
|
||||
end;
|
||||
|
||||
PIPv4Configuration = ^TIPv4Configuration;
|
||||
|
@ -23,12 +23,74 @@ var
|
||||
Registered : Boolean = false;
|
||||
Protocols : Array[0..255] of TRecvCallback;
|
||||
Config : TIPv4Configuration;
|
||||
CurrentID : uint16 = 0;
|
||||
|
||||
function getIPv4Config : PIPv4Configuration;
|
||||
begin
|
||||
getIPv4Config:= @Config;
|
||||
end;
|
||||
|
||||
function calculateChecksum(p_data : puint16; p_len : uint16) : uint16;
|
||||
var
|
||||
sum : uint32;
|
||||
dat : puint16;
|
||||
carry : uint16;
|
||||
i : uint32;
|
||||
l : uint32;
|
||||
|
||||
begin
|
||||
dat:= p_data;
|
||||
sum:= 0;
|
||||
l:= p_len div 2;
|
||||
for i:=1 to l do begin
|
||||
sum:= sum + p_data^;
|
||||
inc(p_data);
|
||||
end;
|
||||
while (sum > $FFFF) do begin
|
||||
carry:= (sum AND $FFFF0000) SHR 16;
|
||||
sum:= sum + carry;
|
||||
end;
|
||||
calculateChecksum:= not sum;
|
||||
end;
|
||||
|
||||
procedure send(p_data : void; p_len : uint16; p_context : PPacketContext);
|
||||
var
|
||||
Header : TIPV4Header;
|
||||
Len : uint16;
|
||||
CHK : uint16;
|
||||
buffer : void;
|
||||
|
||||
begin
|
||||
writeToLogLn(' L3: ipv4.send');
|
||||
inc(CurrentID);
|
||||
Header.version:= 4;
|
||||
Header.header_len:= 5;
|
||||
Header.ToS:= 0;
|
||||
Len:= 20 + p_len;
|
||||
Header.total_len_Hi:= Len SHR 8;
|
||||
Header.total_len_Lo:= Len AND $FF;
|
||||
Header.identifier_Hi:= CurrentID SHR 8;
|
||||
Header.identifier_Lo:= CurrentID AND $FF;
|
||||
Header.Flags:= 0;
|
||||
Header.Fragment_Off:= 0;
|
||||
Header.TTL:= p_context^.TTL;
|
||||
Header.Protocol:= p_context^.Protocol.L4 AND $FF;
|
||||
Header.HDR_CHK_Hi:= 0;
|
||||
Header.HDR_CHK_Lo:= 0;
|
||||
CopyIPv4(@getIPv4Config^.Address[0], @Header.Src[0]);
|
||||
CopyIPv4(@p_context^.IP.Destination[0], @Header.Dst[0]);
|
||||
Header.Options:= 0;
|
||||
Header.Padding:= 0;
|
||||
CHK:= calculateChecksum(puint16(@Header), sizeof(TIPV4Header));
|
||||
Header.HDR_CHK_Hi:= CHK SHR 8;
|
||||
Header.HDR_CHK_Lo:= CHK AND $FF;
|
||||
Buffer:= kalloc(Len);
|
||||
memcpy(uint32(@Header), uint32(Buffer), Header.header_len * 4);
|
||||
memcpy(uint32(p_data), uint32(Buffer) + (Header.header_len * 4), p_len);
|
||||
eth2.send(Buffer, (Header.header_len * 4) + p_len, $0800, p_context);
|
||||
kfree(Buffer);
|
||||
end;
|
||||
|
||||
procedure recv(p_data : void; p_len : uint16; p_context : PPacketContext);
|
||||
var
|
||||
Header : PIPV4Header;
|
||||
|
@ -556,7 +556,6 @@ begin
|
||||
net.registerNetworkCard(@sendPacket, getMACAddress());
|
||||
|
||||
isrmanager.registerISR(32 + PCI_Info^.interrupt_line, @fire);
|
||||
//IDT.set_gate(32 + PCI_Info^.interrupt_line, uint32(@fire), $08, ISR_RING_0);
|
||||
enableInturrupt();
|
||||
|
||||
rxinit();
|
||||
|
@ -3,20 +3,20 @@ unit asuro;
|
||||
interface
|
||||
|
||||
const
|
||||
VERSION = '1.0.1-677ia';
|
||||
VERSION = '1.0.1-726ia';
|
||||
VERSION_MAJOR = '1';
|
||||
VERSION_MINOR = '0';
|
||||
VERSION_SUB = '1';
|
||||
REVISION = '677';
|
||||
REVISION = '726';
|
||||
RELEASE = 'ia';
|
||||
LINE_COUNT = 28115;
|
||||
LINE_COUNT = 28185;
|
||||
FILE_COUNT = 90;
|
||||
DRIVER_COUNT = 32;
|
||||
FPC_VERSION = '2.6.4';
|
||||
NASM_VERSION = '2.10.09';
|
||||
MAKE_VERSION = '3.81';
|
||||
COMPILE_DATE = '12/05/18';
|
||||
COMPILE_TIME = '11:08:14';
|
||||
COMPILE_TIME = '16:05:29';
|
||||
|
||||
implementation
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user