git-svn-id: https://spexeah.com:8443/svn/Asuro@918 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
6db9d71479
commit
5d26e199aa
BIN
bin/kernel.bin
BIN
bin/kernel.bin
Binary file not shown.
@ -1,14 +1,14 @@
|
|||||||
|
|
||||||
8ef8efd229a0415a93fc30fa2d78b225 src//console.pas
|
8ef8efd229a0415a93fc30fa2d78b225 src//console.pas
|
||||||
d534df93f6054e736d61f1e9dfd1665c src//contextswitcher.pas
|
d534df93f6054e736d61f1e9dfd1665c src//contextswitcher.pas
|
||||||
892adbcd2fc5757d2c9afe89faff914d src//cpu.pas
|
f4b745969438d521d7b1573ec1f8fa83 src//cpu.pas
|
||||||
64759af7b591dba6fff847e3d725001d src//drivermanagement.pas
|
64759af7b591dba6fff847e3d725001d src//drivermanagement.pas
|
||||||
10fcd18a055d3af9606a59475bf48eab src//faults.pas
|
10fcd18a055d3af9606a59475bf48eab src//faults.pas
|
||||||
fedbc69eb42fb2bd685aa3c98732dd24 src//gdt.pas
|
fedbc69eb42fb2bd685aa3c98732dd24 src//gdt.pas
|
||||||
1e96141f52b3249777c4c561f74486b2 src//idt.pas
|
1e96141f52b3249777c4c561f74486b2 src//idt.pas
|
||||||
ff963c65c48984566b201003eec8ce47 src//irq.pas
|
ff963c65c48984566b201003eec8ce47 src//irq.pas
|
||||||
ab3f144c41b5e718b4575eb4ef51aa1b src//isr.pas
|
ab3f144c41b5e718b4575eb4ef51aa1b src//isr.pas
|
||||||
945c3c5f05deae905c9cc0a9676637ec src//kernel.pas
|
c90f709181000d1126c4a3bc18e33fd8 src//kernel.pas
|
||||||
375a0beff3986ead4e9275b2dfa0ec7d src//lmemorymanager.pas
|
375a0beff3986ead4e9275b2dfa0ec7d src//lmemorymanager.pas
|
||||||
dce0fec2a2bb8dde7dced3598a613318 src//pmemorymanager.pas
|
dce0fec2a2bb8dde7dced3598a613318 src//pmemorymanager.pas
|
||||||
2517817ea68f5797b5c10926dfaf497e src//processloader.pas
|
2517817ea68f5797b5c10926dfaf497e src//processloader.pas
|
||||||
@ -44,7 +44,7 @@ b26eb54cfc1be4b9afa103e0ec041eba src/prog/memview.pas
|
|||||||
84fe7bc577629e64074adf0a0b363cf8 src/prog/splash.pas
|
84fe7bc577629e64074adf0a0b363cf8 src/prog/splash.pas
|
||||||
4ea0a47afaace151f3bd66f3786947ed src/prog/terminal.pas
|
4ea0a47afaace151f3bd66f3786947ed src/prog/terminal.pas
|
||||||
c18ca66db1e0e7c3aa8c2974e220a5ec src/prog/themer.pas
|
c18ca66db1e0e7c3aa8c2974e220a5ec src/prog/themer.pas
|
||||||
348812145d1abd16ed75c4836ad01c14 src/prog/udpcat.pas
|
dcdc2a2b3d065a9793dcb37f8efec4a1 src/prog/udpcat.pas
|
||||||
a69305637377f209b509b097e7271052 src/prog/vmlog.pas
|
a69305637377f209b509b097e7271052 src/prog/vmlog.pas
|
||||||
af1e55dbd64c939cb63a1703de1002c7 src/prog/vmstate.pas
|
af1e55dbd64c939cb63a1703de1002c7 src/prog/vmstate.pas
|
||||||
c0b825d6daacd672ce343e062edc7238 src/include/bios_data_area.pas
|
c0b825d6daacd672ce343e062edc7238 src/include/bios_data_area.pas
|
||||||
@ -52,6 +52,7 @@ c0b825d6daacd672ce343e062edc7238 src/include/bios_data_area.pas
|
|||||||
93342ca736d038c448e6322687edf3e2 src/include/fonts.pas
|
93342ca736d038c448e6322687edf3e2 src/include/fonts.pas
|
||||||
afd15dca933f082c73f48aba1059a04e src/include/lists.pas
|
afd15dca933f082c73f48aba1059a04e src/include/lists.pas
|
||||||
6964ed22ee91c4c35724893a1996bfd7 src/include/multiboot.pas
|
6964ed22ee91c4c35724893a1996bfd7 src/include/multiboot.pas
|
||||||
|
7a4166a3baff1527695df50f523ed6da src/include/rand.pas
|
||||||
2aa600f989602fd2aaed548d7344736e src/include/strings.pas
|
2aa600f989602fd2aaed548d7344736e src/include/strings.pas
|
||||||
01e4c69601c664fff8922f4a0d96c02d src/include/system.pas
|
01e4c69601c664fff8922f4a0d96c02d src/include/system.pas
|
||||||
6103928fbe8c413929cde49df82f5a1f src/include/types.pas
|
6103928fbe8c413929cde49df82f5a1f src/include/types.pas
|
||||||
@ -81,10 +82,10 @@ d6b9b21258bcb471d91c85c85c92cdca src/driver/bus/UHCI.pas
|
|||||||
0d38ece46e1dd89d6b9298d2dd21e809 src/driver/bus/XHCI.pas
|
0d38ece46e1dd89d6b9298d2dd21e809 src/driver/bus/XHCI.pas
|
||||||
e6bac1105d578010d8c80ad98e73da75 src/driver/net/l4/icmp.pas
|
e6bac1105d578010d8c80ad98e73da75 src/driver/net/l4/icmp.pas
|
||||||
d15e40376b2ea95d309c19959bbe670c src/driver/net/l4/tcp.pas
|
d15e40376b2ea95d309c19959bbe670c src/driver/net/l4/tcp.pas
|
||||||
ac3c7deeb4e26520fc9753961577e007 src/driver/net/l4/udp.pas
|
13e54d913a5cc2b59f59c93a98bd6941 src/driver/net/l4/udp.pas
|
||||||
37a2153a326041fccdc8d3006ec81001 src/driver/net/l2/eth2.pas
|
37a2153a326041fccdc8d3006ec81001 src/driver/net/l2/eth2.pas
|
||||||
31163add86f65e5dfa3eb519f4cc6334 src/driver/net/l1/net.pas
|
31163add86f65e5dfa3eb519f4cc6334 src/driver/net/l1/net.pas
|
||||||
d877ae603669cb210bba08cafddff767 src/driver/net/include/nettypes.pas
|
fb31707405021d5d4f3833a96e66ef1f src/driver/net/include/nettypes.pas
|
||||||
9ee7cf2903b026bda5113c433081d895 src/driver/net/include/netutils.pas
|
9ee7cf2903b026bda5113c433081d895 src/driver/net/include/netutils.pas
|
||||||
f26d7788d454b9eb27d65b99908aebea src/driver/net/l3/arp.pas
|
f26d7788d454b9eb27d65b99908aebea src/driver/net/l3/arp.pas
|
||||||
036941af78c64a14334b3cd4751889ce src/driver/net/l3/ipv4.pas
|
036941af78c64a14334b3cd4751889ce src/driver/net/l3/ipv4.pas
|
||||||
|
Binary file not shown.
BIN
lib/E1000.ppu
BIN
lib/E1000.ppu
Binary file not shown.
BIN
lib/RTC.ppu
BIN
lib/RTC.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/cpu.ppu
BIN
lib/cpu.ppu
Binary file not shown.
BIN
lib/eth2.ppu
BIN
lib/eth2.ppu
Binary file not shown.
BIN
lib/icmp.ppu
BIN
lib/icmp.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.
BIN
lib/util.ppu
BIN
lib/util.ppu
Binary file not shown.
@ -78,7 +78,7 @@ type
|
|||||||
OSXSAVE : Boolean;
|
OSXSAVE : Boolean;
|
||||||
AVX : Boolean;
|
AVX : Boolean;
|
||||||
RESV3 : Boolean;
|
RESV3 : Boolean;
|
||||||
RESV4 : Boolean;
|
RDRAND : Boolean;
|
||||||
RESV5 : Boolean;
|
RESV5 : Boolean;
|
||||||
end;
|
end;
|
||||||
TClockSpeed = record
|
TClockSpeed = record
|
||||||
@ -247,6 +247,7 @@ begin
|
|||||||
if CPUID.Capabilities1^.XSAVE then writestringWND(', XSAVE', WND);
|
if CPUID.Capabilities1^.XSAVE then writestringWND(', XSAVE', WND);
|
||||||
if CPUID.Capabilities1^.OSXSAVE then writestringWND(', OSXSAVE', WND);
|
if CPUID.Capabilities1^.OSXSAVE then writestringWND(', OSXSAVE', WND);
|
||||||
if CPUID.Capabilities1^.AVX then writestringWND(', AVX', WND);
|
if CPUID.Capabilities1^.AVX then writestringWND(', AVX', WND);
|
||||||
|
if CPUID.Capabilities1^.RDRAND then writestringWND(', RDRAND', WND);
|
||||||
writestringlnWND(' ', WND);
|
writestringlnWND(' ', WND);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -166,13 +166,28 @@ type
|
|||||||
UID : uint32;
|
UID : uint32;
|
||||||
end;
|
end;
|
||||||
PUDPHeader = ^TUDPHeader;
|
PUDPHeader = ^TUDPHeader;
|
||||||
TUDPHeader = record
|
TUDPHeader = packed record
|
||||||
SrcPort : uint16;
|
SrcPort : uint16;
|
||||||
DstPort : uint16;
|
DstPort : uint16;
|
||||||
Length : uint16;
|
Length : uint16;
|
||||||
Checksum : uint16;
|
Checksum : uint16;
|
||||||
end;
|
end;
|
||||||
|
TUDPSendContext = record
|
||||||
|
DstPort : uint16;
|
||||||
|
socket : PUDPBindContext;
|
||||||
|
context : PPacketContext;
|
||||||
|
end;
|
||||||
|
PUDPSendContext = ^TUDPSendContext;
|
||||||
|
TUDPPseudoHeader = packed record
|
||||||
|
Source_IP : uint32;
|
||||||
|
Destination_IP : uint32;
|
||||||
|
Protocol : uint16;
|
||||||
|
Length : uint16;
|
||||||
|
UDP_Source : uint16;
|
||||||
|
UDP_Destination : uint16;
|
||||||
|
UDP_Length : uint16;
|
||||||
|
end;
|
||||||
|
PUDPPseudoHeader = ^TUDPPseudoHeader;
|
||||||
|
|
||||||
{ Callback Types }
|
{ Callback Types }
|
||||||
|
|
||||||
@ -187,12 +202,22 @@ const
|
|||||||
NULL_MAC : Array[0..5] of uint8 = ($00, $00, $00, $00, $00, $00);
|
NULL_MAC : Array[0..5] of uint8 = ($00, $00, $00, $00, $00, $00);
|
||||||
FORCE_MAC : Array[0..5] of uint8 = ($08, $00, $27, $E6, $3F, $81);
|
FORCE_MAC : Array[0..5] of uint8 = ($08, $00, $27, $E6, $3F, $81);
|
||||||
|
|
||||||
|
{ IPs }
|
||||||
|
BROADCAST_IP : Array[0..3] of uint8 = ($FF, $FF, $FF, $FF);
|
||||||
|
NULL_IP : Array[0..3] of uint8 = ($00, $00, $00, $00);
|
||||||
|
|
||||||
{ ICMP Data }
|
{ ICMP Data }
|
||||||
ICMP_DATA_GENERIC : Array[0..31] of uint8 = ( $61, $62, $63, $64, $65, $66, $67, $68,
|
ICMP_DATA_GENERIC : Array[0..31] of uint8 = ( $61, $62, $63, $64, $65, $66, $67, $68,
|
||||||
$69, $6a, $6b, $6c, $6d, $6e, $6f, $70,
|
$69, $6a, $6b, $6c, $6d, $6e, $6f, $70,
|
||||||
$71, $72, $73, $74, $75, $76, $77, $61,
|
$71, $72, $73, $74, $75, $76, $77, $61,
|
||||||
$62, $63, $64, $65, $66, $67, $68, $69 );
|
$62, $63, $64, $65, $66, $67, $68, $69 );
|
||||||
|
|
||||||
|
{ UDP Test Data }
|
||||||
|
UDPT_S_IP : Array[0..3] of uint8 = ($C0, $A8, $00, $1F);
|
||||||
|
UDPT_D_IP : Array[0..3] of uint8 = ($C0, $A8, $00, $1E);
|
||||||
|
UDPT_DATA : Array[0..1] of uint8 = ($48, $69);
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
end.
|
end.
|
@ -19,15 +19,136 @@ var
|
|||||||
procedure register();
|
procedure register();
|
||||||
function bind(bindContext : PUDPBindContext) : TUDPError;
|
function bind(bindContext : PUDPBindContext) : TUDPError;
|
||||||
function unbind(bindContext : PUDPBindContext) : TUDPError;
|
function unbind(bindContext : PUDPBindContext) : TUDPError;
|
||||||
|
procedure send(p_data : void; p_len : uint16; udpContext : PUDPSendContext);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
console, terminal;
|
console, terminal;
|
||||||
|
|
||||||
procedure send(p_data : void; p_len : uint16; p_context : PPacketContext; bindContext : PUDPBindContext);
|
function CalculateChecksum(p_data : void; p_len : uint16; udpContext : PUDPSendContext) : uint16;
|
||||||
begin
|
var
|
||||||
|
pseudoBuffer : void;
|
||||||
|
pseudoBuffer32 : puint32;
|
||||||
|
pseudoBuffer16 : puint16;
|
||||||
|
pseudoBuffer8 : puint8;
|
||||||
|
pseudoSize : uint16;
|
||||||
|
nullend : boolean;
|
||||||
|
pseudoHeader : PUDPPseudoHeader;
|
||||||
|
pseduoSrc : uint16;
|
||||||
|
i : uint16;
|
||||||
|
Checksum_u : uint32;
|
||||||
|
Checksum_c : uint16;
|
||||||
|
Checksum_f : uint16;
|
||||||
|
size : uint16;
|
||||||
|
|
||||||
|
begin
|
||||||
|
size:= p_len + sizeof(TUDPHeader);
|
||||||
|
//Checksum
|
||||||
|
if udpContext^.socket <> nil then begin
|
||||||
|
pseduoSrc:= udpContext^.socket^.Port;
|
||||||
|
end else begin
|
||||||
|
pseduoSrc:= 0;
|
||||||
|
end;
|
||||||
|
nullend:= false;
|
||||||
|
pseudoSize:= p_len;
|
||||||
|
if (pseudoSize mod 2) = 1 then begin
|
||||||
|
pseudoSize:= pseudoSize + 1;
|
||||||
|
nullend:= true;
|
||||||
|
end;
|
||||||
|
pseudoBuffer:= kalloc(sizeof(TUDPPseudoHeader) + pseudoSize);
|
||||||
|
pseudoBuffer8:= puint8(pseudoBuffer);
|
||||||
|
pseudoBuffer16:= puint16(pseudoBuffer);
|
||||||
|
pseudoBuffer32:= puint32(pseudoBuffer32);
|
||||||
|
pseudoHeader:= PUDPPseudoHeader(pseudoBuffer);
|
||||||
|
copyIPv4(puint8(@udpContext^.context^.IP.Source[0]), puint8(@pseudoBuffer8[0]));
|
||||||
|
copyIPv4(puint8(@udpContext^.context^.IP.Destination[0]), puint8(@pseudoBuffer8[4]));
|
||||||
|
pseudoHeader^.Protocol:= $11;
|
||||||
|
pseudoHeader^.Length:= pseudoSize + sizeof(TUDPHeader);
|
||||||
|
pseudoHeader^.UDP_Source:= pseduoSrc;
|
||||||
|
pseudoHeader^.UDP_Destination:= udpContext^.DstPort;
|
||||||
|
pseudoHeader^.UDP_Length:= size;
|
||||||
|
memcpy(uint32(p_data), uint32(pseudoBuffer) + SizeOf(TUDPPseudoHeader), p_len);
|
||||||
|
if nullend then pseudoBuffer8[pseudoSize-1]:= 0;
|
||||||
|
|
||||||
|
pseudoHeader^.Source_IP:= switchendian32(pseudoHeader^.Source_IP);
|
||||||
|
pseudoHeader^.Destination_IP:= switchendian32(pseudoHeader^.Destination_IP);
|
||||||
|
|
||||||
|
//writehexln(pseudoHeader^.Source_IP);
|
||||||
|
//writehexln(pseudoHeader^.Destination_IP);
|
||||||
|
//writehexln(pseudoHeader^.Protocol);
|
||||||
|
//writehexln(pseudoHeader^.Length);
|
||||||
|
//writehexln(pseudoHeader^.UDP_Source);
|
||||||
|
//writehexln(pseudoHeader^.UDP_Destination);
|
||||||
|
//writehexln(pseudoHeader^.UDP_Length);
|
||||||
|
|
||||||
|
Checksum_u:= 0;
|
||||||
|
for i:=0 to (SizeOf(TUDPPseudoHeader) div 2)-1 do begin
|
||||||
|
//writestring('+ ');
|
||||||
|
//writehexln(pseudoBuffer16[i]);
|
||||||
|
Checksum_u:= Checksum_u + pseudoBuffer16[i];
|
||||||
|
end;
|
||||||
|
for i:=(SizeOf(TUDPPseudoHeader) div 2) to ((pseudoSize + SizeOf(TUDPPseudoHeader)) div 2) - 1 do begin
|
||||||
|
//writestring('- ');
|
||||||
|
//ritehexln( switchendian16(pseudoBuffer16[i]));
|
||||||
|
Checksum_u:= Checksum_u + switchendian16(pseudoBuffer16[i]);
|
||||||
|
end;
|
||||||
|
Checksum_f:= Checksum_u AND $FFFF;
|
||||||
|
Checksum_c:= (Checksum_u AND $FFFF0000) SHR 16;
|
||||||
|
Checksum_f:= Checksum_f + Checksum_c;
|
||||||
|
Checksum_f:= not Checksum_f;
|
||||||
|
CalculateChecksum:= Checksum_f;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure send(p_data : void; p_len : uint16; udpContext : PUDPSendContext);
|
||||||
|
var
|
||||||
|
buffer : void;
|
||||||
|
hdr : PUDPHeader;
|
||||||
|
size : uint16;
|
||||||
|
checksum : uint16;
|
||||||
|
i : uint16;
|
||||||
|
|
||||||
|
|
||||||
|
begin
|
||||||
|
if udpContext <> nil then begin
|
||||||
|
size:= p_len + sizeof(TUDPHeader);
|
||||||
|
buffer:= kalloc(size);
|
||||||
|
hdr:= PUDPHeader(kalloc(sizeof(TUDPHeader)));
|
||||||
|
if udpContext^.socket <> nil then begin
|
||||||
|
hdr^.SrcPort:= switchendian16(udpContext^.socket^.Port);
|
||||||
|
end else begin
|
||||||
|
hdr^.SrcPort:= 0;
|
||||||
|
end;
|
||||||
|
hdr^.DstPort:= switchendian16(udpContext^.DstPort);
|
||||||
|
|
||||||
|
checksum:= CalculateChecksum(p_data, p_len, udpContext);
|
||||||
|
|
||||||
|
hdr^.Checksum:= switchendian16(checksum);
|
||||||
|
hdr^.Length:= switchendian16(size);
|
||||||
|
|
||||||
|
memcpy(uint32(hdr), uint32(buffer), sizeof(TUDPHeader));
|
||||||
|
memcpy(uint32(p_data), uint32(buffer + sizeof(TUDPHeader)), p_len);
|
||||||
|
|
||||||
|
for i:=0 to p_len-1 do begin
|
||||||
|
writehexpair(puint8(p_data)[i]);
|
||||||
|
end;
|
||||||
|
writestringln(' ');
|
||||||
|
for i:=0 to p_len-1 do begin
|
||||||
|
writechar(pchar(p_data)[i]);
|
||||||
|
end;
|
||||||
|
writestringln(' ');
|
||||||
|
for i:=0 to size-1 do begin
|
||||||
|
writehexpair(puint8(buffer)[i]);
|
||||||
|
end;
|
||||||
|
writestringln(' ');
|
||||||
|
|
||||||
|
udpContext^.context^.Protocol.L4:= $11;
|
||||||
|
|
||||||
|
ipv4.send(buffer, size, udpContext^.context);
|
||||||
|
|
||||||
|
kfree(buffer);
|
||||||
|
kfree(void(hdr));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function bind(bindContext : PUDPBindContext) : TUDPError;
|
function bind(bindContext : PUDPBindContext) : TUDPError;
|
||||||
@ -124,6 +245,11 @@ var
|
|||||||
context : PUDPBindContext;
|
context : PUDPBindContext;
|
||||||
r : TUDPError;
|
r : TUDPError;
|
||||||
|
|
||||||
|
SendContext : PUDPSendContext;
|
||||||
|
BindContext : PUDPBindContext;
|
||||||
|
PacketContext : PPacketContext;
|
||||||
|
Checksum : uint32;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
for i:=0 to 65535 do begin
|
for i:=0 to 65535 do begin
|
||||||
Ports[i]:= nil;
|
Ports[i]:= nil;
|
||||||
@ -133,13 +259,28 @@ begin
|
|||||||
//context^.Callback:= @TestRecv;
|
//context^.Callback:= @TestRecv;
|
||||||
//context^.UID:= 4398724;
|
//context^.UID:= 4398724;
|
||||||
//r:= bind(context);
|
//r:= bind(context);
|
||||||
//writestring('[TestBind] ');
|
writestring('[TestBind] ');
|
||||||
//case r of
|
//case r of
|
||||||
// tueOK:writestringln('22294 bind OK');
|
// tueOK:writestringln('22294 bind OK');
|
||||||
// tuePortInUse:writestringln('22294 port in use');
|
// tuePortInUse:writestringln('22294 port in use');
|
||||||
// tueGenericError:writestringln('22294 generic error');
|
// tueGenericError:writestringln('22294 generic error');
|
||||||
// tuePortRestricted:writestringln('22294 restricted');
|
// tuePortRestricted:writestringln('22294 restricted');
|
||||||
//end;
|
//end;
|
||||||
|
|
||||||
|
SendContext:= PUDPSendContext(kalloc(SizeOf(TUDPSendContext)));
|
||||||
|
BindContext:= PUDPBindContext(kalloc(SizeOf(TUDPBindContext)));
|
||||||
|
PacketContext:= PPacketContext(kalloc(SizeOf(TPacketContext)));
|
||||||
|
SendContext^.DstPort:= 10;
|
||||||
|
SendContext^.Socket:= BindContext;
|
||||||
|
SendContext^.Context:= PacketContext;
|
||||||
|
BindContext^.Port:= 20;
|
||||||
|
copyIPv4(puint8(@UDPT_S_IP[0]), puint8(@PacketContext^.IP.Source[0]));
|
||||||
|
copyIPv4(puint8(@UDPT_D_IP[0]), puint8(@PacketContext^.IP.Destination[0]));
|
||||||
|
|
||||||
|
Checksum:= CalculateChecksum(void(@UDPT_DATA[0]), 2, SendContext);
|
||||||
|
writehexln(Checksum);
|
||||||
|
//while true do begin end;
|
||||||
|
|
||||||
ipv4.registerProtocol($11, @ProcessPacket);
|
ipv4.registerProtocol($11, @ProcessPacket);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
36
src/include/rand.pas
Normal file
36
src/include/rand.pas
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
unit rand;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
function rand32 : uint32;
|
||||||
|
function rand16 : uint16;
|
||||||
|
function rand8 : uint8;
|
||||||
|
procedure srand(seed : uint32);
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
var
|
||||||
|
next : uint32 = 1;
|
||||||
|
|
||||||
|
function rand32 : uint32;
|
||||||
|
begin
|
||||||
|
next:= next * 1103515245 + 12345;
|
||||||
|
rand32:= (next div 65536) mod 32768;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function rand16 : uint16;
|
||||||
|
begin
|
||||||
|
rand16:= rand32 AND $FFFF;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function rand8 : uint8;
|
||||||
|
begin
|
||||||
|
rand8:= rand32 AND $FF;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure srand(seed : uint32);
|
||||||
|
begin
|
||||||
|
next:= seed;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
@ -38,14 +38,15 @@ uses
|
|||||||
shell,
|
shell,
|
||||||
memview,
|
memview,
|
||||||
splash,
|
splash,
|
||||||
cpu,
|
|
||||||
themer,
|
themer,
|
||||||
netlog,
|
netlog,
|
||||||
vmlog,
|
vmlog,
|
||||||
vm,
|
vm,
|
||||||
vmstate,
|
vmstate,
|
||||||
edit,
|
edit,
|
||||||
udpcat;
|
udpcat,
|
||||||
|
cpu,
|
||||||
|
rand;
|
||||||
|
|
||||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
|
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
|
||||||
|
|
||||||
@ -154,6 +155,7 @@ begin
|
|||||||
isrmanager.init();
|
isrmanager.init();
|
||||||
faults.init();
|
faults.init();
|
||||||
RTC.init();
|
RTC.init();
|
||||||
|
rand.srand((getDateTime.Seconds SHR 24) OR (getDateTime.Minutes SHR 16) OR (getDateTime.Hours SHR 8) OR (getDateTime.Day));
|
||||||
pmemorymanager.init();
|
pmemorymanager.init();
|
||||||
vmemorymanager.init();
|
vmemorymanager.init();
|
||||||
lmemorymanager.init();
|
lmemorymanager.init();
|
||||||
|
@ -8,7 +8,7 @@ unit udpcat;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
console, terminal, keyboard, util, strings, tracer, udp, nettypes, lmemorymanager;
|
console, terminal, keyboard, util, strings, tracer, udp, nettypes, netutils, lmemorymanager;
|
||||||
|
|
||||||
procedure init();
|
procedure init();
|
||||||
|
|
||||||
@ -32,6 +32,8 @@ procedure OnReceive(p_data : void; p_len : uint16; p_context : PUDPPacketContext
|
|||||||
var
|
var
|
||||||
c : pchar;
|
c : pchar;
|
||||||
i : uint16;
|
i : uint16;
|
||||||
|
sendContext : PUDPSendContext;
|
||||||
|
Message : pchar;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
c:= pchar(p_data);
|
c:= pchar(p_data);
|
||||||
@ -39,6 +41,23 @@ begin
|
|||||||
writecharWND(c[i], Handle);
|
writecharWND(c[i], Handle);
|
||||||
end;
|
end;
|
||||||
writestringlnWND(' ', Handle);
|
writestringlnWND(' ', Handle);
|
||||||
|
sendContext:= PUDPSendContext(kalloc(sizeof(TUDPSendContext)));
|
||||||
|
sendContext^.DstPort:= p_context^.SrcPort;
|
||||||
|
sendContext^.Socket:= context;
|
||||||
|
sendContext^.context:= p_context^.PacketContext;
|
||||||
|
sendContext^.context^.TTL:= 128;
|
||||||
|
contextMACSwitch(p_context^.PacketContext);
|
||||||
|
contextIPv4Switch(p_context^.PacketContext);
|
||||||
|
Message:= pchar(kalloc(6));
|
||||||
|
Message[0]:= 'A';
|
||||||
|
Message[1]:= 'S';
|
||||||
|
Message[2]:= 'U';
|
||||||
|
Message[3]:= 'R';
|
||||||
|
Message[4]:= 'O';
|
||||||
|
Message[5]:= '!';
|
||||||
|
udp.send(void(Message), 6, sendContext);
|
||||||
|
kfree(void(sendContext));
|
||||||
|
kfree(void(Message));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure run(Params : PParamList);
|
procedure run(Params : PParamList);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user