text stringlengths 0 234 |
|---|
exit when Is_Whitespace and Equals_Loc /= 0; |
-- We also want to confirm there's a = in there somewhere |
end loop; |
-- It's all whitespace, skip it |
if Is_Whitespace |
then |
goto Config_Parse_Continue; |
end if; |
if Equals_Loc = 0 |
then |
Exception_Message := |
To_Unbounded_String ("Malformed line (no = found) at"); |
Append (Exception_Message, Line_Count'Image); |
Append (Exception_Message, ": "); |
Append (Exception_Message, Current_Line); |
raise Malformed_Line with To_String (Exception_Message); |
end if; |
-- Read in the essential values |
for C in GCP_Map.Iterate |
loop |
-- Slightly annoying, but need to handle not reading past the |
-- end of Current_Line. We also need to check that the next char |
-- is a space or = so we don't match substrings by accident. |
if Key_End_Loc = Key (C)'Length |
then |
if Key (C) = To_Upper (Current_Line |
(1 .. Key (C)'Length)) |
then |
-- Determine the starting character of the value |
for I in Current_Line |
(Equals_Loc + 1 .. Current_Line'Length)'range |
loop |
if Current_Line (I) /= ' ' and |
Current_Line (I) /= Ada.Characters.Latin_1.HT |
then |
Value_Loc := I; |
exit; |
end if; |
end loop; |
-- If Value_Loc is zero, pass an empty string in |
if Value_Loc = 0 |
then |
Element (C).all (Config, ""); |
else |
Element (C).all (Config, Current_Line |
(Value_Loc .. Current_Line'Length)); |
end if; |
end if; |
end if; |
end loop; |
<<Config_Parse_Continue>> |
Line_Count := Line_Count + 1; |
Function Definition: procedure DNSC is |
Function Body: DClient : DNSCatcher.DNS.Client.Client; |
Capture_Config : DNSCatcher.Config.Configuration; |
Logger_Task : DNSCatcher.Utils.Logger.Logger; |
Transaction_Manager_Ptr : DNS_Transaction_Manager_Task_Ptr; |
Sender_Interface : DNSCatcher.Network.UDP.Sender.UDP_Sender_Interface; |
Receiver_Interface : DNSCatcher.Network.UDP.Receiver.UDP_Receiver_Interface; |
Outbound_Packet : Raw_Packet_Record_Ptr; |
Logger_Packet : DNSCatcher.Utils.Logger.Logger_Message_Packet_Ptr; |
Socket : Socket_Type; |
begin |
Capture_Config.Local_Listen_Port := 41231; |
Capture_Config.Upstream_DNS_Server := To_Unbounded_String ("4.2.2.2"); |
Capture_Config.Upstream_DNS_Server_Port := 53; |
-- Configure the logger |
Capture_Config.Logger_Config.Log_Level := DEBUG; |
Capture_Config.Logger_Config.Use_Color := True; |
Logger_Task.Initialize (Capture_Config.Logger_Config); |
Logger_Task.Start; |
Logger_Packet := new Logger_Message_Packet; |
Transaction_Manager_Ptr := new DNS_Transaction_Manager_Task; |
-- Socket has to be shared between receiver and sender. This likely needs to |
-- move to to a higher level class |
begin |
Create_Socket |
(Socket => Socket, |
Mode => Socket_Datagram); |
Set_Socket_Option |
(Socket => Socket, |
Level => IP_Protocol_For_IP_Level, |
Option => (GNAT.Sockets.Receive_Timeout, Timeout => 1.0)); |
Bind_Socket |
(Socket => Socket, |
Address => |
(Family => Family_Inet, Addr => Any_Inet_Addr, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.