Started work on DHCP.

git-svn-id: https://spexeah.com:8443/svn/Asuro@926 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron
2020-07-10 14:51:48 +00:00
parent 861f65abe0
commit 29f986a8e4
6 changed files with 229 additions and 45 deletions

View File

@ -0,0 +1,55 @@
unit dhcp;
interface
uses
lmemorymanager, console,
nettypes, netutils, udp, netlog, net,
util, rand, lists;
type
TDHCPOptions = PLinkedListBase;
PDHCPOptions = ^PLinkedListBase;
TDHCPOption = record
Opcode : TDHCPOpCode;
Size : uint32;
Value : void;
Header_Location : void;
Reverse_Endian : boolean;
end;
PDHCPOption = ^TDHCPOption;
procedure register();
procedure DHCPDiscover();
implementation
var
XID : uint32;
Socket : PUDPBindContext;
procedure processPacket(p_data : void; p_len : uint16; context : PUDPPacketContext);
begin
end;
procedure DHCPDiscover();
begin
end;
procedure register();
begin
console.outputln('DHCP', 'Register begin.');
Socket:= PUDPBindContext(Kalloc(sizeof(TUDPBindContext)));
Socket^.Port:= 68;
Socket^.Callback:= @processPacket;
Socket^.UID:= rand32;
case UDP.bind(Socket) of
tueOK:console.outputln('DHCP', 'Successfully bound port 68.');
else console.outputln('DHCP', 'Failed to bind port 68.');
end;
console.outputln('DHCP', 'Register end.');
end;
end.