text stringlengths 0 234 |
|---|
begin |
Queue := Queued_Packets.First_Element; |
Queued_Packets.Delete_First; |
end Get; |
entry Count (Count : out Integer) when True is |
begin |
Count := Integer (Queued_Packets.Length); |
end Count; |
entry Empty when True is |
begin |
declare |
procedure Dump_Vector_Data |
(c : Logger_Message_Packet_Vector.Cursor) |
is |
begin |
Free_Logger_Msg_Ptr (Queued_Packets (c)); |
end Dump_Vector_Data; |
begin |
Queued_Packets.Iterate (Dump_Vector_Data'access); |
Function Definition: procedure Process_Queue is |
Function Body: procedure Print_Messages (c : Log_Message_Vector.Cursor) is |
Current_Msg : constant Log_Message_Record := |
Log_Message_Vector.Element (c); |
begin |
-- This is so ugly :( |
if Log_Levels'Enum_Rep (Logger_Cfg.Log_Level) >= |
Log_Levels'Enum_Rep (Current_Msg.Log_Level) |
then |
Msg_String := |
Format_Log_Level |
(Logger_Cfg.Use_Color, Current_Msg.Log_Level); |
Msg_String := |
Msg_String & |
Create_String_From_Components (Current_Msg.Component); |
Msg_String := Msg_String & " " & Current_Msg.Message; |
Put_Line (To_String (Msg_String)); |
end if; |
end Print_Messages; |
begin |
Logger_Queue.Count (Queues_To_Process); |
while Queues_To_Process > 0 |
loop |
Logger_Queue.Get (Current_Queue); |
-- Get a local copy and then empty it; we don't care past that |
-- point |
if Current_Queue /= null |
then |
Current_Queue.Get_All_And_Empty (Msg_Packets); |
Msg_Packets.Iterate (Print_Messages'Access); |
Free_Logger_Msg_Ptr (Current_Queue); |
end if; |
Logger_Queue.Count (Queues_To_Process); |
end loop; |
exception |
-- Not sure if there's a better way to do this, but avoids a race |
-- condition |
when Constraint_Error => |
begin |
null; |
Function Definition: function To_Domain_Section is new Ada.Unchecked_Conversion |
Function Body: (Source => Stream_Element_Array, Target => Domain_Section); |
begin |
Domain_Name := Domain_Name & To_Domain_Section (Raw_Data.all |
(Offset .. Stream_Element_Offset (Section_Length))); |
Offset := Offset + Stream_Element_Offset (Section_Length); |
Function Definition: function Get_Byte_Fixed_Header is new Ada.Unchecked_Conversion |
Function Body: (Source => Stream_Element_Array, Target => Packer_Pointer); |
begin |
-- Oh, and for more fuckery, the pointer is 16-bit ... |
Packet_Ptr := Get_Byte_Fixed_Header (Raw_Data.all |
(Offset .. Offset + 1)); -- Make the top bytes vanish |
-- We subtract 12-1 for the packet header |
Packet_Ptr.Packet_Offset := |
(Packet_Ptr.Packet_Offset and 16#3fff#) - 11; |
-- Sanity check ourselves |
if (Section_Length and 2#11#) /= 0 |
then |
-- Should never happen but you never know ... |
raise Unknown_Compression_Method; |
end if; |
-- Now we need to decode the whole old string ... ugh |
Decompressed_Domain_String := |
Parse_DNS_Packet_Name_Records |
(Raw_Data, |
Stream_Element_Offset (Packet_Ptr.Packet_Offset)); |
Offset := Offset + 2; |
return Domain_Name & Decompressed_Domain_String; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.